- Mar 07, 2023
-
-
Alex Bennée authored
Our GDB syscall support is the last chunk of code that needs target specific support so move it to a new file. We take the opportunity to move the syscall state into its own singleton instance and add in a few helpers for the main gdbstub to interact with the module. I also moved the gdb_exit() declaration into syscalls.h as it feels pretty related and most of the callers of it treat it as such. Reviewed-by:
Richard Henderson <richard.henderson@linaro.org> Signed-off-by:
Alex Bennée <alex.bennee@linaro.org> Message-Id: <20230302190846.2593720-22-alex.bennee@linaro.org> Message-Id: <20230303025805.625589-22-richard.henderson@linaro.org>
-
Alex Bennée authored
The process was pretty similar to the softmmu move except we take the time to split stuff between user.c and user-target.c to avoid as much target specific compilation as possible. We also start to make use of our shiny new header scheme so the user-only helpers can be included without the rest of the exec/gsbstub.h cruft. As before we split some functions into user and softmmu versions Reviewed-by:
Fabiano Rosas <farosas@suse.de> Signed-off-by:
Alex Bennée <alex.bennee@linaro.org> Message-Id: <20230302190846.2593720-12-alex.bennee@linaro.org> Message-Id: <20230303025805.625589-12-richard.henderson@linaro.org>
-
- Mar 01, 2023
-
-
Kyle Evans authored
do_freebsd_sysctlbyname needs to translate the 'name' back down to a OID so we can intercept the special ones. Do that and call the common wrapper do_freebsd_sysctl_oid. Signed-off-by:
Kyle Evans <kevans@FreeBSD.org> Reviewed-by:
Warner Losh <imp@bsdimp.com> Signed-off-by:
Warner Losh <imp@bsdimp.com> Reviewed-by:
Richard Henderson <richard.henderson@linaro.org>
-
Kyle Evans authored
Implement the wrapper function for sysctl(2). This puts the oid arguments into a standard form and calls the common do_freebsd_sysctl_oid. Signed-off-by:
Kyle Evans <kevans@FreeBSD.org> Co-Authored-by:
Juergen Lock <nox@jelal.kn-bremen.de> Signed-off-by:
Juergen Lock <nox@jelal.kn-bremen.de> Co-Authored-by:
Stacey Son <sson@FreeBSD.org> Signed-off-by:
Stacey Son <sson@FreeBSD.org> Reviewed-by:
Warner Losh <imp@bsdimp.com> Signed-off-by:
Warner Losh <imp@bsdimp.com> Reviewed-by:
Richard Henderson <richard.henderson@linaro.org>
-
Juergen Lock authored
Intercept some syscalls that we need to translate (like the archiecture we're running on) and translate them. These are only the simplest ones so far. Signed-off-by:
Juergen Lock <nox@jelal.kn-bremen.de> Co-Authored-by:
Stacey Son <sson@FreeBSD.org> Signed-off-by:
Stacey Son <sson@FreeBSD.org> Co-Authored-by:
Warner Losh <imp@bsdimp.com> Signed-off-by:
Warner Losh <imp@bsdimp.com> Reviewed-by:
Richard Henderson <richard.henderson@linaro.org>
-
Juergen Lock authored
do_freebsd_sysctl_oid filters out some of the binary and special sysctls where host != target. None of the sysctls that have to be translated from host to target are handled here. Signed-off-by:
Juergen Lock <nox@jelal.kn-bremen.de> Co-Authored-by:
Stacey Son <sson@FreeBSD.org> Signed-off-by:
Stacey Son <sson@FreeBSD.org> Co-Authored-by:
Warner Losh <imp@bsdimp.com> Signed-off-by:
Warner Losh <imp@bsdimp.com> Reviewed-by:
Richard Henderson <richard.henderson@linaro.org>
-
Juergen Lock authored
Helper functions for sysctl implementations. sysctl_name2oid and sysctl_oidfmt convert oids between host and targets Signed-off-by:
Juergen Lock <nox@jelal.kn-bremen.de> Reviewed-by:
Warner Losh <imp@bsdimp.com> Signed-off-by:
Warner Losh <imp@bsdimp.com> Reviewed-by:
Richard Henderson <richard.henderson@linaro.org>
-
Stacey Son authored
oidfmt uses undocumented system call to get the type of the sysctl. Co-Authored-by:
Sean Bruno <sbruno@FreeBSD.org> Signed-off-by:
Sean Bruno <sbruno@FreeBSD.org> Co-Authored-by:
Juergen Lock <nox@jelal.kn-bremen.de> Signed-off-by:
Juergen Lock <nox@jelal.kn-bremen.de> Co-Authored-by:
Raphael Kubo da Costa <rakuco@FreeBSD.org> Signed-off-by:
Raphael Kubo da Costa <rakuco@FreeBSD.org> Signed-off-by:
Stacey Son <sson@FreeBSD.org> Reviewed-by:
Warner Losh <imp@bsdimp.com> Signed-off-by:
Warner Losh <imp@bsdimp.com> Acked-by:
Richard Henderson <richard.henderson@linaro.org>
-
Warner Losh authored
cap_memory - Caps the memory to just below MAXINT scale_to_guest_pages - Account for difference in host / guest page size h2g_long_sat - converts a int64_t to a int32_t, saturating at max / min values h2g_ulong_sat - converts a uint64_t to a uint32_t, saturating at max value Signed-off-by:
Warner Losh <imp@bsdimp.com> Reviewed-by:
Richard Henderson <richard.henderson@linaro.org>
-
Stacey Son authored
Connect up the sysarch system call. Signed-off-by:
Juergen Lock <nox@jelal.kn-bremen.de> Co-authored-by:
Juergen Lock <nox@jelal.kn-bremen.de> Signed-off-by:
Stacey Son <sson@FreeBSD.org> Reviewed-by:
Warner Losh <imp@bsdimp.com> Signed-off-by:
Warner Losh <imp@bsdimp.com> Reviewed-by:
Richard Henderson <richard.henderson@linaro.org>
-
Doug Rabson authored
System call return values on FreeBSD are in a register (which is spelled abi_long in qemu). This was being assigned into an int variable which causes problems for 64bit targets. Resolves: https://github.com/qemu-bsd-user/qemu-bsd-user/issues/40 Signed-off-by:
Doug Rabson <dfr@rabson.org> Reviewed-by:
Warner Losh <imp@bsdimp.com> [ Edited commit message for upstreaming into qemu-project ] Signed-off-by:
Warner Losh <imp@bsdimp.com> Reviewed-by:
Richard Henderson <richard.henderson@linaro.org>
-
- Feb 17, 2023
-
-
Emanuele Giuseppe Esposito authored
FreeBSD implements pthread headers using TSA (thread safety analysis) annotations, therefore when an application is compiled with -Wthread-safety there are some locking/annotation requirements that the user of the pthread API has to follow. This will also be the case in QEMU, since bsd-user/mmap.c uses the pthread API. Therefore when building it with -Wthread-safety the compiler will throw warnings because the functions are not properly annotated. We need TSA to be enabled because it ensures that the critical sections of an annotated variable are properly locked. In order to make the compiler happy and avoid adding all the necessary macros to all callers (lock functions should use TSA_ACQUIRE, while unlock TSA_RELEASE, and this applies to all users of pthread_mutex_lock and pthread_mutex_unlock), simply use TSA_NO_TSA to supppress such warnings. Signed-off-by:
Emanuele Giuseppe Esposito <eesposit@redhat.com> Message-Id: <20230117135203.3049709-3-eesposit@redhat.com> Reviewed-by:
Warner Losh <imp@bsdimp.com> Reviewed-by:
Kevin Wolf <kwolf@redhat.com> Signed-off-by:
Kevin Wolf <kwolf@redhat.com>
-
- Feb 08, 2023
-
-
Markus Armbruster authored
This commit was created with scripts/clean-includes. All .c should include qemu/osdep.h first. The script performs three related cleanups: * Ensure .c files include qemu/osdep.h first. * Including it in a .h is redundant, since the .c already includes it. Drop such inclusions. * Likewise, including headers qemu/osdep.h includes is redundant. Drop these, too. Signed-off-by:
Markus Armbruster <armbru@redhat.com> Reviewed-by:
Warner Losh <imp@bsdimp.com> Reviewed-by:
Michael S. Tsirkin <mst@redhat.com> Message-Id: <20230202133830.2152150-6-armbru@redhat.com>
-
- Dec 14, 2022
-
-
Markus Armbruster authored
Signed-off-by:
Markus Armbruster <armbru@redhat.com> Reviewed-by:
Laurent Vivier <laurent@vivier.eu> Message-Id: <20221123133811.1398562-1-armbru@redhat.com>
-
- Oct 26, 2022
-
-
Muhammad Moinur Rahman authored
Some versions of FreeBSD now require sys/param.h for machine/pmap.h on x86. Include them here to meet that requirement. It does no harm on older versions, so there's no need to #ifdef it. Signed-off-by:
Muhammad Moinur Rahman <bofh@FreeBSD.org> Reviewed-by:
John Baldwin <jhb@FreeBSD.org> Signed-off-by:
Warner Losh <imp@bsdimp.com>
-
Richard Henderson authored
When PAGE_RESET is set, we are replacing pages with new content, which means that we need to invalidate existing cached data, such as TranslationBlocks. Perform the reset invalidate while we're doing other invalidates, which allows us to remove the separate invalidates from the user-only mmap/munmap/mprotect routines. In addition, restrict invalidation to PAGE_EXEC pages. Since cdf71308, we have validated PAGE_EXEC is present before translation, which means we can assume that if the bit is not present, there are no translations to invalidate. Reviewed-by:
Alex Bennée <alex.bennee@linaro.org> Signed-off-by:
Richard Henderson <richard.henderson@linaro.org>
-
- Jul 02, 2022
-
-
Warner Losh authored
In the last series, I inadvertantly didn't remove this inline, but did all the others. Remove it for consistency. Signed-off-by:
Warner Losh <imp@bsdimp.com> Reviewed-by:
Richard Henderson <richard.henderson@linaro.org>
-
Warner Losh authored
Signed-off-by:
Stacey Son <sson@FreeBSD.org> Signed-off-by:
Warner Losh <imp@bsdimp.com> Reviewed-by:
Richard Henderson <richard.henderson@linaro.org>
-
Warner Losh authored
Signed-off-by:
Stacey Son <sson@FreeBSD.org> Signed-off-by:
Warner Losh <imp@bsdimp.com> Reviewed-by:
Richard Henderson <richard.henderson@linaro.org>
-
Warner Losh authored
Signed-off-by:
Stacey Son <sson@FreeBSD.org> Signed-off-by:
Warner Losh <imp@bsdimp.com> Reviewed-by:
Richard Henderson <richard.henderson@linaro.org>
-
Warner Losh authored
Signed-off-by:
Stacey Son <sson@FreeBSD.org> Signed-off-by:
Warner Losh <imp@bsdimp.com> Reviewed-by:
Richard Henderson <richard.henderson@linaro.org>
-
Warner Losh authored
Signed-off-by:
Stacey Son <sson@FreeBSD.org> Signed-off-by:
Warner Losh <imp@bsdimp.com> Reviewed-by:
Richard Henderson <richard.henderson@linaro.org>
-
Warner Losh authored
Signed-off-by:
Stacey Son <sson@FreeBSD.org> Signed-off-by:
Warner Losh <imp@bsdimp.com> Reviewed-by:
Richard Henderson <richard.henderson@linaro.org>
-
Warner Losh authored
These implement both the old-pre INO64 mknod variations, as well as the now current INO64 variant. Make direct syscall calls for these older syscalls to avloid too many dependencies. Signed-off-by:
Stacey Son <sson@FreeBSD.org> Signed-off-by:
Michal Meloun <mmel@FreeBSD.org> Signed-off-by:
Warner Losh <imp@bsdimp.com> Reviewed-by:
Richard Henderson <richard.henderson@linaro.org>
-
Warner Losh authored
Signed-off-by:
Stacey Son <sson@FreeBSD.org> Signed-off-by:
Warner Losh <imp@bsdimp.com> Reviewed-by:
Richard Henderson <richard.henderson@linaro.org>
-
Warner Losh authored
Signed-off-by:
Stacey Son <sson@FreeBSD.org> Signed-off-by:
Jung-uk Kim <jkim@FreeBSD.org> Signed-off-by:
Warner Losh <imp@bsdimp.com> Reviewed-by:
Richard Henderson <richard.henderson@linaro.org>
-
Warner Losh authored
Signed-off-by:
Stacey Son <sson@FreeBSD.org> Signed-off-by:
Jung-uk Kim <jkim@FreeBSD.org> Signed-off-by:
Warner Losh <imp@bsdimp.com> Reviewed-by:
Richard Henderson <richard.henderson@linaro.org>
-
- Jun 14, 2022
-
-
Warner Losh authored
Signed-off-by:
Stacey Son <sson@FreeBSD.org> Signed-off-by:
Warner Losh <imp@bsdimp.com> Reviewed-by:
Richard Henderson <richard.henderson@linaro.org>
-
Warner Losh authored
Signed-off-by:
Stacey Son <sson@FreeBSD.org> Signed-off-by:
Warner Losh <imp@bsdimp.com> Reviewed-by:
Richard Henderson <richard.henderson@linaro.org>
-
Warner Losh authored
Signed-off-by:
Stacey Son <sson@FreeBSD.org> Signed-off-by:
Warner Losh <imp@bsdimp.com> Reviewed-by:
Richard Henderson <richard.henderson@linaro.org>
-
Warner Losh authored
Implemenet rmdir and __getcwd. __getcwd is the undocumented back end to getcwd(3). Signed-off-by:
Stacey Son <sson@FreeBSD.org> Signed-off-by:
Jung-uk Kim <jkim@FreeBSD.org> Signed-off-by:
Warner Losh <imp@bsdimp.com> Reviewed-by:
Richard Henderson <richard.henderson@linaro.org>
-
Warner Losh authored
Signed-off-by:
Stacey Son <sson@FreeBSD.org> Signed-off-by:
Warner Losh <imp@bsdimp.com> Reviewed-by:
Richard Henderson <richard.henderson@linaro.org>
-
- Jun 13, 2022
-
-
Warner Losh authored
Signed-off-by:
Stacey Son <sson@FreeBSD.org> Signed-off-by:
Jung-uk Kim <jkim@FreeBSD.org> Signed-off-by:
Warner Losh <imp@bsdimp.com> Reviewed-by:
Richard Henderson <richard.henderson@linaro.org>
-
Warner Losh authored
Plus the helper LOCK_PATH2 and UNLOCK_PATH2 macros. Signed-off-by:
Stacey Son <sson@FreeBSD.org> Signed-off-by:
Jung-uk Kim <jkim@FreeBSD.org> Signed-off-by:
Warner Losh <imp@bsdimp.com> Reviewed-by:
Richard Henderson <richard.henderson@linaro.org>
-
Warner Losh authored
Signed-off-by:
Stacey Son <sson@FreeBSD.org> Signed-off-by:
Warner Losh <imp@bsdimp.com> Reviewed-by:
Richard Henderson <richard.henderson@linaro.org>
-
Warner Losh authored
Signed-off-by:
Stacey Son <sson@FreeBSD.org> Signed-off-by:
Warner Losh <imp@bsdimp.com> Reviewed-by:
Richard Henderson <richard.henderson@linaro.org>
-
Warner Losh authored
Implement fdatasync(2), fsync(2) and close_from(2). Signed-off-by:
Stacey Son <sson@FreeBSD.org> Signed-off-by:
Jung-uk Kim <jkim@FreeBSD.org> Signed-off-by:
Warner Losh <imp@bsdimp.com> Reviewed-by:
Richard Henderson <richard.henderson@linaro.org>
-
Warner Losh authored
Add the open, openat and close system calls. We need to lock paths, so implmenent that as well. Signed-off-by:
Stacey Son <sson@FreeBSD.org> Signed-off-by:
Jung-uk Kim <jkim@FreeBSD.org> Signed-off-by:
Kyle Evans <kevans@FreeBSD.org> Signed-off-by:
Warner Losh <imp@bsdimp.com> Reviewed-by:
Richard Henderson <richard.henderson@linaro.org>
-
- Jun 11, 2022
-
-
Warner Losh authored
Implement the exit system call. Bring in bsd-proc.h to contain all the process system call implementation and helper routines. Signed-off-by:
Stacey Son <sson@FreeBSD.org> Signed-off-by:
Warner Losh <imp@bsdimp.com> Reviewed-by:
Richard Henderson <richard.henderson@linaro.org> Reviewed-by:
Kyle Evans <kevans@FreeBSD.org>
-
Warner Losh authored
Implement write, writev, pwrite and pwritev and connect them to the system call dispatch routine. Signed-off-by:
Stacey Son <sson@FreeBSD.org> Signed-off-by:
Kyle Evans <kevans@FreeBSD.org> Signed-off-by:
Warner Losh <imp@bsdimp.com> Reviewed-by:
Richard Henderson <richard.henderson@linaro.org>
-