[PULL 00/42] bsd-user updates to run hello world

2021-09-10 Thread imp
From: Warner Losh The following changes since commit a61c30b8c8c3c8619847cfaa289233cc696f5689: Merge remote-tracking branch 'remotes/mjt/tags/patch-fetch' into staging (2021-09-07 10:15:48 +0100) are available in the Git repository at: https://gitlab.com/bsdimp/qemu.git tags/pull-bsd-user

[PULL 07/42] bsd-user: move arch specific defines out of elfload.c

2021-09-10 Thread imp
From: Warner Losh Move the architecture specific defines to target_arch_elf.h and delete them from elfload.c. Only retain ifdefs appropriate for i386 and x86_64. Add the copyright/license comments, and guard ifdefs. Signed-off-by: Warner Losh Reviewed-by: Richard Henderson --- bsd-user/elfloa

[PULL 42/42] bsd-user: Update mapping to handle reserved and starting conditions

2021-09-07 Thread imp
From: Warner Losh Update the reserved base based on what platform we're on, as well as the start of the mmap range. Update routines that find va ranges to interact with the reserved ranges as well as properly align the mapping (this is especially important for targets whose page size does not mat

[PULL 38/42] bsd-user: Refactor load_elf_sections and is_target_elf_binary

2021-09-07 Thread imp
From: Warner Losh Factor out load_elf_sections and is_target_elf_binary out of load_elf_interp. Signed-off-by: Mikaël Urankar Signed-off-by: Stacey Son Signed-off-by: Warner Losh Reviewed-by: Kyle Evans --- bsd-user/elfload.c | 344 + 1 file chang

[PULL 36/42] bsd-user: add stubbed out core dump support

2021-09-07 Thread imp
From: Warner Losh Add a stubbed-out version of the bsd-user fork's core dump support. This allows elfload.c to be almost the same between what's upstream and what's in qemu-project upstream w/o the burden of reviewing the core dump support. Signed-off-by: Stacey Son Signed-off-by: Warner Losh

[PULL 34/42] bsd-user: Add target_arch_reg to describe a target's register set

2021-09-07 Thread imp
From: Warner Losh target_reg_t is the normal register. target_fpreg_t is the floating point registers. target_copy_regs copies the registers out of CPU context for things like core dumps. Signed-off-by: Stacey Son Signed-off-by: Warner Losh Reviewed-by: Richard Henderson --- bsd-user/i386/ta

[PULL 40/42] bsd-user: Implement interlock for atomic operations

2021-09-07 Thread imp
From: Warner Losh Implement the internlock in fork_start() and fork_end() to properly cope with atomic operations and to safely keep state for parent and child processes. Signed-off-by: Stacey Son Signed-off-by: Warner Losh Reviewed-by: Richard Henderson --- bsd-user/main.c | 24

[PULL 39/42] bsd-user: move gemu_log to later in the file

2021-09-07 Thread imp
From: Warner Losh Signed-off-by: Warner Losh Acked-by: Richard Henderson Reviewed-by: Kyle Evans --- bsd-user/main.c | 17 + 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/bsd-user/main.c b/bsd-user/main.c index 71fd9d5aba..768f4ee41e 100644 --- a/bsd-user/main.

[PULL 33/42] bsd-user: update debugging in mmap.c

2021-09-07 Thread imp
From: Warner Losh Update the debugging code for new features and different targets. Signed-off-by: Mikaël Urankar Signed-off-by: Sean Bruno Signed-off-by: Kyle Evans Signed-off-by: Warner Losh Acked-by: Richard Henderson Reviewed-by: Kyle Evans --- bsd-user/mmap.c | 55 +++

[PULL 26/42] bsd-user: *BSD specific siginfo defintions

2021-09-07 Thread imp
From: Warner Losh Add FreeBSD, NetBSD and OpenBSD values for the various signal info types and defines to decode different signals to discover more information about the specific signal types. Signed-off-by: Stacey Son Signed-off-by: Warner Losh Acked-by: Richard Henderson Reviewed-by: Kyle E

[PULL 35/42] bsd-user: Add target_os_user.h to capture the user/kernel structures

2021-09-07 Thread imp
From: Warner Losh This file evolved over the years to capture the user/kernel interfaces, including those that changed over time. Signed-off-by: Stacey Son Signed-off-by: Michal Meloun Signed-off-by: Warner Losh Acked-by: Richard Henderson Reviewed-by: Kyle Evans --- bsd-user/freebsd/targe

[PULL 41/42] bsd-user: Add '-0 argv0' option to bsd-user/main.c

2021-09-07 Thread imp
From: Colin Percival Previously it was impossible to emulate a program with a file name different from its argv[0]. With this change, you can run qemu -0 fakename realname args which runs the program "realname" with an argv of "fakename args". Signed-off-by: Colin Percival Signed-off-by: W

[PULL 27/42] bsd-user: Implement --seed and initialize random state

2021-09-07 Thread imp
From: Warner Losh Copy --seed implementation (translated from linux-user's newer command line scheme to the older one bsd-user still uses). Initialize the randomness with the glib if a specific seed is specified or use the qcrypto library if not. Signed-off-by: Warner Losh Reviewed-by: Richard

[PULL 37/42] bsd-user: elfload.c style catch up patch

2021-09-07 Thread imp
From: Warner Losh Various style fixes to elfload.c that were too painful to make earlier in this series. Signed-off-by: Warner Losh Reviewed-by: Richard Henderson --- bsd-user/elfload.c | 208 ++--- 1 file changed, 104 insertions(+), 104 deletions(-) d

[PULL 32/42] bsd-user: Rewrite target system call definintion glue

2021-09-07 Thread imp
From: Warner Losh Rewrite target definnitions to interface with the FreeBSD system calls. This covers basic types (time_t, iovec, umtx_time, timespec, timeval, rusage, rwusage) and basic defines (mmap, rusage). Also included are FreeBSD version-specific variations. Signed-off-by: Stacey Son Sig

[PULL 24/42] bsd-user: Create target specific vmparam.h

2021-09-07 Thread imp
From: Warner Losh Target specific values for vm parameters and details. Signed-off-by: Stacey Son Signed-off-by: Warner Losh Reviewed-by: Richard Henderson --- bsd-user/freebsd/target_os_vmparam.h | 38 ++ bsd-user/i386/target_arch_vmparam.h | 46 ++

[PULL 31/42] bsd-user: Remove dead #ifdefs from elfload.c

2021-09-07 Thread imp
From: Warner Losh LOW_ELF_STACK doesn't exist on FreeBSD and likely never will. Remove it. Likewise, remove an #if 0 block that's not useful Signed-off-by: Warner Losh Reviewed-by: Richard Henderson --- bsd-user/elfload.c | 20 1 file changed, 20 deletions(-) diff --git

[PULL 22/42] bsd-user: Include more things in qemu.h

2021-09-07 Thread imp
From: Warner Losh Include more header files to match bsd-user fork. Signed-off-by: Warner Losh Reviewed-by: Richard Henderson --- bsd-user/qemu.h | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/bsd-user/qemu.h b/bsd-user/qemu.h index 5e4cbb40d4..55d71130bb 100644 ---

[PULL 30/42] bsd-user: elf cleanup

2021-09-07 Thread imp
From: Warner Losh Move OS-dependent defines into target_os_elf.h. Move the architectural dependent stuff into target_arch_elf.h. Adjust elfload.c to use target_create_elf_tables instead of create_elf_tables. Signed-off-by: Warner Losh Signed-off-by: Stacey Son Signed-off-by: Kyle Evans Signed

[PULL 28/42] bsd-user: Move stack initializtion into a per-os file.

2021-09-07 Thread imp
From: Warner Losh Move all of the stack initialization into target_os_stack.h. Each BSD sets up processes a little differently. Signed-off-by: Stacey Son Signed-off-by: Warner Losh Reviewed-by: Richard Henderson --- bsd-user/freebsd/target_os_stack.h | 181 + bsd-

[PULL 29/42] bsd-user: Add architecture specific signal tramp code

2021-09-07 Thread imp
From: Warner Losh Add a stubbed out version of setup_sigtramp. This is not yet used for x86, but is used for other architectures. This will be connected in future commits. Signed-off-by: Stacey Son Signed-off-by: Warner Losh Reviewed-by: Richard Henderson --- bsd-user/i386/target_arch_sigtra

[PULL 16/42] bsd-user: add host-os.h

2021-09-07 Thread imp
From: Warner Losh Host OS specific bits for this implementation go in this file. Signed-off-by: Stacey Son Signed-off-by: Warner Losh Reviewed-by: Richard Henderson --- bsd-user/freebsd/host-os.h | 23 +++ bsd-user/netbsd/host-os.h | 23 +++ bsd-user/

[PULL 20/42] bsd-user: Move per-cpu code into target_arch_cpu.h

2021-09-07 Thread imp
From: Warner Losh Move cpu_loop() into target_cpu_loop(), and put that in target_arch_cpu.h for each architecture. Signed-off-by: Stacey Son Signed-off-by: Warner Losh Reviewed-by: Richard Henderson --- bsd-user/i386/target_arch_cpu.c | 1 + bsd-user/i386/target_arch_cpu.h | 209 ++

[PULL 21/42] bsd-user: pull in target_arch_thread.h update target_arch_elf.h

2021-09-07 Thread imp
From: Warner Losh Update target_arch_elf.h to remove thread_init. Move its contents to target_arch_thread.h and rename to target_thread_init(). Update elfload.c to call it. Create thread_os_thread.h to hold the os specific parts of the thread and threat manipulation routines. Currently, it just i

[PULL 23/42] bsd-user: define max args in terms of pages

2021-09-07 Thread imp
From: Warner Losh For 32-bit platforms, pass in up to 256k of args. For 64-bit, bump that to 512k. Signed-off-by: Kyle Evans Signed-off-by: Warner Losh Reviewed-by: Richard Henderson --- bsd-user/qemu.h | 15 +++ 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/bsd-

[PULL 25/42] bsd-user: Add system independent stack, data and text limiting

2021-09-07 Thread imp
From: Warner Losh Eliminate the x86 specific stack stuff in favor of more generic control over the process size: target_maxtsiz max text size target_dfldsiz initial data size limit target_maxdsiz max data size target_dflssiz initial stack size limit target_maxssiz max sta

[PULL 11/42] bsd-user: Eliminate elf personality

2021-09-07 Thread imp
From: Warner Losh The linux kernel supports a number of different ELF binaries. The Linux userland emulator inheritted some of that. And we inheritted it from there. However, for BSD there's only one kind of ELF file supported per platform, so there's no need to cope with historical quirks. Simpl

[PULL 14/42] bsd-user: elfload: simplify bswap a bit.

2021-09-07 Thread imp
From: Warner Losh Reduce the number of ifdefs by always calling the swapping routine, but making them empty when swapping isn't needed. Signed-off-by: Warner Losh Reviewed-by: Richard Henderson --- bsd-user/elfload.c | 97 ++ 1 file changed, 47 inse

[PULL 17/42] bsd-user: Include host-os.h from main

2021-09-07 Thread imp
From: Warner Losh Include host-os.h from main.c to pick up the default OS to emulate. Set that default in main(). Signed-off-by: Stacey Son Signed-off-by: Warner Losh Reviewed-by: Richard Henderson --- bsd-user/freebsd/host-os.h | 2 ++ bsd-user/main.c| 4 +++- bsd-user/netbsd/h

[PULL 19/42] bsd-user: start to move target CPU functions to target_arch*

2021-09-07 Thread imp
From: Warner Losh Move the CPU functions into target_arch_cpu.c that are unique to each CPU. These are defined in target_arch.h. Signed-off-by: Stacey Son Signed-off-by: Warner Losh Reviewed-by: Richard Henderson --- bsd-user/i386/target_arch.h | 31 + bsd-user/i386/target_

[PULL 12/42] bsd-user: remove a.out support

2021-09-07 Thread imp
From: Warner Losh Remove still-born a.out support. The BSDs switched from a.out to ELF 20+ years ago. It's out of scope for bsd-user, and what little support there was would simply wind up at a not-implemented message. Simplify the whole mess by removing it entirely. Should future support be requ

[PULL 13/42] bsd-user: TARGET_NGROUPS unused in this file, remove

2021-09-07 Thread imp
From: Warner Losh Signed-off-by: Warner Losh Reviewed-by: Richard Henderson --- bsd-user/bsdload.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/bsd-user/bsdload.c b/bsd-user/bsdload.c index 6aefc7a28b..5b3c061a45 100644 --- a/bsd-user/bsdload.c +++ b/bsd-user/bsdload.c @@ -19,8 +19,6 @

[PULL 10/42] bsd-user: implement path searching

2021-09-07 Thread imp
From: Warner Losh Use the PATH to find the executable given a bare argument. We need to do this so we can implement mixing native and emulated binaries (e.g., execing a x86 native binary from an emulated arm binary to optimize parts of the build). By finding the binary, we will know how to exec i

[PULL 18/42] bsd-user: save the path to the qemu emulator

2021-09-07 Thread imp
From: Warner Losh Save the path to the qemu emulator. This will be used later when we have a more complete implementation of exec. Signed-off-by: Stacey Son Signed-off-by: Warner Losh Acked-by: Richard Henderson Reviewed-by: Kyle Evans --- bsd-user/main.c | 21 + bsd-use

[PULL 06/42] bsd-user: Remove all non-x86 code from elfload.c

2021-09-07 Thread imp
From: Warner Losh bsd-user only builds x86 at the moment. Remove all non x86 code from elfload.c. We'll move the x86 code to {i386,x86_64}/target_arch_elf.h and bring it that support code from the forked bsd-user when the time comes. Signed-off-by: Warner Losh Reviewed-by: Richard Henderson --

[PULL 07/42] bsd-user: move arch specific defines out of elfload.c

2021-09-07 Thread imp
From: Warner Losh Move the architecture specific defines to target_arch_elf.h and delete them from elfload.c. Only retain ifdefs appropriate for i386 and x86_64. Add the copyright/license comments, and guard ifdefs. Signed-off-by: Warner Losh Reviewed-by: Richard Henderson --- bsd-user/elfloa

[PULL 08/42] bsd-user: pass the bsd_param into loader_exec

2021-09-07 Thread imp
From: Warner Losh Pass the bsd_param into loader_exec, and adjust. We use it to track the inital stack allocation and to set stack, open files, and other state shared between bsdload.c and elfload.c Signed-off-by: Warner Losh Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé

[PULL 15/42] bsd-user: assume pthreads and support of __thread

2021-09-07 Thread imp
From: Warner Losh All compilers for some time have supported this. Follow linux-user and eliminate the #define THREAD and unconditionally insert __thread where needed. Please insert: "(see 24cb36a61c6: "configure: Make NPTL non-optional")" Signed-off-by: Warner Losh Reviewed-by: Richard Henders

[PULL 01/42] bsd-user: remove sparc and sparc64

2021-09-07 Thread imp
From: Warner Losh These are broken here and in the bsd-user fork. They won't be fixed as FreeBSD has dropped support for sparc. If people wish to support this in other BSDs, you're better off starting over than starting from these files. Signed-off-by: Warner Losh Reviewed-by: Richard Henderson

[PULL 03/42] bsd-user: Add Stacey's copyright to main.c

2021-09-07 Thread imp
From: Warner Losh Add Stacey's updated copyright to main.c Signed-off-by: Warner Losh Signed-off-by: Stacey Son Reviewed-by: Richard Henderson --- bsd-user/main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bsd-user/main.c b/bsd-user/main.c index 38185da111..39c4a0f

[PULL 05/42] bsd-user: style nits: bsdload.c whitespace to qemu standard

2021-09-07 Thread imp
From: Warner Losh Signed-off-by: Warner Losh Reviewed-by: Richard Henderson --- bsd-user/bsdload.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bsd-user/bsdload.c b/bsd-user/bsdload.c index 0ade58b9e2..ec71c5e923 100644 --- a/bsd-user/bsdload.c +++ b/bsd-user/bsdload

[PULL 09/42] bsd-user: Fix calculation of size to allocate

2021-09-07 Thread imp
From: Warner Losh It was incorrect to subtract off the size of an unsigned int here. In bsd-user fork, this change was made when moving the arch specific items to specific files. The size in BSD that's available for the arguments does not need a return address subtracted from it. Signed-off-by

[PULL 04/42] bsd-user: add license to bsdload.c

2021-09-07 Thread imp
From: Warner Losh Pull in the license statement at the top of the bsdload.c file from the bsd-user fork version of this file. No functional changes. Signed-off-by: Warner Losh Reviewed-by: Richard Henderson --- bsd-user/bsdload.c | 17 - 1 file changed, 16 insertions(+), 1 del

[PULL 02/42] bsd-user: add copyright header to elfload.c

2021-09-07 Thread imp
From: Warner Losh Add Stacey's copyright to elfload.c Signed-off-by: Stacey Son Signed-off-by: Warner Losh Reviewed-by: Richard Henderson --- bsd-user/elfload.c | 19 ++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/bsd-user/elfload.c b/bsd-user/elfload.c ind

[PULL 00/42] bsd-user updates to run hello world

2021-09-07 Thread imp
From: Warner Losh The following changes since commit f214d8e0150766c31172e16ef4b17674f549d852: Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20210826' into staging (2021-08-26 18:03:57 +0100) are available in the Git repository at: https://gitlab.com/bsdimp/qemu.git

[PATCH v3 39/43] bsd-user: Refactor load_elf_sections and is_target_elf_binary

2021-09-02 Thread imp
From: Warner Losh Factor out load_elf_sections and is_target_elf_binary out of load_elf_interp. Signed-off-by: Mikaël Urankar Signed-off-by: Stacey Son Signed-off-by: Warner Losh --- bsd-user/elfload.c | 344 + 1 file changed, 158 insertions(+), 18

[PATCH v3 35/43] bsd-user: Add target_arch_reg to describe a target's register set

2021-09-02 Thread imp
From: Warner Losh target_reg_t is the normal register. target_fpreg_t is the floating point registers. target_copy_regs copies the registers out of CPU context for things like core dumps. Signed-off-by: Stacey Son Signed-off-by: Warner Losh Reviewed-by: Richard Henderson --- bsd-user/i386/ta

[PATCH v3 42/43] bsd-user: Add '-0 argv0' option to bsd-user/main.c

2021-09-02 Thread imp
From: Colin Percival Previously it was impossible to emulate a program with a file name different from its argv[0]. With this change, you can run qemu -0 fakename realname args which runs the program "realname" with an argv of "fakename args". Signed-off-by: Colin Percival Signed-off-by: W

[PATCH v3 28/43] bsd-user: Move stack initializtion into a per-os file.

2021-09-02 Thread imp
From: Warner Losh Move all of the stack initialization into target_os_stack.h. Each BSD sets up processes a little differently. Signed-off-by: Stacey Son Signed-off-by: Warner Losh Reviewed-by: Richard Henderson --- bsd-user/freebsd/target_os_stack.h | 181 + bsd-

[PATCH v3 24/43] bsd-user: Create target specific vmparam.h

2021-09-02 Thread imp
From: Warner Losh Target specific values for vm parameters and details. Signed-off-by: Stacey Son Signed-off-by: Warner Losh Reviewed-by: Richard Henderson --- bsd-user/freebsd/target_os_vmparam.h | 38 ++ bsd-user/i386/target_arch_vmparam.h | 46 ++

[PATCH v3 43/43] bsd-user: Update mapping to handle reserved and starting conditions

2021-09-02 Thread imp
From: Warner Losh Update the reserved base based on what platform we're on, as well as the start of the mmap range. Update routines that find va ranges to interact with the reserved ranges as well as properly align the mapping (this is especially important for targets whose page size does not mat

[PATCH v3 38/43] bsd-user: elfload.c style catch up patch

2021-09-02 Thread imp
From: Warner Losh Various style fixes to elfload.c that were too painful to make earlier in this series. Signed-off-by: Warner Losh Reviewed-by: Richard Henderson --- bsd-user/elfload.c | 208 ++--- 1 file changed, 104 insertions(+), 104 deletions(-) d

[PATCH v3 40/43] bsd-user: move qemu_log to later in the file

2021-09-02 Thread imp
From: Warner Losh Signed-off-by: Warner Losh Acked-by: Richard Henderson --- bsd-user/main.c | 17 + 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/bsd-user/main.c b/bsd-user/main.c index 50c8fdc1e2..1de86ae493 100644 --- a/bsd-user/main.c +++ b/bsd-user/main.c @

[PATCH v3 23/43] bsd-user: define max args in terms of pages

2021-09-02 Thread imp
From: Warner Losh For 32-bit platforms, pass in up to 256k of args. For 64-bit, bump that to 512k. Signed-off-by: Kyle Evans Signed-off-by: Warner Losh Reviewed-by: Richard Henderson --- bsd-user/qemu.h | 15 +++ 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/bsd-

[PATCH v3 41/43] bsd-user: Implement interlock for atomic operations

2021-09-02 Thread imp
From: Warner Losh Implement the internlock in fork_start() and fork_end() to properly cope with atomic operations and to safely keep state for parent and child processes. Signed-off-by: Stacey Son Signed-off-by: Warner Losh Reviewed-by: Richard Henderson --- bsd-user/main.c | 24

[PATCH v3 34/43] bsd-user: update debugging in mmap.c

2021-09-02 Thread imp
From: Warner Losh Update the debugging code for new features and different targets. Signed-off-by: Mikaël Urankar Signed-off-by: Sean Bruno Signed-off-by: Kyle Evans Signed-off-by: Warner Losh Acked-by: Richard Henderson --- bsd-user/mmap.c | 55 ++--

[PATCH v3 37/43] bsd-user: add stubbed out core dump support

2021-09-02 Thread imp
From: Warner Losh Add a stubbed-out version of the bsd-user fork's core dump support. This allows elfload.c to be almost the same between what's upstream and what's in qemu-project upstream w/o the burden of reviewing the core dump support. Signed-off-by: Stacey Son Signed-off-by: Warner Losh

[PATCH v3 19/43] bsd-user: start to move target CPU functions to target_arch*

2021-09-02 Thread imp
From: Warner Losh Move the CPU functions into target_arch_cpu.c that are unique to each CPU. These are defined in target_arch.h. Signed-off-by: Stacey Son Signed-off-by: Warner Losh Reviewed-by: Richard Henderson --- bsd-user/i386/target_arch.h | 31 + bsd-user/i386/target_

[PATCH v3 30/43] bsd-user: elf cleanup

2021-09-02 Thread imp
From: Warner Losh Move OS-dependent defines into target_os_elf.h. Move the architectural dependent stuff into target_arch_elf.h. Adjust elfload.c to use target_create_elf_tables instead of create_elf_tables. Signed-off-by: Warner Losh Signed-off-by: Stacey Son Signed-off-by: Kyle Evans Signed

[PATCH v3 21/43] bsd-user: pull in target_arch_thread.h update target_arch_elf.h

2021-09-02 Thread imp
From: Warner Losh Update target_arch_elf.h to remove thread_init. Move its contents to target_arch_thread.h and rename to target_thread_init(). Update elfload.c to call it. Create thread_os_thread.h to hold the os specific parts of the thread and threat manipulation routines. Currently, it just i

[PATCH v3 36/43] bsd-user: Add target_os_user.h to capture the user/kernel structures

2021-09-02 Thread imp
From: Warner Losh This file evolved over the years to capture the user/kernel interfaces, including those that changed over time. Signed-off-by: Stacey Son Signed-off-by: Michal Meloun Signed-off-by: Warner Losh Acked-by: Richard Henderson --- bsd-user/freebsd/target_os_user.h | 427 +++

[PATCH v3 18/43] bsd-user: save the path to the qemu emulator

2021-09-02 Thread imp
From: Warner Losh Save the path to the qemu emulator. This will be used later when we have a more complete implementation of exec. Signed-off-by: Stacey Son Signed-off-by: Warner Losh Acked-by: Richard Henderson --- bsd-user/main.c | 21 + bsd-user/qemu.h | 1 + 2 files

[PATCH v3 32/43] bsd-user: Rewrite target system call definintion glue

2021-09-02 Thread imp
From: Warner Losh Rewrite target definnitions to interface with the FreeBSD system calls. This covers basic types (time_t, iovec, umtx_time, timespec, timeval, rusage, rwusage) and basic defines (mmap, rusage). Also included are FreeBSD version-specific variations. Signed-off-by: Stacey Son Sig

[PATCH v3 27/43] bsd-user: Implement --seed and initialize random state

2021-09-02 Thread imp
From: Warner Losh Copy --seed implementation (translated from linux-user's newer command line scheme to the older one bsd-user still uses). Initialize the randomness with the glibc if a specific seed is specified or use the qcrypto library if not. Signed-off-by: Warner Losh --- bsd-user/main.c

[PATCH v3 25/43] bsd-user: Add system independent stack, data and text limiting

2021-09-02 Thread imp
From: Warner Losh Eliminate the x86 specific stack stuff in favor of more generic control over the process size: target_maxtsiz max text size target_dfldsiz initial data size limit target_maxdsiz max data size target_dflssiz initial stack size limit target_maxssiz max sta

[PATCH v3 22/43] bsd-user: Include more things in qemu.h

2021-09-02 Thread imp
From: Warner Losh Include more header files to match bsd-user fork. Signed-off-by: Warner Losh --- bsd-user/qemu.h | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/bsd-user/qemu.h b/bsd-user/qemu.h index 5e4cbb40d4..55d71130bb 100644 --- a/bsd-user/qemu.h +++ b/bsd-use

[PATCH v3 15/43] bsd-user: assume pthreads and support of __thread

2021-09-02 Thread imp
From: Warner Losh All compilers for some time have supported this. Follow linux-user and eliminate the #define THREAD and unconditionally insert __thread where needed. Please insert: "(see 24cb36a61c6: "configure: Make NPTL non-optional")" Signed-off-by: Warner Losh Reviewed-by: Richard Henders

[PATCH v3 33/43] bsd-user: Make cpu_model and cpu_type visible to all of main.c

2021-09-02 Thread imp
From: Warner Losh cpu_model and cpu_type will be used future commits, so move them from main() scoped to file scoped. Signed-off-by: Warner Losh Acked-by: Richard Henderson --- bsd-user/main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bsd-user/main.c b/bsd-user/m

[PATCH v3 13/43] bsd-user: TARGET_NGROUPS unused in this file, remove

2021-09-02 Thread imp
From: Warner Losh Signed-off-by: Warner Losh Reviewed-by: Richard Henderson --- bsd-user/bsdload.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/bsd-user/bsdload.c b/bsd-user/bsdload.c index 6aefc7a28b..5b3c061a45 100644 --- a/bsd-user/bsdload.c +++ b/bsd-user/bsdload.c @@ -19,8 +19,6 @

[PATCH v3 14/43] bsd-user: elfload: simplify bswap a bit.

2021-09-02 Thread imp
From: Warner Losh Reduce the number of ifdefs by always calling the swapping routine, but making them empty when swapping isn't needed. Signed-off-by: Warner Losh Reviewed-by: Richard Henderson --- bsd-user/elfload.c | 97 ++ 1 file changed, 47 inse

[PATCH v3 31/43] bsd-user: Remove dead #ifdefs from elfload.c

2021-09-02 Thread imp
From: Warner Losh LOW_ELF_STACK doesn't exist on FreeBSD and likely never will. Remove it. Likewise, remove an #if 0 block that's not useful Signed-off-by: Warner Losh Reviewed-by: Richard Henderson --- bsd-user/elfload.c | 20 1 file changed, 20 deletions(-) diff --git

[PATCH v3 12/43] bsd-user: remove a.out support

2021-09-02 Thread imp
From: Warner Losh Remove still-born a.out support. The BSDs switched from a.out to ELF 20+ years ago. It's out of scope for bsd-user, and what little support there was would simply wind up at a not-implemented message. Simplify the whole mess by removing it entirely. Should future support be requ

[PATCH v3 17/43] bsd-user: Include host-os.h from main

2021-09-02 Thread imp
From: Warner Losh Include host-os.h from main.c to pick up the default OS to emulate. Set that default in main(). Signed-off-by: Stacey Son Signed-off-by: Warner Losh Reviewed-by: Richard Henderson --- bsd-user/freebsd/host-os.h | 2 ++ bsd-user/main.c| 4 +++- bsd-user/netbsd/h

[PATCH v3 16/43] bsd-user: add host-os.h

2021-09-02 Thread imp
From: Warner Losh Host OS specific bits for this implementation go in this file. Signed-off-by: Stacey Son Signed-off-by: Warner Losh Reviewed-by: Richard Henderson --- bsd-user/freebsd/host-os.h | 23 +++ bsd-user/netbsd/host-os.h | 23 +++ bsd-user/

[PATCH v3 11/43] bsd-user: Eliminate elf personality

2021-09-02 Thread imp
From: Warner Losh The linux kernel supports a number of different ELF binaries. The Linux userland emulator inheritted some of that. And we inheritted it from there. However, for BSD there's only one kind of ELF file supported per platform, so there's no need to cope with historical quirks. Simpl

[PATCH v3 26/43] bsd-user: *BSD specific siginfo defintions

2021-09-02 Thread imp
From: Warner Losh Add FreeBSD, NetBSD and OpenBSD values for the various signal info types and defines to decode different signals to discover more information about the specific signal types. Signed-off-by: Stacey Son Signed-off-by: Warner Losh Acked-by: Richard Henderson --- bsd-user/freeb

[PATCH v3 10/43] bsd-user: implement path searching

2021-09-02 Thread imp
From: Warner Losh Use the PATH to find the executable given a bare argument. We need to do this so we can implement mixing native and emulated binaries (e.g., execing a x86 native binary from an emulated arm binary to optimize parts of the build). By finding the binary, we will know how to exec i

[PATCH v3 07/43] bsd-user: move arch specific defines out of elfload.c

2021-09-02 Thread imp
From: Warner Losh Move the architecture specific defines to target_arch_elf.h and delete them from elfload.c. Only retain ifdefs appropriate for i386 and x86_64. Add the copyright/license comments, and guard ifdefs. Signed-off-by: Warner Losh Reviewed-by: Richard Henderson --- bsd-user/elfloa

[PATCH v3 29/43] bsd-user: Add architecture specific signal tramp code

2021-09-02 Thread imp
From: Warner Losh Add a stubbed out version of setup_sigtramp. This is not yet used for x86, but is used for other architectures. This will be connected in future commits. Signed-off-by: Stacey Son Signed-off-by: Warner Losh Reviewed-by: Richard Henderson --- bsd-user/i386/target_arch_sigtra

[PATCH v3 09/43] bsd-user: Fix calculation of size to allocate

2021-09-02 Thread imp
From: Warner Losh It was incorrect to subtract off the size of an unsigned int here. In bsd-user fork, this change was made when moving the arch specific items to specific files. The size in BSD that's available for the arguments does not need a return address subtracted from it. Signed-off-by

[PATCH v3 04/43] bsd-user: add license to bsdload.c

2021-09-02 Thread imp
From: Warner Losh Pull in the license statement at the top of the bsdload.c file from the bsd-user fork version of this file. No functional changes. Signed-off-by: Warner Losh Reviewed-by: Richard Henderson --- bsd-user/bsdload.c | 17 - 1 file changed, 16 insertions(+), 1 del

[PATCH v3 20/43] bsd-user: Move per-cpu code into target_arch_cpu.h

2021-09-02 Thread imp
From: Warner Losh Move cpu_loop() into target_cpu_loop(), and put that in target_arch_cpu.h for each architecture. Signed-off-by: Stacey Son Signed-off-by: Warner Losh --- bsd-user/i386/target_arch_cpu.c | 1 + bsd-user/i386/target_arch_cpu.h | 209 bsd-user/main.c

[PATCH v3 08/43] bsd-user: pass the bsd_param into loader_exec

2021-09-02 Thread imp
From: Warner Losh Pass the bsd_param into loader_exec, and adjust. We use it to track the inital stack allocation and to set stack, open files, and other state shared between bsdload.c and elfload.c Signed-off-by: Warner Losh Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé

[PATCH v3 05/43] bsd-user: style nits: bsdload.c whitespace to qemu standard

2021-09-02 Thread imp
From: Warner Losh Signed-off-by: Warner Losh Reviewed-by: Richard Henderson --- bsd-user/bsdload.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bsd-user/bsdload.c b/bsd-user/bsdload.c index 0ade58b9e2..ec71c5e923 100644 --- a/bsd-user/bsdload.c +++ b/bsd-user/bsdload

[PATCH v3 02/43] bsd-user: add copyright header to elfload.c

2021-09-02 Thread imp
From: Warner Losh Add Stacey's copyright to elfload.c Signed-off-by: Stacey Son Signed-off-by: Warner Losh Reviewed-by: Richard Henderson --- bsd-user/elfload.c | 19 ++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/bsd-user/elfload.c b/bsd-user/elfload.c ind

[PATCH v3 01/43] bsd-user: remove sparc and sparc64

2021-09-02 Thread imp
From: Warner Losh These are broken here and in the bsd-user fork. They won't be fixed as FreeBSD has dropped support for sparc. If people wish to support this in other BSDs, you're better off starting over than starting from these files. Signed-off-by: Warner Losh Reviewed-by: Richard Henderson

[PATCH v3 00/43] bsd-user updates to run hello world

2021-09-02 Thread imp
From: Warner Losh This series of patches gets me to the point that I can run "Hello World" on i386 and x86_64. This is for static binaries only, that are relatively small, but it's better than the 100% instant mmap failre that is the current state of all things bsd-user in upstream qemu. Future p

[PATCH v3 06/43] bsd-user: Remove all non-x86 code from elfload.c

2021-09-02 Thread imp
From: Warner Losh bsd-user only builds x86 at the moment. Remove all non x86 code from elfload.c. We'll move the x86 code to {i386,x86_64}/target_arch_elf.h and bring it that support code from the forked bsd-user when the time comes. Signed-off-by: Warner Losh Reviewed-by: Richard Henderson --

[PATCH v3 03/43] bsd-user: Add Stacey's copyright to main.c

2021-09-02 Thread imp
From: Warner Losh Add Stacey's updated copyright to main.c Signed-off-by: Warner Losh Signed-off-by: Stacey Son Reviewed-by: Richard Henderson --- bsd-user/main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bsd-user/main.c b/bsd-user/main.c index 38185da111..39c4a0f

[PATCH v2 39/43] bsd-user: move qemu_log to later in the file

2021-08-26 Thread imp
From: Warner Losh Signed-off-by: Warner Losh Acked-by: Richard Henderson --- bsd-user/main.c | 17 + 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/bsd-user/main.c b/bsd-user/main.c index 57669ad7b7..d60a0a7ee2 100644 --- a/bsd-user/main.c +++ b/bsd-user/main.c @

[PATCH v2 30/43] bsd-user: Remove dead #ifdefs from elfload.c

2021-08-26 Thread imp
From: Warner Losh LOW_ELF_STACK doesn't exist on FreeBSD and likely never will. Remove it. Likewise, remove an #if 0 block that's not useful Signed-off-by: Warner Losh Reviewed-by: Richard Henderson --- bsd-user/elfload.c | 20 1 file changed, 20 deletions(-) diff --git

[PATCH v2 34/43] bsd-user: Add target_arch_reg to describe a target's register set

2021-08-26 Thread imp
From: Warner Losh target_reg_t is the normal register. target_fpreg_t is the floating point registers. target_copy_regs copies the registers out of CPU context for things like core dumps. Signed-off-by: Stacey Son Signed-off-by: Warner Losh Reviewed-by: Richard Henderson --- bsd-user/i386/ta

[PATCH v2 33/43] bsd-user: update debugging in mmap.c

2021-08-26 Thread imp
From: Warner Losh Update the debugging code for new features and different targets. Signed-off-by: Mikaël Urankar Signed-off-by: Sean Bruno Signed-off-by: Kyle Evans Signed-off-by: Warner Losh Acked-by: Richard Henderson --- bsd-user/mmap.c | 45

[PATCH v2 32/43] bsd-user: Make cpu_model and cpu_type visible to all of main.c

2021-08-26 Thread imp
From: Warner Losh cpu_model and cpu_type will be used future commits, so move them from main() scoped to file scoped. Signed-off-by: Warner Losh Acked-by: Richard Henderson --- bsd-user/main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bsd-user/main.c b/bsd-user/m

[PATCH v2 42/43] bsd-user: Add '-0 argv0' option to bsd-user/main.c

2021-08-26 Thread imp
From: Colin Percival Previously it was impossible to emulate a program with a file name different from its argv[0]. With this change, you can run qemu -0 fakename realname args which runs the program "realname" with an argv of "fakename args". Signed-off-by: Colin Percival Signed-off-by: W

[PATCH v2 29/43] bsd-user: elf cleanup

2021-08-26 Thread imp
From: Warner Losh Move OS-dependent defines into target_os_elf.h. Move the architectural dependent stuff into target_arch_elf.h. Adjust elfload.c to use target_create_elf_tables instead of create_elf_tables. Signed-off-by: Warner Losh Signed-off-by: Stacey Son Signed-off-by: Kyle Evans Signed

[PATCH v2 38/43] bsd-user: Refactor load_elf_sections and is_target_elf_binary

2021-08-26 Thread imp
From: Warner Losh Factor out load_elf_sections and is_target_elf_binary out of load_elf_interp. Signed-off-by: Mikaël Urankar Signed-off-by: Stacey Son Signed-off-by: Warner Losh --- bsd-user/elfload.c | 350 + 1 file changed, 164 insertions(+), 18

[PATCH v2 23/43] bsd-user: define max args in terms of pages

2021-08-26 Thread imp
From: Warner Losh For 32-bit platforms, pass in up to 256k of args. For 64-bit, bump that to 512k. Signed-off-by: Kyle Evans Signed-off-by: Warner Losh Reviewed-by: Richard Henderson --- bsd-user/qemu.h | 15 +++ 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/bsd-

[PATCH v2 31/43] bsd-user: Rewrite target system call definintion glue

2021-08-26 Thread imp
From: Warner Losh Rewrite target definnitions to interface with the FreeBSD system calls. This covers basic types (time_t, iovec, umtx_time, timespec, timeval, rusage, rwusage) and basic defines (mmap, rusage). Also included are FreeBSD version-specific variations. Signed-off-by: Stacey Son Sig

[PATCH v2 21/43] bsd-user: pull in target_arch_thread.h update target_arch_elf.h

2021-08-26 Thread imp
From: Warner Losh Update target_arch_elf.h to remove thread_init. Move its contents to target_arch_thread.h and rename to target_thread_init(). Update elfload.c to call it. Create thread_os_thread.h to hold the os specific parts of the thread and threat manipulation routines. Currently, it just i

  1   2   3   >