From: Warner Losh <i...@bsdimp.com> Version 2:
In version 2 I've fixed all the checkpatch.pl issues for all the files that I touched. Since files are changed incrementally, some of the individual changes may not pass checkpatch.pl due to pre-existing problems, but the cumulative diff passes with just warnings. I've folded the 'if 0 should just be lost' advice in the relevant hunks, as well as in a few places where things were commented out. I've included all the reviews I've got so far, but since this is my first time with such a complex review here please let me know if I've missed following all the conventions somehow. I had to tweak patches 025 and 026, which had been previously reviewed (adding static in 2 places to fix a warning). So I removed the Reviewed By: line from it. I hope that's the proper protocol here, but if not I'm keen on suggestions. Version 1: 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. Warner Losh (48): 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: Remove commented out code bsd-user: style tweak: Remove #if 0'd code bsd-user: style tweak: Remove #if 0'd code bsd-user: style tweak: Remove #if 0'd code bsd-user: style tweak: Remove #if 0'd code bsd-user: style tweak: return is not a function, eliminate () bsd-user: style tweak: Put {} around all if/else/for statements bsd-user: style tweak: Fix commentary issues bsd-user: style tweak: Use preferred block comments bsd-user: style tweak: move extern to header file bsd-user: style tweak: use {} consistently in for / if / else statements bsd-user: style nits: return is not a function bsd-user: use qemu_strtoul in preference to strtol bsd-user: introduce host_os.h for bsd-specific code and defaults 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: style tweak: space pedantry bsd-user: style tweak: comments bsd-user: style tweak: use {} correctly bsd-user: style tweak: fix block comments bsd-user: style tweak: use {} for all if statements, format else correctly bsd-user: style tweak: remove spacing after '*' and add after } bsd-user: style tweak: Use preferred block comments bsd-user: style tweak: don't assign in if statements bsd-user: style tweak: use {} for all if statements, format else correctly bsd-user: style tweak: Use preferred block comments bsd-user: style tweak: don't assign in if statements bsd-user: style tweak: use {} for all if statements, format else correctly bsd-user: style tweak: spaces around =, remove stray space bsd-user: style tweak: Use preferred block comments bsd-user: style tweak: don't assign in if statements bsd-user: style tweak: spaces around operators and commas bsd-user: style tweak: fold long lines bsd-user: style tweak: use preferred block comments bsd-user: style tweak: Use preferred {} in if/else statements. bsd-user: style tweak: Return is not a function call. bsd-user: style tweak: don't assign in if statement. bsd-user: put back a break; that had gone missing... bsd-user/arm/target_arch_cpu.h | 22 + bsd-user/bsd-mman.h | 42 +- bsd-user/bsdload.c | 55 +-- bsd-user/elfload.c | 677 ++++++++++++++++------------- bsd-user/freebsd/host_os.h | 25 ++ bsd-user/i386/target_arch_cpu.h | 197 +++++++++ bsd-user/main.c | 657 +++------------------------- bsd-user/mmap.c | 185 +++++--- bsd-user/netbsd/host_os.h | 25 ++ bsd-user/openbsd/host_os.h | 25 ++ bsd-user/qemu.h | 128 +++--- bsd-user/sparc/target_arch_cpu.h | 287 ++++++++++++ bsd-user/sparc64/target_arch_cpu.h | 19 + bsd-user/strace.c | 21 +- bsd-user/syscall.c | 222 ++++++---- bsd-user/uaccess.c | 27 +- bsd-user/x86_64/target_arch_cpu.h | 19 + bsd-user/x86_64/target_syscall.h | 15 - 18 files changed, 1449 insertions(+), 1199 deletions(-) create mode 100644 bsd-user/arm/target_arch_cpu.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