aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2021-09-13linux-user: Split safe-syscall macro into its own headerPeter Maydell
Split the safe-syscall macro from qemu.h into a new safe-syscall.h. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20210908154405.15417-7-peter.maydell@linaro.org> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2021-09-13linux-user: Split mmap prototypes into user-mmap.hPeter Maydell
Split out the mmap prototypes into a new header user-mmap.h which we only include where required. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20210908154405.15417-6-peter.maydell@linaro.org> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2021-09-13linux-user: Split loader-related prototypes into loader.hPeter Maydell
Split guest-binary loader prototypes out into a new header loader.h which we include only where required. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20210908154405.15417-5-peter.maydell@linaro.org> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2021-09-13linux-user: Split signal-related prototypes into signal-common.hPeter Maydell
Split the signal related prototypes into the existing header file signal-common.h, and include it in those places that now require it. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20210908154405.15417-4-peter.maydell@linaro.org> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2021-09-13linux-user: Split strace prototypes into strace.hPeter Maydell
The functions implemented in strace.c are only used in a few files in linux-user; split them out of qemu.h and into a new strace.h header which we include in the places that need it. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20210908154405.15417-3-peter.maydell@linaro.org> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2021-09-13linux-user: Fix coding style nits in qemu.hPeter Maydell
We're about to move a lot of the code in qemu.h out into different header files; fix the coding style nits first so that checkpatch is happy with the pure code-movement patches. This is mostly block-comment style but also a few whitespace issues. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20210908154405.15417-2-peter.maydell@linaro.org> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2021-09-13Merge remote-tracking branch 'remotes/bonzini-gitlab/tags/for-upstream' into ↵Peter Maydell
staging * Fixes for "-cpu max" on i386 TCG (Daniel) * vVMLOAD/VMSAVE and vGIF implementation (Lara) * Reorganize i386 targets documentation in preparation for SGX (myself) * Meson cleanups (myself, Thomas) * NVMM fixes (Reinoud) * Suppress bogus -Wstringop-overflow (Richard) # gpg: Signature made Mon 13 Sep 2021 12:56:33 BST # gpg: using RSA key F13338574B662389866C7682BFFBD25F78C7AE83 # gpg: issuer "pbonzini@redhat.com" # gpg: Good signature from "Paolo Bonzini <bonzini@gnu.org>" [full] # gpg: aka "Paolo Bonzini <pbonzini@redhat.com>" [full] # Primary key fingerprint: 46F5 9FBD 57D6 12E7 BFD4 E2F7 7E15 100C CD36 69B1 # Subkey fingerprint: F133 3857 4B66 2389 866C 7682 BFFB D25F 78C7 AE83 * remotes/bonzini-gitlab/tags/for-upstream: (21 commits) docs: link to archived Fedora code of conduct Fix nvmm_ram_block_added() function arguments Only check CONFIG_NVMM when NEED_CPU_H is defined util: Suppress -Wstringop-overflow in qemu_thread_start fw_cfg: add etc/msr_feature_control meson: remove dead variable meson: do not use python.full_path() unnecessarily meson: look up cp and dtrace with find_program() meson.build: Do not look for VNC-related libraries if have_system is not set docs/system: move x86 CPU configuration to a separate document docs/system: standardize man page sections to --- with overline docs: standardize directory index to --- with overline docs: standardize book titles to === with overline target/i386: Added vVMLOAD and vVMSAVE feature target/i386: Added changed priority check for VIRQ target/i386: Added ignore TPR check in ctl_has_irq target/i386: Added VGIF V_IRQ masking capability target/i386: Moved int_ctl into CPUX86State structure target/i386: Added VGIF feature target/i386: VMRUN and VMLOAD canonicalizations ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2021-09-13docs: link to archived Fedora code of conductPaolo Bonzini
Fedora has switched to a different CoC. QEMU's own code of conduct is based on the previous version and cites it as a source. Replace the link with one to the Wayback Machine. Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-09-13Fix nvmm_ram_block_added() function argumentsReinoud Zandijk
A parameter max_size was added to the RAMBlockNotifier ram_block_added function. Use the max_size for pre allocation of hva space. Signed-off-by: Reinoud Zandijk <Reinoud@NetBSD.org> Message-Id: <20210718134650.1191-3-reinoud@NetBSD.org> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-09-13Only check CONFIG_NVMM when NEED_CPU_H is definedReinoud Zandijk
Userland targers will otherwise use a poisoned CONFIG_NVMM Signed-off-by: Reinoud Zandijk <Reinoud@NetBSD.org> Message-Id: <20210718134650.1191-2-reinoud@NetBSD.org> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-09-13util: Suppress -Wstringop-overflow in qemu_thread_startRichard Henderson
This seems to be either a glibc or gcc bug, but the code appears to be fine with the warning suppressed. Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20210803211907.150525-1-richard.henderson@linaro.org> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-09-13fw_cfg: add etc/msr_feature_controlPaolo Bonzini
The file already existed, but nobody had noticed the warning until now. Add it at the bottom, since that is where unknown files go in legacy mode. Fixes: 217f1b4a721 ("target-i386: Publish advised value of MSR_IA32_FEATURE_CONTROL via fw_cfg") Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-09-13meson: remove dead variablePaolo Bonzini
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-09-13meson: do not use python.full_path() unnecessarilyPaolo Bonzini
The "python" variable is an external program and can be passed directly to custom_target. This avoids the need to look it up multiple times, which was previously silent but is now explicit in recent Meson versions. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-09-13meson: look up cp and dtrace with find_program()Paolo Bonzini
Avoid that meson prints a "Program xyz found" test once per custom_target. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-09-13meson.build: Do not look for VNC-related libraries if have_system is not setThomas Huth
When running "./configure --static --disable-system" there is currently a warning if the static version of libpng is missing: WARNING: Static library 'png16' not found for dependency 'libpng', may not be statically linked Since it does not make sense to look for the VNC-related libraries at all when we're building without system emulator binaries, let's add a check for have_system here to silence this warning. Signed-off-by: Thomas Huth <thuth@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-Id: <20210906153939.165567-1-thuth@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-09-13docs/system: move x86 CPU configuration to a separate documentPaolo Bonzini
Currently, cpu-models-x86.rst.inc is included in target-i386.rst directly. To make the toctree more homogeneous when adding more documentation, include it through a first-class .rst file. Together with the previous changes to the man page skeletons, this also frees "===" for the headings, so that cpu-models-x86.rst.inc need not assume anything about the headings used by target-i386.rst. Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-09-13docs/system: standardize man page sections to --- with overlinePaolo Bonzini
Man pages in docs/system use file inclusion heavily. Use headings with overlines in the main files, so that the same included file work well from both manuals and man pages. This style of heading is a bit more heavy-weight, so it is not used by the other man pages in interop/ and tools/. If in the future they are changed to use include files, for example to avoid having sections named "synopsis" or "description", they can switch to --- with overline as well. Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-09-13docs: standardize directory index to --- with overlinePaolo Bonzini
Use a standard heading format for the index.rst file in a directory. Using overlines makes it clear that individual documents can use e.g. === for chapter titles and --- for section titles, as suggested in the Linux kernel guidelines[1]. They could do it anyway, because documents included in a toctree are parsed separately and therefore are not tied to the same conventions for headings. However, keeping some consistency is useful since sometimes files are included from multiple places. [1] https://www.kernel.org/doc/html/latest/doc-guide/sphinx.html Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-09-13docs: standardize book titles to === with overlinePaolo Bonzini
Documents within a Sphinx manual are separate files and therefore can use different conventions for headings. However, keeping some consistency is useful so that included files are easy to get right. This patch uses a standard heading format for book titles, so that it is obvious when a file sits at the top level toctree of a book or man page. The heading is irrelevant for man pages, but keep it consistent as well. Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-09-13target/i386: Added vVMLOAD and vVMSAVE featureLara Lazier
The feature allows the VMSAVE and VMLOAD instructions to execute in guest mode without causing a VMEXIT. (APM2 15.33.1) Signed-off-by: Lara Lazier <laramglazier@gmail.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-09-13target/i386: Added changed priority check for VIRQLara Lazier
Writes to cr8 affect v_tpr. This could set or unset an interrupt request as the priority might have changed. Signed-off-by: Lara Lazier <laramglazier@gmail.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-09-13target/i386: Added ignore TPR check in ctl_has_irqLara Lazier
The APM2 states that if V_IGN_TPR is nonzero, the current virtual interrupt ignores the (virtual) TPR. Signed-off-by: Lara Lazier <laramglazier@gmail.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-09-13target/i386: Added VGIF V_IRQ masking capabilityLara Lazier
VGIF provides masking capability for when virtual interrupts are taken. (APM2) Signed-off-by: Lara Lazier <laramglazier@gmail.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-09-13target/i386: Moved int_ctl into CPUX86State structureLara Lazier
Moved int_ctl into the CPUX86State structure. It removes some unnecessary stores and loads, and prepares for tracking the vIRQ state even when it is masked due to vGIF. Signed-off-by: Lara Lazier <laramglazier@gmail.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-09-13target/i386: Added VGIF featureLara Lazier
VGIF allows STGI and CLGI to execute in guest mode and control virtual interrupts in guest mode. When the VGIF feature is enabled then: * executing STGI in the guest sets bit 9 of the VMCB offset 60h. * executing CLGI in the guest clears bit 9 of the VMCB offset 60h. Signed-off-by: Lara Lazier <laramglazier@gmail.com> Message-Id: <20210730070742.9674-1-laramglazier@gmail.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-09-13target/i386: VMRUN and VMLOAD canonicalizationsLara Lazier
APM2 requires that VMRUN and VMLOAD canonicalize (sign extend to 63 from 48/57) all base addresses in the segment registers that have been respectively loaded. Signed-off-by: Lara Lazier <laramglazier@gmail.com> Message-Id: <20210804113058.45186-1-laramglazier@gmail.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-09-13target/i386: add missing bits to CR4_RESERVED_MASKDaniel P. Berrangé
Booting Fedora kernels with -cpu max hangs very early in boot. Disabling the la57 CPUID bit fixes the problem. git bisect traced the regression to commit 213ff024a2f92020290296cb9dc29c2af3d4a221 (HEAD, refs/bisect/bad) Author: Lara Lazier <laramglazier@gmail.com> Date: Wed Jul 21 17:26:50 2021 +0200 target/i386: Added consistency checks for CR4 All MBZ bits in CR4 must be zero. (APM2 15.5) Added reserved bitmask and added checks in both helper_vmrun and helper_write_crN. Signed-off-by: Lara Lazier <laramglazier@gmail.com> Message-Id: <20210721152651.14683-2-laramglazier@gmail.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> In this commit CR4_RESERVED_MASK is missing CR4_LA57_MASK and two others. Adding this lets Fedora kernels boot once again. Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> Tested-by: Richard W.M. Jones <rjones@redhat.com> Message-Id: <20210831175033.175584-1-berrange@redhat.com> [Removed VMXE/SMXE, matching the commit message. - Paolo] Fixes: 213ff024a2 ("target/i386: Added consistency checks for CR4", 2021-07-22) Cc: qemu-stable@nongnu.org Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-09-13Merge remote-tracking branch 'remotes/armbru/tags/pull-qapi-2021-09-13' into ↵Peter Maydell
staging QAPI patches patches for 2021-09-13 # gpg: Signature made Mon 13 Sep 2021 08:53:42 BST # gpg: using RSA key 354BC8B3D7EB2A6B68674E5F3870B400EB918653 # gpg: issuer "armbru@redhat.com" # gpg: Good signature from "Markus Armbruster <armbru@redhat.com>" [full] # gpg: aka "Markus Armbruster <armbru@pond.sub.org>" [full] # Primary key fingerprint: 354B C8B3 D7EB 2A6B 6867 4E5F 3870 B400 EB91 8653 * remotes/armbru/tags/pull-qapi-2021-09-13: qapi: Fix bogus error for 'if': { 'not': '' } tests/qapi-schema: Cover 'not' condition with empty argument qapi: Bury some unused code in class Indentation qapi: Drop Indentation.__bool__() qapi: Fix a botched type annotation Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2021-09-11Merge remote-tracking branch 'remotes/bsdimp/tags/pull-bsd-user-20210910' ↵Peter Maydell
into staging 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 patch sets will refine this, add the missing system calls, fix bugs preventing more sophisticated programms from running and add a bunch of new architecture support. There's three large themes in these patches, though the changes that represent them are interrelated making it hard to separate out further. 1. Reorganization to support multiple OS and architectures (though I've only tested FreeBSD, other BSDs might not even compile yet). 2. Diff reduction with the bsd-user fork for several files. These diffs include changes that borrowed from linux-user as well as changes to make things work on FreeBSD. The records keeping when this was done, however, was poor at best, so many of the specific borrowings are going unacknowledged here, apart from this general ack. These diffs also include some minor code shuffling. Some of the changes are done specifically to make it easier to rebase the bsd-user fork's changes when these land in the tree (a number of changes have been pushed there to make this more possible). 3. Filling in the missing pieces to make things work. There's many changes to elfload to make it load things in the right places, to find the interpreter better, etc. There's changes to mmap.c to make the mappings work better and there's changes to main.c that were inspired, at least, by now-ancient changes to linux-user's main.c. I ran checkpatch.pl on this, and there's 350-odd errors it identifies (the vast majoirty come from BSD's fetish for tabs), so there will need to be a V2 to fix this at the very least. In addition, the change set is big (about +~4.5k/-~2.5k lines), so I anticipate some iteration as well just based on its sheer size. I've tried to keep each set small to make it easy to review in isolation, but I've also allowed some interrelated ones to get a little bigger than I'd normally like. I've not done the customary documentation of the expected checkpatch.pl output because it is large, and because I wanted to get review of the other parts rolling to get this project unstuck. Future versions of the patch will document the expected output. In addition, I noticed a number of places where I could modernize to make the code match things like linux-user better. I've resisted the urge to do these at this time, since it would complicate merging the other ~30k lines of diff that remains after this batch. Future batches should generally be smaller once this one has landed since they are, by and large, either a bunch of new files to support armv7, aarch64, riscv64, mips, mipsel, mips64, ppc, ppc64 and ppc64le, or are adding system calls, which can be done individually or small groups. I've removed sparc and sparc64 support as they've been removed from FreeBSD and have been near totally busted for years. Stacey Son did the bulk of this work originally, but since I had to move things around so much and/or retool that work in non-trivial ways, I've kept myself as author, and added his signed-off-by line. I'm unsure of the qemu standard practice for this, but am happy to learn if this is too far outside its current mainstream. For a while Sean Bruno did the merges from upstream, and he's credited using his signed-off-by in appropriate places, though for this patch set there's only a few. I've tried to ensure that others who have work in individual patches that I've aggregated together also are reflected in their signed-off-by. Given the chaotic stat of the upstream repo for its early history, this may be the best that can be reconstructed at this late date. Most of these files are 'foundational' so have existed from the earliest days when record keeping wasn't quite what I'd wish for in hindsight. There was only really one change that I could easily cherry-pick (Colin's), so I did that. # gpg: Signature made Fri 10 Sep 2021 21:24:08 BST # gpg: using RSA key 2035F894B00AA3CF7CCDE1B76C1CD1287DB01100 # gpg: Good signature from "Warner Losh <wlosh@netflix.com>" [unknown] # gpg: aka "Warner Losh <imp@bsdimp.com>" [unknown] # gpg: aka "Warner Losh <imp@freebsd.org>" [unknown] # gpg: aka "Warner Losh <imp@village.org>" [unknown] # gpg: aka "Warner Losh <wlosh@bsdimp.com>" [unknown] # gpg: WARNING: This key is not certified with a trusted signature! # gpg: There is no indication that the signature belongs to the owner. # Primary key fingerprint: 2035 F894 B00A A3CF 7CCD E1B7 6C1C D128 7DB0 1100 * remotes/bsdimp/tags/pull-bsd-user-20210910: (42 commits) bsd-user: Update mapping to handle reserved and starting conditions bsd-user: Add '-0 argv0' option to bsd-user/main.c bsd-user: Implement interlock for atomic operations bsd-user: move gemu_log to later in the file bsd-user: Refactor load_elf_sections and is_target_elf_binary bsd-user: elfload.c style catch up patch bsd-user: add stubbed out core dump support bsd-user: Add target_os_user.h to capture the user/kernel structures bsd-user: Add target_arch_reg to describe a target's register set bsd-user: update debugging in mmap.c bsd-user: Rewrite target system call definintion glue bsd-user: Remove dead #ifdefs from elfload.c bsd-user: elf cleanup bsd-user: Add architecture specific signal tramp code bsd-user: Move stack initializtion into a per-os file. bsd-user: Implement --seed and initialize random state bsd-user: *BSD specific siginfo defintions bsd-user: Add system independent stack, data and text limiting bsd-user: Create target specific vmparam.h bsd-user: define max args in terms of pages ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2021-09-10bsd-user: Update mapping to handle reserved and starting conditionsWarner 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 match the host's). Loop where appropriate when the initial address space offered by mmap does not meet the contraints. This has 18e80c55bb6 from linux-user folded in to the upstream bsd-user code as well. Signed-off-by: Mikaël Urankar <mikael.urankar@gmail.com> Signed-off-by: Stacey Son <sson@FreeBSD.org> Signed-off-by: Warner Losh <imp@bsdimp.com> Acked-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Kyle Evans <kevans@FreeBSD.org>
2021-09-10bsd-user: Add '-0 argv0' option to bsd-user/main.cColin 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 <cperciva@tarsnap.com> Signed-off-by: Warner Losh <imp@bsdimp.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
2021-09-10bsd-user: Implement interlock for atomic operationsWarner 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 <sson@FreeBSD.org> Signed-off-by: Warner Losh <imp@bsdimp.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
2021-09-10bsd-user: move gemu_log to later in the fileWarner Losh
Signed-off-by: Warner Losh <imp@bsdimp.com> Acked-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Kyle Evans <kevans@FreeBSD.org>
2021-09-10bsd-user: Refactor load_elf_sections and is_target_elf_binaryWarner Losh
Factor out load_elf_sections and is_target_elf_binary out of load_elf_interp. Signed-off-by: Mikaël Urankar <mikael.urankar@gmail.com> Signed-off-by: Stacey Son <sson@FreeBSD.org> Signed-off-by: Warner Losh <imp@bsdimp.com> Reviewed-by: Kyle Evans <kevans@FreeBSD.org>
2021-09-10bsd-user: elfload.c style catch up patchWarner Losh
Various style fixes to elfload.c that were too painful to make earlier in this series. Signed-off-by: Warner Losh <imp@bsdimp.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
2021-09-10bsd-user: add stubbed out core dump supportWarner 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 <sson@FreeBSD.org> Signed-off-by: Warner Losh <imp@bsdimp.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
2021-09-10bsd-user: Add target_os_user.h to capture the user/kernel structuresWarner Losh
This file evolved over the years to capture the user/kernel interfaces, including those that changed over time. Signed-off-by: Stacey Son <sson@FreeBSD.org> Signed-off-by: Michal Meloun <mmel@FreeBSD.org> Signed-off-by: Warner Losh <imp@bsdimp.com> Acked-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Kyle Evans <kevans@FreeBSD.org>
2021-09-10bsd-user: Add target_arch_reg to describe a target's register setWarner 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 <sson@FreeBSD.org> Signed-off-by: Warner Losh <imp@bsdimp.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
2021-09-10bsd-user: update debugging in mmap.cWarner Losh
Update the debugging code for new features and different targets. Signed-off-by: Mikaël Urankar <mikael.urankar@gmail.com> Signed-off-by: Sean Bruno <sbruno@FreeBSD.org> Signed-off-by: Kyle Evans <kevans@FreeBSD.org> Signed-off-by: Warner Losh <imp@bsdimp.com> Acked-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Kyle Evans <kevans@FreeBSD.org>
2021-09-10bsd-user: Rewrite target system call definintion glueWarner 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 <sson@FreeBSD.org> Signed-off-by: Warner Losh <imp@bsdimp.com> Acked-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Kyle Evans <kevans@FreeBSD.org>
2021-09-10bsd-user: Remove dead #ifdefs from elfload.cWarner 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 <imp@bsdimp.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
2021-09-10bsd-user: elf cleanupWarner 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 <imp@bsdimp.com> Signed-off-by: Stacey Son <sson@FreeBSD.org> Signed-off-by: Kyle Evans <kevans@FreeBSD.org> Signed-off-by: Justin Hibbits <chmeeedalf@gmail.com> Signed-off-by: Alexander Kabaev <kan@FreeBSD.ORG> Acked-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Kyle Evans <kevans@FreeBSD.org>
2021-09-10bsd-user: Add architecture specific signal tramp codeWarner 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 <sson@FreeBSD.org> Signed-off-by: Warner Losh <imp@bsdimp.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
2021-09-10bsd-user: Move stack initializtion into a per-os file.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 <sson@FreeBSD.org> Signed-off-by: Warner Losh <imp@bsdimp.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
2021-09-10bsd-user: Implement --seed and initialize random stateWarner 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 <imp@bsdimp.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
2021-09-10bsd-user: *BSD specific siginfo defintionsWarner 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 <sson@FreeBSD.org> Signed-off-by: Warner Losh <imp@bsdimp.com> Acked-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Kyle Evans <kevans@FreeBSD.org>
2021-09-10bsd-user: Add system independent stack, data and text limitingWarner 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 stack size target_sgrowsiz amount to grow stack These can be set on a per-arch basis, and the stack size can be set on the command line. Adjust the stack size parameters at startup. Signed-off-by: Stacey Son <sson@FreeBSD.org> Signed-off-by: Warner Losh <imp@bsdimp.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
2021-09-10bsd-user: Create target specific vmparam.hWarner Losh
Target specific values for vm parameters and details. Signed-off-by: Stacey Son <sson@FreeBSD.org> Signed-off-by: Warner Losh <imp@bsdimp.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
2021-09-10bsd-user: define max args in terms of pagesWarner Losh
For 32-bit platforms, pass in up to 256k of args. For 64-bit, bump that to 512k. Signed-off-by: Kyle Evans <kevans@freebsd.org> Signed-off-by: Warner Losh <imp@bsdimp.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>