bsd-user: Update Queue
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
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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
Re: [Qemu-devel] [PATCH 1/4] bsd-user: Implement new syscall print_sysarch and add strace support
Quoted 18 lines · Sean Bruno
Signed-off-by Sean Bruno <[email protected]>Signed-off-by Stacey Son <[email protected]>--- 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.hbsd-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
PATCH 2/4 bsd-user: move arch/OS dependent code out of main.c
In reply to Sean BrunoFrom: 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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
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.cto the OS and arch dependent directories. This eliminates many of the #ifdef's inmain.c. The cpu initialization and loop code is now located in the arch directory along with target arch support code.Signed-off-by Sean Bruno <[email protected]>--- 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
PATCH 3/4 bsd-user: Rename linux_binprm to bsd_binprm
In reply to Sean BrunoThese 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
@@ -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
@@ -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
@@ -328,7 +328,7 @@ int main(int argc, char **argv)const char *log_mask =NULL ;struct target_pt_regs regs1, *regs = ®s1;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
@@ -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
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.
Signed-off-by Sean Bruno <[email protected]>
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
PATCH 4/4 bsd-user: move arch/OS dependent code out of syscall.c
In reply to Sean BrunoFrom: 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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
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.cto the OS and arch dependent directories. This eliminates many of the #ifdef's insyscall.c. These system call handlers are now located in the host os and target arch directories.
Quoted 5 lines
Signed-off-by Sean Bruno <[email protected]>Signed-off-by Stacey Son <[email protected]>--- 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
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
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_sysarchand 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 syscallprint_sysarchand add strace support
bsd-user: Rename structlinux_binprmto structbsd_binprmStacey Son (2):
bsd-user: movearch/OSdependent code out ofmain.c
bsd-user: movearch/OSdependent code out ofsyscall.cbsd-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
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_sysarchand 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 syscallprint_sysarchand add strace support
bsd-user: Rename structlinux_binprmto structbsd_binprmStacey Son (2):
bsd-user: movearch/OSdependent code out ofmain.c
bsd-user: movearch/OSdependent code out ofsyscall.cbsd-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.hQuoted 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