From: Peter Maydell Date: Sat, 11 Sep 2021 13:00:39 +0000 (+0100) Subject: Merge remote-tracking branch 'remotes/bsdimp/tags/pull-bsd-user-20210910' into staging X-Git-Tag: v6.2.0~157 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=99c44988d5ba1866a411450c877ed818b1b70081;p=mirror_qemu.git Merge remote-tracking branch 'remotes/bsdimp/tags/pull-bsd-user-20210910' 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 " [unknown] # gpg: aka "Warner Losh " [unknown] # gpg: aka "Warner Losh " [unknown] # gpg: aka "Warner Losh " [unknown] # gpg: aka "Warner Losh " [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 --- 99c44988d5ba1866a411450c877ed818b1b70081