qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PULL 00/42] bsd-user updates to run hello world
@ 2021-09-10 20:30 imp
  2021-09-10 20:30 ` [PULL 07/42] bsd-user: move arch specific defines out of elfload.c imp
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: imp @ 2021-09-10 20:30 UTC (permalink / raw)
  To: qemu-devel; +Cc: kevans, Warner Losh

From: Warner Losh <imp@bsdimp.com>

The following changes since commit a61c30b8c8c3c8619847cfaa289233cc696f5689:

  Merge remote-tracking branch 'remotes/mjt/tags/patch-fetch' into staging (2021-09-07 10:15:48 +0100)

are available in the Git repository at:

  https://gitlab.com/bsdimp/qemu.git tags/pull-bsd-user-20210910

for you to fetch changes up to be04f210f954bed8663943a94ece50c2ca410231:

  bsd-user: Update mapping to handle reserved and starting conditions (2021-09-10 14:13:06 -0600)

----------------------------------------------------------------
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.

----------------------------------------------------------------
Colin Percival (1):
  bsd-user: Add '-0 argv0' option to bsd-user/main.c

Warner Losh (41):
  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: 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 gemu_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                               |  832 ++--------
 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 +-
 51 files changed, 4386 insertions(+), 2263 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



^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PULL 07/42] bsd-user: move arch specific defines out of elfload.c
  2021-09-10 20:30 [PULL 00/42] bsd-user updates to run hello world imp
@ 2021-09-10 20:30 ` imp
  2021-09-10 21:51 ` [PULL 00/42] bsd-user updates to run hello world Philippe Mathieu-Daudé
  2021-09-11 15:38 ` Peter Maydell
  2 siblings, 0 replies; 12+ messages in thread
From: imp @ 2021-09-10 20:30 UTC (permalink / raw)
  To: qemu-devel; +Cc: kevans, Richard Henderson, Warner Losh

From: Warner Losh <imp@bsdimp.com>

Move the architecture specific defines to target_arch_elf.h and delete
them from elfload.c. Only retain ifdefs appropriate for i386 and x86_64.
Add the copyright/license comments, and guard ifdefs.

Signed-off-by: Warner Losh <imp@bsdimp.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
---
 bsd-user/elfload.c                | 81 +------------------------------
 bsd-user/i386/target_arch_elf.h   | 81 +++++++++++++++++++++++++++++++
 bsd-user/x86_64/target_arch_elf.h | 67 +++++++++++++++++++++++++
 3 files changed, 150 insertions(+), 79 deletions(-)
 create mode 100644 bsd-user/i386/target_arch_elf.h
 create mode 100644 bsd-user/x86_64/target_arch_elf.h

diff --git a/bsd-user/elfload.c b/bsd-user/elfload.c
index fffa24f041..639673f5b7 100644
--- a/bsd-user/elfload.c
+++ b/bsd-user/elfload.c
@@ -23,6 +23,8 @@
 #include "disas/disas.h"
 #include "qemu/path.h"
 
+#include "target_arch_elf.h"
+
 /* from personality.h */
 
 /*
@@ -93,85 +95,6 @@ enum {
 #define ELIBBAD 80
 #endif
 
-#ifdef TARGET_I386
-
-#define ELF_PLATFORM get_elf_platform()
-
-static const char *get_elf_platform(void)
-{
-    static char elf_platform[] = "i386";
-    int family = object_property_get_int(OBJECT(thread_cpu), "family", NULL);
-    if (family > 6)
-        family = 6;
-    if (family >= 3)
-        elf_platform[1] = '0' + family;
-    return elf_platform;
-}
-
-#define ELF_HWCAP get_elf_hwcap()
-
-static uint32_t get_elf_hwcap(void)
-{
-    X86CPU *cpu = X86_CPU(thread_cpu);
-
-    return cpu->env.features[FEAT_1_EDX];
-}
-
-#ifdef TARGET_X86_64
-#define ELF_START_MMAP 0x2aaaaab000ULL
-#define elf_check_arch(x) (((x) == ELF_ARCH))
-
-#define ELF_CLASS      ELFCLASS64
-#define ELF_DATA       ELFDATA2LSB
-#define ELF_ARCH       EM_X86_64
-
-static inline void init_thread(struct target_pt_regs *regs, struct image_info *infop)
-{
-    regs->rax = 0;
-    regs->rsp = infop->start_stack;
-    regs->rip = infop->entry;
-    if (bsd_type == target_freebsd) {
-        regs->rdi = infop->start_stack;
-    }
-}
-
-#else /* !TARGET_X86_64 */
-
-#define ELF_START_MMAP 0x80000000
-
-/*
- * This is used to ensure we don't load something for the wrong architecture.
- */
-#define elf_check_arch(x) (((x) == EM_386) || ((x) == EM_486))
-
-/*
- * These are used to set parameters in the core dumps.
- */
-#define ELF_CLASS       ELFCLASS32
-#define ELF_DATA        ELFDATA2LSB
-#define ELF_ARCH        EM_386
-
-static inline void init_thread(struct target_pt_regs *regs, struct image_info *infop)
-{
-    regs->esp = infop->start_stack;
-    regs->eip = infop->entry;
-
-    /* SVR4/i386 ABI (pages 3-31, 3-32) says that when the program
-       starts %edx contains a pointer to a function which might be
-       registered using `atexit'.  This provides a mean for the
-       dynamic linker to call DT_FINI functions for shared libraries
-       that have been loaded before the code runs.
-
-       A value of 0 tells we have no such handler.  */
-    regs->edx = 0;
-}
-#endif /* !TARGET_X86_64 */
-
-#define USE_ELF_CORE_DUMP
-#define ELF_EXEC_PAGESIZE       4096
-
-#endif
-
 #ifndef ELF_PLATFORM
 #define ELF_PLATFORM (NULL)
 #endif
diff --git a/bsd-user/i386/target_arch_elf.h b/bsd-user/i386/target_arch_elf.h
new file mode 100644
index 0000000000..84f61bd930
--- /dev/null
+++ b/bsd-user/i386/target_arch_elf.h
@@ -0,0 +1,81 @@
+/*
+ *  i386 ELF definitions
+ *
+ *  Copyright (c) 2013 Stacey D. Son
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, see <http://www.gnu.org/licenses/>.
+ */
+#ifndef _TARGET_ARCH_ELF_H_
+#define _TARGET_ARCH_ELF_H_
+
+#define ELF_PLATFORM get_elf_platform()
+
+static const char *get_elf_platform(void)
+{
+    static char elf_platform[] = "i386";
+    int family = object_property_get_int(OBJECT(thread_cpu), "family", NULL);
+    if (family > 6) {
+        family = 6;
+    }
+    if (family >= 3) {
+        elf_platform[1] = '0' + family;
+    }
+    return elf_platform;
+}
+
+#define ELF_HWCAP get_elf_hwcap()
+
+static uint32_t get_elf_hwcap(void)
+{
+    X86CPU *cpu = X86_CPU(thread_cpu);
+
+    return cpu->env.features[FEAT_1_EDX];
+}
+
+#define ELF_START_MMAP 0x80000000
+
+/*
+ * This is used to ensure we don't load something for the wrong architecture.
+ */
+#define elf_check_arch(x) (((x) == EM_386) || ((x) == EM_486))
+
+/*
+ * These are used to set parameters in the core dumps.
+ */
+#define ELF_CLASS       ELFCLASS32
+#define ELF_DATA        ELFDATA2LSB
+#define ELF_ARCH        EM_386
+
+static inline void init_thread(struct target_pt_regs *regs,
+                               struct image_info *infop)
+{
+    regs->esp = infop->start_stack;
+    regs->eip = infop->entry;
+
+    /*
+     * SVR4/i386 ABI (pages 3-31, 3-32) says that when the program
+     * starts %edx contains a pointer to a function which might be
+     * registered using `atexit'.  This provides a mean for the
+     * dynamic linker to call DT_FINI functions for shared libraries
+     * that have been loaded before the code runs.
+     *
+     * A value of 0 tells we have no such handler.
+     */
+    regs->edx = 0;
+}
+
+#define USE_ELF_CORE_DUMP
+#define ELF_EXEC_PAGESIZE       4096
+
+#endif /* _TARGET_ARCH_ELF_H_ */
diff --git a/bsd-user/x86_64/target_arch_elf.h b/bsd-user/x86_64/target_arch_elf.h
new file mode 100644
index 0000000000..e7c8aa2755
--- /dev/null
+++ b/bsd-user/x86_64/target_arch_elf.h
@@ -0,0 +1,67 @@
+/*
+ *  x86_64 ELF definitions
+ *
+ *  Copyright (c) 2013 Stacey D. Son
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, see <http://www.gnu.org/licenses/>.
+ */
+#ifndef _TARGET_ARCH_ELF_H_
+#define _TARGET_ARCH_ELF_H_
+
+#define ELF_PLATFORM get_elf_platform()
+
+static const char *get_elf_platform(void)
+{
+    static char elf_platform[] = "i386";
+    int family = object_property_get_int(OBJECT(thread_cpu), "family", NULL);
+    if (family > 6) {
+        family = 6;
+    }
+    if (family >= 3) {
+        elf_platform[1] = '0' + family;
+    }
+    return elf_platform;
+}
+
+#define ELF_HWCAP get_elf_hwcap()
+
+static uint32_t get_elf_hwcap(void)
+{
+    X86CPU *cpu = X86_CPU(thread_cpu);
+
+    return cpu->env.features[FEAT_1_EDX];
+}
+
+#define ELF_START_MMAP 0x2aaaaab000ULL
+#define elf_check_arch(x) (((x) == ELF_ARCH))
+
+#define ELF_CLASS      ELFCLASS64
+#define ELF_DATA       ELFDATA2LSB
+#define ELF_ARCH       EM_X86_64
+
+static inline void init_thread(struct target_pt_regs *regs,
+                               struct image_info *infop)
+{
+    regs->rax = 0;
+    regs->rsp = infop->start_stack;
+    regs->rip = infop->entry;
+    if (bsd_type == target_freebsd) {
+        regs->rdi = infop->start_stack;
+    }
+}
+
+#define USE_ELF_CORE_DUMP
+#define ELF_EXEC_PAGESIZE       4096
+
+#endif /* _TARGET_ARCH_ELF_H_ */
-- 
2.32.0



^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PULL 00/42] bsd-user updates to run hello world
  2021-09-10 20:30 [PULL 00/42] bsd-user updates to run hello world imp
  2021-09-10 20:30 ` [PULL 07/42] bsd-user: move arch specific defines out of elfload.c imp
@ 2021-09-10 21:51 ` Philippe Mathieu-Daudé
  2021-09-11 15:38 ` Peter Maydell
  2 siblings, 0 replies; 12+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-09-10 21:51 UTC (permalink / raw)
  To: imp, qemu-devel; +Cc: kevans

On 9/10/21 10:30 PM, imp@bsdimp.com wrote:
> From: Warner Losh <imp@bsdimp.com>
> 
> The following changes since commit a61c30b8c8c3c8619847cfaa289233cc696f5689:
> 
>   Merge remote-tracking branch 'remotes/mjt/tags/patch-fetch' into staging (2021-09-07 10:15:48 +0100)
> 
> are available in the Git repository at:
> 
>   https://gitlab.com/bsdimp/qemu.git tags/pull-bsd-user-20210910

Well done, chapeau!

> for you to fetch changes up to be04f210f954bed8663943a94ece50c2ca410231:
> 
>   bsd-user: Update mapping to handle reserved and starting conditions (2021-09-10 14:13:06 -0600)
> 
> ----------------------------------------------------------------
> 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.
> 
> ----------------------------------------------------------------
> Colin Percival (1):
>   bsd-user: Add '-0 argv0' option to bsd-user/main.c
> 
> Warner Losh (41):
>   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
...


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PULL 00/42] bsd-user updates to run hello world
  2021-09-10 20:30 [PULL 00/42] bsd-user updates to run hello world imp
  2021-09-10 20:30 ` [PULL 07/42] bsd-user: move arch specific defines out of elfload.c imp
  2021-09-10 21:51 ` [PULL 00/42] bsd-user updates to run hello world Philippe Mathieu-Daudé
@ 2021-09-11 15:38 ` Peter Maydell
  2 siblings, 0 replies; 12+ messages in thread
From: Peter Maydell @ 2021-09-11 15:38 UTC (permalink / raw)
  To: Warner Losh; +Cc: Kyle Evans, QEMU Developers

On Fri, 10 Sept 2021 at 21:32, <imp@bsdimp.com> wrote:
>
> From: Warner Losh <imp@bsdimp.com>
>
> The following changes since commit a61c30b8c8c3c8619847cfaa289233cc696f5689:
>
>   Merge remote-tracking branch 'remotes/mjt/tags/patch-fetch' into staging (2021-09-07 10:15:48 +0100)
>
> are available in the Git repository at:
>
>   https://gitlab.com/bsdimp/qemu.git tags/pull-bsd-user-20210910
>
> for you to fetch changes up to be04f210f954bed8663943a94ece50c2ca410231:
>
>   bsd-user: Update mapping to handle reserved and starting conditions (2021-09-10 14:13:06 -0600)
>



Applied, thanks.

Please update the changelog at https://wiki.qemu.org/ChangeLog/6.2
for any user-visible changes.

-- PMM


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PULL 00/42] bsd-user updates to run hello world
  2021-09-09 16:31     ` Philippe Mathieu-Daudé
@ 2021-09-10 20:35       ` Warner Losh
  0 siblings, 0 replies; 12+ messages in thread
From: Warner Losh @ 2021-09-10 20:35 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé; +Cc: Peter Maydell, QEMU Developers, Kyle Evans

[-- Attachment #1: Type: text/plain, Size: 1685 bytes --]

On Thu, Sep 9, 2021 at 10:31 AM Philippe Mathieu-Daudé <f4bug@amsat.org>
wrote:

> On 9/9/21 5:12 PM, Warner Losh wrote:
> >
> >
> > On Thu, Sep 9, 2021, 9:01 AM Peter Maydell <peter.maydell@linaro.org
> > <mailto:peter.maydell@linaro.org>> wrote:
> >
> >     On Tue, 7 Sept 2021 at 22:56, <imp@bsdimp.com
> >     <mailto:imp@bsdimp.com>> wrote:
> >     >
> >     > From: Warner Losh <imp@bsdimp.com <mailto:imp@bsdimp.com>>
> >     >
> >     > The following changes since commit
> >     f214d8e0150766c31172e16ef4b17674f549d852:
> >     >
> >     >   Merge remote-tracking branch
> >     'remotes/pmaydell/tags/pull-target-arm-20210826' into staging
> >     (2021-08-26 18:03:57 +0100)
> >     >
> >     > are available in the Git repository at:
> >     >
> >     >   https://gitlab.com/bsdimp/qemu.git
> >     <https://gitlab.com/bsdimp/qemu.git> tags/bsd-user-pull-20210907-tag
> >     >
> >     > for you to fetch changes up to
> >     dc96376e46a52ac63a27ea185c3f0a6fd54e3c82:
> >     >
> >     >   bsd-user: Update mapping to handle reserved and starting
> >     conditions (2021-09-07 08:26:53 -0600)
> >
> >     >  slirp                                         |    2 +-
> >
> >     A bogus submodule update seems to have crept in here...
> >
> >
> > So I need to fix this and resubmit?
>
> Yes, but since there is no change in most of the commits, you don't
> need to repost the whole, once pushed the new tag, you can just
> post the the cover letter (which triggers Peter's scripts) and the
> fixed "[PULL 07/42] bsd-user: move arch specific defines out of
> elfload.c" which updated the submodule.
>

Done. Thanks!

Warner

[-- Attachment #2: Type: text/html, Size: 2926 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PULL 00/42] bsd-user updates to run hello world
  2021-09-09 16:29 ` Philippe Mathieu-Daudé
@ 2021-09-10 20:31   ` Warner Losh
  0 siblings, 0 replies; 12+ messages in thread
From: Warner Losh @ 2021-09-10 20:31 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé; +Cc: Kyle Evans, QEMU Developers

[-- Attachment #1: Type: text/plain, Size: 15181 bytes --]

On Thu, Sep 9, 2021 at 10:29 AM Philippe Mathieu-Daudé <f4bug@amsat.org>
wrote:

> On 9/7/21 11:52 PM, imp@bsdimp.com wrote:
> > From: Warner Losh <imp@bsdimp.com>
> >
> > The following changes since commit
> f214d8e0150766c31172e16ef4b17674f549d852:
> >
> >   Merge remote-tracking branch
> 'remotes/pmaydell/tags/pull-target-arm-20210826' into staging (2021-08-26
> 18:03:57 +0100)
> >
> > are available in the Git repository at:
> >
> >   https://gitlab.com/bsdimp/qemu.git tags/bsd-user-pull-20210907-tag
> >
> > for you to fetch changes up to dc96376e46a52ac63a27ea185c3f0a6fd54e3c82:
> >
> >   bsd-user: Update mapping to handle reserved and starting conditions
> (2021-09-07 08:26:53 -0600)
> >
> > ----------------------------------------------------------------
> >
> > 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.
>
> ---
>
> Something got wrong with the signed tag, it should probably end here,
> but all the cover letter is included.
>

Just a slight case of PEBEK I think :)


> FYI git-publish eases the process:
> https://github.com/stefanha/git-publish


I'll have to give this a try next time... The first couple of rounds were
easy enough to
do by hand, but this last round has been quite a bit more difficult.

Warner


>
> > 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 (41):
> >   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: 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 gemu_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                               |  832 ++--------
> >  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, 4387 insertions(+), 2264 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
> >
>
>

[-- Attachment #2: Type: text/html, Size: 18378 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PULL 00/42] bsd-user updates to run hello world
  2021-09-09 15:12   ` Warner Losh
  2021-09-09 15:21     ` Daniel P. Berrangé
@ 2021-09-09 16:31     ` Philippe Mathieu-Daudé
  2021-09-10 20:35       ` Warner Losh
  1 sibling, 1 reply; 12+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-09-09 16:31 UTC (permalink / raw)
  To: Warner Losh, Peter Maydell; +Cc: Kyle Evans, QEMU Developers

On 9/9/21 5:12 PM, Warner Losh wrote:
> 
> 
> On Thu, Sep 9, 2021, 9:01 AM Peter Maydell <peter.maydell@linaro.org
> <mailto:peter.maydell@linaro.org>> wrote:
> 
>     On Tue, 7 Sept 2021 at 22:56, <imp@bsdimp.com
>     <mailto:imp@bsdimp.com>> wrote:
>     >
>     > From: Warner Losh <imp@bsdimp.com <mailto:imp@bsdimp.com>>
>     >
>     > The following changes since commit
>     f214d8e0150766c31172e16ef4b17674f549d852:
>     >
>     >   Merge remote-tracking branch
>     'remotes/pmaydell/tags/pull-target-arm-20210826' into staging
>     (2021-08-26 18:03:57 +0100)
>     >
>     > are available in the Git repository at:
>     >
>     >   https://gitlab.com/bsdimp/qemu.git
>     <https://gitlab.com/bsdimp/qemu.git> tags/bsd-user-pull-20210907-tag
>     >
>     > for you to fetch changes up to
>     dc96376e46a52ac63a27ea185c3f0a6fd54e3c82:
>     >
>     >   bsd-user: Update mapping to handle reserved and starting
>     conditions (2021-09-07 08:26:53 -0600)
> 
>     >  slirp                                         |    2 +-
> 
>     A bogus submodule update seems to have crept in here...
> 
> 
> So I need to fix this and resubmit?

Yes, but since there is no change in most of the commits, you don't
need to repost the whole, once pushed the new tag, you can just
post the the cover letter (which triggers Peter's scripts) and the
fixed "[PULL 07/42] bsd-user: move arch specific defines out of
elfload.c" which updated the submodule.


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PULL 00/42] bsd-user updates to run hello world
  2021-09-07 21:52 imp
  2021-09-09 15:00 ` Peter Maydell
@ 2021-09-09 16:29 ` Philippe Mathieu-Daudé
  2021-09-10 20:31   ` Warner Losh
  1 sibling, 1 reply; 12+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-09-09 16:29 UTC (permalink / raw)
  To: imp, qemu-devel; +Cc: kevans

On 9/7/21 11:52 PM, imp@bsdimp.com wrote:
> From: Warner Losh <imp@bsdimp.com>
> 
> The following changes since commit f214d8e0150766c31172e16ef4b17674f549d852:
> 
>   Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20210826' into staging (2021-08-26 18:03:57 +0100)
> 
> are available in the Git repository at:
> 
>   https://gitlab.com/bsdimp/qemu.git tags/bsd-user-pull-20210907-tag
> 
> for you to fetch changes up to dc96376e46a52ac63a27ea185c3f0a6fd54e3c82:
> 
>   bsd-user: Update mapping to handle reserved and starting conditions (2021-09-07 08:26:53 -0600)
> 
> ----------------------------------------------------------------
> 
> 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.

---

Something got wrong with the signed tag, it should probably end here,
but all the cover letter is included.

FYI git-publish eases the process:
https://github.com/stefanha/git-publish

> 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 (41):
>   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: 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 gemu_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                               |  832 ++--------
>  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, 4387 insertions(+), 2264 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
> 



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PULL 00/42] bsd-user updates to run hello world
  2021-09-09 15:12   ` Warner Losh
@ 2021-09-09 15:21     ` Daniel P. Berrangé
  2021-09-09 16:31     ` Philippe Mathieu-Daudé
  1 sibling, 0 replies; 12+ messages in thread
From: Daniel P. Berrangé @ 2021-09-09 15:21 UTC (permalink / raw)
  To: Warner Losh; +Cc: Peter Maydell, QEMU Developers, Kyle Evans

On Thu, Sep 09, 2021 at 09:12:45AM -0600, Warner Losh wrote:
> On Thu, Sep 9, 2021, 9:01 AM Peter Maydell <peter.maydell@linaro.org> wrote:
> 
> > On Tue, 7 Sept 2021 at 22:56, <imp@bsdimp.com> wrote:
> > >
> > > From: Warner Losh <imp@bsdimp.com>
> > >
> > > The following changes since commit
> > f214d8e0150766c31172e16ef4b17674f549d852:
> > >
> > >   Merge remote-tracking branch
> > 'remotes/pmaydell/tags/pull-target-arm-20210826' into staging (2021-08-26
> > 18:03:57 +0100)
> > >
> > > are available in the Git repository at:
> > >
> > >   https://gitlab.com/bsdimp/qemu.git tags/bsd-user-pull-20210907-tag
> > >
> > > for you to fetch changes up to dc96376e46a52ac63a27ea185c3f0a6fd54e3c82:
> > >
> > >   bsd-user: Update mapping to handle reserved and starting conditions
> > (2021-09-07 08:26:53 -0600)
> >
> > >  slirp                                         |    2 +-
> >
> > A bogus submodule update seems to have crept in here...
> >
> 
> So I need to fix this and resubmit?
> 
> My loath of modules is coming to a middle... they update in the rebase, but
> don't reset without magic commands. :(

Historically this was quite a common problem as  'git add -u' would
stage any submodule  changes. At some point in recentish history
git stopped doing that, so these accidental inclusions don't happen
as easily.

For your specific case here:

diff --git a/slirp b/slirp
index a88d9ace23..8f43a99191 160000
--- a/slirp
+++ b/slirp
@@ -1 +1 @@
-Subproject commit a88d9ace234a24ce1c17189642ef9104799425e0
+Subproject commit 8f43a99191afb47ca3f3c6972f6306209f367ece


to fix this you just need to go into the submodule and checkout the
original hash and then add it to the commit. eg

  cd slirp
  git checkout a88d9ace234a24ce1c17189642ef9104799425e0
  cd ..
  git add slirp
  git commit --amend
  

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|



^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PULL 00/42] bsd-user updates to run hello world
  2021-09-09 15:00 ` Peter Maydell
@ 2021-09-09 15:12   ` Warner Losh
  2021-09-09 15:21     ` Daniel P. Berrangé
  2021-09-09 16:31     ` Philippe Mathieu-Daudé
  0 siblings, 2 replies; 12+ messages in thread
From: Warner Losh @ 2021-09-09 15:12 UTC (permalink / raw)
  To: Peter Maydell; +Cc: Kyle Evans, QEMU Developers

[-- Attachment #1: Type: text/plain, Size: 1000 bytes --]

On Thu, Sep 9, 2021, 9:01 AM Peter Maydell <peter.maydell@linaro.org> wrote:

> On Tue, 7 Sept 2021 at 22:56, <imp@bsdimp.com> wrote:
> >
> > From: Warner Losh <imp@bsdimp.com>
> >
> > The following changes since commit
> f214d8e0150766c31172e16ef4b17674f549d852:
> >
> >   Merge remote-tracking branch
> 'remotes/pmaydell/tags/pull-target-arm-20210826' into staging (2021-08-26
> 18:03:57 +0100)
> >
> > are available in the Git repository at:
> >
> >   https://gitlab.com/bsdimp/qemu.git tags/bsd-user-pull-20210907-tag
> >
> > for you to fetch changes up to dc96376e46a52ac63a27ea185c3f0a6fd54e3c82:
> >
> >   bsd-user: Update mapping to handle reserved and starting conditions
> (2021-09-07 08:26:53 -0600)
>
> >  slirp                                         |    2 +-
>
> A bogus submodule update seems to have crept in here...
>

So I need to fix this and resubmit?

My loath of modules is coming to a middle... they update in the rebase, but
don't reset without magic commands. :(

Warner

>

[-- Attachment #2: Type: text/html, Size: 1965 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PULL 00/42] bsd-user updates to run hello world
  2021-09-07 21:52 imp
@ 2021-09-09 15:00 ` Peter Maydell
  2021-09-09 15:12   ` Warner Losh
  2021-09-09 16:29 ` Philippe Mathieu-Daudé
  1 sibling, 1 reply; 12+ messages in thread
From: Peter Maydell @ 2021-09-09 15:00 UTC (permalink / raw)
  To: Warner Losh; +Cc: Kyle Evans, QEMU Developers

On Tue, 7 Sept 2021 at 22:56, <imp@bsdimp.com> wrote:
>
> From: Warner Losh <imp@bsdimp.com>
>
> The following changes since commit f214d8e0150766c31172e16ef4b17674f549d852:
>
>   Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20210826' into staging (2021-08-26 18:03:57 +0100)
>
> are available in the Git repository at:
>
>   https://gitlab.com/bsdimp/qemu.git tags/bsd-user-pull-20210907-tag
>
> for you to fetch changes up to dc96376e46a52ac63a27ea185c3f0a6fd54e3c82:
>
>   bsd-user: Update mapping to handle reserved and starting conditions (2021-09-07 08:26:53 -0600)

>  slirp                                         |    2 +-

A bogus submodule update seems to have crept in here...

-- PMM


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PULL 00/42] bsd-user updates to run hello world
@ 2021-09-07 21:52 imp
  2021-09-09 15:00 ` Peter Maydell
  2021-09-09 16:29 ` Philippe Mathieu-Daudé
  0 siblings, 2 replies; 12+ messages in thread
From: imp @ 2021-09-07 21:52 UTC (permalink / raw)
  To: qemu-devel; +Cc: kevans, Warner Losh

From: Warner Losh <imp@bsdimp.com>

The following changes since commit f214d8e0150766c31172e16ef4b17674f549d852:

  Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20210826' into staging (2021-08-26 18:03:57 +0100)

are available in the Git repository at:

  https://gitlab.com/bsdimp/qemu.git tags/bsd-user-pull-20210907-tag

for you to fetch changes up to dc96376e46a52ac63a27ea185c3f0a6fd54e3c82:

  bsd-user: Update mapping to handle reserved and starting conditions (2021-09-07 08:26:53 -0600)

----------------------------------------------------------------

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 (41):
  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: 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 gemu_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                               |  832 ++--------
 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, 4387 insertions(+), 2264 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



^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2021-09-11 15:39 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-10 20:30 [PULL 00/42] bsd-user updates to run hello world imp
2021-09-10 20:30 ` [PULL 07/42] bsd-user: move arch specific defines out of elfload.c imp
2021-09-10 21:51 ` [PULL 00/42] bsd-user updates to run hello world Philippe Mathieu-Daudé
2021-09-11 15:38 ` Peter Maydell
  -- strict thread matches above, loose matches on Subject: below --
2021-09-07 21:52 imp
2021-09-09 15:00 ` Peter Maydell
2021-09-09 15:12   ` Warner Losh
2021-09-09 15:21     ` Daniel P. Berrangé
2021-09-09 16:31     ` Philippe Mathieu-Daudé
2021-09-10 20:35       ` Warner Losh
2021-09-09 16:29 ` Philippe Mathieu-Daudé
2021-09-10 20:31   ` Warner Losh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).