From: Warner Losh <i...@bsdimp.com> Greetings,
This series starts to cleanup bsd-user. The current checkpatch.pl output is on the order of 4500 lines long. These cleanups don't fix everything (there's still plenty of errors, even in some of the files the patches touch). I've tried to make things better in every case, but be advised that checkpatch.pl is unhappy with many of the files still in the first 15 commits. I do plan on addressing the issues in the future as I need to make real commits to those files. The changes were ones that were trivial to do with scripts that I had to do for main.c anyway. main.c is now completely clean. All the cleanup I've done myself, and at the end of this patch trail the output is only 3500 lines... Next, I've started to reorg the bsd-user sources. There's really 4 BSDs in the wild (FreeBSD, NetBSD, OpenBSD and Dragonfly) that these could, in theory, target. In the bsd-user branch, we've broken the emulation of these apart. It largely preserves the other BSD's as is, and greatly expands FreeBSD so that we can do package builds in user-land emulation. The other BSDs have not been run-time tested, though the CI tooling builds some of them. It's my belief that in the current state, even an old-school cat(1) would fail, though I am to fix that at least for FreeBSD... We've also added a number of other architectures than sparc and i386. Those additions, though, are dependent on other things not yet reshuffled and or merged, so they will be coming along in due time: mips (32 and 64 bit), arm, aarch64 and riscv willl come in due time. powerpc might, but it's in a frightful state. I'm open to other BSDs that wish to work along with me as well, though it may be best to wait until after future patch sets as much is still set to change. CHERI and related work may also happen, but that's still TBD. In this installement, after the style stuff, I've created a target_arch_cpu.h. Here, all the functions related to the cpu loop and similar things are moved into there on a per-architecture basis to start to tame the number of #ifdefs in mail. Linux-user did a similar thing years after we had done it in the repo, and a number of different choices were made. Rather than redo all the work from the bsd-user repo, I'm recreating / rebasing it on a current qemu. Future patch series will address other aspects. Once they are complete, we can look, potentially, at any refactoring between linux-user and bsd-user. I very much explicitly want to push that to the end because otherwise I'm completely recreating a lot of the work on the bsd-user branch rather than just transitioning it forward to a newer qemu. This reorg was started by Stacey Son and I've redone it with the latest code. I've added his signoff (with his blanket permission) to those commits. Also, all of these commits pass checkpatch.pl Please let me know what you think, and how I might structure future patches if there's ways I can do them better. I've switched to pull-requests with this series since it will be easier to keep track of, especially in the future. Warner P.S. This has no relevance to 6.0 at all: we're too late and this feature isn't fully integrated by this patch trail. The following changes since commit 9950da284fa5e2ea9ab57d87e05b693fb60c79ce: Merge remote-tracking branch 'remotes/alistair/tags/pull-riscv-to-apply-20210322-2' into staging (2021-03-23 15:30:46 +0000) are available in the Git repository at: https://gitlab.com/bsdimp/qemu.git tags/pull-request-2021-04-23 for you to fetch changes up to cc6e9793094f5207509bb74b90854a89195d22db: bsd-user: move sparc cpu_loop into target_arch_cpu.h as target_cpu_loop (2021-04-23 13:13:13 -0600) ---------------------------------------------------------------- April 23, 2021 bsd-user update Style changes to reduce checkpatch whinage (much more needed as only some issues globally and all issues in main.c have been address, other files need much love). Start to reorg so we can bring in all the work from the bsd-user repo. ---------------------------------------------------------------- Warner Losh (24): bsd-user: whitespace changes bsd-user: whitespace changes bsd-user: whitespace changes bsd-user: style tweak: keyword space ( bsd-user: style tweak: keyword space ( bsd-user: style tweak: keyword space ( bsd-user: style tweak: keyword space ( bsd-user: style tweak: use C not C++ comments bsd-user: style tweak: use C not C++ comments bsd-user: style tweak: use C not C++ comments bsd-user: style tweak: if 0 -> ifdef notyet for code needed in future bsd-user: style tweak: if 0 -> ifdef notyet for code needed in future bsd-user: style tweak: if 0 -> ifdef notyet for code needed in future bsd-user: style tweak: if 0 -> ifdef notyet for code needed in future bsd-user: Fix commentary issues bsd-user: Use preferred block comments bsd-user: move extern to header file bsd-user: style changes for {} bsd-user: use qemu_strtol in preference to strtol bsd-user: introduce host_os.h for bsd-specific code and defaults bsd-user: add arm target_signal.h bsd-user: create target_arch_cpu.h bsd-user: move x86 (i386 and x86_64) cpu_loop to target_arch_cpu.h bsd-user: move sparc cpu_loop into target_arch_cpu.h as target_cpu_loop bsd-user/arm/target_arch_cpu.h | 22 + bsd-user/arm/target_signal.h | 31 ++ bsd-user/bsd-mman.h | 42 +- bsd-user/bsdload.c | 26 +- bsd-user/elfload.c | 334 +++++++-------- bsd-user/freebsd/host_os.h | 25 ++ bsd-user/i386/target_arch_cpu.h | 305 ++++++++++++++ bsd-user/main.c | 651 +++-------------------------- bsd-user/mmap.c | 22 +- bsd-user/netbsd/host_os.h | 25 ++ bsd-user/openbsd/host_os.h | 25 ++ bsd-user/qemu.h | 16 +- bsd-user/sparc/target_arch_cpu.h | 322 ++++++++++++++ bsd-user/sparc64/target_arch_cpu.h | 19 + bsd-user/strace.c | 2 +- bsd-user/syscall.c | 18 +- bsd-user/uaccess.c | 2 +- bsd-user/x86_64/target_arch_cpu.h | 19 + bsd-user/x86_64/target_syscall.h | 2 +- 19 files changed, 1081 insertions(+), 827 deletions(-) create mode 100644 bsd-user/arm/target_arch_cpu.h create mode 100644 bsd-user/arm/target_signal.h create mode 100644 bsd-user/freebsd/host_os.h create mode 100644 bsd-user/i386/target_arch_cpu.h create mode 100644 bsd-user/netbsd/host_os.h create mode 100644 bsd-user/openbsd/host_os.h create mode 100644 bsd-user/sparc/target_arch_cpu.h create mode 100644 bsd-user/sparc64/target_arch_cpu.h create mode 100644 bsd-user/x86_64/target_arch_cpu.h -- 2.22.1