-
bsd-user-2024q4-pull-request52a523af · ·
bsd-user: Minor fixes These patches have been in my queue pending too long (I have a bunch of others that haven't been reviewd, but those will be done clsoe to the end of the release to not get in the way of the release). The patches align the stack properly on x86_64, implements setting the tb-size and properly setting the ts_tid for initial threads. They have all been reviewed.
-
bsd-user-for-9.1-pull-requestec018b76 · ·
bsd-user: Misc changes for 9.1 (I hope) V2: Add missing bsd-user/aarch64/target.h This patch series includes two main sets of patches. To make it simple to review, I've included the changes from my student which the later changes depend on. I've included a change from Jessica and Doug as well. I've reviewed them, but more eyes never hurt. I've also included a number of 'touch up' patches needed either to get the aarch64 building, or to implmement suggestions from prior review cycles. The main one is what's charitably described as a kludge: force aarch64 to use 4k pages. The qemu-project (and blitz branch) hasn't had the necessary changes to bsd-user needed to support variable page size. Sorry this is so late... Live has conspired to delay me.
-
bsd-user-misc-2024q2-pull-requestcb4c2590 · ·
bsd-user: Baby Steps towards eliminating qemu_host_page_size, et al First baby-steps towards eliminating qemu_host_page_size: tackle the reserve_va calculation (which is easier to copy from linux-user than to fix).
-
bsd-user-mmap-pull-requestdfa1d915 · ·
bsd-user mmap and exec branches from gsoc This pull request represents the mmap and exec changes from Karim Taha for his GSoC project. They represent all the mmap and exec related system calls and get bsd-user to the point that a dynamic hello-world works (at least for armv7). There are a couple of patch check errors, but they are the lessor evil: I made purposely bad style choices to ensure all the commits compiled (and i undid the style choices in subsequent commits). I pushed an earlier version to gitlab, and all but the riscv64 pipelines were green. Since bsd-user doesn't change anything related to ricsv64 (there's no support in qemu-project repo, though we do have it in the bsd-user fork: coming soon). I think this is good to go. https://gitlab.com/bsdimp/qemu.git Warner
-
2023q3-bsd-user-pull-requestf51e7c41 · ·
Pull request for bsd-user 2023 Q3 (first batch) First batch of commits submitted by my GSoC student Karim Taha These implement the stat, statfs, statfh and dirents system calls. In addition, fix a missing break statment, and submit Richard Henderson's elf stat mmap cleansup.
-
bsd-user-2023q1-pull-request6da777e2 · ·
2023 Q1 bsd-user upstreaming: bugfixes and sysctl [ letter edited -- need reviews for these hunks bsd-user: Helper routines h2g_old_sysctl bsd-user: various helper routines for sysctl ] This group of patches gets the basic framework for sysctl upstreamed. There's a lot more to translate far too many binary blobs the kernel publishes via sysctls, but I'm leaving those out in the name of simplicity. There's also a bug fix from Doug Rabson that fixes a long int confusion leading to a trunctation of addresses (oops) There's a fix for the -static option, since clang hates -no-pie and needs only -fno-pie. Finally, I'm changing how I'm upstreaming a little. I'm doing a little deeper dives into our rather chaotic repo to find a couple of authors I might have missed. From here on out, I'll be using the original author's name as the git author. I'll also tag the co-authors better as well when there's multiple people that did something (other than reformat and/or move code around). I've discovered more code moved about than I'd previously known. This seems more in line with standard practice. v3->pull: o minor tweaks in the conditional reviews around formatting o fix all errors for check patch and am OK with remaining warnings for line length that's only slightly too long o edited letter for changes in review process v3: o Removed -strict, it's not ready and needs a complete rethink. o Add g_assert_not_reached() o target -> guest in most places o Use MIN() to simplify things o Better types in many places (abi_int instead of int32_t) o Use ARRAY_COUNT o fix tabs copied from FreeBSD sources to spaces v2: o Created various helper functions to make the code a little better o split a few patches that I thought would be approved together but that generated commentary. It's easier to manage 1 per patch for those. o Add/delete G_GNU_UNUSED to ensure all patches compile w/o warnings o Fix 64-bit running 32-bit binary to get a LONG or ULONG. Add a bounce buffer for these so we don't overflow anything on the target and return all the elements of arrays. o Fixed a number of nits noticed in the review. o Add or improve comments to explain things there were questions on during the review. o fix noted typos o fix host != target page size differences o Add pointers to FreeBSD source code, as appropriate o fix locking (mostly unlocking) on error paths o Note: -strict feedback not yet applied due to large numbers of changes from the rest. Next round.
-
bsd-user-preen-2022q1-pull-requesta5b88166 · ·
bsd-user: Prepare for future upstream of system calls. This series of patches does three things. First, it starts to give up on the idea that you can run FooBSD binaries on BarBSD. They are too different to make that happen any time soon, though I've kept the support for Net/OpenBSD, even though they haven't built. We'll need a lot of work to make that happen, though, and I need to simplify to get things upstream. Second, it starts to move some of the ifdef trees into target.h. Third, it starts to upstream bsd-file.h, but the remainder of the file in the bsd-user fork had some issues that will be resolved before next quarter's update.
-
bsd-user-arm-2022q1-pull-request1103d59c · ·
bsd-user: upstream signal implementation Upstream the bsd-user fork signal implementation, for the most part. This series of commits represents nearly all of the infrastructure that surround signals, except the actual system call glue (that was also reworked in the fork and needs its own series). In addition, this adds the sigsegv and sigbus code to arm. Even in the fork, we don't have good x86 signal implementation, so there's little to upstream for that at the moment. bsd-user's signal implementation is similar to linux-user's. The full context can be found in the bsd-user's fork's 'blitz branch' at https://github.com/qemu-bsd-user/qemu-bsd-user/tree/blitz which shows how these are used to implement various system calls. Since this was built from linux-user's stack stuff, evolved for BSD with the passage of a few years, it no-doubt missed some bug fixes from linux-user (though nothing obvious stood out in the quick comparison I made). After the first round of reviews, many of these improvements have been incorporated. Patchew history: https://patchew.org/QEMU/20220125012947.14974-1-imp@bsdimp.com/
-
bsd-user-arm-pull-request18fe5d99 · ·
bsd-user: arm (32-bit) support This series of patches brings in 32-bit arm support for bsd-user. It implements all the bits needed to do image activation, signal handling, stack management and threading. This allows us to get to the "Hello World" level. The arm and x86 code are now the same as in the bsd-user fork. For full context, the fork is at https://github.com/qemu-bsd-user/qemu-bsd-user/tree/blitz (though the the recent sig{bus,segv} needed updates are incomplete). v5 changes: o Moved to using the CPUArchState typedef and move set_sigtramp_args, get_mcontext, set_mcontext, and get_ucontext_sigreturn prototypes to bsd-user/freebsd/target_os_ucontext.h o Fix issues with arm's set_mcontext related to masking and remove an unnecessary check. We're down to only one hunk needing review: bsd-user/arm/target_arch_signal.c: arm set_mcontext Warnings that should be ignored: o make checkpatch has a couple of complaints about the comments for the signal trampoline, since it's a false positive IMHO. WARNING: Block comments use a leading /* on a separate line + /* 8 */ sys_sigreturn, WARNING: Block comments use a leading /* on a separate line + /* 9 */ sys_exit
-
pull-bsd-user-20211018-pull-request5abfac27 · ·
bsd-user pull request: merge dependencies for next architectures Merge the dependencies for arm, aarch64, and riscv64 architectures. This joins together two patch series: [PATCH v2 00/15] bsd-user: misc cleanup for aarch64 import Prepare for aarch64 support (the next architecture to be upstreamed). As the aarch64 emulation is more complete, it relies on a number of different items. In some cases, I've pulled in the full support from bsd-user fork. In other cases I've created a simple stub (as is the case for signals, which have independent changes pending, so I wanted to be as minimal as possible. Since all pre-12.2 support was purged from the bsd-user fork, go ahead and remove it here. FreeBSD 11.x goes ouft of support at the end of the month. Remove what little multi-version support that's in upstream. and [PATCH v3 0/9] bsd-user mmap fixes This series synchronizes mmap.c with the bsd-user fork. This is a mix of old bug fixes pulled in from linux-user, as well as some newer fixes to adress bugs found in check-tcg and recent FreeBSD developments. There are also a couple of style commits. Updated to migrate debugging to qemu_log. as well as a couple of minor rebase tweaks. In addition, the next two architectures I plan on upstreaming (arm and riscv64) also have their prereqs satisfied with this request. v2: Remove accidental module regression in patch 7 and try again.
-
pull-bsd-user-20210910be04f210 · ·
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.
-
bsd-user-pull-20210907-tagdc96376e · ·
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. v2: rejected patches dropped Use suggested glibc routines Updated to be closer to qemu style Disable bsd-user on netbsd and openbsd since they don't compile fold together a couple of related changes [[ tagged the review-by and acked-by from last series, but by hand... I think I got them all... ]] v3: Fix a bug in refactoring load_elf_sections and is_target_elf_binary Fix spelling errors in commit messages drop copy_cpu() patch until we use that function reword a few commit messages to make them clearer fix return value of setup_sigtramp to be 0 after #ifdef elimination Add patch to initialize random state and implement --seed Fix a boatload of style issues. Rebase to tip of master NOTE: checkpatch.pl will have several warning about line length > 80 and admonishment to not use architecture specific defines. The slightly long lines look a lot better than wrapping and the arch specific defines are basically required (one could wrap them, and I plan to in the future once I've pruned the obsolete ones in a future patch set: there's so many that errors would crop up if I were to do it now). Warner Colin Percival (1): bsd-user: Add '-0 argv0' option to bsd-user/main.c Warner Losh (42): bsd-user: remove sparc and sparc64 bsd-user: add copyright header to elfload.c bsd-user: Add Stacey's copyright to main.c bsd-user: add license to bsdload.c bsd-user: style nits: bsdload.c whitespace to qemu standard bsd-user: Remove all non-x86 code from elfload.c bsd-user: move arch specific defines out of elfload.c bsd-user: pass the bsd_param into loader_exec bsd-user: Fix calculation of size to allocate bsd-user: implement path searching bsd-user: Eliminate elf personality bsd-user: remove a.out support bsd-user: TARGET_NGROUPS unused in this file, remove bsd-user: elfload: simplify bswap a bit. bsd-user: assume pthreads and support of __thread bsd-user: add host-os.h bsd-user: Include host-os.h from main bsd-user: save the path to the qemu emulator bsd-user: start to move target CPU functions to target_arch* bsd-user: Move per-cpu code into target_arch_cpu.h bsd-user: pull in target_arch_thread.h update target_arch_elf.h bsd-user: Include more things in qemu.h bsd-user: define max args in terms of pages bsd-user: Create target specific vmparam.h bsd-user: Add system independent stack, data and text limiting bsd-user: *BSD specific siginfo defintions bsd-user: Implement --seed and initialize random state bsd-user: Move stack initializtion into a per-os file. bsd-user: Add architecture specific signal tramp code bsd-user: elf cleanup bsd-user: Remove dead #ifdefs from elfload.c bsd-user: Rewrite target system call definintion glue bsd-user: Make cpu_model and cpu_type visible to all of main.c bsd-user: update debugging in mmap.c bsd-user: Add target_arch_reg to describe a target's register set bsd-user: Add target_os_user.h to capture the user/kernel structures bsd-user: add stubbed out core dump support bsd-user: elfload.c style catch up patch bsd-user: Refactor load_elf_sections and is_target_elf_binary bsd-user: move qemu_log to later in the file bsd-user: Implement interlock for atomic operations bsd-user: Update mapping to handle reserved and starting conditions bsd-user/bsd-mman.h | 121 -- bsd-user/bsdload.c | 104 +- bsd-user/elfcore.c | 10 + bsd-user/elfload.c | 1469 +++++------------ bsd-user/freebsd/host-os.h | 25 + bsd-user/freebsd/target_os_elf.h | 137 ++ bsd-user/freebsd/target_os_siginfo.h | 145 ++ bsd-user/freebsd/target_os_signal.h | 78 + bsd-user/freebsd/target_os_stack.h | 181 ++ bsd-user/freebsd/target_os_thread.h | 25 + bsd-user/freebsd/target_os_user.h | 427 +++++ bsd-user/freebsd/target_os_vmparam.h | 38 + .../target_syscall.h => i386/target_arch.h} | 27 +- bsd-user/i386/target_arch_cpu.c | 76 + bsd-user/i386/target_arch_cpu.h | 209 +++ bsd-user/i386/target_arch_elf.h | 35 + bsd-user/i386/target_arch_reg.h | 82 + bsd-user/i386/target_arch_signal.h | 94 ++ bsd-user/i386/target_arch_sigtramp.h | 29 + bsd-user/i386/target_arch_thread.h | 47 + bsd-user/i386/target_arch_vmparam.h | 46 + bsd-user/main.c | 836 ++-------- bsd-user/mmap.c | 472 +++++- bsd-user/netbsd/host-os.h | 25 + bsd-user/netbsd/target_os_elf.h | 146 ++ bsd-user/netbsd/target_os_siginfo.h | 82 + bsd-user/netbsd/target_os_signal.h | 69 + bsd-user/netbsd/target_os_stack.h | 56 + bsd-user/netbsd/target_os_thread.h | 25 + bsd-user/openbsd/host-os.h | 25 + bsd-user/openbsd/target_os_elf.h | 146 ++ bsd-user/openbsd/target_os_siginfo.h | 82 + bsd-user/openbsd/target_os_signal.h | 69 + bsd-user/openbsd/target_os_stack.h | 56 + bsd-user/openbsd/target_os_thread.h | 25 + bsd-user/qemu.h | 63 +- bsd-user/sparc/target_arch_sysarch.h | 52 - bsd-user/sparc64/target_arch_sysarch.h | 52 - bsd-user/syscall.c | 11 - bsd-user/syscall_defs.h | 255 +-- .../target_syscall.h => x86_64/target_arch.h} | 28 +- bsd-user/x86_64/target_arch_cpu.c | 76 + bsd-user/x86_64/target_arch_cpu.h | 247 +++ bsd-user/x86_64/target_arch_elf.h | 35 + bsd-user/x86_64/target_arch_reg.h | 92 ++ bsd-user/x86_64/target_arch_signal.h | 94 ++ bsd-user/x86_64/target_arch_sigtramp.h | 29 + bsd-user/x86_64/target_arch_thread.h | 40 + bsd-user/x86_64/target_arch_vmparam.h | 46 + configure | 7 +- meson.build | 7 +- slirp | 2 +- 52 files changed, 4389 insertions(+), 2266 deletions(-) delete mode 100644 bsd-user/bsd-mman.h create mode 100644 bsd-user/elfcore.c create mode 100644 bsd-user/freebsd/host-os.h create mode 100644 bsd-user/freebsd/target_os_elf.h create mode 100644 bsd-user/freebsd/target_os_siginfo.h create mode 100644 bsd-user/freebsd/target_os_signal.h create mode 100644 bsd-user/freebsd/target_os_stack.h create mode 100644 bsd-user/freebsd/target_os_thread.h create mode 100644 bsd-user/freebsd/target_os_user.h create mode 100644 bsd-user/freebsd/target_os_vmparam.h rename bsd-user/{sparc/target_syscall.h => i386/target_arch.h} (60%) create mode 100644 bsd-user/i386/target_arch_cpu.c create mode 100644 bsd-user/i386/target_arch_cpu.h create mode 100644 bsd-user/i386/target_arch_elf.h create mode 100644 bsd-user/i386/target_arch_reg.h create mode 100644 bsd-user/i386/target_arch_signal.h create mode 100644 bsd-user/i386/target_arch_sigtramp.h create mode 100644 bsd-user/i386/target_arch_thread.h create mode 100644 bsd-user/i386/target_arch_vmparam.h create mode 100644 bsd-user/netbsd/host-os.h create mode 100644 bsd-user/netbsd/target_os_elf.h create mode 100644 bsd-user/netbsd/target_os_siginfo.h create mode 100644 bsd-user/netbsd/target_os_signal.h create mode 100644 bsd-user/netbsd/target_os_stack.h create mode 100644 bsd-user/netbsd/target_os_thread.h create mode 100644 bsd-user/openbsd/host-os.h create mode 100644 bsd-user/openbsd/target_os_elf.h create mode 100644 bsd-user/openbsd/target_os_siginfo.h create mode 100644 bsd-user/openbsd/target_os_signal.h create mode 100644 bsd-user/openbsd/target_os_stack.h create mode 100644 bsd-user/openbsd/target_os_thread.h delete mode 100644 bsd-user/sparc/target_arch_sysarch.h delete mode 100644 bsd-user/sparc64/target_arch_sysarch.h rename bsd-user/{sparc64/target_syscall.h => x86_64/target_arch.h} (59%) create mode 100644 bsd-user/x86_64/target_arch_cpu.c create mode 100644 bsd-user/x86_64/target_arch_cpu.h create mode 100644 bsd-user/x86_64/target_arch_elf.h create mode 100644 bsd-user/x86_64/target_arch_reg.h create mode 100644 bsd-user/x86_64/target_arch_signal.h create mode 100644 bsd-user/x86_64/target_arch_sigtramp.h create mode 100644 bsd-user/x86_64/target_arch_thread.h create mode 100644 bsd-user/x86_64/target_arch_vmparam.h -- 2.32.0