Skip to contentSkip to conversation

bsd-user: Update Queue

PATCH In review Sean Bruno 3 participants 11 messages Jun 20, 2014 – Jul 3, 2014

lore
Share & tools
lore

Sean Bruno

author
#0 lore raw

cover bsd-user: Update Queue

This patchset brings us a couple of steps closer to the FreeBSD Development tree, Stacey Son's bsd-user branch and qemu-devel port maintained out of tree.

These patches are designed to begin to break apart the architectures in bsd-user for the upcoming new arch support patches.

Patch 1/4 of this set is a reset of Patch 5/10 from the last bsd-user update push. It addresses Peter Maydell's commentary about missing and redundant code for print_sysarch and the build breakage for netbsd and openbsd bsd-user programs.

Patch 4/4 of this set includes Patch 10/10 from the last bsd-user update push. It includes the code that uses the #define vaules as to avoid the possibility of commiting dead code.

Sean Bruno (2):
bsd-user: Implement new syscall print_sysarch and add strace support
bsd-user: Rename struct linux_binprm to struct bsd_binprm

Stacey Son (2):
bsd-user: move arch/OS dependent code out of main.c
bsd-user: move arch/OS dependent code out of syscall.c

 bsd-user/Makefile.objs                  |   2 +-
 bsd-user/bsdload.c                      | 170 ++++--
 bsd-user/elfload.c                      |  11 +-
 bsd-user/freebsd/host_os.h              |  46 ++
 bsd-user/freebsd/os-strace.h            |  29 +
 bsd-user/freebsd/os-sys.c               | 285 ++++++++++
 bsd-user/freebsd/strace.list            |   2 +-
 bsd-user/freebsd/target_os_stack.h      | 157 ++++++
 bsd-user/freebsd/target_os_vmparam.h    |  23 +
 bsd-user/i386/syscall.h                 |  23 +
 bsd-user/i386/target_arch.h             |  13 +
 bsd-user/i386/target_arch_cpu.c         |  79 +++
 bsd-user/i386/target_arch_cpu.h         | 300 +++++++++++
 bsd-user/i386/target_arch_sigtramp.h    |  11 +
 bsd-user/i386/target_arch_sysarch.h     |  78 +++
 bsd-user/i386/target_arch_vmparam.h     |  28 +
 bsd-user/i386/target_signal.h           |   6 -
 bsd-user/main.c                         | 927 +++++++-------------------------
 bsd-user/mmap.c                         |   2 +-
 bsd-user/netbsd/host_os.h               |  31 ++
 bsd-user/netbsd/os-strace.h             |  29 +
 bsd-user/netbsd/os-sys.c                |  46 ++
 bsd-user/netbsd/target_os_stack.h       |  33 ++
 bsd-user/netbsd/target_os_vmparam.h     |  23 +
 bsd-user/openbsd/host_os.h              |  31 ++
 bsd-user/openbsd/os-strace.h            |  29 +
 bsd-user/openbsd/os-sys.c               |  46 ++
 bsd-user/openbsd/target_os_stack.h      |  33 ++
 bsd-user/openbsd/target_os_vmparam.h    |  23 +
 bsd-user/qemu.h                         |  50 +-
 bsd-user/sparc/syscall.h                |  29 +-
 bsd-user/sparc/target_arch.h            |  11 +
 bsd-user/sparc/target_arch_cpu.c        | 113 ++++
 bsd-user/sparc/target_arch_cpu.h        | 158 ++++++
 bsd-user/sparc/target_arch_sigtramp.h   |  11 +
 bsd-user/sparc/target_arch_sysarch.h    |  52 ++
 bsd-user/sparc/target_arch_vmparam.h    |  37 ++
 bsd-user/sparc/target_signal.h          |   5 -
 bsd-user/sparc64/syscall.h              |  28 +-
 bsd-user/sparc64/target_arch.h          |  11 +
 bsd-user/sparc64/target_arch_cpu.c      | 118 ++++
 bsd-user/sparc64/target_arch_cpu.h      | 191 +++++++
 bsd-user/sparc64/target_arch_sigtramp.h |  11 +
 bsd-user/sparc64/target_arch_sysarch.h  |  52 ++
 bsd-user/sparc64/target_arch_vmparam.h  |  37 ++
 bsd-user/sparc64/target_signal.h        |   5 -
 bsd-user/strace.c                       |  10 +
 bsd-user/syscall.c                      | 210 +-------
 bsd-user/x86_64/syscall.h               |  26 +-
 bsd-user/x86_64/target_arch.h           |  13 +
 bsd-user/x86_64/target_arch_cpu.c       |  79 +++
 bsd-user/x86_64/target_arch_cpu.h       | 322 +++++++++++
 bsd-user/x86_64/target_arch_sigtramp.h  |  11 +
 bsd-user/x86_64/target_arch_sysarch.h   |  76 +++
 bsd-user/x86_64/target_arch_vmparam.h   |  28 +
 bsd-user/x86_64/target_signal.h         |   5 -
 56 files changed, 3207 insertions(+), 1008 deletions(-)
 create mode 100644 bsd-user/freebsd/host_os.h
 create mode 100644 bsd-user/freebsd/os-strace.h
 create mode 100644 bsd-user/freebsd/os-sys.c
 create mode 100644 bsd-user/freebsd/target_os_stack.h
 create mode 100644 bsd-user/freebsd/target_os_vmparam.h
 create mode 100644 bsd-user/i386/target_arch.h
 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_sigtramp.h
 create mode 100644 bsd-user/i386/target_arch_sysarch.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/os-strace.h
 create mode 100644 bsd-user/netbsd/os-sys.c
 create mode 100644 bsd-user/netbsd/target_os_stack.h
 create mode 100644 bsd-user/netbsd/target_os_vmparam.h
 create mode 100644 bsd-user/openbsd/host_os.h
 create mode 100644 bsd-user/openbsd/os-strace.h
 create mode 100644 bsd-user/openbsd/os-sys.c
 create mode 100644 bsd-user/openbsd/target_os_stack.h
 create mode 100644 bsd-user/openbsd/target_os_vmparam.h
 create mode 100644 bsd-user/sparc/target_arch.h
 create mode 100644 bsd-user/sparc/target_arch_cpu.c
 create mode 100644 bsd-user/sparc/target_arch_cpu.h
 create mode 100644 bsd-user/sparc/target_arch_sigtramp.h
 create mode 100644 bsd-user/sparc/target_arch_sysarch.h
 create mode 100644 bsd-user/sparc/target_arch_vmparam.h
 create mode 100644 bsd-user/sparc64/target_arch.h
 create mode 100644 bsd-user/sparc64/target_arch_cpu.c
 create mode 100644 bsd-user/sparc64/target_arch_cpu.h
 create mode 100644 bsd-user/sparc64/target_arch_sigtramp.h
 create mode 100644 bsd-user/sparc64/target_arch_sysarch.h
 create mode 100644 bsd-user/sparc64/target_arch_vmparam.h
 create mode 100644 bsd-user/x86_64/target_arch.h
 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_sigtramp.h
 create mode 100644 bsd-user/x86_64/target_arch_sysarch.h
 create mode 100644 bsd-user/x86_64/target_arch_vmparam.h
Signature · 1 line
2.0.0
author
#1 lore raw

PATCH 1/4 bsd-user: Implement new syscall print_sysarch and add strace support

---
 bsd-user/freebsd/os-strace.h           | 35 +++++++++++++++
 bsd-user/freebsd/strace.list           |  2 +-
 bsd-user/i386/syscall.h                | 21 +++++++++
 bsd-user/i386/target_arch_sysarch.h    | 78 ++++++++++++++++++++++++++++++++++
 bsd-user/netbsd/os-strace.h            | 37 ++++++++++++++++
 bsd-user/openbsd/os-strace.h           | 37 ++++++++++++++++
 bsd-user/qemu.h                        |  3 ++
 bsd-user/sparc/syscall.h               | 27 +++++++++++-
 bsd-user/sparc/target_arch_sysarch.h   | 52 +++++++++++++++++++++++
 bsd-user/sparc64/syscall.h             | 26 +++++++++++-
 bsd-user/sparc64/target_arch_sysarch.h | 52 +++++++++++++++++++++++
 bsd-user/strace.c                      | 10 +++++
 bsd-user/syscall.c                     | 63 +--------------------------
 bsd-user/x86_64/syscall.h              | 24 ++++++++++-
 bsd-user/x86_64/target_arch_sysarch.h  | 76 +++++++++++++++++++++++++++++++++
 15 files changed, 477 insertions(+), 66 deletions(-)
 create mode 100644 bsd-user/freebsd/os-strace.h
 create mode 100644 bsd-user/i386/target_arch_sysarch.h
 create mode 100644 bsd-user/netbsd/os-strace.h
 create mode 100644 bsd-user/openbsd/os-strace.h
 create mode 100644 bsd-user/sparc/target_arch_sysarch.h
 create mode 100644 bsd-user/sparc64/target_arch_sysarch.h
 create mode 100644 bsd-user/x86_64/target_arch_sysarch.h
bsd-user/freebsd/os-strace.h new file +35 -0
new file mode 100644
index 0000000..c856450
@@ -0,0 +1,35 @@
+/*
+ *  FreeBSD dependent strace print functions
+ *
+ *  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/>.
+ */
+
+#include "target_arch_sysarch.h"    /* architecture dependent functions */
+
+
+static inline void do_os_print_sysarch(const struct syscallname *name,
+        abi_long arg1, abi_long arg2, abi_long arg3, abi_long arg4,
+        abi_long arg5, abi_long arg6)
+{
+    /* This is arch dependent */
+    do_freebsd_arch_print_sysarch(name, arg1, arg2, arg3, arg4, arg5, arg6);
+}
+
+/* sysarch() is architecture dependent. */
+abi_long do_bsd_sysarch(void *cpu_env, abi_long arg1, abi_long arg2)
+{
+    return do_freebsd_arch_sysarch(cpu_env, arg1, arg2);
+}
bsd-user/freebsd/strace.list +1 -1
index 2800a2d..55f5ff8 100644
@@ -209,7 +209,7 @@
 { TARGET_FREEBSD_NR_statfs, "statfs", "%s(\"%s\",%p)", NULL, NULL },
 { TARGET_FREEBSD_NR_symlink, "symlink", "%s(\"%s\",\"%s\")", NULL, NULL },
 { TARGET_FREEBSD_NR_sync, "sync", NULL, NULL, NULL },
-{ TARGET_FREEBSD_NR_sysarch, "sysarch", NULL, NULL, NULL },
+{ TARGET_FREEBSD_NR_sysarch, "sysarch", NULL, print_sysarch, NULL },
 { TARGET_FREEBSD_NR_syscall, "syscall", NULL, NULL, NULL },
 { TARGET_FREEBSD_NR_thr_create, "thr_create", "%s(%#x, %#x, %d)", NULL, NULL },
 { TARGET_FREEBSD_NR_thr_exit, "thr_exit", "%s(%#x)", NULL, NULL },
bsd-user/i386/syscall.h +21 -0
index 9b34c61..8028fc8 100644
@@ -1,3 +1,23 @@
+/*
+ *  i386 system call definitions
+ *
+ *
+ *  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 _I386_SYSCALL_H_
+#define _I386_SYSCALL_H_
+
 /* default linux values for the selectors */
 #define __USER_CS	(0x23)
 #define __USER_DS	(0x2B)
@@ -159,3 +179,4 @@ struct target_vm86plus_struct {
 
 #define UNAME_MACHINE "i386"
 
+#endif /* ! _I386_SYSCALL_H_ */
bsd-user/i386/target_arch_sysarch.h new file +78 -0

78 lines not on this page · raw message

bsd-user/netbsd/os-strace.h new file +37 -0
new file mode 100644
index 0000000..20dfd4b
@@ -0,0 +1,37 @@
+/*
+ *  NetBSD dependent strace print functions
+ *
+ *  Copyright (c) 2014 Sean Bruno <[email protected]>
+ *
+ *  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/>.
+ */
+
+#include "target_arch_sysarch.h"    /* architecture dependent functions */
+
+
+static inline void do_os_print_sysarch(const struct syscallname *name,
+        abi_long arg1, abi_long arg2, abi_long arg3, abi_long arg4,
+        abi_long arg5, abi_long arg6)
+{
+    qemu_log("qemu: Unsupported syscall %s\n", __func__);
+    return -TARGET_ENOSYS;
+}
+
+/* sysarch() is architecture dependent. */
+abi_long do_bsd_sysarch(void *cpu_env, abi_long arg1, abi_long arg2)
+{
+    qemu_log("qemu: Unsupported syscall sysarch()\n");
+    return -TARGET_ENOSYS;
+}
+
bsd-user/openbsd/os-strace.h new file +37 -0
new file mode 100644
index 0000000..277b96c
@@ -0,0 +1,37 @@
+/*
+ *  OpenBSD dependent strace print functions
+ *
+ *  Copyright (c) 2014 Sean Bruno <[email protected]>
+ *
+ *  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/>.
+ */
+
+#include "target_arch_sysarch.h"    /* architecture dependent functions */
+
+
+static inline void do_os_print_sysarch(const struct syscallname *name,
+        abi_long arg1, abi_long arg2, abi_long arg3, abi_long arg4,
+        abi_long arg5, abi_long arg6)
+{
+    qemu_log("qemu: Unsupported syscall %s\n", __func__);
+    return -TARGET_ENOSYS;
+}
+
+/* sysarch() is architecture dependent. */
+abi_long do_bsd_sysarch(void *cpu_env, abi_long arg1, abi_long arg2)
+{
+
+    qemu_log("qemu: Unsupported syscall sysarch()\n");
+    return -TARGET_ENOSYS;
+}
bsd-user/qemu.h +3 -0
index 5362297..658999b 100644
@@ -225,6 +225,9 @@ void mmap_fork_end(int child);
 /* main.c */
 extern unsigned long x86_stack_size;
 
+/* os-strace.h */
+abi_long do_bsd_sysarch(void *cpu_env, abi_long arg1, abi_long arg2);
+
 /* user access */
 
 #define VERIFY_READ 0
bsd-user/sparc/syscall.h +26 -1
index 5a9bb7e..7ed2152 100644
@@ -1,3 +1,23 @@
+/*
+ *  sparc dependent system call definitions
+ *
+ *
+ *  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 _SPARC_SYSCALL_H_
+#define _SPARC_SYSCALL_H_
+
 struct target_pt_regs {
 	abi_ulong psr;
 	abi_ulong pc;
@@ -6,4 +26,9 @@ struct target_pt_regs {
 	abi_ulong u_regs[16];
 };
 
-#define UNAME_MACHINE "sun4"
+#define UNAME_MACHINE           "sun4"
+
+#define TARGET_SPARC_UTRAP_INSTALL      1
+#define TARGET_SPARC_SIGTRAMP_INSTALL   2
+
+#endif /* ! _SPARC_SYSCALL_H_ */
bsd-user/sparc/target_arch_sysarch.h new file +52 -0

52 lines not on this page · raw message

bsd-user/sparc64/syscall.h +25 -1
index 81a816d..8571092 100644
@@ -1,3 +1,22 @@
+/*
+ *  sparc64 dependent system call definitions
+ *
+ *
+ *  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 _SPARC64_SYSCALL_H_
+#define _SPARC64_SYSCALL_H_
 struct target_pt_regs {
 	abi_ulong u_regs[16];
 	abi_ulong tstate;
@@ -7,4 +26,9 @@ struct target_pt_regs {
 	abi_ulong fprs;
 };
 
-#define UNAME_MACHINE "sun4u"
+#define UNAME_MACHINE           "sun4u"
+
+#define TARGET_SPARC_UTRAP_INSTALL      1
+#define TARGET_SPARC_SIGTRAMP_INSTALL   2
+
+#endif /* !_SPARC64_SYSCALL_H_ */
bsd-user/sparc64/target_arch_sysarch.h new file +52 -0

52 lines not on this page · raw message

bsd-user/strace.c +10 -0
index e33dd4d..60aabc3 100644
@@ -27,6 +27,8 @@
 
 #include "qemu.h"
 
+#include "os-strace.h"  /* OS dependent strace print functions */
+
 int do_strace;
 
 /*
@@ -108,6 +110,14 @@ static void print_ioctl(const struct syscallname *name,
             arg3);
 }
 
+static void print_sysarch(const struct syscallname *name, abi_long arg1,
+        abi_long arg2, abi_long arg3, abi_long arg4, abi_long arg5,
+        abi_long arg6)
+{
+    /* This is os dependent. */
+    do_os_print_sysarch(name, arg1, arg2, arg3, arg4, arg5, arg6);
+}
+
 /*
  * Variants for the return value output function
  */
bsd-user/syscall.c +1 -62

75 lines not on this page · raw message

bsd-user/x86_64/syscall.h +23 -1
index 630514a..4e77235 100644
@@ -1,3 +1,23 @@
+/*
+ *  x86_64 system call definitions
+ *
+ *
+ *  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 _X86_64_SYSCALL_H_
+#define _X86_64_SYSCALL_H_
+
 #define __USER_CS	(0x33)
 #define __USER_DS	(0x2B)
 
@@ -108,9 +128,11 @@ struct target_msqid64_ds {
 #define TARGET_FREEBSD_AMD64_SET_GSBASE	131
 
 
-#define UNAME_MACHINE "x86_64"
+#define UNAME_MACHINE           "x86_64"
 
 #define TARGET_ARCH_SET_GS 0x1001
 #define TARGET_ARCH_SET_FS 0x1002
 #define TARGET_ARCH_GET_FS 0x1003
 #define TARGET_ARCH_GET_GS 0x1004
+
+#endif /* ! _X86_64_SYSCALL_H_ */
bsd-user/x86_64/target_arch_sysarch.h new file +76 -0

76 lines not on this page · raw message

Signature · 1 line
2.0.0
#2 lore raw

Re: [Qemu-devel] [PATCH 1/4] bsd-user: Implement new syscall print_sysarch and add strace support

Quoted 18 lines · Sean Bruno
---
 bsd-user/freebsd/os-strace.h           | 35 +++++++++++++++
 bsd-user/freebsd/strace.list           |  2 +-
 bsd-user/i386/syscall.h                | 21 +++++++++
 bsd-user/i386/target_arch_sysarch.h    | 78 ++++++++++++++++++++++++++++++++++
 bsd-user/netbsd/os-strace.h            | 37 ++++++++++++++++
 bsd-user/openbsd/os-strace.h           | 37 ++++++++++++++++
 bsd-user/qemu.h                        |  3 ++
 bsd-user/sparc/syscall.h               | 27 +++++++++++-
 bsd-user/sparc/target_arch_sysarch.h   | 52 +++++++++++++++++++++++
 bsd-user/sparc64/syscall.h             | 26 +++++++++++-
 bsd-user/sparc64/target_arch_sysarch.h | 52 +++++++++++++++++++++++
 bsd-user/strace.c                      | 10 +++++
 bsd-user/syscall.c                     | 63 +--------------------------
 bsd-user/x86_64/syscall.h              | 24 ++++++++++-
 bsd-user/x86_64/target_arch_sysarch.h  | 76 +++++++++++++++++++++++++++++++++
Quoted 8 lines
 15 files changed, 477 insertions(+), 66 deletions(-)
 create mode 100644 bsd-user/freebsd/os-strace.h
 create mode 100644 bsd-user/i386/target_arch_sysarch.h
 create mode 100644 bsd-user/netbsd/os-strace.h
 create mode 100644 bsd-user/openbsd/os-strace.h
 create mode 100644 bsd-user/sparc/target_arch_sysarch.h
 create mode 100644 bsd-user/sparc64/target_arch_sysarch.h
 create mode 100644 bsd-user/x86_64/target_arch_sysarch.h

I think this would be clearer if you split it in two:
* code motion to split the syscall into per-OS/per-arch subdirectories
* add support for strace for it

At the moment this is a big patch doing two distinct things, which is usually a sign it should be split up.

Your commit message is also very brief and inaccurate (the syscall is not called "print_sysarch" and we already implemented it, this is just refactoring). Single-line commit messages should be the exception, not the rule, and generally only for very simple small patches.

Codewise there are just a few minor things:

Quoted 20 lines

+++ b/bsd-user/netbsd/os-strace.h

bsd-user/netbsd/os-strace.h new file +18 -0
@@ -0,0 +1,37 @@
+/*
+ *  NetBSD dependent strace print functions
+ *
+ *  Copyright (c) 2014 Sean Bruno <[email protected]>
+ *
+ *  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/>.
+ */

bsd-user/netbsd/os-strace.h line 28

Quoted 10 lines
bsd-user/netbsd/os-strace.h new file +10 -0
+
+#include "target_arch_sysarch.h"    /* architecture dependent functions */
+
+
+static inline void do_os_print_sysarch(const struct syscallname *name,
+        abi_long arg1, abi_long arg2, abi_long arg3, abi_long arg4,
+        abi_long arg5, abi_long arg6)
+{
+    qemu_log("qemu: Unsupported syscall %s\n", __func__);
+    return -TARGET_ENOSYS;

Void function attempting to return a value... (the compiler ought to warn about this I hope).

bsd-user/netbsd/os-strace.h line 29

Quoted 7 lines
bsd-user/netbsd/os-strace.h new file +7 -0
+static inline void do_os_print_sysarch(const struct syscallname *name,
+        abi_long arg1, abi_long arg2, abi_long arg3, abi_long arg4,
+        abi_long arg5, abi_long arg6)
+{
+    qemu_log("qemu: Unsupported syscall %s\n", __func__);
+    return -TARGET_ENOSYS;
+}

Ditto.

bsd-user/sparc/target_arch_sysarch.h line 34

Quoted 10 lines
bsd-user/sparc/target_arch_sysarch.h new file +10 -0
+static inline abi_long do_freebsd_arch_sysarch(void *env, int op,
+        abi_ulong parms)
+{
+    int ret = 0;
+
+    switch (op) {
+    case TARGET_SPARC_SIGTRAMP_INSTALL:
+        /* XXX not currently handled */
+    case TARGET_SPARC_UTRAP_INSTALL:
+        /* XXX not currently handled */

If you want to fall through to a following case you should have a marker comment like this:

    /* fallthrough */

for the benefit of automatic static analysis tools.

Quoted 4 lines
bsd-user/sparc/target_arch_sysarch.h new file +4 -0
+static inline abi_long do_freebsd_arch_sysarch(void *env, int op,
+        abi_ulong parms)
+{
+    int ret = 0;

bsd-user/sparc/target_arch_sysarch.h line 38

Quoted 10 lines
bsd-user/sparc/target_arch_sysarch.h new file +10 -0
+
+    switch (op) {
+    case TARGET_SPARC_SIGTRAMP_INSTALL:
+        /* XXX not currently handled */
+    case TARGET_SPARC_UTRAP_INSTALL:
+        /* XXX not currently handled */
+    default:
+        ret = -TARGET_EINVAL;
+        break;
+    }

Ditto.

thanks
-- PMM

author
#3 lore raw

PATCH 2/4 bsd-user: move arch/OS dependent code out of main.c

In reply to Sean Bruno

From: Stacey Son <[email protected]>

This change moves the cpu initialization and main loop code from main.c to the OS and arch dependent directories. This eliminates many of the #ifdef's in main.c. The cpu initialization and loop code is now located in the arch directory along with target arch support code.

---
 bsd-user/Makefile.objs                 |   2 +-
 bsd-user/elfload.c                     |   2 +-
 bsd-user/freebsd/host_os.h             |  46 ++
 bsd-user/freebsd/target_os_vmparam.h   |  23 +
 bsd-user/i386/target_arch.h            |  13 +
 bsd-user/i386/target_arch_cpu.c        |  79 +++
 bsd-user/i386/target_arch_cpu.h        | 300 +++++++++++
 bsd-user/i386/target_arch_vmparam.h    |  28 +
 bsd-user/i386/target_signal.h          |   6 -
 bsd-user/main.c                        | 927 +++++++--------------------------
 bsd-user/mmap.c                        |   2 +-
 bsd-user/netbsd/host_os.h              |  31 ++
 bsd-user/netbsd/os-strace.h            |   2 +-
 bsd-user/netbsd/target_os_vmparam.h    |  23 +
 bsd-user/openbsd/host_os.h             |  31 ++
 bsd-user/openbsd/os-strace.h           |   2 +-
 bsd-user/openbsd/target_os_vmparam.h   |  23 +
 bsd-user/qemu.h                        |  21 +-
 bsd-user/sparc/target_arch.h           |  11 +
 bsd-user/sparc/target_arch_cpu.c       | 113 ++++
 bsd-user/sparc/target_arch_cpu.h       | 158 ++++++
 bsd-user/sparc/target_arch_vmparam.h   |  37 ++
 bsd-user/sparc/target_signal.h         |   5 -
 bsd-user/sparc64/target_arch.h         |  11 +
 bsd-user/sparc64/target_arch_cpu.c     | 118 +++++
 bsd-user/sparc64/target_arch_cpu.h     | 191 +++++++
 bsd-user/sparc64/target_arch_vmparam.h |  37 ++
 bsd-user/sparc64/target_signal.h       |   5 -
 bsd-user/x86_64/target_arch.h          |  13 +
 bsd-user/x86_64/target_arch_cpu.c      |  79 +++
 bsd-user/x86_64/target_arch_cpu.h      | 322 ++++++++++++
 bsd-user/x86_64/target_arch_vmparam.h  |  28 +
 bsd-user/x86_64/target_signal.h        |   5 -
 33 files changed, 1930 insertions(+), 764 deletions(-)
 create mode 100644 bsd-user/freebsd/host_os.h
 create mode 100644 bsd-user/freebsd/target_os_vmparam.h
 create mode 100644 bsd-user/i386/target_arch.h
 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_vmparam.h
 create mode 100644 bsd-user/netbsd/host_os.h
 create mode 100644 bsd-user/netbsd/target_os_vmparam.h
 create mode 100644 bsd-user/openbsd/host_os.h
 create mode 100644 bsd-user/openbsd/target_os_vmparam.h
 create mode 100644 bsd-user/sparc/target_arch.h
 create mode 100644 bsd-user/sparc/target_arch_cpu.c
 create mode 100644 bsd-user/sparc/target_arch_cpu.h
 create mode 100644 bsd-user/sparc/target_arch_vmparam.h
 create mode 100644 bsd-user/sparc64/target_arch.h
 create mode 100644 bsd-user/sparc64/target_arch_cpu.c
 create mode 100644 bsd-user/sparc64/target_arch_cpu.h
 create mode 100644 bsd-user/sparc64/target_arch_vmparam.h
 create mode 100644 bsd-user/x86_64/target_arch.h
 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_vmparam.h
bsd-user/Makefile.objs +1 -1
index 5e77f57..41e8dce 100644
@@ -1,2 +1,2 @@
 obj-y = main.o bsdload.o elfload.o mmap.o signal.o strace.o syscall.o \
-	        uaccess.o
+	        uaccess.o $(TARGET_ABI_DIR)/target_arch_cpu.o
bsd-user/elfload.c +1 -1
index 93fd9e4..ccf72d1 100644
@@ -674,7 +674,7 @@ static abi_ulong setup_arg_pages(abi_ulong p, struct linux_binprm *bprm,
     /* Create enough stack to hold everything.  If we don't use
      * it for args, we'll use it for something else...
      */
-    size = x86_stack_size;
+    size = target_dflssiz;
     if (size < MAX_ARG_PAGES*TARGET_PAGE_SIZE)
         size = MAX_ARG_PAGES*TARGET_PAGE_SIZE;
     error = target_mmap(0,
bsd-user/freebsd/host_os.h new file +46 -0

46 lines not on this page · raw message

bsd-user/freebsd/target_os_vmparam.h new file +23 -0
new file mode 100644
index 0000000..80ac6c8
@@ -0,0 +1,23 @@
+#ifndef _TARGET_OS_VMPARAM_H_
+#define _TARGET_OS_VMPARAM_H_
+
+#include "target_arch_vmparam.h"
+
+#define TARGET_SPACE_USRSPACE   4096
+#define TARGET_ARG_MAX          262144
+
+/* Compare to sys/exec.h */
+struct target_ps_strings {
+    abi_ulong ps_argvstr;
+    uint32_t ps_nargvstr;
+    abi_ulong ps_envstr;
+    uint32_t ps_nenvstr;
+};
+
+extern abi_ulong target_stkbas;
+extern abi_ulong target_stksiz;
+
+#define TARGET_PS_STRINGS  ((target_stkbas + target_stksiz) - \
+		sizeof(struct target_ps_strings))
+
+#endif /* !TARGET_OS_VMPARAM_H_ */
bsd-user/i386/target_arch.h new file +13 -0
new file mode 100644
index 0000000..4cb398c
@@ -0,0 +1,13 @@
+
+#ifndef _TARGET_ARCH_H_
+#define _TARGET_ARCH_H_
+
+/* target_arch_cpu.c */
+void bsd_i386_write_dt(void *ptr, unsigned long addr, unsigned long limit,
+                int flags);
+void bsd_i386_set_idt(int n, unsigned int dpl);
+void bsd_i386_set_idt_base(uint64_t base);
+
+#define target_cpu_set_tls(env, newtls)
+
+#endif /* ! _TARGET_ARCH_H_ */
bsd-user/i386/target_arch_cpu.c new file +79 -0

79 lines not on this page · raw message

bsd-user/i386/target_arch_cpu.h new file +300 -0

300 lines not on this page · raw message

bsd-user/i386/target_arch_vmparam.h new file +28 -0
new file mode 100644
index 0000000..f15af91
@@ -0,0 +1,28 @@
+#ifndef _TARGET_ARCH_VMPARAM_H_
+#define _TARGET_ARCH_VMPARAM_H_
+
+#include "cpu.h"
+
+/* compare to i386/include/vmparam.h */
+#define TARGET_MAXTSIZ  (128UL*1024*1024)   /* max text size */
+#define TARGET_DFLDSIZ  (128UL*1024*1024)   /* initial data size limit */
+#define TARGET_MAXDSIZ  (512UL*1024*1024)   /* max data size */
+#define TARGET_DFLSSIZ  (8UL*1024*1024)     /* initial stack size limit */
+#define TARGET_MAXSSIZ  (64UL*1024*1024)    /* max stack size */
+#define TARGET_SGROWSIZ (128UL*1024)        /* amount to grow stack */
+
+#define TARGET_RESERVED_VA 0xf7000000
+
+#define TARGET_USRSTACK (0xbfc00000)
+
+static inline abi_ulong get_sp_from_cpustate(CPUX86State *state)
+{
+    return state->regs[R_ESP];
+}
+
+static inline void set_second_rval(CPUX86State *state, abi_ulong retval2)
+{
+    state->regs[R_EDX] = retval2;
+}
+
+#endif /* !_TARGET_ARCH_VMPARAM_H_ */
bsd-user/i386/target_signal.h +0 -6
index 2ef36d1..5491687 100644
@@ -11,10 +11,4 @@ typedef struct target_sigaltstack {
 	abi_ulong ss_size;
 } target_stack_t;
 
-
-static inline abi_ulong get_sp_from_cpustate(CPUX86State *state)
-{
-    return state->regs[R_ESP];
-}
-
 #endif /* TARGET_SIGNAL_H */
bsd-user/main.c +193 -734

1,089 lines not on this page · raw message

bsd-user/mmap.c +1 -1
index 092bf7f..121443a 100644
@@ -30,7 +30,7 @@
 
 //#define DEBUG_MMAP
 
-#if defined(CONFIG_USE_NPTL)
+#ifdef __FreeBSD__
 pthread_mutex_t mmap_mutex;
 static int __thread mmap_lock_count;
 
bsd-user/netbsd/host_os.h new file +31 -0
new file mode 100644
index 0000000..5c492e3
@@ -0,0 +1,31 @@
+/*
+ *  NetBSD host dependent code and definitions
+ *
+ *
+ *  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 __HOST_OS_H_
+#define __HOST_OS_H_
+
+#include "qemu.h"
+
+#define HOST_DEFAULT_BSD_TYPE target_netbsd
+
+static inline void save_proc_pathname(char *argv0)
+{
+    /* XXX */
+}
+
+#endif /*!__HOST_OS_H_ */
bsd-user/netbsd/os-strace.h +1 -1
index 20dfd4b..ead15db 100644
@@ -25,7 +25,7 @@ static inline void do_os_print_sysarch(const struct syscallname *name,
         abi_long arg5, abi_long arg6)
 {
     qemu_log("qemu: Unsupported syscall %s\n", __func__);
-    return -TARGET_ENOSYS;
+    return;
 }
 
 /* sysarch() is architecture dependent. */
bsd-user/netbsd/target_os_vmparam.h new file +23 -0
new file mode 100644
index 0000000..80ac6c8
@@ -0,0 +1,23 @@
+#ifndef _TARGET_OS_VMPARAM_H_
+#define _TARGET_OS_VMPARAM_H_
+
+#include "target_arch_vmparam.h"
+
+#define TARGET_SPACE_USRSPACE   4096
+#define TARGET_ARG_MAX          262144
+
+/* Compare to sys/exec.h */
+struct target_ps_strings {
+    abi_ulong ps_argvstr;
+    uint32_t ps_nargvstr;
+    abi_ulong ps_envstr;
+    uint32_t ps_nenvstr;
+};
+
+extern abi_ulong target_stkbas;
+extern abi_ulong target_stksiz;
+
+#define TARGET_PS_STRINGS  ((target_stkbas + target_stksiz) - \
+		sizeof(struct target_ps_strings))
+
+#endif /* !TARGET_OS_VMPARAM_H_ */
bsd-user/openbsd/host_os.h new file +31 -0
new file mode 100644
index 0000000..162ce58
@@ -0,0 +1,31 @@
+/*
+ *  OpenBSD host dependent code and definitions
+ *
+ *
+ *  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 __HOST_OS_H_
+#define __HOST_OS_H_
+
+#include "qemu.h"
+
+#define HOST_DEFAULT_BSD_TYPE target_openbsd
+
+static inline void save_proc_pathname(char *argv0)
+{
+    /* XXX */
+}
+
+#endif /*!__HOST_OS_H_ */
bsd-user/openbsd/os-strace.h +1 -1
index 277b96c..88907b4 100644
@@ -25,7 +25,7 @@ static inline void do_os_print_sysarch(const struct syscallname *name,
         abi_long arg5, abi_long arg6)
 {
     qemu_log("qemu: Unsupported syscall %s\n", __func__);
-    return -TARGET_ENOSYS;
+    return;
 }
 
 /* sysarch() is architecture dependent. */
bsd-user/openbsd/target_os_vmparam.h new file +23 -0
new file mode 100644
index 0000000..80ac6c8
@@ -0,0 +1,23 @@
+#ifndef _TARGET_OS_VMPARAM_H_
+#define _TARGET_OS_VMPARAM_H_
+
+#include "target_arch_vmparam.h"
+
+#define TARGET_SPACE_USRSPACE   4096
+#define TARGET_ARG_MAX          262144
+
+/* Compare to sys/exec.h */
+struct target_ps_strings {
+    abi_ulong ps_argvstr;
+    uint32_t ps_nargvstr;
+    abi_ulong ps_envstr;
+    uint32_t ps_nenvstr;
+};
+
+extern abi_ulong target_stkbas;
+extern abi_ulong target_stksiz;
+
+#define TARGET_PS_STRINGS  ((target_stkbas + target_stksiz) - \
+		sizeof(struct target_ps_strings))
+
+#endif /* !TARGET_OS_VMPARAM_H_ */
bsd-user/qemu.h +17 -4
index 658999b..7521ebe 100644
@@ -39,10 +39,11 @@ extern enum BSDType bsd_type;
 
 #include "syscall_defs.h"
 #include "syscall.h"
+#include "target_os_vmparam.h"
 #include "target_signal.h"
 #include "exec/gdbstub.h"
 
-#if defined(CONFIG_USE_NPTL)
+#ifdef __FreeBSD__
 #define THREAD __thread
 #else
 #define THREAD
@@ -90,6 +91,7 @@ typedef struct TaskState {
     struct TaskState *next;
     int used; /* non zero if used */
     struct image_info *info;
+    struct linux_binprm *bprm;
 
     struct emulated_sigtable sigtab[TARGET_NSIG];
     struct sigqueue sigqueue_table[MAX_SIGQUEUE_SIZE]; /* siginfo queue */
@@ -100,6 +102,7 @@ typedef struct TaskState {
 } __attribute__((aligned(16))) TaskState;
 
 void init_task_state(TaskState *ts);
+void stop_all_tasks(void);
 extern const char *qemu_uname_release;
 #if defined(CONFIG_USE_GUEST_BASE)
 extern unsigned long mmap_min_addr;
@@ -217,13 +220,23 @@ void mmap_lock(void);
 void mmap_unlock(void);
 void cpu_list_lock(void);
 void cpu_list_unlock(void);
-#if defined(CONFIG_USE_NPTL)
+#ifdef __FreeBSD__
 void mmap_fork_start(void);
 void mmap_fork_end(int child);
 #endif
 
 /* main.c */
-extern unsigned long x86_stack_size;
+extern unsigned long target_maxtsiz;
+extern unsigned long target_dfldsiz;
+extern unsigned long target_maxdsiz;
+extern unsigned long target_dflssiz;
+extern unsigned long target_maxssiz;
+extern unsigned long target_sgrowsiz;
+extern char qemu_proc_pathname[];
+void start_exclusive(void);
+void end_exclusive(void);
+void cpu_exec_start(CPUState *cpu);
+void cpu_exec_end(CPUState *cpu);
 
 /* os-strace.h */
 abi_long do_bsd_sysarch(void *cpu_env, abi_long arg1, abi_long arg2);
@@ -417,7 +430,7 @@ static inline void *lock_user_string(abi_ulong guest_addr)
 #define unlock_user_struct(host_ptr, guest_addr, copy)          \
     unlock_user(host_ptr, guest_addr, (copy) ? sizeof(*host_ptr) : 0)
 
-#if defined(CONFIG_USE_NPTL)
+#ifdef __FreeBSD__
 #include <pthread.h>
 #endif
 
bsd-user/sparc/target_arch.h new file +11 -0
new file mode 100644
index 0000000..5ee479b
@@ -0,0 +1,11 @@
+
+#ifndef _TARGET_ARCH_H_
+#define _TARGET_ARCH_H_
+
+void bsd_sparc_save_window(CPUSPARCState *env);
+void bsd_sparc_restore_window(CPUSPARCState *env);
+void bsd_sparc_flush_windows(CPUSPARCState *env);
+
+#define target_cpu_set_tls(env, newtls)
+
+#endif /* ! _TARGET_ARCH_H_ */
bsd-user/sparc/target_arch_cpu.c new file +113 -0

113 lines not on this page · raw message

bsd-user/sparc/target_arch_cpu.h new file +158 -0

158 lines not on this page · raw message

bsd-user/sparc/target_arch_vmparam.h new file +37 -0
new file mode 100644
index 0000000..5f28fcf
@@ -0,0 +1,37 @@
+#ifndef _TARGET_ARCH_VMPARAM_H_
+#define _TARGET_ARCH_VMPARAM_H_
+
+#include "cpu.h"
+
+#define TARGET_MAXTSIZ  (1*1024*1024*1024)  /* max text size */
+#define TARGET_DFLDSIZ  (128*1024*1024)     /* initial data size limit */
+#define TARGET_MAXDSIZ  (1*1024*1024*1024)  /* max data size */
+#define TARGET_DFLSSIZ  (128*1024*1024)     /* initial stack size limit */
+#define TARGET_MAXSSIZ  (1*1024*1024*1024)  /* max stack size */
+#define TARGET_SGROWSIZ (128*1024)      /* amount to grow stack */
+
+#define TARGET_RESERVED_VA 0xf7000000
+
+/* XXX this may not be right */
+#define TARGET_VM_MAXUSER_ADDRESS   (0xc0000000 - (512 * 1024 * 1024))
+#define TARGET_USRSTACK (TARGET_VM_MAXUSER_ADDRESS - TARGET_PAGE_SIZE)
+
+#ifndef UREG_I6
+#define UREG_I6        6
+#endif
+#ifndef UREG_FP
+#define UREG_FP        UREG_I6
+#endif
+
+static inline abi_ulong get_sp_from_cpustate(CPUSPARCState *state)
+{
+    return state->regwptr[UREG_FP];
+}
+
+static inline void set_second_rval(CPUSPARCState *state, abi_ulong retval2)
+{
+    state->regwptr[1] = retval2;
+}
+
+#endif /* !_TARGET_ARCH_VMPARAM_H_ */
+
bsd-user/sparc/target_signal.h +0 -5
index 5b2abba..181867a 100644
@@ -19,9 +19,4 @@ typedef struct target_sigaltstack {
 #define UREG_FP        UREG_I6
 #endif
 
-static inline abi_ulong get_sp_from_cpustate(CPUSPARCState *state)
-{
-    return state->regwptr[UREG_FP];
-}
-
 #endif /* TARGET_SIGNAL_H */
bsd-user/sparc64/target_arch.h new file +11 -0
new file mode 100644
index 0000000..46bbcf8
@@ -0,0 +1,11 @@
+
+#ifndef _TARGET_ARCH_H_
+#define _TARGET_ARCH_H_
+
+void bsd_sparc64_save_window(CPUSPARCState *env);
+void bsd_sparc64_restore_window(CPUSPARCState *env);
+void bsd_sparc64_flush_windows(CPUSPARCState *env);
+
+#define target_cpu_set_tls(env, newtls)
+
+#endif /* ! _TARGET_ARCH_H_ */
bsd-user/sparc64/target_arch_cpu.c new file +118 -0

118 lines not on this page · raw message

bsd-user/sparc64/target_arch_cpu.h new file +191 -0

191 lines not on this page · raw message

bsd-user/sparc64/target_arch_vmparam.h new file +37 -0
new file mode 100644
index 0000000..2c2323b
@@ -0,0 +1,37 @@
+#ifndef _TARGET_ARCH_VMPARAM_H_
+#define _TARGET_ARCH_VMPARAM_H_
+
+#include "cpu.h"
+
+/* compare to amd64/include/vmparam.h */
+#define TARGET_MAXTSIZ  (1*1024*1024*1024)  /* max text size */
+#define TARGET_DFLDSIZ  (128*1024*1024)     /* initial data size limit */
+#define TARGET_MAXDSIZ  (1*1024*1024*1024)  /* max data size */
+#define TARGET_DFLSSIZ  (128*1024*1024)     /* initial stack size limit */
+#define TARGET_MAXSSIZ  (1*1024*1024*1024)  /* max stack size */
+#define TARGET_SGROWSIZ (128*1024)      /* amount to grow stack */
+
+/* XXX */
+#define TARGET_VM_MINUSER_ADDRESS   (0x0000000000000000UL)
+#define TARGET_VM_MAXUSER_ADDRESS   (0x000007fe00000000UL)
+#define TARGET_USRSTACK (TARGET_VM_MAXUSER_ADDRESS - TARGET_PAGE_SIZE)
+
+#ifndef UREG_I6
+#define UREG_I6        6
+#endif
+#ifndef UREG_FP
+#define UREG_FP        UREG_I6
+#endif
+
+static inline abi_ulong get_sp_from_cpustate(CPUSPARCState *state)
+{
+    return state->regwptr[UREG_FP];
+}
+
+static inline void set_second_rval(CPUSPARCState *state, abi_ulong retval2)
+{
+    state->regwptr[1] = retval2;
+}
+
+#endif /* !_TARGET_ARCH_VMPARAM_H_ */
+
bsd-user/sparc64/target_signal.h +0 -5
index 5b2abba..181867a 100644
@@ -19,9 +19,4 @@ typedef struct target_sigaltstack {
 #define UREG_FP        UREG_I6
 #endif
 
-static inline abi_ulong get_sp_from_cpustate(CPUSPARCState *state)
-{
-    return state->regwptr[UREG_FP];
-}
-
 #endif /* TARGET_SIGNAL_H */
bsd-user/x86_64/target_arch.h new file +13 -0
new file mode 100644
index 0000000..7fe81dc
@@ -0,0 +1,13 @@
+
+#ifndef _TARGET_ARCH_H_
+#define _TARGET_ARCH_H_
+
+/* target_arch_cpu.c */
+void bsd_x86_64_write_dt(void *ptr, unsigned long addr, unsigned long limit,
+                int flags);
+void bsd_x86_64_set_idt(int n, unsigned int dpl);
+void bsd_x86_64_set_idt_base(uint64_t base);
+
+#define target_cpu_set_tls(env, newtls)
+
+#endif /* !_TARGET_ARCH_H_ */
bsd-user/x86_64/target_arch_cpu.c new file +79 -0

79 lines not on this page · raw message

bsd-user/x86_64/target_arch_cpu.h new file +322 -0

322 lines not on this page · raw message

bsd-user/x86_64/target_arch_vmparam.h new file +28 -0
new file mode 100644
index 0000000..ceb8af5
@@ -0,0 +1,28 @@
+#ifndef _TARGET_ARCH_VMPARAM_H_
+#define _TARGET_ARCH_VMPARAM_H_
+
+#include "cpu.h"
+
+/* compare to amd64/include/vmparam.h */
+#define TARGET_MAXTSIZ  (128UL*1024*1024)   /* max text size */
+#define TARGET_DFLDSIZ  (32768UL*1024*1024) /* initial data size limit */
+#define TARGET_MAXDSIZ  (32768UL*1024*1024) /* max data size */
+#define TARGET_DFLSSIZ  (8UL*1024*1024)     /* initial stack size limit */
+#define TARGET_MAXSSIZ  (512UL*1024*1024)   /* max stack size */
+#define TARGET_SGROWSIZ (128UL*1024)        /* amount to grow stack */
+
+#define TARGET_VM_MAXUSER_ADDRESS   (0x00007fffff000000UL)
+
+#define TARGET_USRSTACK (TARGET_VM_MAXUSER_ADDRESS - TARGET_PAGE_SIZE)
+
+static inline abi_ulong get_sp_from_cpustate(CPUX86State *state)
+{
+    return state->regs[R_ESP];
+}
+
+static inline void set_second_rval(CPUX86State *state, abi_ulong retval2)
+{
+    state->regs[R_EDX] = retval2;
+}
+
+#endif /* !_TARGET_ARCH_VMPARAM_H_ */
bsd-user/x86_64/target_signal.h +0 -5
index 659cd40..5491687 100644
@@ -11,9 +11,4 @@ typedef struct target_sigaltstack {
 	abi_ulong ss_size;
 } target_stack_t;
 
-static inline abi_ulong get_sp_from_cpustate(CPUX86State *state)
-{
-    return state->regs[R_ESP];
-}
-
 #endif /* TARGET_SIGNAL_H */
Signature · 1 line
2.0.0
#4 lore raw

Re: [Qemu-devel] [PATCH 2/4] bsd-user: move arch/OS dependent code out of main.c

Quoted 36 lines · Sean Bruno

From: Stacey Son <[email protected]>

This change moves the cpu initialization and main loop code from main.c to the OS and arch dependent directories. This eliminates many of the #ifdef's in main.c. The cpu initialization and loop code is now located in the arch directory along with target arch support code.

---
 bsd-user/Makefile.objs                 |   2 +-
 bsd-user/elfload.c                     |   2 +-
 bsd-user/freebsd/host_os.h             |  46 ++
 bsd-user/freebsd/target_os_vmparam.h   |  23 +
 bsd-user/i386/target_arch.h            |  13 +
 bsd-user/i386/target_arch_cpu.c        |  79 +++
 bsd-user/i386/target_arch_cpu.h        | 300 +++++++++++
 bsd-user/i386/target_arch_vmparam.h    |  28 +
 bsd-user/i386/target_signal.h          |   6 -
 bsd-user/main.c                        | 927 +++++++--------------------------
 bsd-user/mmap.c                        |   2 +-
 bsd-user/netbsd/host_os.h              |  31 ++
 bsd-user/netbsd/os-strace.h            |   2 +-
 bsd-user/netbsd/target_os_vmparam.h    |  23 +
 bsd-user/openbsd/host_os.h             |  31 ++
 bsd-user/openbsd/os-strace.h           |   2 +-
 bsd-user/openbsd/target_os_vmparam.h   |  23 +
 bsd-user/qemu.h                        |  21 +-
 bsd-user/sparc/target_arch.h           |  11 +
 bsd-user/sparc/target_arch_cpu.c       | 113 ++++
 bsd-user/sparc/target_arch_cpu.h       | 158 ++++++
 bsd-user/sparc/target_arch_vmparam.h   |  37 ++
 bsd-user/sparc/target_signal.h         |   5 -
 bsd-user/sparc64/target_arch.h         |  11 +
 bsd-user/sparc64/target_arch_cpu.c     | 118 +++++
 bsd-user/sparc64/target_arch_cpu.h     | 191 +++++++
Quoted 8 lines
 bsd-user/sparc64/target_arch_vmparam.h |  37 ++
 bsd-user/sparc64/target_signal.h       |   5 -
 bsd-user/x86_64/target_arch.h          |  13 +
 bsd-user/x86_64/target_arch_cpu.c      |  79 +++
 bsd-user/x86_64/target_arch_cpu.h      | 322 ++++++++++++
 bsd-user/x86_64/target_arch_vmparam.h  |  28 +
 bsd-user/x86_64/target_signal.h        |   5 -
 33 files changed, 1930 insertions(+), 764 deletions(-)

Oof. I'm afraid this still needs to be separated out into separate patches a bit more. This patch seems to have:
* some things which are unrelated to the code-refactoring it claims to be doing (I've noted a few below)
* movement of multiple different functions (most notably, this patch deals with both the main cpu loop and also the target-cpu-init) which could be done in separate patches
* some minor style/whitespace changes

bsd-user/main.c line 59

Quoted 13 lines
bsd-user/main.c +11 -0
+#if (TARGET_LONG_BITS == 32) && (HOST_LONG_BITS == 64)
+/*
+ * When running 32-on-64 we should make sure we can fit all of the possible
+ * guest address space into a contiguous chunk of virtual host memory.
+ *
+ * This way we will never overlap with our own libraries or binaries or stack
+ * or anything else that QEMU maps.
+ */
+unsigned long reserved_va = TARGET_RESERVED_VA;
+#else
 unsigned long reserved_va;
 #endif
+#endif /* CONFIG_USE_GUEST_BASE */

For instance, this is a separate change -- it's moving into line with linux-user for the default reserved address, which is good but not related to moving the arch/OS dependent code.

bsd-user/main.c line 87

Quoted 13 lines
bsd-user/main.c +12 -0
+/* Helper routines for implementing atomic operations. */
 
+/*
+ * To implement exclusive operations we force all cpus to synchronize.
+ * We don't require a full sync, only that no cpus are executing guest code.
+ * The alternative is to map target atomic ops onto host eqivalents,
+ * which requires quite a lot of per host/target work.
+ */
+static pthread_mutex_t cpu_list_mutex = PTHREAD_MUTEX_INITIALIZER;
+static pthread_mutex_t exclusive_lock = PTHREAD_MUTEX_INITIALIZER;
+static pthread_cond_t exclusive_cond = PTHREAD_COND_INITIALIZER;
+static pthread_cond_t exclusive_resume = PTHREAD_COND_INITIALIZER;
+static int pending_cpus;

This atomic-operations stuff also looks like a new feature that should go in its own patch.

bsd-user/main.c line 89

Quoted 2 lines
bsd-user/main.c +2 -0
+
+#if defined(CONFIG_USE_NPTL)

Anything using CONFIG_USE_NPTL needs fixing, because configure no longer sets that at all: using NPTL became the default once we converted all the Linux archs to it.

bsd-user/main.c void init_task_state(TaskState *ts) · line 322

Quoted 8 lines
bsd-user/main.c +8 -0
+void gemu_log(const char *fmt, ...)
+{
+    va_list ap;
+
+    va_start(ap, fmt);
+    vfprintf(stderr, fmt, ap);
+    va_end(ap);
+}

This function just randomly moved location; seems a bit pointless, but if you want to do it don't stuff it into this patch.

bsd-user/main.c int main(int argc, char **argv) · line 365

Quoted 6 lines
bsd-user/main.c +1 -1
@@ -767,7 +362,7 @@ int main(int argc, char **argv)
 #endif
 
     optind = 1;
-    for(;;) {
+    for (;;) {

Stray style/whitespace only change, don't bother or put it in its own patch.

bsd-user/main.c int main(int argc, char **argv) · line 544

Quoted 2 lines
bsd-user/main.c +1 -1
-    if (loader_exec(filename, argv+optind, target_environ, regs, info) != 0) {
+    if (loader_exec(filename, argv+optind, target_environ, regs, info)) {

Another style-only change.

bsd-user/netbsd/os-strace.h static inline void do_os_print_sysarch(const struct syscallname *name, · line 29

Quoted 7 lines
bsd-user/netbsd/os-strace.h +1 -1
@@ -25,7 +25,7 @@ static inline void do_os_print_sysarch(const struct syscallname *name,
         abi_long arg5, abi_long arg6)
 {
     qemu_log("qemu: Unsupported syscall %s\n", __func__);
-    return -TARGET_ENOSYS;
+    return;
 }

Oh look, here's the fix for a bug I pointed out in review of patch 1/4 :-)

thanks
-- PMM

author
#5 lore raw

PATCH 3/4 bsd-user: Rename linux_binprm to bsd_binprm

In reply to Sean Bruno

These too similar data structures will be diverging in future updates from my trees. Rename now.

---
 bsd-user/bsdload.c | 4 ++--
 bsd-user/elfload.c | 4 ++--
 bsd-user/main.c    | 2 +-
 bsd-user/qemu.h    | 8 ++++----
 4 files changed, 9 insertions(+), 9 deletions(-)
bsd-user/bsdload.c +2 -2
index 2abc713..e59b03d 100644
@@ -53,7 +53,7 @@ static int count(char ** vec)
     return(i);
 }
 
-static int prepare_binprm(struct linux_binprm *bprm)
+static int prepare_binprm(struct bsd_binprm *bprm)
 {
     struct stat         st;
     int mode;
@@ -157,7 +157,7 @@ abi_ulong loader_build_argptr(int envc, int argc, abi_ulong sp,
 int loader_exec(const char * filename, char ** argv, char ** envp,
              struct target_pt_regs * regs, struct image_info *infop)
 {
-    struct linux_binprm bprm;
+    struct bsd_binprm bprm;
     int retval;
     int i;
 
bsd-user/elfload.c +2 -2
index ccf72d1..c2e2daa 100644
@@ -665,7 +665,7 @@ static abi_ulong copy_elf_strings(int argc,char ** argv, void **page,
     return p;
 }
 
-static abi_ulong setup_arg_pages(abi_ulong p, struct linux_binprm *bprm,
+static abi_ulong setup_arg_pages(abi_ulong p, struct bsd_binprm *bprm,
                                  struct image_info *info)
 {
     abi_ulong stack_base, size, error;
@@ -1147,7 +1147,7 @@ static void load_symbols(struct elfhdr *hdr, int fd)
     syminfos = s;
 }
 
-int load_elf_binary(struct linux_binprm * bprm, struct target_pt_regs * regs,
+int load_elf_binary(struct bsd_binprm * bprm, struct target_pt_regs * regs,
                     struct image_info * info)
 {
     struct elfhdr elf_ex;
bsd-user/main.c +1 -1
index 9c5711d..0ba5955 100644
@@ -328,7 +328,7 @@ int main(int argc, char **argv)
     const char *log_mask = NULL;
     struct target_pt_regs regs1, *regs = &regs1;
     struct image_info info1, *info = &info1;
-    struct linux_binprm bprm;
+    struct bsd_binprm bprm;
     TaskState ts1, *ts = &ts1;
     CPUArchState *env;
     CPUState *cpu;
bsd-user/qemu.h +4 -4
index 7521ebe..c70602e 100644
@@ -91,7 +91,7 @@ typedef struct TaskState {
     struct TaskState *next;
     int used; /* non zero if used */
     struct image_info *info;
-    struct linux_binprm *bprm;
+    struct bsd_binprm *bprm;
 
     struct emulated_sigtable sigtab[TARGET_NSIG];
     struct sigqueue sigqueue_table[MAX_SIGQUEUE_SIZE]; /* siginfo queue */
@@ -120,7 +120,7 @@ extern unsigned long mmap_min_addr;
  * This structure is used to hold the arguments that are
  * used when loading binaries.
  */
-struct linux_binprm {
+struct bsd_binprm {
         char buf[128];
         void *page[MAX_ARG_PAGES];
         abi_ulong p;
@@ -138,9 +138,9 @@ abi_ulong loader_build_argptr(int envc, int argc, abi_ulong sp,
 int loader_exec(const char * filename, char ** argv, char ** envp,
              struct target_pt_regs * regs, struct image_info *infop);
 
-int load_elf_binary(struct linux_binprm * bprm, struct target_pt_regs * regs,
+int load_elf_binary(struct bsd_binprm * bprm, struct target_pt_regs * regs,
                     struct image_info * info);
-int load_flt_binary(struct linux_binprm * bprm, struct target_pt_regs * regs,
+int load_flt_binary(struct bsd_binprm * bprm, struct target_pt_regs * regs,
                     struct image_info * info);
 
 abi_long memcpy_to_target(abi_ulong dest, const void *src,
Signature · 1 line
2.0.0
Reviewed-by on v1 3/4
#6 lore raw

Re: [Qemu-devel] [PATCH 3/4] bsd-user: Rename linux_binprm to bsd_binprm

Quoted 5 lines · Sean Bruno

These too similar data structures will be diverging in future updates from my trees. Rename now.

bsd-user/qemu.h abi_ulong loader_build_argptr(int envc, int argc, abi_ulong sp, · line 144

Quoted 10 lines
bsd-user/qemu.h +3 -3
-int load_elf_binary(struct linux_binprm * bprm, struct target_pt_regs * regs,
+int load_elf_binary(struct bsd_binprm * bprm, struct target_pt_regs * regs,
                     struct image_info * info)
 
-int load_elf_binary(struct linux_binprm * bprm, struct target_pt_regs * regs,
+int load_elf_binary(struct bsd_binprm * bprm, struct target_pt_regs * regs,
                     struct image_info * info);
-int load_flt_binary(struct linux_binprm * bprm, struct target_pt_regs * regs,
+int load_flt_binary(struct bsd_binprm * bprm, struct target_pt_regs * regs,
                     struct image_info * info);

If you run this patch through checkpatch.pl you'll find that it complains about the space following the "*" in these function prototypes. You might as well fix that here since you touch those lines anyway.

Otherwise

thanks
-- PMM

author
#7 lore raw

PATCH 4/4 bsd-user: move arch/OS dependent code out of syscall.c

In reply to Sean Bruno

From: Stacey Son <[email protected]>

This change moves the system call handler for sysctl(2) and sysarch(2) from syscall.c to the OS and arch dependent directories. This eliminates many of the #ifdef's in syscall.c. These system call handlers are now located in the host os and target arch directories.

---
 bsd-user/Makefile.objs                  |   2 +-
 bsd-user/bsdload.c                      | 168 +++++++++++++------
 bsd-user/elfload.c                      |   7 +-
 bsd-user/freebsd/os-strace.h            |   6 -
 bsd-user/freebsd/os-sys.c               | 285 ++++++++++++++++++++++++++++++++
 bsd-user/freebsd/target_os_stack.h      | 157 ++++++++++++++++++
 bsd-user/i386/syscall.h                 |   2 +
 bsd-user/i386/target_arch_sigtramp.h    |  11 ++
 bsd-user/main.c                         |   2 +-
 bsd-user/netbsd/os-strace.h             |   8 -
 bsd-user/netbsd/os-sys.c                |  46 ++++++
 bsd-user/netbsd/target_os_stack.h       |  33 ++++
 bsd-user/openbsd/os-strace.h            |   8 -
 bsd-user/openbsd/os-sys.c               |  46 ++++++
 bsd-user/openbsd/target_os_stack.h      |  33 ++++
 bsd-user/qemu.h                         |  28 +++-
 bsd-user/sparc/syscall.h                |   2 +
 bsd-user/sparc/target_arch_sigtramp.h   |  11 ++
 bsd-user/sparc64/syscall.h              |   2 +
 bsd-user/sparc64/target_arch_sigtramp.h |  11 ++
 bsd-user/syscall.c                      | 151 ++++-------------
 bsd-user/x86_64/syscall.h               |   2 +
 bsd-user/x86_64/target_arch_sigtramp.h  |  11 ++
 23 files changed, 827 insertions(+), 205 deletions(-)
 create mode 100644 bsd-user/freebsd/os-sys.c
 create mode 100644 bsd-user/freebsd/target_os_stack.h
 create mode 100644 bsd-user/i386/target_arch_sigtramp.h
 create mode 100644 bsd-user/netbsd/os-sys.c
 create mode 100644 bsd-user/netbsd/target_os_stack.h
 create mode 100644 bsd-user/openbsd/os-sys.c
 create mode 100644 bsd-user/openbsd/target_os_stack.h
 create mode 100644 bsd-user/sparc/target_arch_sigtramp.h
 create mode 100644 bsd-user/sparc64/target_arch_sigtramp.h
 create mode 100644 bsd-user/x86_64/target_arch_sigtramp.h
bsd-user/Makefile.objs +1 -1
index 41e8dce..a4dca8e 100644
@@ -1,2 +1,2 @@
 obj-y = main.o bsdload.o elfload.o mmap.o signal.o strace.o syscall.o \
-	        uaccess.o $(TARGET_ABI_DIR)/target_arch_cpu.o
+	        uaccess.o $(HOST_VARIANT_DIR)/os-sys.o $(TARGET_ABI_DIR)/target_arch_cpu.o
bsd-user/bsdload.c +121 -47

223 lines not on this page · raw message

bsd-user/elfload.c +5 -2
index c2e2daa..68d0209 100644
@@ -91,6 +91,9 @@ enum {
 #define ELIBBAD 80
 #endif
 
+abi_ulong target_stksiz;
+abi_ulong target_stkbas;
+
 #ifdef TARGET_I386
 
 #define ELF_PLATFORM get_elf_platform()
@@ -1147,8 +1150,8 @@ static void load_symbols(struct elfhdr *hdr, int fd)
     syminfos = s;
 }
 
-int load_elf_binary(struct bsd_binprm * bprm, struct target_pt_regs * regs,
-                    struct image_info * info)
+int load_elf_binary(struct bsd_binprm *bprm, struct target_pt_regs *regs,
+                    struct image_info *info)
 {
     struct elfhdr elf_ex;
     struct elfhdr interp_elf_ex;
bsd-user/freebsd/os-strace.h +0 -6
index c856450..a222f09 100644
@@ -27,9 +27,3 @@ static inline void do_os_print_sysarch(const struct syscallname *name,
     /* This is arch dependent */
     do_freebsd_arch_print_sysarch(name, arg1, arg2, arg3, arg4, arg5, arg6);
 }
-
-/* sysarch() is architecture dependent. */
-abi_long do_bsd_sysarch(void *cpu_env, abi_long arg1, abi_long arg2)
-{
-    return do_freebsd_arch_sysarch(cpu_env, arg1, arg2);
-}
bsd-user/freebsd/os-sys.c new file +285 -0

285 lines not on this page · raw message

bsd-user/freebsd/target_os_stack.h new file +157 -0

157 lines not on this page · raw message

bsd-user/i386/syscall.h +2 -0
index 8028fc8..52de302 100644
@@ -178,5 +178,7 @@ struct target_vm86plus_struct {
 
 
 #define UNAME_MACHINE "i386"
+#define TARGET_HW_MACHINE UNAME_MACHINE
+#define TARGET_HW_MACHINE_ARCH UNAME_MACHINE
 
 #endif /* ! _I386_SYSCALL_H_ */
bsd-user/i386/target_arch_sigtramp.h new file +11 -0
new file mode 100644
index 0000000..f0f36d1
@@ -0,0 +1,11 @@
+
+#ifndef _TARGET_ARCH_SIGTRAMP_H_
+#define _TARGET_ARCH_SIGTRAMP_H_
+
+static inline abi_long setup_sigtramp(abi_ulong offset, unsigned sigf_uc,
+        unsigned sys_sigreturn)
+{
+
+    return -TARGET_EOPNOTSUPP;
+}
+#endif /* _TARGET_ARCH_SIGTRAMP_H_ */
bsd-user/main.c +1 -1
index 0ba5955..e11f524 100644
@@ -541,7 +541,7 @@ int main(int argc, char **argv)
     }
 #endif /* CONFIG_USE_GUEST_BASE */
 
-    if (loader_exec(filename, argv+optind, target_environ, regs, info)) {
+    if (loader_exec(filename, argv+optind, target_environ, regs, info, &bprm)) {
         printf("Error loading %s\n", filename);
         _exit(1);
     }
bsd-user/netbsd/os-strace.h +0 -8
index ead15db..442af7f 100644
@@ -27,11 +27,3 @@ static inline void do_os_print_sysarch(const struct syscallname *name,
     qemu_log("qemu: Unsupported syscall %s\n", __func__);
     return;
 }
-
-/* sysarch() is architecture dependent. */
-abi_long do_bsd_sysarch(void *cpu_env, abi_long arg1, abi_long arg2)
-{
-    qemu_log("qemu: Unsupported syscall sysarch()\n");
-    return -TARGET_ENOSYS;
-}
-
bsd-user/netbsd/os-sys.c new file +46 -0

46 lines not on this page · raw message

bsd-user/netbsd/target_os_stack.h new file +33 -0
new file mode 100644
index 0000000..1a26c3f
@@ -0,0 +1,33 @@
+#ifndef _TARGET_OS_STACK_H_
+#define _TARGET_OS_STACK_H_
+
+#include "target_arch_sigtramp.h"
+
+static inline int setup_initial_stack(struct bsd_binprm *bprm, abi_ulong *p)
+{
+    int i;
+    abi_ulong stack_base;
+
+    stack_base = (target_stkbas + target_stksiz) -
+                  MAX_ARG_PAGES * TARGET_PAGE_SIZE;
+    if (p) {
+        *p = stack_base;
+    }
+
+    for (i = 0; i < MAX_ARG_PAGES; i++) {
+        if (bprm->page[i]) {
+            info->rss++;
+            if (!memcpy_to_target(stack_base, bprm->page[i],
+                        TARGET_PAGE_SIZE)) {
+                errno = EFAULT;
+                return -1;
+            }
+            g_free(bprm->page[i]);
+        }
+        stack_base += TARGET_PAGE_SIZE;
+    }
+
+    return 0;
+}
+
+#endif /* !_TARGET_OS_STACK_H_ */
bsd-user/openbsd/os-strace.h +0 -8
index 88907b4..d8dc83b 100644
@@ -27,11 +27,3 @@ static inline void do_os_print_sysarch(const struct syscallname *name,
     qemu_log("qemu: Unsupported syscall %s\n", __func__);
     return;
 }
-
-/* sysarch() is architecture dependent. */
-abi_long do_bsd_sysarch(void *cpu_env, abi_long arg1, abi_long arg2)
-{
-
-    qemu_log("qemu: Unsupported syscall sysarch()\n");
-    return -TARGET_ENOSYS;
-}
bsd-user/openbsd/os-sys.c new file +46 -0

46 lines not on this page · raw message

bsd-user/openbsd/target_os_stack.h new file +33 -0
new file mode 100644
index 0000000..1a26c3f
@@ -0,0 +1,33 @@
+#ifndef _TARGET_OS_STACK_H_
+#define _TARGET_OS_STACK_H_
+
+#include "target_arch_sigtramp.h"
+
+static inline int setup_initial_stack(struct bsd_binprm *bprm, abi_ulong *p)
+{
+    int i;
+    abi_ulong stack_base;
+
+    stack_base = (target_stkbas + target_stksiz) -
+                  MAX_ARG_PAGES * TARGET_PAGE_SIZE;
+    if (p) {
+        *p = stack_base;
+    }
+
+    for (i = 0; i < MAX_ARG_PAGES; i++) {
+        if (bprm->page[i]) {
+            info->rss++;
+            if (!memcpy_to_target(stack_base, bprm->page[i],
+                        TARGET_PAGE_SIZE)) {
+                errno = EFAULT;
+                return -1;
+            }
+            g_free(bprm->page[i]);
+        }
+        stack_base += TARGET_PAGE_SIZE;
+    }
+
+    return 0;
+}
+
+#endif /* !_TARGET_OS_STACK_H_ */
bsd-user/qemu.h +19 -9
index c70602e..eda6f29 100644
@@ -129,19 +129,23 @@ struct bsd_binprm {
         int argc, envc;
         char **argv;
         char **envp;
-        char * filename;        /* Name of binary */
+        char *filename;         /* (Given) Name of binary */
+        char *fullpath;         /* Full path of binary */
+        int (*core_dump)(int, const CPUArchState *);
 };
 
 void do_init_thread(struct target_pt_regs *regs, struct image_info *infop);
 abi_ulong loader_build_argptr(int envc, int argc, abi_ulong sp,
                               abi_ulong stringp, int push_ptr);
-int loader_exec(const char * filename, char ** argv, char ** envp,
-             struct target_pt_regs * regs, struct image_info *infop);
+int loader_exec(const char *filename, char **argv, char **envp,
+             struct target_pt_regs *regs, struct image_info *infop,
+             struct bsd_binprm *bprm);
 
-int load_elf_binary(struct bsd_binprm * bprm, struct target_pt_regs * regs,
-                    struct image_info * info);
-int load_flt_binary(struct bsd_binprm * bprm, struct target_pt_regs * regs,
-                    struct image_info * info);
+int load_elf_binary(struct bsd_binprm *bprm, struct target_pt_regs *regs,
+                    struct image_info *info);
+int load_flt_binary(struct bsd_binprm *bprm, struct target_pt_regs *regs,
+                    struct image_info *info);
+int is_target_elf_binary(int fd);
 
 abi_long memcpy_to_target(abi_ulong dest, const void *src,
                           unsigned long len);
@@ -238,8 +242,14 @@ void end_exclusive(void);
 void cpu_exec_start(CPUState *cpu);
 void cpu_exec_end(CPUState *cpu);
 
-/* os-strace.h */
-abi_long do_bsd_sysarch(void *cpu_env, abi_long arg1, abi_long arg2);
+/* syscall.c */
+abi_long get_errno(abi_long ret);
+int is_error(abi_long ret);
+
+/* os-sys.c */
+abi_long do_freebsd_sysctl(CPUArchState *env, abi_ulong namep, int32_t namelen,
+        abi_ulong oldp, abi_ulong oldlenp, abi_ulong newp, abi_ulong newlen);
+abi_long do_freebsd_sysarch(void *cpu_env, abi_long arg1, abi_long arg2);
 
 /* user access */
 
bsd-user/sparc/syscall.h +2 -0
index 7ed2152..3a5b1e2 100644
@@ -27,6 +27,8 @@ struct target_pt_regs {
 };
 
 #define UNAME_MACHINE           "sun4"
+#define TARGET_HW_MACHINE       "sparc"
+#define TARGET_HW_MACHINE_ARCH  "sparc"
 
 #define TARGET_SPARC_UTRAP_INSTALL      1
 #define TARGET_SPARC_SIGTRAMP_INSTALL   2
bsd-user/sparc/target_arch_sigtramp.h new file +11 -0
new file mode 100644
index 0000000..f0f36d1
@@ -0,0 +1,11 @@
+
+#ifndef _TARGET_ARCH_SIGTRAMP_H_
+#define _TARGET_ARCH_SIGTRAMP_H_
+
+static inline abi_long setup_sigtramp(abi_ulong offset, unsigned sigf_uc,
+        unsigned sys_sigreturn)
+{
+
+    return -TARGET_EOPNOTSUPP;
+}
+#endif /* _TARGET_ARCH_SIGTRAMP_H_ */
bsd-user/sparc64/syscall.h +2 -0
index 8571092..58cc38d 100644
@@ -27,6 +27,8 @@ struct target_pt_regs {
 };
 
 #define UNAME_MACHINE           "sun4u"
+#define TARGET_HW_MACHINE       "sparc"
+#define TARGET_HW_MACHINE_ARCH  "sparc64"
 
 #define TARGET_SPARC_UTRAP_INSTALL      1
 #define TARGET_SPARC_SIGTRAMP_INSTALL   2
bsd-user/sparc64/target_arch_sigtramp.h new file +11 -0
new file mode 100644
index 0000000..f0f36d1
@@ -0,0 +1,11 @@
+
+#ifndef _TARGET_ARCH_SIGTRAMP_H_
+#define _TARGET_ARCH_SIGTRAMP_H_
+
+static inline abi_long setup_sigtramp(abi_ulong offset, unsigned sigf_uc,
+        unsigned sys_sigreturn)
+{
+
+    return -TARGET_EOPNOTSUPP;
+}
+#endif /* _TARGET_ARCH_SIGTRAMP_H_ */
bsd-user/syscall.c +28 -123

201 lines not on this page · raw message

bsd-user/x86_64/syscall.h +2 -0
index 4e77235..4fff6a5 100644
@@ -129,6 +129,8 @@ struct target_msqid64_ds {
 
 
 #define UNAME_MACHINE           "x86_64"
+#define TARGET_HW_MACHINE       "amd64"
+#define TARGET_HW_MACHINE_ARCH  "amd64"
 
 #define TARGET_ARCH_SET_GS 0x1001
 #define TARGET_ARCH_SET_FS 0x1002
bsd-user/x86_64/target_arch_sigtramp.h new file +11 -0
new file mode 100644
index 0000000..f0f36d1
@@ -0,0 +1,11 @@
+
+#ifndef _TARGET_ARCH_SIGTRAMP_H_
+#define _TARGET_ARCH_SIGTRAMP_H_
+
+static inline abi_long setup_sigtramp(abi_ulong offset, unsigned sigf_uc,
+        unsigned sys_sigreturn)
+{
+
+    return -TARGET_EOPNOTSUPP;
+}
+#endif /* _TARGET_ARCH_SIGTRAMP_H_ */
Signature · 1 line
2.0.0
#8 lore raw

Re: [Qemu-devel] [PATCH 4/4] bsd-user: move arch/OS dependent code out of syscall.c

Quoted 8 lines · Sean Bruno

From: Stacey Son <[email protected]>

This change moves the system call handler for sysctl(2) and sysarch(2) from syscall.c to the OS and arch dependent directories. This eliminates many of the #ifdef's in syscall.c. These system call handlers are now located in the host os and target arch directories.

Quoted 5 lines
---
 bsd-user/Makefile.objs                  |   2 +-
 bsd-user/bsdload.c                      | 168 +++++++++++++------

Why are we making lots of changes to bsdload.c then? This doesn't match up with the commit message...

Quoted 24 lines
 bsd-user/elfload.c                      |   7 +-
 bsd-user/freebsd/os-strace.h            |   6 -
 bsd-user/freebsd/os-sys.c               | 285 ++++++++++++++++++++++++++++++++
 bsd-user/freebsd/target_os_stack.h      | 157 ++++++++++++++++++
 bsd-user/i386/syscall.h                 |   2 +
 bsd-user/i386/target_arch_sigtramp.h    |  11 ++
 bsd-user/main.c                         |   2 +-
 bsd-user/netbsd/os-strace.h             |   8 -
 bsd-user/netbsd/os-sys.c                |  46 ++++++
 bsd-user/netbsd/target_os_stack.h       |  33 ++++
 bsd-user/openbsd/os-strace.h            |   8 -
 bsd-user/openbsd/os-sys.c               |  46 ++++++
 bsd-user/openbsd/target_os_stack.h      |  33 ++++
 bsd-user/qemu.h                         |  28 +++-
 bsd-user/sparc/syscall.h                |   2 +
 bsd-user/sparc/target_arch_sigtramp.h   |  11 ++
 bsd-user/sparc64/syscall.h              |   2 +
 bsd-user/sparc64/target_arch_sigtramp.h |  11 ++
 bsd-user/syscall.c                      | 151 ++++-------------
 bsd-user/x86_64/syscall.h               |   2 +
 bsd-user/x86_64/target_arch_sigtramp.h  |  11 ++
 23 files changed, 827 insertions(+), 205 deletions(-)
 create mode 100644 bsd-user/freebsd/os-sys.c
 create mode 100644 bsd-user/freebsd/target_os_stack.h
Quoted 8 lines
 create mode 100644 bsd-user/i386/target_arch_sigtramp.h
 create mode 100644 bsd-user/netbsd/os-sys.c
 create mode 100644 bsd-user/netbsd/target_os_stack.h
 create mode 100644 bsd-user/openbsd/os-sys.c
 create mode 100644 bsd-user/openbsd/target_os_stack.h
 create mode 100644 bsd-user/sparc/target_arch_sigtramp.h
 create mode 100644 bsd-user/sparc64/target_arch_sigtramp.h
 create mode 100644 bsd-user/x86_64/target_arch_sigtramp.h

Again, this patch is doing too much at once. I would suggest you could split it out into at least:
* 1 patch for sigtramp related code
* 1 patch for os_stack related code
* 1 or more patches for the loader changes
* 1 patch for sysctl changes (making sure you keep "add new functionality" separate from "just moving code around"; I'm pretty sure you're adding support for new sysctls here, like the HW_MACHINE stuff)
* either drop whitespace/format changes or put them in their own patch, your choice

Quoted 5 lines
bsd-user/freebsd/os-strace.h +0 -0
index c856450..a222f09 100644

bsd-user/freebsd/os-strace.h static inline void do_os_print_sysarch(const struct syscallname *name, · line 35

Quoted 9 lines
bsd-user/freebsd/os-strace.h +0 -6
@@ -27,9 +27,3 @@ static inline void do_os_print_sysarch(const struct syscallname *name,
     /* This is arch dependent */
     do_freebsd_arch_print_sysarch(name, arg1, arg2, arg3, arg4, arg5, arg6);
 }
-
-/* sysarch() is architecture dependent. */
-abi_long do_bsd_sysarch(void *cpu_env, abi_long arg1, abi_long arg2)
-{
-    return do_freebsd_arch_sysarch(cpu_env, arg1, arg2);
-}

We just added this function in patch 1, why are we removing it again? Either patch 1 or this one is wrong... There are other bits of code in this patch touching the sysarch code which should be in patch 1 as well.

thanks
-- PMM

#9 lore raw
In reply to Sean Bruno
Quoted 111 lines · Sean Bruno

This patchset brings us a couple of steps closer to the FreeBSD Development tree, Stacey Son's bsd-user branch and qemu-devel port maintained out of tree.

These patches are designed to begin to break apart the architectures in bsd-user for the upcoming new arch support patches.

Patch 1/4 of this set is a reset of Patch 5/10 from the last bsd-user update push. It addresses Peter Maydell's commentary about missing and redundant code for print_sysarch and the build breakage for netbsd and openbsd bsd-user programs.

Patch 4/4 of this set includes Patch 10/10 from the last bsd-user update push. It includes the code that uses the #define vaules as to avoid the possibility of commiting dead code.

Sean Bruno (2):
bsd-user: Implement new syscall print_sysarch and add strace support
bsd-user: Rename struct linux_binprm to struct bsd_binprm

Stacey Son (2):
bsd-user: move arch/OS dependent code out of main.c
bsd-user: move arch/OS dependent code out of syscall.c

 bsd-user/Makefile.objs                  |   2 +-
 bsd-user/bsdload.c                      | 170 ++++--
 bsd-user/elfload.c                      |  11 +-
 bsd-user/freebsd/host_os.h              |  46 ++
 bsd-user/freebsd/os-strace.h            |  29 +
 bsd-user/freebsd/os-sys.c               | 285 ++++++++++
 bsd-user/freebsd/strace.list            |   2 +-
 bsd-user/freebsd/target_os_stack.h      | 157 ++++++
 bsd-user/freebsd/target_os_vmparam.h    |  23 +
 bsd-user/i386/syscall.h                 |  23 +
 bsd-user/i386/target_arch.h             |  13 +
 bsd-user/i386/target_arch_cpu.c         |  79 +++
 bsd-user/i386/target_arch_cpu.h         | 300 +++++++++++
 bsd-user/i386/target_arch_sigtramp.h    |  11 +
 bsd-user/i386/target_arch_sysarch.h     |  78 +++
 bsd-user/i386/target_arch_vmparam.h     |  28 +
 bsd-user/i386/target_signal.h           |   6 -
 bsd-user/main.c                         | 927 +++++++-------------------------
 bsd-user/mmap.c                         |   2 +-
 bsd-user/netbsd/host_os.h               |  31 ++
 bsd-user/netbsd/os-strace.h             |  29 +
 bsd-user/netbsd/os-sys.c                |  46 ++
 bsd-user/netbsd/target_os_stack.h       |  33 ++
 bsd-user/netbsd/target_os_vmparam.h     |  23 +
 bsd-user/openbsd/host_os.h              |  31 ++
 bsd-user/openbsd/os-strace.h            |  29 +
 bsd-user/openbsd/os-sys.c               |  46 ++
 bsd-user/openbsd/target_os_stack.h      |  33 ++
 bsd-user/openbsd/target_os_vmparam.h    |  23 +
 bsd-user/qemu.h                         |  50 +-
 bsd-user/sparc/syscall.h                |  29 +-
 bsd-user/sparc/target_arch.h            |  11 +
 bsd-user/sparc/target_arch_cpu.c        | 113 ++++
 bsd-user/sparc/target_arch_cpu.h        | 158 ++++++
 bsd-user/sparc/target_arch_sigtramp.h   |  11 +
 bsd-user/sparc/target_arch_sysarch.h    |  52 ++
 bsd-user/sparc/target_arch_vmparam.h    |  37 ++
 bsd-user/sparc/target_signal.h          |   5 -
 bsd-user/sparc64/syscall.h              |  28 +-
 bsd-user/sparc64/target_arch.h          |  11 +
 bsd-user/sparc64/target_arch_cpu.c      | 118 ++++
 bsd-user/sparc64/target_arch_cpu.h      | 191 +++++++
 bsd-user/sparc64/target_arch_sigtramp.h |  11 +
 bsd-user/sparc64/target_arch_sysarch.h  |  52 ++
 bsd-user/sparc64/target_arch_vmparam.h  |  37 ++
 bsd-user/sparc64/target_signal.h        |   5 -
 bsd-user/strace.c                       |  10 +
 bsd-user/syscall.c                      | 210 +-------
 bsd-user/x86_64/syscall.h               |  26 +-
 bsd-user/x86_64/target_arch.h           |  13 +
 bsd-user/x86_64/target_arch_cpu.c       |  79 +++
 bsd-user/x86_64/target_arch_cpu.h       | 322 +++++++++++
 bsd-user/x86_64/target_arch_sigtramp.h  |  11 +
 bsd-user/x86_64/target_arch_sysarch.h   |  76 +++
 bsd-user/x86_64/target_arch_vmparam.h   |  28 +
 bsd-user/x86_64/target_signal.h         |   5 -
 56 files changed, 3207 insertions(+), 1008 deletions(-)
 create mode 100644 bsd-user/freebsd/host_os.h
 create mode 100644 bsd-user/freebsd/os-strace.h
 create mode 100644 bsd-user/freebsd/os-sys.c
 create mode 100644 bsd-user/freebsd/target_os_stack.h
 create mode 100644 bsd-user/freebsd/target_os_vmparam.h
 create mode 100644 bsd-user/i386/target_arch.h
 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_sigtramp.h
 create mode 100644 bsd-user/i386/target_arch_sysarch.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/os-strace.h
 create mode 100644 bsd-user/netbsd/os-sys.c
 create mode 100644 bsd-user/netbsd/target_os_stack.h
 create mode 100644 bsd-user/netbsd/target_os_vmparam.h
 create mode 100644 bsd-user/openbsd/host_os.h
 create mode 100644 bsd-user/openbsd/os-strace.h
 create mode 100644 bsd-user/openbsd/os-sys.c
 create mode 100644 bsd-user/openbsd/target_os_stack.h
 create mode 100644 bsd-user/openbsd/target_os_vmparam.h
 create mode 100644 bsd-user/sparc/target_arch.h
 create mode 100644 bsd-user/sparc/target_arch_cpu.c
 create mode 100644 bsd-user/sparc/target_arch_cpu.h
 create mode 100644 bsd-user/sparc/target_arch_sigtramp.h
 create mode 100644 bsd-user/sparc/target_arch_sysarch.h
 create mode 100644 bsd-user/sparc/target_arch_vmparam.h
 create mode 100644 bsd-user/sparc64/target_arch.h
 create mode 100644 bsd-user/sparc64/target_arch_cpu.c
 create mode 100644 bsd-user/sparc64/target_arch_cpu.h
 create mode 100644 bsd-user/sparc64/target_arch_sigtramp.h
Quoted 9 lines
 create mode 100644 bsd-user/sparc64/target_arch_sysarch.h
 create mode 100644 bsd-user/sparc64/target_arch_vmparam.h
 create mode 100644 bsd-user/x86_64/target_arch.h
 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_sigtramp.h
 create mode 100644 bsd-user/x86_64/target_arch_sysarch.h
 create mode 100644 bsd-user/x86_64/target_arch_vmparam.h

ping and happy weekend!

sean

#10 lore raw
Quoted 122 lines · Sean Bruno
Quoted 111 lines · Sean Bruno

This patchset brings us a couple of steps closer to the FreeBSD Development tree, Stacey Son's bsd-user branch and qemu-devel port maintained out of tree.

These patches are designed to begin to break apart the architectures in bsd-user for the upcoming new arch support patches.

Patch 1/4 of this set is a reset of Patch 5/10 from the last bsd-user update push. It addresses Peter Maydell's commentary about missing and redundant code for print_sysarch and the build breakage for netbsd and openbsd bsd-user programs.

Patch 4/4 of this set includes Patch 10/10 from the last bsd-user update push. It includes the code that uses the #define vaules as to avoid the possibility of commiting dead code.

Sean Bruno (2):
bsd-user: Implement new syscall print_sysarch and add strace support
bsd-user: Rename struct linux_binprm to struct bsd_binprm

Stacey Son (2):
bsd-user: move arch/OS dependent code out of main.c
bsd-user: move arch/OS dependent code out of syscall.c

 bsd-user/Makefile.objs                  |   2 +-
 bsd-user/bsdload.c                      | 170 ++++--
 bsd-user/elfload.c                      |  11 +-
 bsd-user/freebsd/host_os.h              |  46 ++
 bsd-user/freebsd/os-strace.h            |  29 +
 bsd-user/freebsd/os-sys.c               | 285 ++++++++++
 bsd-user/freebsd/strace.list            |   2 +-
 bsd-user/freebsd/target_os_stack.h      | 157 ++++++
 bsd-user/freebsd/target_os_vmparam.h    |  23 +
 bsd-user/i386/syscall.h                 |  23 +
 bsd-user/i386/target_arch.h             |  13 +
 bsd-user/i386/target_arch_cpu.c         |  79 +++
 bsd-user/i386/target_arch_cpu.h         | 300 +++++++++++
 bsd-user/i386/target_arch_sigtramp.h    |  11 +
 bsd-user/i386/target_arch_sysarch.h     |  78 +++
 bsd-user/i386/target_arch_vmparam.h     |  28 +
 bsd-user/i386/target_signal.h           |   6 -
 bsd-user/main.c                         | 927 +++++++-------------------------
 bsd-user/mmap.c                         |   2 +-
 bsd-user/netbsd/host_os.h               |  31 ++
 bsd-user/netbsd/os-strace.h             |  29 +
 bsd-user/netbsd/os-sys.c                |  46 ++
 bsd-user/netbsd/target_os_stack.h       |  33 ++
 bsd-user/netbsd/target_os_vmparam.h     |  23 +
 bsd-user/openbsd/host_os.h              |  31 ++
 bsd-user/openbsd/os-strace.h            |  29 +
 bsd-user/openbsd/os-sys.c               |  46 ++
 bsd-user/openbsd/target_os_stack.h      |  33 ++
 bsd-user/openbsd/target_os_vmparam.h    |  23 +
 bsd-user/qemu.h                         |  50 +-
 bsd-user/sparc/syscall.h                |  29 +-
 bsd-user/sparc/target_arch.h            |  11 +
 bsd-user/sparc/target_arch_cpu.c        | 113 ++++
 bsd-user/sparc/target_arch_cpu.h        | 158 ++++++
 bsd-user/sparc/target_arch_sigtramp.h   |  11 +
 bsd-user/sparc/target_arch_sysarch.h    |  52 ++
 bsd-user/sparc/target_arch_vmparam.h    |  37 ++
 bsd-user/sparc/target_signal.h          |   5 -
 bsd-user/sparc64/syscall.h              |  28 +-
 bsd-user/sparc64/target_arch.h          |  11 +
 bsd-user/sparc64/target_arch_cpu.c      | 118 ++++
 bsd-user/sparc64/target_arch_cpu.h      | 191 +++++++
 bsd-user/sparc64/target_arch_sigtramp.h |  11 +
 bsd-user/sparc64/target_arch_sysarch.h  |  52 ++
 bsd-user/sparc64/target_arch_vmparam.h  |  37 ++
 bsd-user/sparc64/target_signal.h        |   5 -
 bsd-user/strace.c                       |  10 +
 bsd-user/syscall.c                      | 210 +-------
 bsd-user/x86_64/syscall.h               |  26 +-
 bsd-user/x86_64/target_arch.h           |  13 +
 bsd-user/x86_64/target_arch_cpu.c       |  79 +++
 bsd-user/x86_64/target_arch_cpu.h       | 322 +++++++++++
 bsd-user/x86_64/target_arch_sigtramp.h  |  11 +
 bsd-user/x86_64/target_arch_sysarch.h   |  76 +++
 bsd-user/x86_64/target_arch_vmparam.h   |  28 +
 bsd-user/x86_64/target_signal.h         |   5 -
 56 files changed, 3207 insertions(+), 1008 deletions(-)
 create mode 100644 bsd-user/freebsd/host_os.h
 create mode 100644 bsd-user/freebsd/os-strace.h
 create mode 100644 bsd-user/freebsd/os-sys.c
 create mode 100644 bsd-user/freebsd/target_os_stack.h
 create mode 100644 bsd-user/freebsd/target_os_vmparam.h
 create mode 100644 bsd-user/i386/target_arch.h
 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_sigtramp.h
 create mode 100644 bsd-user/i386/target_arch_sysarch.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/os-strace.h
 create mode 100644 bsd-user/netbsd/os-sys.c
 create mode 100644 bsd-user/netbsd/target_os_stack.h
 create mode 100644 bsd-user/netbsd/target_os_vmparam.h
 create mode 100644 bsd-user/openbsd/host_os.h
 create mode 100644 bsd-user/openbsd/os-strace.h
 create mode 100644 bsd-user/openbsd/os-sys.c
 create mode 100644 bsd-user/openbsd/target_os_stack.h
 create mode 100644 bsd-user/openbsd/target_os_vmparam.h
 create mode 100644 bsd-user/sparc/target_arch.h
 create mode 100644 bsd-user/sparc/target_arch_cpu.c
 create mode 100644 bsd-user/sparc/target_arch_cpu.h
 create mode 100644 bsd-user/sparc/target_arch_sigtramp.h
 create mode 100644 bsd-user/sparc/target_arch_sysarch.h
 create mode 100644 bsd-user/sparc/target_arch_vmparam.h
 create mode 100644 bsd-user/sparc64/target_arch.h
 create mode 100644 bsd-user/sparc64/target_arch_cpu.c
 create mode 100644 bsd-user/sparc64/target_arch_cpu.h
 create mode 100644 bsd-user/sparc64/target_arch_sigtramp.h
Quoted 9 lines
 create mode 100644 bsd-user/sparc64/target_arch_sysarch.h
 create mode 100644 bsd-user/sparc64/target_arch_vmparam.h
 create mode 100644 bsd-user/x86_64/target_arch.h
 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_sigtramp.h
 create mode 100644 bsd-user/x86_64/target_arch_sysarch.h
 create mode 100644 bsd-user/x86_64/target_arch_vmparam.h
Quoted 5 lines

ping and happy weekend!

sean

ping x2, happy monday.

sean