bsd-user: Add system call and mips/arm support.
cover bsd-user: Add system call and mips/arm support.
This patch series adds a significant number of system calls and mips/arm support for bsd-user. In its current state it can emulate most FreeBSD mips/mips64 and arm target binaries on a x86 host in a simple chroot environment. (see https://wiki.freebsd.org/QemuUserModeHowTo for the details.)
Besides adding a lot of shims and other support code this change restructures the code significantly to reduce the amount of C preprocessor conditionals for the various target and host arch/OS's. In general, the target cpu depedent code has been moved into into the various arch directories and the host OS dependent code (ie. FreeBSD, NetBSD, OpenBSD) has been moved into the OS directories as much as possible.
I would like to recognize Olivier Houchard for a lot of the arm dependent code and Juergen Lock, the maintainer of the FreeBSD Qemu port, for their contributions.
Best Regards,
Stacey D. Son
---
Stacey Son (18):
bsd-user: refresh freebsd system call numbers
bsd-user: add HOST_ABI_DIR for the various *BSD dependent code.
bsd-user: move OS/arch dependent code for strace into separate
directories
bsd-user: move target arch and host OS dependent code out of main.c
bsd-user: move target arch and host OS dependent code out of
syscall.c
bsd-user: add support for freebsd time related system calls
bsd-user: add support for freebsd signal related system calls
bsd-user: move target arch and host OS dependent code out of
elfload.c
bsd-user: add support for freebsd process related system calls
bsd-user: add support for file system related system calls
bsd-user: add support for stat, directory, and file control related
system calls
bsd-user: add support for memory management related system calls
bsd-user: add support for socket related system calls
bsd-user: add support for thread related system calls
bsd-user: add support for the ioctl system call
bsd-user: add support for extended attribute and ACL related syscalls
bsd-user: add support for miscellaneous system calls
bsd-user: add arm, mips and mips64 options to configure target-list
Makefile.target | 5 +- bsd-user/Makefile.objs | 6 +- bsd-user/arm/syscall.h | 36 + bsd-user/arm/target_arch.h | 10 + bsd-user/arm/target_arch_cpu.c | 27 + bsd-user/arm/target_arch_cpu.h | 435 +++++++ bsd-user/arm/target_arch_elf.h | 54 + bsd-user/arm/target_arch_signal.h | 257 +++++ bsd-user/arm/target_arch_sigtramp.h | 33 + bsd-user/arm/target_arch_sysarch.h | 81 ++ bsd-user/arm/target_arch_thread.h | 62 + bsd-user/arm/target_arch_vmparam.h | 49 + bsd-user/bsd-file.h | 1111 ++++++++++++++++++ bsd-user/bsd-ioctl.c | 448 ++++++++ bsd-user/bsd-ioctl.h | 27 + bsd-user/bsd-mem.c | 122 ++ bsd-user/bsd-mem.h | 393 +++++++ bsd-user/bsd-misc.c | 209 ++++ bsd-user/bsd-misc.h | 339 ++++++ bsd-user/bsd-proc.c | 160 +++ bsd-user/bsd-proc.h | 434 +++++++ bsd-user/bsd-signal.h | 232 ++++ bsd-user/bsd-socket.c | 108 ++ bsd-user/bsd-socket.h | 266 +++++ bsd-user/bsdload.c | 147 ++- bsd-user/elfload.c | 947 +++------------- bsd-user/errno_defs.h | 13 +- bsd-user/freebsd/host_os.h | 46 + bsd-user/freebsd/os-extattr.c | 119 ++ bsd-user/freebsd/os-extattr.h | 644 +++++++++++ bsd-user/freebsd/os-ioctl-cmds.h | 47 + bsd-user/freebsd/os-ioctl-filio.h | 45 + bsd-user/freebsd/os-ioctl-ioccom.h | 54 + bsd-user/freebsd/os-ioctl-ttycom.h | 257 +++++ bsd-user/freebsd/os-ioctl-types.h | 7 + bsd-user/freebsd/os-misc.h | 442 ++++++++ bsd-user/freebsd/os-proc.c | 234 ++++ bsd-user/freebsd/os-proc.h | 428 +++++++ bsd-user/freebsd/os-signal.h | 43 + bsd-user/freebsd/os-socket.c | 149 +++ bsd-user/freebsd/os-socket.h | 548 +++++++++ bsd-user/freebsd/os-stat.c | 234 ++++ bsd-user/freebsd/os-stat.h | 437 +++++++ bsd-user/freebsd/os-strace.h | 29 + bsd-user/freebsd/os-sys.c | 268 +++++ bsd-user/freebsd/os-thread.c | 936 +++++++++++++++ bsd-user/freebsd/os-thread.h | 510 +++++++++ bsd-user/freebsd/os-time.c | 205 ++++ bsd-user/freebsd/os-time.h | 643 +++++++++++ bsd-user/freebsd/qemu-os.h | 79 ++ bsd-user/freebsd/strace.list | 76 ++- bsd-user/freebsd/syscall_nr.h | 813 ++++++++------ bsd-user/freebsd/target_os_elf.h | 145 +++ bsd-user/freebsd/target_os_siginfo.h | 100 ++ bsd-user/freebsd/target_os_signal.h | 79 ++ bsd-user/freebsd/target_os_stack.h | 157 +++ bsd-user/freebsd/target_os_thread.h | 6 + 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 | 302 +++++ bsd-user/i386/target_arch_elf.h | 62 + bsd-user/i386/target_arch_signal.h | 94 ++ bsd-user/i386/target_arch_sigtramp.h | 11 + bsd-user/i386/target_arch_sysarch.h | 78 ++ bsd-user/i386/target_arch_thread.h | 45 + bsd-user/i386/target_arch_vmparam.h | 26 + bsd-user/i386/target_signal.h | 6 - bsd-user/main.c | 881 +++------------ bsd-user/mips/syscall.h | 52 + bsd-user/mips/target_arch.h | 10 + bsd-user/mips/target_arch_cpu.c | 27 + bsd-user/mips/target_arch_cpu.h | 243 ++++ bsd-user/mips/target_arch_elf.h | 36 + bsd-user/mips/target_arch_signal.h | 237 ++++ bsd-user/mips/target_arch_sigtramp.h | 23 + bsd-user/mips/target_arch_sysarch.h | 69 ++ bsd-user/mips/target_arch_thread.h | 54 + bsd-user/mips/target_arch_vmparam.h | 47 + bsd-user/mips64/syscall.h | 53 + bsd-user/mips64/target_arch.h | 10 + bsd-user/mips64/target_arch_cpu.c | 27 + bsd-user/mips64/target_arch_cpu.h | 243 ++++ bsd-user/mips64/target_arch_elf.h | 36 + bsd-user/mips64/target_arch_signal.h | 236 ++++ bsd-user/mips64/target_arch_sigtramp.h | 23 + bsd-user/mips64/target_arch_sysarch.h | 69 ++ bsd-user/mips64/target_arch_thread.h | 54 + bsd-user/mips64/target_arch_vmparam.h | 47 + bsd-user/mmap.c | 140 +-- bsd-user/netbsd/host_os.h | 31 + bsd-user/netbsd/os-extattr.h | 247 ++++ bsd-user/netbsd/os-ioctl-cmds.h | 48 + bsd-user/netbsd/os-ioctl-filio.h | 29 + bsd-user/netbsd/os-ioctl-ioccom.h | 38 + bsd-user/netbsd/os-ioctl-ttycom.h | 240 ++++ bsd-user/netbsd/os-ioctl-types.h | 7 + bsd-user/netbsd/os-misc.h | 375 ++++++ bsd-user/netbsd/os-proc.c | 11 + bsd-user/netbsd/os-proc.h | 243 ++++ bsd-user/netbsd/os-socket.c | 1 + bsd-user/netbsd/os-socket.h | 98 ++ bsd-user/netbsd/os-stat.c | 1 + bsd-user/netbsd/os-stat.h | 1 + bsd-user/netbsd/os-strace.h | 1 + bsd-user/netbsd/os-sys.c | 46 + bsd-user/netbsd/os-thread.c | 1 + bsd-user/netbsd/os-thread.h | 133 +++ bsd-user/netbsd/os-time.c | 1 + bsd-user/netbsd/os-time.h | 179 +++ bsd-user/netbsd/qemu-os.h | 1 + bsd-user/netbsd/target_os_elf.h | 226 ++++ bsd-user/netbsd/target_os_siginfo.h | 82 ++ bsd-user/netbsd/target_os_signal.h | 70 ++ bsd-user/netbsd/target_os_stack.h | 33 + bsd-user/netbsd/target_os_thread.h | 6 + bsd-user/openbsd/host_os.h | 31 + bsd-user/openbsd/os-extattr.h | 247 ++++ bsd-user/openbsd/os-ioctl-cmds.h | 48 + bsd-user/openbsd/os-ioctl-filio.h | 29 + bsd-user/openbsd/os-ioctl-ioccom.h | 38 + bsd-user/openbsd/os-ioctl-ttycom.h | 240 ++++ bsd-user/openbsd/os-ioctl-types.h | 7 + bsd-user/openbsd/os-misc.h | 375 ++++++ bsd-user/openbsd/os-proc.c | 11 + bsd-user/openbsd/os-proc.h | 243 ++++ bsd-user/openbsd/os-socket.c | 1 + bsd-user/openbsd/os-socket.h | 98 ++ bsd-user/openbsd/os-stat.c | 1 + bsd-user/openbsd/os-stat.h | 176 +++ bsd-user/openbsd/os-strace.h | 1 + bsd-user/openbsd/os-sys.c | 46 + bsd-user/openbsd/os-thread.c | 1 + bsd-user/openbsd/os-thread.h | 133 +++ bsd-user/openbsd/os-time.c | 1 + bsd-user/openbsd/os-time.h | 179 +++ bsd-user/openbsd/qemu-os.h | 1 + bsd-user/openbsd/target_os_elf.h | 226 ++++ bsd-user/openbsd/target_os_siginfo.h | 82 ++ bsd-user/openbsd/target_os_signal.h | 70 ++ bsd-user/openbsd/target_os_stack.h | 33 + bsd-user/openbsd/target_os_thread.h | 6 + bsd-user/qemu-bsd.h | 79 ++ bsd-user/qemu.h | 202 +++- bsd-user/signal.c | 907 +++++++++++++++- 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_elf.h | 30 + bsd-user/sparc/target_arch_signal.h | 77 ++ bsd-user/sparc/target_arch_sigtramp.h | 11 + bsd-user/sparc/target_arch_sysarch.h | 52 + bsd-user/sparc/target_arch_thread.h | 39 + bsd-user/sparc/target_arch_vmparam.h | 35 + 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_elf.h | 34 + bsd-user/sparc64/target_arch_signal.h | 94 ++ bsd-user/sparc64/target_arch_sigtramp.h | 11 + bsd-user/sparc64/target_arch_sysarch.h | 52 + bsd-user/sparc64/target_arch_thread.h | 55 + bsd-user/sparc64/target_arch_vmparam.h | 37 + bsd-user/sparc64/target_signal.h | 5 - bsd-user/strace.c | 175 ++- bsd-user/syscall.c | 1884 ++++++++++++++++++++++++------- bsd-user/syscall_defs.h | 860 +++++++++++++-- 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 | 324 ++++++ bsd-user/x86_64/target_arch_elf.h | 55 + bsd-user/x86_64/target_arch_signal.h | 94 ++ bsd-user/x86_64/target_arch_sigtramp.h | 11 + bsd-user/x86_64/target_arch_sysarch.h | 76 ++ bsd-user/x86_64/target_arch_thread.h | 40 + bsd-user/x86_64/target_arch_vmparam.h | 28 + bsd-user/x86_64/target_signal.h | 5 - configure | 11 + default-configs/arm-bsd-user.mak | 3 + default-configs/mips-bsd-user.mak | 1 + default-configs/mips64-bsd-user.mak | 1 + default-configs/mips64el-bsd-user.mak | 1 + default-configs/mipsel-bsd-user.mak | 1 + 188 files changed, 25101 insertions(+), 2614 deletions(-) create mode 100644 bsd-user/arm/syscall.h create mode 100644 bsd-user/arm/target_arch.h create mode 100644 bsd-user/arm/target_arch_cpu.c create mode 100644 bsd-user/arm/target_arch_cpu.h create mode 100644 bsd-user/arm/target_arch_elf.h create mode 100644 bsd-user/arm/target_arch_signal.h create mode 100644 bsd-user/arm/target_arch_sigtramp.h create mode 100644 bsd-user/arm/target_arch_sysarch.h create mode 100644 bsd-user/arm/target_arch_thread.h create mode 100644 bsd-user/arm/target_arch_vmparam.h create mode 100644 bsd-user/bsd-file.h create mode 100644 bsd-user/bsd-ioctl.c create mode 100644 bsd-user/bsd-ioctl.h create mode 100644 bsd-user/bsd-mem.c create mode 100644 bsd-user/bsd-mem.h create mode 100644 bsd-user/bsd-misc.c create mode 100644 bsd-user/bsd-misc.h create mode 100644 bsd-user/bsd-proc.c create mode 100644 bsd-user/bsd-proc.h create mode 100644 bsd-user/bsd-signal.h create mode 100644 bsd-user/bsd-socket.c create mode 100644 bsd-user/bsd-socket.h create mode 100644 bsd-user/freebsd/host_os.h create mode 100644 bsd-user/freebsd/os-extattr.c create mode 100644 bsd-user/freebsd/os-extattr.h create mode 100644 bsd-user/freebsd/os-ioctl-cmds.h create mode 100644 bsd-user/freebsd/os-ioctl-filio.h create mode 100644 bsd-user/freebsd/os-ioctl-ioccom.h create mode 100644 bsd-user/freebsd/os-ioctl-ttycom.h create mode 100644 bsd-user/freebsd/os-ioctl-types.h create mode 100644 bsd-user/freebsd/os-misc.h create mode 100644 bsd-user/freebsd/os-proc.c create mode 100644 bsd-user/freebsd/os-proc.h create mode 100644 bsd-user/freebsd/os-signal.h create mode 100644 bsd-user/freebsd/os-socket.c create mode 100644 bsd-user/freebsd/os-socket.h create mode 100644 bsd-user/freebsd/os-stat.c create mode 100644 bsd-user/freebsd/os-stat.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/os-thread.c create mode 100644 bsd-user/freebsd/os-thread.h create mode 100644 bsd-user/freebsd/os-time.c create mode 100644 bsd-user/freebsd/os-time.h create mode 100644 bsd-user/freebsd/qemu-os.h create mode 100644 bsd-user/freebsd/target_os_elf.h create mode 100644 bsd-user/freebsd/target_os_siginfo.h create mode 100644 bsd-user/freebsd/target_os_signal.h create mode 100644 bsd-user/freebsd/target_os_stack.h create mode 100644 bsd-user/freebsd/target_os_thread.h create mode 100644 bsd-user/freebsd/target_os_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_elf.h create mode 100644 bsd-user/i386/target_arch_signal.h create mode 100644 bsd-user/i386/target_arch_sigtramp.h create mode 100644 bsd-user/i386/target_arch_sysarch.h create mode 100644 bsd-user/i386/target_arch_thread.h create mode 100644 bsd-user/i386/target_arch_vmparam.h create mode 100644 bsd-user/mips/syscall.h create mode 100644 bsd-user/mips/target_arch.h create mode 100644 bsd-user/mips/target_arch_cpu.c create mode 100644 bsd-user/mips/target_arch_cpu.h create mode 100644 bsd-user/mips/target_arch_elf.h create mode 100644 bsd-user/mips/target_arch_signal.h create mode 100644 bsd-user/mips/target_arch_sigtramp.h create mode 100644 bsd-user/mips/target_arch_sysarch.h create mode 100644 bsd-user/mips/target_arch_thread.h create mode 100644 bsd-user/mips/target_arch_vmparam.h create mode 100644 bsd-user/mips64/syscall.h create mode 100644 bsd-user/mips64/target_arch.h create mode 100644 bsd-user/mips64/target_arch_cpu.c create mode 100644 bsd-user/mips64/target_arch_cpu.h create mode 100644 bsd-user/mips64/target_arch_elf.h create mode 100644 bsd-user/mips64/target_arch_signal.h create mode 100644 bsd-user/mips64/target_arch_sigtramp.h create mode 100644 bsd-user/mips64/target_arch_sysarch.h create mode 100644 bsd-user/mips64/target_arch_thread.h create mode 100644 bsd-user/mips64/target_arch_vmparam.h create mode 100644 bsd-user/netbsd/host_os.h create mode 100644 bsd-user/netbsd/os-extattr.h create mode 100644 bsd-user/netbsd/os-ioctl-cmds.h create mode 100644 bsd-user/netbsd/os-ioctl-filio.h create mode 100644 bsd-user/netbsd/os-ioctl-ioccom.h create mode 100644 bsd-user/netbsd/os-ioctl-ttycom.h create mode 100644 bsd-user/netbsd/os-ioctl-types.h create mode 100644 bsd-user/netbsd/os-misc.h create mode 100644 bsd-user/netbsd/os-proc.c create mode 100644 bsd-user/netbsd/os-proc.h create mode 100644 bsd-user/netbsd/os-socket.c create mode 100644 bsd-user/netbsd/os-socket.h create mode 100644 bsd-user/netbsd/os-stat.c create mode 100644 bsd-user/netbsd/os-stat.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/os-thread.c create mode 100644 bsd-user/netbsd/os-thread.h create mode 100644 bsd-user/netbsd/os-time.c create mode 100644 bsd-user/netbsd/os-time.h create mode 100644 bsd-user/netbsd/qemu-os.h create mode 100644 bsd-user/netbsd/target_os_elf.h create mode 100644 bsd-user/netbsd/target_os_siginfo.h create mode 100644 bsd-user/netbsd/target_os_signal.h create mode 100644 bsd-user/netbsd/target_os_stack.h create mode 100644 bsd-user/netbsd/target_os_thread.h create mode 100644 bsd-user/openbsd/host_os.h create mode 100644 bsd-user/openbsd/os-extattr.h create mode 100644 bsd-user/openbsd/os-ioctl-cmds.h create mode 100644 bsd-user/openbsd/os-ioctl-filio.h create mode 100644 bsd-user/openbsd/os-ioctl-ioccom.h create mode 100644 bsd-user/openbsd/os-ioctl-ttycom.h create mode 100644 bsd-user/openbsd/os-ioctl-types.h create mode 100644 bsd-user/openbsd/os-misc.h create mode 100644 bsd-user/openbsd/os-proc.c create mode 100644 bsd-user/openbsd/os-proc.h create mode 100644 bsd-user/openbsd/os-socket.c create mode 100644 bsd-user/openbsd/os-socket.h create mode 100644 bsd-user/openbsd/os-stat.c create mode 100644 bsd-user/openbsd/os-stat.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/os-thread.c create mode 100644 bsd-user/openbsd/os-thread.h create mode 100644 bsd-user/openbsd/os-time.c create mode 100644 bsd-user/openbsd/os-time.h create mode 100644 bsd-user/openbsd/qemu-os.h create mode 100644 bsd-user/openbsd/target_os_elf.h create mode 100644 bsd-user/openbsd/target_os_siginfo.h create mode 100644 bsd-user/openbsd/target_os_signal.h create mode 100644 bsd-user/openbsd/target_os_stack.h create mode 100644 bsd-user/openbsd/target_os_thread.h create mode 100644 bsd-user/qemu-bsd.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_elf.h create mode 100644 bsd-user/sparc/target_arch_signal.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_thread.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_elf.h create mode 100644 bsd-user/sparc64/target_arch_signal.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_thread.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_elf.h create mode 100644 bsd-user/x86_64/target_arch_signal.h create mode 100644 bsd-user/x86_64/target_arch_sigtramp.h create mode 100644 bsd-user/x86_64/target_arch_sysarch.h create mode 100644 bsd-user/x86_64/target_arch_thread.h create mode 100644 bsd-user/x86_64/target_arch_vmparam.h create mode 100644 default-configs/arm-bsd-user.mak create mode 100644 default-configs/mips-bsd-user.mak create mode 100644 default-configs/mips64-bsd-user.mak create mode 100644 default-configs/mips64el-bsd-user.mak create mode 100644 default-configs/mipsel-bsd-user.mak
Signature · 1 line
1.7.8
PATCH 1/18 bsd-user: refresh freebsd system call numbers
Update FreeBSD system call numbers in freebsd/syscall_nr.h.
--- bsd-user/freebsd/syscall_nr.h | 813 ++++++++++++++++++++++------------------- 1 files changed, 445 insertions(+), 368 deletions(-)
bsd-user/freebsd/syscall_nr.h +445 -368
@@ -1,373 +1,450 @@/* * System call numbers. * -* $FreeBSD: src/sys/sys/syscall.h,v 1.224 2008/08/24 21:23:08 rwatson Exp $ -* created from FreeBSD: head/sys/kern/syscalls.master 182123 2008-08-24 21:20:35Z rwatson +* created from FreeBSD: releng/9.1/sys/kern/syscalls.master 229723 +* 2012-01-06 19:29:16Z jhb */ -#define TARGET_FREEBSD_NR_syscall 0 -#define TARGET_FREEBSD_NR_exit 1 -#define TARGET_FREEBSD_NR_fork 2 -#define TARGET_FREEBSD_NR_read 3 -#define TARGET_FREEBSD_NR_write 4 -#define TARGET_FREEBSD_NR_open 5 -#define TARGET_FREEBSD_NR_close 6 -#define TARGET_FREEBSD_NR_wait4 7 -#define TARGET_FREEBSD_NR_link 9 -#define TARGET_FREEBSD_NR_unlink 10 -#define TARGET_FREEBSD_NR_chdir 12 -#define TARGET_FREEBSD_NR_fchdir 13 -#define TARGET_FREEBSD_NR_mknod 14 -#define TARGET_FREEBSD_NR_chmod 15 -#define TARGET_FREEBSD_NR_chown 16 -#define TARGET_FREEBSD_NR_break 17 -#define TARGET_FREEBSD_NR_freebsd4_getfsstat 18 -#define TARGET_FREEBSD_NR_getpid 20 -#define TARGET_FREEBSD_NR_mount 21 -#define TARGET_FREEBSD_NR_unmount 22 -#define TARGET_FREEBSD_NR_setuid 23 -#define TARGET_FREEBSD_NR_getuid 24 -#define TARGET_FREEBSD_NR_geteuid 25 -#define TARGET_FREEBSD_NR_ptrace 26 -#define TARGET_FREEBSD_NR_recvmsg 27 -#define TARGET_FREEBSD_NR_sendmsg 28 -#define TARGET_FREEBSD_NR_recvfrom 29 -#define TARGET_FREEBSD_NR_accept 30 -#define TARGET_FREEBSD_NR_getpeername 31 -#define TARGET_FREEBSD_NR_getsockname 32 -#define TARGET_FREEBSD_NR_access 33 -#define TARGET_FREEBSD_NR_chflags 34 -#define TARGET_FREEBSD_NR_fchflags 35 -#define TARGET_FREEBSD_NR_sync 36 -#define TARGET_FREEBSD_NR_kill 37 -#define TARGET_FREEBSD_NR_getppid 39 -#define TARGET_FREEBSD_NR_dup 41 -#define TARGET_FREEBSD_NR_pipe 42 -#define TARGET_FREEBSD_NR_getegid 43 -#define TARGET_FREEBSD_NR_profil 44 -#define TARGET_FREEBSD_NR_ktrace 45 -#define TARGET_FREEBSD_NR_getgid 47 -#define TARGET_FREEBSD_NR_getlogin 49 -#define TARGET_FREEBSD_NR_setlogin 50 -#define TARGET_FREEBSD_NR_acct 51 -#define TARGET_FREEBSD_NR_sigaltstack 53 -#define TARGET_FREEBSD_NR_ioctl 54 -#define TARGET_FREEBSD_NR_reboot 55 -#define TARGET_FREEBSD_NR_revoke 56 -#define TARGET_FREEBSD_NR_symlink 57 -#define TARGET_FREEBSD_NR_readlink 58 -#define TARGET_FREEBSD_NR_execve 59 -#define TARGET_FREEBSD_NR_umask 60 -#define TARGET_FREEBSD_NR_chroot 61 -#define TARGET_FREEBSD_NR_msync 65 -#define TARGET_FREEBSD_NR_vfork 66 -#define TARGET_FREEBSD_NR_sbrk 69 -#define TARGET_FREEBSD_NR_sstk 70 -#define TARGET_FREEBSD_NR_vadvise 72 -#define TARGET_FREEBSD_NR_munmap 73 -#define TARGET_FREEBSD_NR_mprotect 74 -#define TARGET_FREEBSD_NR_madvise 75 -#define TARGET_FREEBSD_NR_mincore 78 -#define TARGET_FREEBSD_NR_getgroups 79 -#define TARGET_FREEBSD_NR_setgroups 80 -#define TARGET_FREEBSD_NR_getpgrp 81 -#define TARGET_FREEBSD_NR_setpgid 82 -#define TARGET_FREEBSD_NR_setitimer 83 -#define TARGET_FREEBSD_NR_swapon 85 -#define TARGET_FREEBSD_NR_getitimer 86 -#define TARGET_FREEBSD_NR_getdtablesize 89 -#define TARGET_FREEBSD_NR_dup2 90 -#define TARGET_FREEBSD_NR_fcntl 92 -#define TARGET_FREEBSD_NR_select 93 -#define TARGET_FREEBSD_NR_fsync 95 -#define TARGET_FREEBSD_NR_setpriority 96 -#define TARGET_FREEBSD_NR_socket 97 -#define TARGET_FREEBSD_NR_connect 98 -#define TARGET_FREEBSD_NR_getpriority 100 -#define TARGET_FREEBSD_NR_bind 104 -#define TARGET_FREEBSD_NR_setsockopt 105 -#define TARGET_FREEBSD_NR_listen 106 -#define TARGET_FREEBSD_NR_gettimeofday 116 -#define TARGET_FREEBSD_NR_getrusage 117 -#define TARGET_FREEBSD_NR_getsockopt 118 -#define TARGET_FREEBSD_NR_readv 120 -#define TARGET_FREEBSD_NR_writev 121 -#define TARGET_FREEBSD_NR_settimeofday 122 -#define TARGET_FREEBSD_NR_fchown 123 -#define TARGET_FREEBSD_NR_fchmod 124 -#define TARGET_FREEBSD_NR_setreuid 126 -#define TARGET_FREEBSD_NR_setregid 127 -#define TARGET_FREEBSD_NR_rename 128 -#define TARGET_FREEBSD_NR_flock 131 -#define TARGET_FREEBSD_NR_mkfifo 132 -#define TARGET_FREEBSD_NR_sendto 133 -#define TARGET_FREEBSD_NR_shutdown 134 -#define TARGET_FREEBSD_NR_socketpair 135 -#define TARGET_FREEBSD_NR_mkdir 136 -#define TARGET_FREEBSD_NR_rmdir 137 -#define TARGET_FREEBSD_NR_utimes 138 -#define TARGET_FREEBSD_NR_adjtime 140 -#define TARGET_FREEBSD_NR_setsid 147 -#define TARGET_FREEBSD_NR_quotactl 148 -#define TARGET_FREEBSD_NR_nlm_syscall 154 -#define TARGET_FREEBSD_NR_nfssvc 155 -#define TARGET_FREEBSD_NR_freebsd4_statfs 157 -#define TARGET_FREEBSD_NR_freebsd4_fstatfs 158 -#define TARGET_FREEBSD_NR_lgetfh 160 -#define TARGET_FREEBSD_NR_getfh 161 -#define TARGET_FREEBSD_NR_getdomainname 162 -#define TARGET_FREEBSD_NR_setdomainname 163 -#define TARGET_FREEBSD_NR_uname 164 -#define TARGET_FREEBSD_NR_sysarch 165 -#define TARGET_FREEBSD_NR_rtprio 166 -#define TARGET_FREEBSD_NR_semsys 169 -#define TARGET_FREEBSD_NR_msgsys 170 -#define TARGET_FREEBSD_NR_shmsys 171 -#define TARGET_FREEBSD_NR_freebsd6_pread 173 -#define TARGET_FREEBSD_NR_freebsd6_pwrite 174 -#define TARGET_FREEBSD_NR_setfib 175 -#define TARGET_FREEBSD_NR_ntp_adjtime 176 -#define TARGET_FREEBSD_NR_setgid 181 -#define TARGET_FREEBSD_NR_setegid 182 -#define TARGET_FREEBSD_NR_seteuid 183 -#define TARGET_FREEBSD_NR_stat 188 -#define TARGET_FREEBSD_NR_fstat 189 -#define TARGET_FREEBSD_NR_lstat 190 -#define TARGET_FREEBSD_NR_pathconf 191 -#define TARGET_FREEBSD_NR_fpathconf 192 -#define TARGET_FREEBSD_NR_getrlimit 194 -#define TARGET_FREEBSD_NR_setrlimit 195 -#define TARGET_FREEBSD_NR_getdirentries 196 -#define TARGET_FREEBSD_NR_freebsd6_mmap 197 -#define TARGET_FREEBSD_NR___syscall 198 -#define TARGET_FREEBSD_NR_freebsd6_lseek 199 -#define TARGET_FREEBSD_NR_freebsd6_truncate 200 -#define TARGET_FREEBSD_NR_freebsd6_ftruncate 201 -#define TARGET_FREEBSD_NR___sysctl 202 -#define TARGET_FREEBSD_NR_mlock 203 -#define TARGET_FREEBSD_NR_munlock 204 -#define TARGET_FREEBSD_NR_undelete 205 -#define TARGET_FREEBSD_NR_futimes 206 -#define TARGET_FREEBSD_NR_getpgid 207 -#define TARGET_FREEBSD_NR_poll 209 -#define TARGET_FREEBSD_NR___semctl 220 -#define TARGET_FREEBSD_NR_semget 221 -#define TARGET_FREEBSD_NR_semop 222 -#define TARGET_FREEBSD_NR_msgctl 224 -#define TARGET_FREEBSD_NR_msgget 225 -#define TARGET_FREEBSD_NR_msgsnd 226 -#define TARGET_FREEBSD_NR_msgrcv 227 -#define TARGET_FREEBSD_NR_shmat 228 -#define TARGET_FREEBSD_NR_shmctl 229 -#define TARGET_FREEBSD_NR_shmdt 230 -#define TARGET_FREEBSD_NR_shmget 231 -#define TARGET_FREEBSD_NR_clock_gettime 232 -#define TARGET_FREEBSD_NR_clock_settime 233 -#define TARGET_FREEBSD_NR_clock_getres 234 -#define TARGET_FREEBSD_NR_ktimer_create 235 -#define TARGET_FREEBSD_NR_ktimer_delete 236 -#define TARGET_FREEBSD_NR_ktimer_settime 237 -#define TARGET_FREEBSD_NR_ktimer_gettime 238 -#define TARGET_FREEBSD_NR_ktimer_getoverrun 239 -#define TARGET_FREEBSD_NR_nanosleep 240 -#define TARGET_FREEBSD_NR_ntp_gettime 248 -#define TARGET_FREEBSD_NR_minherit 250 -#define TARGET_FREEBSD_NR_rfork 251 -#define TARGET_FREEBSD_NR_openbsd_poll 252 -#define TARGET_FREEBSD_NR_issetugid 253 -#define TARGET_FREEBSD_NR_lchown 254 -#define TARGET_FREEBSD_NR_aio_read 255 -#define TARGET_FREEBSD_NR_aio_write 256 -#define TARGET_FREEBSD_NR_lio_listio 257 -#define TARGET_FREEBSD_NR_getdents 272 -#define TARGET_FREEBSD_NR_lchmod 274 -#define TARGET_FREEBSD_NR_netbsd_lchown 275 -#define TARGET_FREEBSD_NR_lutimes 276 -#define TARGET_FREEBSD_NR_netbsd_msync 277 -#define TARGET_FREEBSD_NR_nstat 278 -#define TARGET_FREEBSD_NR_nfstat 279 -#define TARGET_FREEBSD_NR_nlstat 280 -#define TARGET_FREEBSD_NR_preadv 289 -#define TARGET_FREEBSD_NR_pwritev 290 -#define TARGET_FREEBSD_NR_freebsd4_fhstatfs 297 -#define TARGET_FREEBSD_NR_fhopen 298 -#define TARGET_FREEBSD_NR_fhstat 299 -#define TARGET_FREEBSD_NR_modnext 300 -#define TARGET_FREEBSD_NR_modstat 301 -#define TARGET_FREEBSD_NR_modfnext 302 -#define TARGET_FREEBSD_NR_modfind 303 -#define TARGET_FREEBSD_NR_kldload 304 -#define TARGET_FREEBSD_NR_kldunload 305 -#define TARGET_FREEBSD_NR_kldfind 306 -#define TARGET_FREEBSD_NR_kldnext 307 -#define TARGET_FREEBSD_NR_kldstat 308 -#define TARGET_FREEBSD_NR_kldfirstmod 309 -#define TARGET_FREEBSD_NR_getsid 310 -#define TARGET_FREEBSD_NR_setresuid 311 -#define TARGET_FREEBSD_NR_setresgid 312 -#define TARGET_FREEBSD_NR_aio_return 314 -#define TARGET_FREEBSD_NR_aio_suspend 315 -#define TARGET_FREEBSD_NR_aio_cancel 316 -#define TARGET_FREEBSD_NR_aio_error 317 -#define TARGET_FREEBSD_NR_oaio_read 318 -#define TARGET_FREEBSD_NR_oaio_write 319 -#define TARGET_FREEBSD_NR_olio_listio 320 -#define TARGET_FREEBSD_NR_yield 321 -#define TARGET_FREEBSD_NR_mlockall 324 -#define TARGET_FREEBSD_NR_munlockall 325 -#define TARGET_FREEBSD_NR___getcwd 326 -#define TARGET_FREEBSD_NR_sched_setparam 327 -#define TARGET_FREEBSD_NR_sched_getparam 328 -#define TARGET_FREEBSD_NR_sched_setscheduler 329 -#define TARGET_FREEBSD_NR_sched_getscheduler 330 -#define TARGET_FREEBSD_NR_sched_yield 331 -#define TARGET_FREEBSD_NR_sched_get_priority_max 332 -#define TARGET_FREEBSD_NR_sched_get_priority_min 333 -#define TARGET_FREEBSD_NR_sched_rr_get_interval 334 -#define TARGET_FREEBSD_NR_utrace 335 -#define TARGET_FREEBSD_NR_freebsd4_sendfile 336 -#define TARGET_FREEBSD_NR_kldsym 337 -#define TARGET_FREEBSD_NR_jail 338 -#define TARGET_FREEBSD_NR_sigprocmask 340 -#define TARGET_FREEBSD_NR_sigsuspend 341 -#define TARGET_FREEBSD_NR_freebsd4_sigaction 342 -#define TARGET_FREEBSD_NR_sigpending 343 -#define TARGET_FREEBSD_NR_freebsd4_sigreturn 344 -#define TARGET_FREEBSD_NR_sigtimedwait 345 -#define TARGET_FREEBSD_NR_sigwaitinfo 346 -#define TARGET_FREEBSD_NR___acl_get_file 347 -#define TARGET_FREEBSD_NR___acl_set_file 348 -#define TARGET_FREEBSD_NR___acl_get_fd 349 -#define TARGET_FREEBSD_NR___acl_set_fd 350 -#define TARGET_FREEBSD_NR___acl_delete_file 351 -#define TARGET_FREEBSD_NR___acl_delete_fd 352 -#define TARGET_FREEBSD_NR___acl_aclcheck_file 353 -#define TARGET_FREEBSD_NR___acl_aclcheck_fd 354 -#define TARGET_FREEBSD_NR_extattrctl 355 -#define TARGET_FREEBSD_NR_extattr_set_file 356 -#define TARGET_FREEBSD_NR_extattr_get_file 357 -#define TARGET_FREEBSD_NR_extattr_delete_file 358 -#define TARGET_FREEBSD_NR_aio_waitcomplete 359 -#define TARGET_FREEBSD_NR_getresuid 360 -#define TARGET_FREEBSD_NR_getresgid 361 -#define TARGET_FREEBSD_NR_kqueue 362 -#define TARGET_FREEBSD_NR_kevent 363 -#define TARGET_FREEBSD_NR_extattr_set_fd 371 -#define TARGET_FREEBSD_NR_extattr_get_fd 372 -#define TARGET_FREEBSD_NR_extattr_delete_fd 373 -#define TARGET_FREEBSD_NR___setugid 374 -#define TARGET_FREEBSD_NR_nfsclnt 375 -#define TARGET_FREEBSD_NR_eaccess 376 -#define TARGET_FREEBSD_NR_nmount 378 -#define TARGET_FREEBSD_NR___mac_get_proc 384 -#define TARGET_FREEBSD_NR___mac_set_proc 385 -#define TARGET_FREEBSD_NR___mac_get_fd 386 -#define TARGET_FREEBSD_NR___mac_get_file 387 -#define TARGET_FREEBSD_NR___mac_set_fd 388 -#define TARGET_FREEBSD_NR___mac_set_file 389 -#define TARGET_FREEBSD_NR_kenv 390 -#define TARGET_FREEBSD_NR_lchflags 391 -#define TARGET_FREEBSD_NR_uuidgen 392 -#define TARGET_FREEBSD_NR_sendfile 393 -#define TARGET_FREEBSD_NR_mac_syscall 394 -#define TARGET_FREEBSD_NR_getfsstat 395 -#define TARGET_FREEBSD_NR_statfs 396 -#define TARGET_FREEBSD_NR_fstatfs 397 -#define TARGET_FREEBSD_NR_fhstatfs 398 -#define TARGET_FREEBSD_NR_ksem_close 400 -#define TARGET_FREEBSD_NR_ksem_post 401 -#define TARGET_FREEBSD_NR_ksem_wait 402 -#define TARGET_FREEBSD_NR_ksem_trywait 403 -#define TARGET_FREEBSD_NR_ksem_init 404 -#define TARGET_FREEBSD_NR_ksem_open 405 -#define TARGET_FREEBSD_NR_ksem_unlink 406 -#define TARGET_FREEBSD_NR_ksem_getvalue 407 -#define TARGET_FREEBSD_NR_ksem_destroy 408 -#define TARGET_FREEBSD_NR___mac_get_pid 409 -#define TARGET_FREEBSD_NR___mac_get_link 410 -#define TARGET_FREEBSD_NR___mac_set_link 411 -#define TARGET_FREEBSD_NR_extattr_set_link 412 -#define TARGET_FREEBSD_NR_extattr_get_link 413 -#define TARGET_FREEBSD_NR_extattr_delete_link 414 -#define TARGET_FREEBSD_NR___mac_execve 415 -#define TARGET_FREEBSD_NR_sigaction 416 -#define TARGET_FREEBSD_NR_sigreturn 417 -#define TARGET_FREEBSD_NR_getcontext 421 -#define TARGET_FREEBSD_NR_setcontext 422 -#define TARGET_FREEBSD_NR_swapcontext 423 -#define TARGET_FREEBSD_NR_swapoff 424 -#define TARGET_FREEBSD_NR___acl_get_link 425 -#define TARGET_FREEBSD_NR___acl_set_link 426 -#define TARGET_FREEBSD_NR___acl_delete_link 427 -#define TARGET_FREEBSD_NR___acl_aclcheck_link 428 -#define TARGET_FREEBSD_NR_sigwait 429 -#define TARGET_FREEBSD_NR_thr_create 430 -#define TARGET_FREEBSD_NR_thr_exit 431 -#define TARGET_FREEBSD_NR_thr_self 432 -#define TARGET_FREEBSD_NR_thr_kill 433 -#define TARGET_FREEBSD_NR__umtx_lock 434 -#define TARGET_FREEBSD_NR__umtx_unlock 435 -#define TARGET_FREEBSD_NR_jail_attach 436 -#define TARGET_FREEBSD_NR_extattr_list_fd 437 -#define TARGET_FREEBSD_NR_extattr_list_file 438 -#define TARGET_FREEBSD_NR_extattr_list_link 439 -#define TARGET_FREEBSD_NR_ksem_timedwait 441 -#define TARGET_FREEBSD_NR_thr_suspend 442 -#define TARGET_FREEBSD_NR_thr_wake 443 -#define TARGET_FREEBSD_NR_kldunloadf 444 -#define TARGET_FREEBSD_NR_audit 445 -#define TARGET_FREEBSD_NR_auditon 446 -#define TARGET_FREEBSD_NR_getauid 447 -#define TARGET_FREEBSD_NR_setauid 448 -#define TARGET_FREEBSD_NR_getaudit 449 -#define TARGET_FREEBSD_NR_setaudit 450 -#define TARGET_FREEBSD_NR_getaudit_addr 451 -#define TARGET_FREEBSD_NR_setaudit_addr 452 -#define TARGET_FREEBSD_NR_auditctl 453 -#define TARGET_FREEBSD_NR__umtx_op 454 -#define TARGET_FREEBSD_NR_thr_new 455 -#define TARGET_FREEBSD_NR_sigqueue 456 -#define TARGET_FREEBSD_NR_kmq_open 457 -#define TARGET_FREEBSD_NR_kmq_setattr 458 -#define TARGET_FREEBSD_NR_kmq_timedreceive 459 -#define TARGET_FREEBSD_NR_kmq_timedsend 460 -#define TARGET_FREEBSD_NR_kmq_notify 461 -#define TARGET_FREEBSD_NR_kmq_unlink 462 -#define TARGET_FREEBSD_NR_abort2 463 -#define TARGET_FREEBSD_NR_thr_set_name 464 -#define TARGET_FREEBSD_NR_aio_fsync 465 -#define TARGET_FREEBSD_NR_rtprio_thread 466 -#define TARGET_FREEBSD_NR_sctp_peeloff 471 -#define TARGET_FREEBSD_NR_sctp_generic_sendmsg 472 -#define TARGET_FREEBSD_NR_sctp_generic_sendmsg_iov 473 -#define TARGET_FREEBSD_NR_sctp_generic_recvmsg 474 -#define TARGET_FREEBSD_NR_pread 475 -#define TARGET_FREEBSD_NR_pwrite 476 -#define TARGET_FREEBSD_NR_mmap 477 -#define TARGET_FREEBSD_NR_lseek 478 -#define TARGET_FREEBSD_NR_truncate 479 -#define TARGET_FREEBSD_NR_ftruncate 480 -#define TARGET_FREEBSD_NR_thr_kill2 481 -#define TARGET_FREEBSD_NR_shm_open 482 -#define TARGET_FREEBSD_NR_shm_unlink 483 -#define TARGET_FREEBSD_NR_cpuset 484 -#define TARGET_FREEBSD_NR_cpuset_setid 485 -#define TARGET_FREEBSD_NR_cpuset_getid 486 -#define TARGET_FREEBSD_NR_cpuset_getaffinity 487 -#define TARGET_FREEBSD_NR_cpuset_setaffinity 488 -#define TARGET_FREEBSD_NR_faccessat 489 -#define TARGET_FREEBSD_NR_fchmodat 490 -#define TARGET_FREEBSD_NR_fchownat 491 -#define TARGET_FREEBSD_NR_fexecve 492 -#define TARGET_FREEBSD_NR_fstatat 493 -#define TARGET_FREEBSD_NR_futimesat 494 -#define TARGET_FREEBSD_NR_linkat 495 -#define TARGET_FREEBSD_NR_mkdirat 496 -#define TARGET_FREEBSD_NR_mkfifoat 497 -#define TARGET_FREEBSD_NR_mknodat 498 -#define TARGET_FREEBSD_NR_openat 499 -#define TARGET_FREEBSD_NR_readlinkat 500 -#define TARGET_FREEBSD_NR_renameat 501 -#define TARGET_FREEBSD_NR_symlinkat 502 -#define TARGET_FREEBSD_NR_unlinkat 503 -#define TARGET_FREEBSD_NR_posix_openpt 504 +#define TARGET_FREEBSD_NR_syscall 0 +#define TARGET_FREEBSD_NR_exit 1 +#define TARGET_FREEBSD_NR_fork 2 +#define TARGET_FREEBSD_NR_read 3 +#define TARGET_FREEBSD_NR_write 4 +#define TARGET_FREEBSD_NR_open 5 +#define TARGET_FREEBSD_NR_close 6 +#define TARGET_FREEBSD_NR_wait4 7 +/* 8 is old creat */ +#define TARGET_FREEBSD_NR_link 9 +#define TARGET_FREEBSD_NR_unlink 10 +/* 11 is obsolete execv */ +#define TARGET_FREEBSD_NR_chdir 12 +#define TARGET_FREEBSD_NR_fchdir 13 +#define TARGET_FREEBSD_NR_mknod 14 +#define TARGET_FREEBSD_NR_chmod 15 +#define TARGET_FREEBSD_NR_chown 16 +#define TARGET_FREEBSD_NR_break 17 +#define TARGET_FREEBSD_NR_freebsd4_getfsstat 18 +/* 19 is old lseek */ +#define TARGET_FREEBSD_NR_getpid 20 +#define TARGET_FREEBSD_NR_mount 21 +#define TARGET_FREEBSD_NR_unmount 22 +#define TARGET_FREEBSD_NR_setuid 23 +#define TARGET_FREEBSD_NR_getuid 24 +#define TARGET_FREEBSD_NR_geteuid 25 +#define TARGET_FREEBSD_NR_ptrace 26 +#define TARGET_FREEBSD_NR_recvmsg 27 +#define TARGET_FREEBSD_NR_sendmsg 28 +#define TARGET_FREEBSD_NR_recvfrom 29 +#define TARGET_FREEBSD_NR_accept 30 +#define TARGET_FREEBSD_NR_getpeername 31 +#define TARGET_FREEBSD_NR_getsockname 32 +#define TARGET_FREEBSD_NR_access 33 +#define TARGET_FREEBSD_NR_chflags 34 +#define TARGET_FREEBSD_NR_fchflags 35 +#define TARGET_FREEBSD_NR_sync 36 +#define TARGET_FREEBSD_NR_kill 37 +/* 38 is old stat */ +#define TARGET_FREEBSD_NR_getppid 39 +/* 40 is old lstat */ +#define TARGET_FREEBSD_NR_dup 41 +#define TARGET_FREEBSD_NR_pipe 42 +#define TARGET_FREEBSD_NR_getegid 43 +#define TARGET_FREEBSD_NR_profil 44 +#define TARGET_FREEBSD_NR_ktrace 45 +/* 46 is old sigaction */ +#define TARGET_FREEBSD_NR_getgid 47 +/* 48 is old sigprocmask */ +#define TARGET_FREEBSD_NR_getlogin 49 +#define TARGET_FREEBSD_NR_setlogin 50 +#define TARGET_FREEBSD_NR_acct 51 +/* 52 is old sigpending */ +#define TARGET_FREEBSD_NR_sigaltstack 53 +#define TARGET_FREEBSD_NR_ioctl 54 +#define TARGET_FREEBSD_NR_reboot 55 +#define TARGET_FREEBSD_NR_revoke 56 +#define TARGET_FREEBSD_NR_symlink 57 +#define TARGET_FREEBSD_NR_readlink 58 +#define TARGET_FREEBSD_NR_execve 59 +#define TARGET_FREEBSD_NR_umask 60 +#define TARGET_FREEBSD_NR_chroot 61 +/* 62 is old fstat */ +/* 63 is old getkerninfo */ +/* 64 is old getpagesize */ +#define TARGET_FREEBSD_NR_msync 65 +#define TARGET_FREEBSD_NR_vfork 66 +/* 67 is obsolete vread */ +/* 68 is obsolete vwrite */ +#define TARGET_FREEBSD_NR_sbrk 69 +#define TARGET_FREEBSD_NR_sstk 70 +/* 71 is old mmap */ +#define TARGET_FREEBSD_NR_vadvise 72 +#define TARGET_FREEBSD_NR_munmap 73 +#define TARGET_FREEBSD_NR_mprotect 74 +#define TARGET_FREEBSD_NR_madvise 75 +/* 76 is obsolete vhangup */ +/* 77 is obsolete vlimit */ +#define TARGET_FREEBSD_NR_mincore 78 +#define TARGET_FREEBSD_NR_getgroups 79 +#define TARGET_FREEBSD_NR_setgroups 80 +#define TARGET_FREEBSD_NR_getpgrp 81 +#define TARGET_FREEBSD_NR_setpgid 82 +#define TARGET_FREEBSD_NR_setitimer 83 +/* 84 is old wait */ +#define TARGET_FREEBSD_NR_swapon 85 +#define TARGET_FREEBSD_NR_getitimer 86 +/* 87 is old gethostname */ +/* 88 is old sethostname */ +#define TARGET_FREEBSD_NR_getdtablesize 89 +#define TARGET_FREEBSD_NR_dup2 90 +#define TARGET_FREEBSD_NR_fcntl 92 +#define TARGET_FREEBSD_NR_select 93 +#define TARGET_FREEBSD_NR_fsync 95 +#define TARGET_FREEBSD_NR_setpriority 96 +#define TARGET_FREEBSD_NR_socket 97 +#define TARGET_FREEBSD_NR_connect 98 +/* 99 is old accept */ +#define TARGET_FREEBSD_NR_getpriority 100 +/* 101 is old send */ +/* 102 is old recv */ +/* 103 is old sigreturn */ +#define TARGET_FREEBSD_NR_bind 104 +#define TARGET_FREEBSD_NR_setsockopt 105 +#define TARGET_FREEBSD_NR_listen 106 +/* 107 is obsolete vtimes */ +/* 108 is old sigvec */ +/* 109 is old sigblock */ +/* 110 is old sigsetmask */ +/* 111 is old sigsuspend */ +/* 112 is old sigstack */ +/* 113 is old recvmsg */ +/* 114 is old sendmsg */ +/* 115 is obsolete vtrace */ +#define TARGET_FREEBSD_NR_gettimeofday 116 +#define TARGET_FREEBSD_NR_getrusage 117 +#define TARGET_FREEBSD_NR_getsockopt 118 +#define TARGET_FREEBSD_NR_readv 120 +#define TARGET_FREEBSD_NR_writev 121 +#define TARGET_FREEBSD_NR_settimeofday 122 +#define TARGET_FREEBSD_NR_fchown 123 +#define TARGET_FREEBSD_NR_fchmod 124 +/* 125 is old recvfrom */ +#define TARGET_FREEBSD_NR_setreuid 126 +#define TARGET_FREEBSD_NR_setregid 127 +#define TARGET_FREEBSD_NR_rename 128 +/* 129 is old truncate */ +/* 130 is old ftruncate */ +#define TARGET_FREEBSD_NR_flock 131 +#define TARGET_FREEBSD_NR_mkfifo 132 +#define TARGET_FREEBSD_NR_sendto 133 +#define TARGET_FREEBSD_NR_shutdown 134 +#define TARGET_FREEBSD_NR_socketpair 135 +#define TARGET_FREEBSD_NR_mkdir 136 +#define TARGET_FREEBSD_NR_rmdir 137 +#define TARGET_FREEBSD_NR_utimes 138 +/* 139 is obsolete 4.2 sigreturn */ +#define TARGET_FREEBSD_NR_adjtime 140 +/* 141 is old getpeername */ +/* 142 is old gethostid */ +/* 143 is old sethostid */ +/* 144 is old getrlimit */ +/* 145 is old setrlimit */ +/* 146 is old killpg */ +#define TARGET_FREEBSD_NR_killpg 146/* COMPAT */ +#define TARGET_FREEBSD_NR_setsid 147 +#define TARGET_FREEBSD_NR_quotactl 148 +/* 149 is old quota */ +/* 150 is old getsockname */ +#define TARGET_FREEBSD_NR_nlm_syscall 154 +#define TARGET_FREEBSD_NR_nfssvc 155 +/* 156 is old getdirentries */ +#define TARGET_FREEBSD_NR_freebsd4_statfs 157 +#define TARGET_FREEBSD_NR_freebsd4_fstatfs 158 +#define TARGET_FREEBSD_NR_lgetfh 160 +#define TARGET_FREEBSD_NR_getfh 161 +#define TARGET_FREEBSD_NR_freebsd4_getdomainname 162 +#define TARGET_FREEBSD_NR_freebsd4_setdomainname 163 +#define TARGET_FREEBSD_NR_freebsd4_uname 164 +#define TARGET_FREEBSD_NR_sysarch 165 +#define TARGET_FREEBSD_NR_rtprio 166 +#define TARGET_FREEBSD_NR_semsys 169 +#define TARGET_FREEBSD_NR_msgsys 170 +#define TARGET_FREEBSD_NR_shmsys 171 +#define TARGET_FREEBSD_NR_freebsd6_pread 173 +#define TARGET_FREEBSD_NR_freebsd6_pwrite 174 +#define TARGET_FREEBSD_NR_setfib 175 +#define TARGET_FREEBSD_NR_ntp_adjtime 176 +#define TARGET_FREEBSD_NR_setgid 181 +#define TARGET_FREEBSD_NR_setegid 182 +#define TARGET_FREEBSD_NR_seteuid 183 +#define TARGET_FREEBSD_NR_stat 188 +#define TARGET_FREEBSD_NR_fstat 189 +#define TARGET_FREEBSD_NR_lstat 190 +#define TARGET_FREEBSD_NR_pathconf 191 +#define TARGET_FREEBSD_NR_fpathconf 192 +#define TARGET_FREEBSD_NR_getrlimit 194 +#define TARGET_FREEBSD_NR_setrlimit 195 +#define TARGET_FREEBSD_NR_getdirentries 196 +#define TARGET_FREEBSD_NR_freebsd6_mmap 197 +#define TARGET_FREEBSD_NR___syscall 198 +#define TARGET_FREEBSD_NR_freebsd6_lseek 199 +#define TARGET_FREEBSD_NR_freebsd6_truncate 200 +#define TARGET_FREEBSD_NR_freebsd6_ftruncate 201 +#define TARGET_FREEBSD_NR___sysctl 202 +#define TARGET_FREEBSD_NR_mlock 203 +#define TARGET_FREEBSD_NR_munlock 204 +#define TARGET_FREEBSD_NR_undelete 205 +#define TARGET_FREEBSD_NR_futimes 206 +#define TARGET_FREEBSD_NR_getpgid 207 +#define TARGET_FREEBSD_NR_poll 209 +#define TARGET_FREEBSD_NR_freebsd7___semctl 220 +#define TARGET_FREEBSD_NR_semget 221 +#define TARGET_FREEBSD_NR_semop 222 +#define TARGET_FREEBSD_NR_freebsd7_msgctl 224 +#define TARGET_FREEBSD_NR_msgget 225 +#define TARGET_FREEBSD_NR_msgsnd 226 +#define TARGET_FREEBSD_NR_msgrcv 227 +#define TARGET_FREEBSD_NR_shmat 228 +#define TARGET_FREEBSD_NR_freebsd7_shmctl 229 +#define TARGET_FREEBSD_NR_shmdt 230 +#define TARGET_FREEBSD_NR_shmget 231 +#define TARGET_FREEBSD_NR_clock_gettime 232 +#define TARGET_FREEBSD_NR_clock_settime 233 +#define TARGET_FREEBSD_NR_clock_getres 234 +#define TARGET_FREEBSD_NR_ktimer_create 235 +#define TARGET_FREEBSD_NR_ktimer_delete 236 +#define TARGET_FREEBSD_NR_ktimer_settime 237 +#define TARGET_FREEBSD_NR_ktimer_gettime 238 +#define TARGET_FREEBSD_NR_ktimer_getoverrun 239 +#define TARGET_FREEBSD_NR_nanosleep 240 +#define TARGET_FREEBSD_NR_ntp_gettime 248 +#define TARGET_FREEBSD_NR_minherit 250 +#define TARGET_FREEBSD_NR_rfork 251 +#define TARGET_FREEBSD_NR_openbsd_poll 252 +#define TARGET_FREEBSD_NR_issetugid 253 +#define TARGET_FREEBSD_NR_lchown 254 +#define TARGET_FREEBSD_NR_aio_read 255 +#define TARGET_FREEBSD_NR_aio_write 256 +#define TARGET_FREEBSD_NR_lio_listio 257 +#define TARGET_FREEBSD_NR_getdents 272 +#define TARGET_FREEBSD_NR_lchmod 274 +#define TARGET_FREEBSD_NR_netbsd_lchown 275 +#define TARGET_FREEBSD_NR_lutimes 276 +#define TARGET_FREEBSD_NR_netbsd_msync 277 +#define TARGET_FREEBSD_NR_nstat 278 +#define TARGET_FREEBSD_NR_nfstat 279 +#define TARGET_FREEBSD_NR_nlstat 280 +#define TARGET_FREEBSD_NR_preadv 289 +#define TARGET_FREEBSD_NR_pwritev 290 +#define TARGET_FREEBSD_NR_freebsd4_fhstatfs 297 +#define TARGET_FREEBSD_NR_fhopen 298 +#define TARGET_FREEBSD_NR_fhstat 299 +#define TARGET_FREEBSD_NR_modnext 300 +#define TARGET_FREEBSD_NR_modstat 301 +#define TARGET_FREEBSD_NR_modfnext 302 +#define TARGET_FREEBSD_NR_modfind 303 +#define TARGET_FREEBSD_NR_kldload 304 +#define TARGET_FREEBSD_NR_kldunload 305 +#define TARGET_FREEBSD_NR_kldfind 306 +#define TARGET_FREEBSD_NR_kldnext 307 +#define TARGET_FREEBSD_NR_kldstat 308 +#define TARGET_FREEBSD_NR_kldfirstmod 309 +#define TARGET_FREEBSD_NR_getsid 310 +#define TARGET_FREEBSD_NR_setresuid 311 +#define TARGET_FREEBSD_NR_setresgid 312 +/* 313 is obsolete signanosleep */ +#define TARGET_FREEBSD_NR_aio_return 314 +#define TARGET_FREEBSD_NR_aio_suspend 315 +#define TARGET_FREEBSD_NR_aio_cancel 316 +#define TARGET_FREEBSD_NR_aio_error 317 +#define TARGET_FREEBSD_NR_oaio_read 318 +#define TARGET_FREEBSD_NR_oaio_write 319 +#define TARGET_FREEBSD_NR_olio_listio 320 +#define TARGET_FREEBSD_NR_yield 321 +/* 322 is obsolete thr_sleep */ +/* 323 is obsolete thr_wakeup */ +#define TARGET_FREEBSD_NR_mlockall 324 +#define TARGET_FREEBSD_NR_munlockall 325 +#define TARGET_FREEBSD_NR___getcwd 326 +#define TARGET_FREEBSD_NR_sched_setparam 327 +#define TARGET_FREEBSD_NR_sched_getparam 328 +#define TARGET_FREEBSD_NR_sched_setscheduler 329 +#define TARGET_FREEBSD_NR_sched_getscheduler 330 +#define TARGET_FREEBSD_NR_sched_yield 331 +#define TARGET_FREEBSD_NR_sched_get_priority_max 332 +#define TARGET_FREEBSD_NR_sched_get_priority_min 333 +#define TARGET_FREEBSD_NR_sched_rr_get_interval 334 +#define TARGET_FREEBSD_NR_utrace 335 +#define TARGET_FREEBSD_NR_freebsd4_sendfile 336 +#define TARGET_FREEBSD_NR_kldsym 337 +#define TARGET_FREEBSD_NR_jail 338 +#define TARGET_FREEBSD_NR_nnpfs_syscall 339 +#define TARGET_FREEBSD_NR_sigprocmask 340 +#define TARGET_FREEBSD_NR_sigsuspend 341 +#define TARGET_FREEBSD_NR_freebsd4_sigaction 342 +#define TARGET_FREEBSD_NR_sigpending 343 +#define TARGET_FREEBSD_NR_freebsd4_sigreturn 344 +#define TARGET_FREEBSD_NR_sigtimedwait 345 +#define TARGET_FREEBSD_NR_sigwaitinfo 346 +#define TARGET_FREEBSD_NR___acl_get_file 347 +#define TARGET_FREEBSD_NR___acl_set_file 348 +#define TARGET_FREEBSD_NR___acl_get_fd 349 +#define TARGET_FREEBSD_NR___acl_set_fd 350 +#define TARGET_FREEBSD_NR___acl_delete_file 351 +#define TARGET_FREEBSD_NR___acl_delete_fd 352 +#define TARGET_FREEBSD_NR___acl_aclcheck_file 353 +#define TARGET_FREEBSD_NR___acl_aclcheck_fd 354 +#define TARGET_FREEBSD_NR_extattrctl 355 +#define TARGET_FREEBSD_NR_extattr_set_file 356 +#define TARGET_FREEBSD_NR_extattr_get_file 357 +#define TARGET_FREEBSD_NR_extattr_delete_file 358 +#define TARGET_FREEBSD_NR_aio_waitcomplete 359 +#define TARGET_FREEBSD_NR_getresuid 360 +#define TARGET_FREEBSD_NR_getresgid 361 +#define TARGET_FREEBSD_NR_kqueue 362 +#define TARGET_FREEBSD_NR_kevent 363 +#define TARGET_FREEBSD_NR_extattr_set_fd 371 +#define TARGET_FREEBSD_NR_extattr_get_fd 372 +#define TARGET_FREEBSD_NR_extattr_delete_fd 373 +#define TARGET_FREEBSD_NR___setugid 374 +#define TARGET_FREEBSD_NR_eaccess 376 +#define TARGET_FREEBSD_NR_afs3_syscall 377 +#define TARGET_FREEBSD_NR_nmount 378 +#define TARGET_FREEBSD_NR___mac_get_proc 384 +#define TARGET_FREEBSD_NR___mac_set_proc 385 +#define TARGET_FREEBSD_NR___mac_get_fd 386 +#define TARGET_FREEBSD_NR___mac_get_file 387 +#define TARGET_FREEBSD_NR___mac_set_fd 388 +#define TARGET_FREEBSD_NR___mac_set_file 389 +#define TARGET_FREEBSD_NR_kenv 390 +#define TARGET_FREEBSD_NR_lchflags 391 +#define TARGET_FREEBSD_NR_uuidgen 392 +#define TARGET_FREEBSD_NR_sendfile 393 +#define TARGET_FREEBSD_NR_mac_syscall 394 +#define TARGET_FREEBSD_NR_getfsstat 395 +#define TARGET_FREEBSD_NR_statfs 396 +#define TARGET_FREEBSD_NR_fstatfs 397 +#define TARGET_FREEBSD_NR_fhstatfs 398 +#define TARGET_FREEBSD_NR_ksem_close 400 +#define TARGET_FREEBSD_NR_ksem_post 401 +#define TARGET_FREEBSD_NR_ksem_wait 402 +#define TARGET_FREEBSD_NR_ksem_trywait 403 +#define TARGET_FREEBSD_NR_ksem_init 404 +#define TARGET_FREEBSD_NR_ksem_open 405 +#define TARGET_FREEBSD_NR_ksem_unlink 406 +#define TARGET_FREEBSD_NR_ksem_getvalue 407 +#define TARGET_FREEBSD_NR_ksem_destroy 408 +#define TARGET_FREEBSD_NR___mac_get_pid 409 +#define TARGET_FREEBSD_NR___mac_get_link 410 +#define TARGET_FREEBSD_NR___mac_set_link 411 +#define TARGET_FREEBSD_NR_extattr_set_link 412 +#define TARGET_FREEBSD_NR_extattr_get_link 413 +#define TARGET_FREEBSD_NR_extattr_delete_link 414 +#define TARGET_FREEBSD_NR___mac_execve 415 +#define TARGET_FREEBSD_NR_sigaction 416 +#define TARGET_FREEBSD_NR_sigreturn 417 +#define TARGET_FREEBSD_NR_getcontext 421 +#define TARGET_FREEBSD_NR_setcontext 422 +#define TARGET_FREEBSD_NR_swapcontext 423 +#define TARGET_FREEBSD_NR_swapoff 424 +#define TARGET_FREEBSD_NR___acl_get_link 425 +#define TARGET_FREEBSD_NR___acl_set_link 426 +#define TARGET_FREEBSD_NR___acl_delete_link 427 +#define TARGET_FREEBSD_NR___acl_aclcheck_link 428 +#define TARGET_FREEBSD_NR_sigwait 429 +#define TARGET_FREEBSD_NR_thr_create 430 +#define TARGET_FREEBSD_NR_thr_exit 431 +#define TARGET_FREEBSD_NR_thr_self 432 +#define TARGET_FREEBSD_NR_thr_kill 433 +#define TARGET_FREEBSD_NR__umtx_lock 434 +#define TARGET_FREEBSD_NR__umtx_unlock 435 +#define TARGET_FREEBSD_NR_jail_attach 436 +#define TARGET_FREEBSD_NR_extattr_list_fd 437 +#define TARGET_FREEBSD_NR_extattr_list_file 438 +#define TARGET_FREEBSD_NR_extattr_list_link 439 +#define TARGET_FREEBSD_NR_ksem_timedwait 441 +#define TARGET_FREEBSD_NR_thr_suspend 442 +#define TARGET_FREEBSD_NR_thr_wake 443 +#define TARGET_FREEBSD_NR_kldunloadf 444 +#define TARGET_FREEBSD_NR_audit 445 +#define TARGET_FREEBSD_NR_auditon 446 +#define TARGET_FREEBSD_NR_getauid 447 +#define TARGET_FREEBSD_NR_setauid 448 +#define TARGET_FREEBSD_NR_getaudit 449 +#define TARGET_FREEBSD_NR_setaudit 450 +#define TARGET_FREEBSD_NR_getaudit_addr 451 +#define TARGET_FREEBSD_NR_setaudit_addr 452 +#define TARGET_FREEBSD_NR_auditctl 453 +#define TARGET_FREEBSD_NR__umtx_op 454 +#define TARGET_FREEBSD_NR_thr_new 455 +#define TARGET_FREEBSD_NR_sigqueue 456 +#define TARGET_FREEBSD_NR_kmq_open 457 +#define TARGET_FREEBSD_NR_kmq_setattr 458 +#define TARGET_FREEBSD_NR_kmq_timedreceive 459 +#define TARGET_FREEBSD_NR_kmq_timedsend 460 +#define TARGET_FREEBSD_NR_kmq_notify 461 +#define TARGET_FREEBSD_NR_kmq_unlink 462 +#define TARGET_FREEBSD_NR_abort2 463 +#define TARGET_FREEBSD_NR_thr_set_name 464 +#define TARGET_FREEBSD_NR_aio_fsync 465 +#define TARGET_FREEBSD_NR_rtprio_thread 466 +#define TARGET_FREEBSD_NR_sctp_peeloff 471 +#define TARGET_FREEBSD_NR_sctp_generic_sendmsg 472 +#define TARGET_FREEBSD_NR_sctp_generic_sendmsg_iov 473 +#define TARGET_FREEBSD_NR_sctp_generic_recvmsg 474 +#define TARGET_FREEBSD_NR_pread 475 +#define TARGET_FREEBSD_NR_pwrite 476 +#define TARGET_FREEBSD_NR_mmap 477 +#define TARGET_FREEBSD_NR_lseek 478 +#define TARGET_FREEBSD_NR_truncate 479 +#define TARGET_FREEBSD_NR_ftruncate 480 +#define TARGET_FREEBSD_NR_thr_kill2 481 +#define TARGET_FREEBSD_NR_shm_open 482 +#define TARGET_FREEBSD_NR_shm_unlink 483 +#define TARGET_FREEBSD_NR_cpuset 484 +#define TARGET_FREEBSD_NR_cpuset_setid 485 +#define TARGET_FREEBSD_NR_cpuset_getid 486 +#define TARGET_FREEBSD_NR_cpuset_getaffinity 487 +#define TARGET_FREEBSD_NR_cpuset_setaffinity 488 +#define TARGET_FREEBSD_NR_faccessat 489 +#define TARGET_FREEBSD_NR_fchmodat 490 +#define TARGET_FREEBSD_NR_fchownat 491 +#define TARGET_FREEBSD_NR_fexecve 492 +#define TARGET_FREEBSD_NR_fstatat 493 +#define TARGET_FREEBSD_NR_futimesat 494 +#define TARGET_FREEBSD_NR_linkat 495 +#define TARGET_FREEBSD_NR_mkdirat 496 +#define TARGET_FREEBSD_NR_mkfifoat 497 +#define TARGET_FREEBSD_NR_mknodat 498 +#define TARGET_FREEBSD_NR_openat 499 +#define TARGET_FREEBSD_NR_readlinkat 500 +#define TARGET_FREEBSD_NR_renameat 501 +#define TARGET_FREEBSD_NR_symlinkat 502 +#define TARGET_FREEBSD_NR_unlinkat 503 +#define TARGET_FREEBSD_NR_posix_openpt 504 +#define TARGET_FREEBSD_NR_gssd_syscall 505 +#define TARGET_FREEBSD_NR_jail_get 506 +#define TARGET_FREEBSD_NR_jail_set 507 +#define TARGET_FREEBSD_NR_jail_remove 508 +#define TARGET_FREEBSD_NR_closefrom 509 +#define TARGET_FREEBSD_NR___semctl 510 +#define TARGET_FREEBSD_NR_msgctl 511 +#define TARGET_FREEBSD_NR_shmctl 512 +#define TARGET_FREEBSD_NR_lpathconf 513 +#define TARGET_FREEBSD_NR_cap_new 514 +#define TARGET_FREEBSD_NR_cap_getrights 515 +#define TARGET_FREEBSD_NR_cap_enter 516 +#define TARGET_FREEBSD_NR_cap_getmode 517 +#define TARGET_FREEBSD_NR_pdfork 518 +#define TARGET_FREEBSD_NR_pdkill 519 +#define TARGET_FREEBSD_NR_pdgetpid 520 +#define TARGET_FREEBSD_NR_pselect 522 +#define TARGET_FREEBSD_NR_getloginclass 523 +#define TARGET_FREEBSD_NR_setloginclass 524 +#define TARGET_FREEBSD_NR_rctl_get_racct 525 +#define TARGET_FREEBSD_NR_rctl_get_rules 526 +#define TARGET_FREEBSD_NR_rctl_get_limits 527 +#define TARGET_FREEBSD_NR_rctl_add_rule 528 +#define TARGET_FREEBSD_NR_rctl_remove_rule 529 +#define TARGET_FREEBSD_NR_posix_fallocate 530 +#define TARGET_FREEBSD_NR_posix_fadvise 531 +#define TARGET_FREEBSD_NR_MAXSYSCALL 532
Signature · 1 line
1.7.8
Re: [Qemu-devel] [PATCH 01/18] bsd-user: refresh freebsd system call numbers
Quoted 3 lines · Stacey Son
Update FreeBSD system call numbers in
freebsd/syscall_nr.h.Signed-off-by Stacey Son <[email protected]>
PATCH 2/18 bsd-user: add HOST_ABI_DIR for the various *BSD dependent code.
In reply to Stacey SonThis change adds HOST_ABI_DIR (similar to TARGET_ABI_DIR) so the various BSD OS dependent code can be seperated into its own directories rather than using #ifdef's.
--- Makefile.target | 3 ++- configure | 11 +++++++++++ 2 files changed, 13 insertions(+), 1 deletions(-)
Makefile.target +2 -1
@@ -103,7 +103,8 @@ endif #CONFIG_LINUX_USER ifdef CONFIG_BSD_USER -QEMU_CFLAGS+=-I$(SRC_PATH)/bsd-user -I$(SRC_PATH)/bsd-user/$(TARGET_ABI_DIR) +QEMU_CFLAGS+=-I$(SRC_PATH)/bsd-user -I$(SRC_PATH)/bsd-user/$(TARGET_ABI_DIR) \ + -I$(SRC_PATH)/bsd-user/$(HOST_ABI_DIR) obj-y += bsd-user/ obj-y += gdbstub.o user-exec.o
configure +11 -0
@@ -449,6 +449,9 @@ fi # OS specific +# host *BSD for user mode +HOST_ABI_DIR="" + case $targetos in CYGWIN*) mingw32="yes"
@@ -473,12 +476,14 @@ FreeBSD) audio_possible_drivers="oss sdl esd pa" # needed for kinfo_getvmmap(3) in libutil.h LIBS="-lutil $LIBS" + HOST_ABI_DIR="freebsd" ;; DragonFly) bsd="yes" make="${MAKE-gmake}" audio_drv_list="oss" audio_possible_drivers="oss sdl esd pa" + HOST_ABI_DIR="dragonfly" ;; NetBSD) bsd="yes"
@@ -486,12 +491,14 @@ NetBSD) audio_drv_list="oss" audio_possible_drivers="oss sdl esd" oss_lib="-lossaudio" + HOST_ABI_DIR="netbsd" ;; OpenBSD) bsd="yes" make="${MAKE-gmake}" audio_drv_list="sdl" audio_possible_drivers="sdl esd" + HOST_ABI_DIR="openbsd" ;; Darwin) bsd="yes"
@@ -510,6 +517,7 @@ Darwin) # Disable attempts to use ObjectiveC features in os/object.h since they # won't work when we're compiling with gcc as a C compiler. QEMU_CFLAGS="-DOS_OBJECT_USE_OBJC=0 $QEMU_CFLAGS" + HOST_ABI_DIR="darwin" ;; SunOS) solaris="yes"
@@ -4475,6 +4483,9 @@ if [ "$TARGET_ABI_DIR" = "" ]; then TARGET_ABI_DIR=$TARGET_ARCH fi echo "TARGET_ABI_DIR=$TARGET_ABI_DIR" >> $config_target_mak +if [ "$HOST_ABI_DIR" != "" ]; then + echo "HOST_ABI_DIR=$HOST_ABI_DIR" >> $config_target_mak +fi case "$target_name" in i386|x86_64) if test "$xen" = "yes" -a "$target_softmmu" = "yes" ; then
Signature · 1 line
1.7.8
PATCH 3/18 bsd-user: move OS/arch dependent code for strace into separate directories
In reply to Stacey SonThis change moves host OS and arch dependent code for the sysarch system call related to the -strace functionality into the appropriate HOST_ABI_DIR and TARGET_ABI_DIR directories.
--- bsd-user/arm/syscall.h | 36 +++++++ bsd-user/arm/target_arch_sysarch.h | 81 +++++++++++++++ bsd-user/freebsd/os-strace.h | 29 +++++ bsd-user/freebsd/strace.list | 76 +++++++++++++-- bsd-user/i386/syscall.h | 23 ++++ bsd-user/i386/target_arch_sysarch.h | 78 ++++++++++++++ bsd-user/mips/syscall.h | 52 ++++++++++ bsd-user/mips/target_arch_sysarch.h | 69 +++++++++++++ bsd-user/mips64/syscall.h | 53 ++++++++++ bsd-user/mips64/target_arch_sysarch.h | 69 +++++++++++++ bsd-user/netbsd/os-strace.h | 1 + bsd-user/openbsd/os-strace.h | 1 + bsd-user/qemu.h | 26 +++++ bsd-user/sparc/syscall.h | 29 +++++- bsd-user/sparc/target_arch_sysarch.h | 52 ++++++++++ bsd-user/sparc64/syscall.h | 28 +++++- bsd-user/sparc64/target_arch_sysarch.h | 52 ++++++++++ bsd-user/strace.c | 175 +++++++++++++++++++++---------- bsd-user/x86_64/syscall.h | 26 +++++- bsd-user/x86_64/target_arch_sysarch.h | 76 ++++++++++++++ 20 files changed, 965 insertions(+), 67 deletions(-) create mode 100644 bsd-user/arm/syscall.h create mode 100644 bsd-user/arm/target_arch_sysarch.h create mode 100644 bsd-user/freebsd/os-strace.h create mode 100644 bsd-user/i386/target_arch_sysarch.h create mode 100644 bsd-user/mips/syscall.h create mode 100644 bsd-user/mips/target_arch_sysarch.h create mode 100644 bsd-user/mips64/syscall.h create mode 100644 bsd-user/mips64/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/arm/syscall.h new file +36 -0
@@ -0,0 +1,36 @@ +#ifndef __ARCH_SYSCALL_H_ +#define __ARCH_SYSCALL_H_ + +struct target_pt_regs { +abi_long uregs[17 ]; +}; + +#define ARM_cpsr uregs[16] +#define ARM_pc uregs[15] +#define ARM_lr uregs[14] +#define ARM_sp uregs[13] +#define ARM_ip uregs[12] +#define ARM_fp uregs[11] +#define ARM_r10 uregs[10] +#define ARM_r9 uregs[9] +#define ARM_r8 uregs[8] +#define ARM_r7 uregs[7] +#define ARM_r6 uregs[6] +#define ARM_r5 uregs[5] +#define ARM_r4 uregs[4] +#define ARM_r3 uregs[3] +#define ARM_r2 uregs[2] +#define ARM_r1 uregs[1] +#define ARM_r0 uregs[0] + +#define ARM_SYSCALL_BASE 0/* XXX: FreeBSD only */ + +#define TARGET_FREEBSD_ARM_SYNC_ICACHE 0 +#define TARGET_FREEBSD_ARM_DRAIN_WRITEBUF 1 +#define TARGET_FREEBSD_ARM_SET_TP 2 +#define TARGET_FREEBSD_ARM_GET_TP 3 + +#define TARGET_HW_MACHINE "arm" +#define TARGET_HW_MACHINE_ARCH "armv6" + +#endif /* !__ARCH_SYSCALL_H_ */
bsd-user/arm/target_arch_sysarch.h new file +81 -0
81 lines not on this page · raw message
bsd-user/freebsd/os-strace.h new file +29 -0
@@ -0,0 +1,29 @@ +/* +* 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); +}
bsd-user/freebsd/strace.list +69 -7
147 lines not on this page · raw message
bsd-user/i386/syscall.h +23 -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)
@@ -158,4 +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_sysarch.h new file +78 -0
78 lines not on this page · raw message
bsd-user/mips/syscall.h new file +52 -0
52 lines not on this page · raw message
bsd-user/mips/target_arch_sysarch.h new file +69 -0
69 lines not on this page · raw message
bsd-user/mips64/syscall.h new file +53 -0
53 lines not on this page · raw message
bsd-user/mips64/target_arch_sysarch.h new file +69 -0
69 lines not on this page · raw message
bsd-user/netbsd/os-strace.h new file +1 -0
@@ -0,0 +1 @@ +/* XXX NetBSD dependent strace print functions */
bsd-user/openbsd/os-strace.h new file +1 -0
@@ -0,0 +1 @@ +/* XXX OpenBSD dependent strace print functions */
bsd-user/qemu.h +26 -0
@@ -1,3 +1,19 @@ +/* +* qemu bsd user mode definition +* +* 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 QEMU_H #define QEMU_H
@@ -149,6 +165,16 @@ void fork_end(int child);#include "qemu/log.h" /* strace.c */ +struct syscallname { +int nr; +const char *name; +const char *format; +void (*call)(const struct syscallname *, +abi_long ,abi_long ,abi_long , +abi_long ,abi_long ,abi_long ); +void (*result)(const struct syscallname *,abi_long ); +}; + void print_freebsd_syscall(int num, abi_long arg1, abi_long arg2, abi_long arg3,
bsd-user/sparc/syscall.h +28 -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,11 @@ struct target_pt_regs { abi_ulong u_regs[16]; }; -#define UNAME_MACHINE "sun4" +#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 + +#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 +27 -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,11 @@ struct target_pt_regs { abi_ulong fprs; }; -#define UNAME_MACHINE "sun4u" +#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 + +#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 +118 -57
282 lines not on this page · raw message
bsd-user/x86_64/syscall.h +25 -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,13 @@ struct target_msqid64_ds {#define TARGET_FREEBSD_AMD64_SET_GSBASE 131 -#define UNAME_MACHINE "x86_64" +#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#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
1.7.8
PATCH 4/18 bsd-user: move target arch and host OS dependent code out of main.c
In reply to Stacey SonThis 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/arm/target_arch.h | 10 + bsd-user/arm/target_arch_cpu.c | 27 ++ bsd-user/arm/target_arch_cpu.h | 435 +++++++++++++++++ bsd-user/arm/target_arch_vmparam.h | 49 ++ 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 | 302 ++++++++++++ bsd-user/i386/target_arch_vmparam.h | 26 + bsd-user/i386/target_signal.h | 6 - bsd-user/main.c | 803 +++----------------------------- bsd-user/mips/target_arch.h | 10 + bsd-user/mips/target_arch_cpu.c | 27 ++ bsd-user/mips/target_arch_cpu.h | 243 ++++++++++ bsd-user/mips/target_arch_vmparam.h | 47 ++ bsd-user/mips64/target_arch.h | 10 + bsd-user/mips64/target_arch_cpu.c | 27 ++ bsd-user/mips64/target_arch_cpu.h | 243 ++++++++++ bsd-user/mips64/target_arch_vmparam.h | 47 ++ bsd-user/netbsd/host_os.h | 31 ++ bsd-user/openbsd/host_os.h | 31 ++ bsd-user/qemu.h | 10 +- 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 | 35 ++ 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 | 324 +++++++++++++ bsd-user/x86_64/target_arch_vmparam.h | 28 ++ bsd-user/x86_64/target_signal.h | 5 - 40 files changed, 2915 insertions(+), 767 deletions(-) create mode 100644 bsd-user/arm/target_arch.h create mode 100644 bsd-user/arm/target_arch_cpu.c create mode 100644 bsd-user/arm/target_arch_cpu.h create mode 100644 bsd-user/arm/target_arch_vmparam.h 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/mips/target_arch.h create mode 100644 bsd-user/mips/target_arch_cpu.c create mode 100644 bsd-user/mips/target_arch_cpu.h create mode 100644 bsd-user/mips/target_arch_vmparam.h create mode 100644 bsd-user/mips64/target_arch.h create mode 100644 bsd-user/mips64/target_arch_cpu.c create mode 100644 bsd-user/mips64/target_arch_cpu.h create mode 100644 bsd-user/mips64/target_arch_vmparam.h create mode 100644 bsd-user/netbsd/host_os.h create mode 100644 bsd-user/openbsd/host_os.h create mode 100644 bsd-user/sparc/target_arch.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/arm/target_arch.h new file +10 -0
@@ -0,0 +1,10 @@ + +#ifndef _TARGET_ARCH_H_ +#define _TARGET_ARCH_H_ + +#include "qemu.h" + +void target_cpu_set_tls (CPUARMState *env,target_ulong newtls); +target_ulong target_cpu_get_tls (CPUARMState *env); + +#endif /* !_TARGET_ARCH_H_ */
bsd-user/arm/target_arch_cpu.c new file +27 -0
@@ -0,0 +1,27 @@ +/* +* arm cpu related code +* +* 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.h" + +void target_cpu_set_tls (CPUARMState *env,target_ulong newtls) +{ + env->cp15.c13_tls2 = newtls; +} + +target_ulong target_cpu_get_tls (CPUARMState *env) +{ +return (env->cp15.c13_tls2); +}
bsd-user/arm/target_arch_cpu.h new file +435 -0
435 lines not on this page · raw message
bsd-user/arm/target_arch_vmparam.h new file +49 -0
49 lines not on this page · raw message
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 +302 -0
302 lines not on this page · raw message
bsd-user/i386/target_arch_vmparam.h new file +26 -0
@@ -0,0 +1,26 @@ +#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_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 +60 -743
930 lines not on this page · raw message
bsd-user/mips/target_arch.h new file +10 -0
@@ -0,0 +1,10 @@ + +#ifndef _TARGET_ARCH_H_ +#define _TARGET_ARCH_H_ + +#include "qemu.h" + +void target_cpu_set_tls (CPUMIPSState *env,target_ulong newtls); +target_ulong target_cpu_get_tls (CPUMIPSState *env); + +#endif /* !_TARGET_ARCH_H_ */
bsd-user/mips/target_arch_cpu.c new file +27 -0
@@ -0,0 +1,27 @@ +/* +* mips cpu related code +* +* 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.h" + +void target_cpu_set_tls (CPUMIPSState *env,target_ulong newtls) +{ + env->tls_value = newtls; +} + +target_ulong target_cpu_get_tls (CPUMIPSState *env) +{ +return (env->tls_value); +}
bsd-user/mips/target_arch_cpu.h new file +243 -0
243 lines not on this page · raw message
bsd-user/mips/target_arch_vmparam.h new file +47 -0
47 lines not on this page · raw message
bsd-user/mips64/target_arch.h new file +10 -0
@@ -0,0 +1,10 @@ + +#ifndef _TARGET_ARCH_H_ +#define _TARGET_ARCH_H_ + +#include "qemu.h" + +void target_cpu_set_tls (CPUMIPSState *env,target_ulong newtls); +target_ulong target_cpu_get_tls (CPUMIPSState *env); + +#endif /* !_TARGET_ARCH_H_ */
bsd-user/mips64/target_arch_cpu.c new file +27 -0
@@ -0,0 +1,27 @@ +/* +* mips64 cpu related code +* +* 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.h" + +void target_cpu_set_tls (CPUMIPSState *env,target_ulong newtls) +{ + env->tls_value = newtls; +} + +target_ulong target_cpu_get_tls (CPUMIPSState *env) +{ +return (env->tls_value); +}
bsd-user/mips64/target_arch_cpu.h new file +243 -0
243 lines not on this page · raw message
bsd-user/mips64/target_arch_vmparam.h new file +47 -0
47 lines not on this page · raw message
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/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/qemu.h +9 -1
@@ -38,6 +38,7 @@ 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"
@@ -99,6 +100,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;
@@ -222,7 +224,13 @@ 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[];/* user access */
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 +35 -0
@@ -0,0 +1,35 @@ +#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 */ + +/* XXX this may not be right */
Lines of this file are not shown. View the raw message.
bsd-user/sparc64/target_arch.h new file +11 -0
Lines of this file are not shown. View the raw message.
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
Lines of this file are not shown. View the raw message.
bsd-user/x86_64/target_arch.h new file +13 -0
Lines of this file are not shown. View the raw message.
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 +324 -0
324 lines not on this page · raw message
bsd-user/x86_64/target_arch_vmparam.h new file +28 -0
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Signature · 1 line
1.7.8
Part of the diff is not shown here. View the raw message.
Re: [Qemu-devel] [PATCH 04/18] bsd-user: move target arch and host OSdependent code out of main.cc
Quoted 7 lines · [email protected] writes:
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 Stacey Son <[email protected]>
<snip>
Quoted 80 lines
bsd-user/arm/target_arch_cpu.h new file +80
-0+#if 0 +TaskState *ts = env->opaque; +uint32_t opcode; +int rc; + +/* we handle the FPU emulation here, as Linux */ +/* we get the opcode */ +/* FIXME - what to do if get_user() fails? */ +get_user_u32 (opcode, env->regs[15 ]); + + rc =EmulateAll (opcode, &ts->fpa, env); +if (rc ==0 ) {/* illegal instruction */ + info.si_signo =SIGILL ; + info.si_errno =0 ; + info.si_code =TARGET_ILL_ILLOPN ; + info._sifields._sigfault._addr = env->regs[15 ]; +queue_signal (env, info.si_signo, &info); + + }else if (rc <0 ) {/* FP exception */ +int arm_fpe =0 ; + +/* translate softfloat flags to FPSR flags */ +if (-rc & float_flag_invalid) { + arm_fpe |=BIT_IOC ; + } +if (-rc & float_flag_divbyzero) { + arm_fpe |=BIT_DZC ; + } +if (-rc & float_flag_overflow) { + arm_fpe |=BIT_OFC ; + } +if (-rc & float_flag_underflow) { + arm_fpe |=BIT_UFC ; + } +if (-rc & float_flag_inexact) { + arm_fpe |=BIT_IXC ; + } + +FPSR fpsr = ts->fpa.fpsr; +/* printf("fpsr 0x%x, arm_fpe 0x%x\n",fpsr,arm_fpe); */ + +if (fpsr & (arm_fpe <<16 )) {/* exception enabled? */ + info.si_signo =SIGFPE ; + info.si_errno =0 ; + +/* ordered by priority, least first */ +if (arm_fpe &BIT_IXC ) { + info.si_code =TARGET_FPE_FLTRES ; + } +if (arm_fpe &BIT_UFC ) { + info.si_code =TARGET_FPE_FLTUND ; + } +if (arm_fpe &BIT_OFC ) { + info.si_code =TARGET_FPE_FLTOVF ; + } +if (arm_fpe &BIT_DZC ) { + info.si_code =TARGET_FPE_FLTDIV ; + } +if (arm_fpe &BIT_IOC ) { + info.si_code =TARGET_FPE_FLTINV ; + } + info._sifields._sigfault._addr = env->regs[15 ]; +queue_signal (env, info.si_signo, &info); + }else { + env->regs[15 ] +=4 ; + } + +/* accumulate unenabled exceptions */ +if ((!(fpsr &BIT_IXE )) && (arm_fpe &BIT_IXC )) { + fpsr |=BIT_IXC ; + } +if ((!(fpsr &BIT_UFE )) && (arm_fpe &BIT_UFC )) { + fpsr |=BIT_UFC ; + } +if ((!(fpsr &BIT_OFE )) && (arm_fpe &BIT_OFC )) { + fpsr |=BIT_OFC ; + } +if ((!(fpsr &BIT_DZE )) && (arm_fpe &BIT_DZC )) { + fpsr |=BIT_DZC ; + }
bsd-user/arm/target_arch_cpu.h line 235
Quoted 10 lines
bsd-user/arm/target_arch_cpu.h new file +10
-0+if ((!(fpsr &BIT_IOE )) && (arm_fpe &BIT_IOC )) { + fpsr |=BIT_IOC ; + } + ts->fpa.fpsr = fpsr; + }else {/* everything OK */ +/* increment PC */ + env->regs[15 ] +=4 ; + } + } +#endif
I'm fairly sure that should either be deleted or re-instated. We have SCMs for a reason ;-)
Quoted 39 lines
bsd-user/arm/target_arch_cpu.h new file +39
-0+break ; +case EXCP_SWI : +case EXCP_BKPT : + { + env->eabi =1 ; +/* system call */ +if (trapnr ==EXCP_BKPT ) { +if (env->thumb) { +/* FIXME - what to do if get_user() fails? */ +#ifdef FREEBSD_ARM_OABI +get_user_u16 (insn, env->regs[15 ]); + n = insn &0xff ; +#else + n = env->regs[7 ]; +#endif + env->regs[15 ] +=2 ; + }else { +/* FIXME - what to do if get_user() fails? */ +#ifdef FREEBSD_ARM_OABI +get_user_u32 (insn, env->regs[15 ]); + n = (insn &0xf ) | ((insn >>4 ) &0xff0 ); +#else + n = env->regs[7 ]; +#endif + env->regs[15 ] +=4 ; + } + }else { +if (env->thumb) { +#ifdef FREEBSD_ARM_OABI +/* FIXME - what to do if get_user() fails? */ +get_user_u16 (insn, env->regs[15 ] -2 ); + n = insn &0xff ; +#else + n = env->regs[7 ]; +#endif + }else { +#ifdef FREEBSD_ARM_OABI +/* FIXME - what to do if get_user() fails? */ +get_user_u32 (insn, env->regs[15 ] -4 );
bsd-user/arm/target_arch_cpu.h line 284
Quoted 10 lines
bsd-user/arm/target_arch_cpu.h new file +10
-0+ n = insn &0xffffff ; +#else + n = env->regs[7 ]; +#endif + } + } + +#ifdef DEBUG_ARM +printf ("AVANT CALL %d\n" , n); +#endif
I think debug statements (rather than user visible logging) should generally be wrapped up in a macro.
bsd-user/arm/target_arch_cpu.h line 290
Quoted 6 lines
bsd-user/arm/target_arch_cpu.h new file +6
-0+if (bsd_type == target_freebsd) { +int ret; +abi_ulong params =get_sp_from_cpustate (env); +int32_t syscall_nr = n; +int32_t arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8; +
Another #if 0, there are several more in the patch.
Quoted 1 line
+#if 0 /* XXX FIXME */
<snip>
bsd-user/arm/target_arch_vmparam.h line 47
Quoted 9 lines
bsd-user/arm/target_arch_vmparam.h new file +9
-0+static inline abi_ulong get_sp_from_cpustate (CPUARMState *state) +{ +return state->regs[13 ];/* sp */ +} + +static inline void set_second_rval (CPUARMState *state,abi_ulong retval2) +{ + state->regs[1 ] = retval2; +}
It's a shame ARM hasn't got some un-ambigious #define's for registers
<snip>
More #if 0's
Quoted 3 lines
bsd-user/i386/target_arch_cpu.h new file +3
-0+#if 0 +case EXCP0B_NOSEG : +case EXCP0C_STACK :
<snip>
Signature · 1 line
Alex Bennée
Re: [Qemu-devel] [PATCH 04/18] bsd-user: move target arch and host OSdependent code out of main.cc
The arm code came from another source as noted in the cover letter. It could use a lot more work.
-stacey.
Quoted 193 lines · Alex Bennée
Quoted 7 lines · [email protected] writes:
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 Stacey Son <[email protected]><snip>
Quoted 80 lines
bsd-user/arm/target_arch_cpu.h new file +80
-0+#if 0 +TaskState *ts = env->opaque; +uint32_t opcode; +int rc; + +/* we handle the FPU emulation here, as Linux */ +/* we get the opcode */ +/* FIXME - what to do if get_user() fails? */ +get_user_u32 (opcode, env->regs[15 ]); + + rc =EmulateAll (opcode, &ts->fpa, env); +if (rc ==0 ) {/* illegal instruction */ + info.si_signo =SIGILL ; + info.si_errno =0 ; + info.si_code =TARGET_ILL_ILLOPN ; + info._sifields._sigfault._addr = env->regs[15 ]; +queue_signal (env, info.si_signo, &info); + + }else if (rc <0 ) {/* FP exception */ +int arm_fpe =0 ; + +/* translate softfloat flags to FPSR flags */ +if (-rc & float_flag_invalid) { + arm_fpe |=BIT_IOC ; + } +if (-rc & float_flag_divbyzero) { + arm_fpe |=BIT_DZC ; + } +if (-rc & float_flag_overflow) { + arm_fpe |=BIT_OFC ; + } +if (-rc & float_flag_underflow) { + arm_fpe |=BIT_UFC ; + } +if (-rc & float_flag_inexact) { + arm_fpe |=BIT_IXC ; + } + +FPSR fpsr = ts->fpa.fpsr; +/* printf("fpsr 0x%x, arm_fpe 0x%x\n",fpsr,arm_fpe); */ + +if (fpsr & (arm_fpe <<16 )) {/* exception enabled? */ + info.si_signo =SIGFPE ; + info.si_errno =0 ; + +/* ordered by priority, least first */ +if (arm_fpe &BIT_IXC ) { + info.si_code =TARGET_FPE_FLTRES ; + } +if (arm_fpe &BIT_UFC ) { + info.si_code =TARGET_FPE_FLTUND ; + } +if (arm_fpe &BIT_OFC ) { + info.si_code =TARGET_FPE_FLTOVF ; + } +if (arm_fpe &BIT_DZC ) { + info.si_code =TARGET_FPE_FLTDIV ; + } +if (arm_fpe &BIT_IOC ) { + info.si_code =TARGET_FPE_FLTINV ; + } + info._sifields._sigfault._addr = env->regs[15 ]; +queue_signal (env, info.si_signo, &info); + }else { + env->regs[15 ] +=4 ; + } + +/* accumulate unenabled exceptions */ +if ((!(fpsr &BIT_IXE )) && (arm_fpe &BIT_IXC )) { + fpsr |=BIT_IXC ; + } +if ((!(fpsr &BIT_UFE )) && (arm_fpe &BIT_UFC )) { + fpsr |=BIT_UFC ; + } +if ((!(fpsr &BIT_OFE )) && (arm_fpe &BIT_OFC )) { + fpsr |=BIT_OFC ; + } +if ((!(fpsr &BIT_DZE )) && (arm_fpe &BIT_DZC )) { + fpsr |=BIT_DZC ; + }bsd-user/arm/target_arch_cpu.h line 235
Quoted 10 lines
bsd-user/arm/target_arch_cpu.h new file +10
-0+if ((!(fpsr &BIT_IOE )) && (arm_fpe &BIT_IOC )) { + fpsr |=BIT_IOC ; + } + ts->fpa.fpsr = fpsr; + }else {/* everything OK */ +/* increment PC */ + env->regs[15 ] +=4 ; + } + } +#endif I'm fairly sure that should either be deleted or re-instated. We have SCMs for a reason ;-)
Quoted 39 lines
bsd-user/arm/target_arch_cpu.h new file +39
-0+break ; +case EXCP_SWI : +case EXCP_BKPT : + { + env->eabi =1 ; +/* system call */ +if (trapnr ==EXCP_BKPT ) { +if (env->thumb) { +/* FIXME - what to do if get_user() fails? */ +#ifdef FREEBSD_ARM_OABI +get_user_u16 (insn, env->regs[15 ]); + n = insn &0xff ; +#else + n = env->regs[7 ]; +#endif + env->regs[15 ] +=2 ; + }else { +/* FIXME - what to do if get_user() fails? */ +#ifdef FREEBSD_ARM_OABI +get_user_u32 (insn, env->regs[15 ]); + n = (insn &0xf ) | ((insn >>4 ) &0xff0 ); +#else + n = env->regs[7 ]; +#endif + env->regs[15 ] +=4 ; + } + }else { +if (env->thumb) { +#ifdef FREEBSD_ARM_OABI +/* FIXME - what to do if get_user() fails? */ +get_user_u16 (insn, env->regs[15 ] -2 ); + n = insn &0xff ; +#else + n = env->regs[7 ]; +#endif + }else { +#ifdef FREEBSD_ARM_OABI +/* FIXME - what to do if get_user() fails? */ +get_user_u32 (insn, env->regs[15 ] -4 );bsd-user/arm/target_arch_cpu.h line 284
Quoted 10 lines
bsd-user/arm/target_arch_cpu.h new file +10
-0+ n = insn &0xffffff ; +#else + n = env->regs[7 ]; +#endif + } + } + +#ifdef DEBUG_ARM +printf ("AVANT CALL %d\n" , n); +#endif I think debug statements (rather than user visible logging) should generally be wrapped up in a macro.
bsd-user/arm/target_arch_cpu.h line 290
Quoted 6 lines
bsd-user/arm/target_arch_cpu.h new file +6
-0+if (bsd_type == target_freebsd) { +int ret; +abi_ulong params =get_sp_from_cpustate (env); +int32_t syscall_nr = n; +int32_t arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8; +Another #if 0, there are several more in the patch.
Quoted 1 line
+#if 0 /* XXX FIXME */
<snip>
bsd-user/arm/target_arch_vmparam.h line 47
Quoted 9 lines
bsd-user/arm/target_arch_vmparam.h new file +9
-0+static inline abi_ulong get_sp_from_cpustate (CPUARMState *state) +{ +return state->regs[13 ];/* sp */ +} + +static inline void set_second_rval (CPUARMState *state,abi_ulong retval2) +{ + state->regs[1 ] = retval2; +}It's a shame ARM hasn't got some un-ambigious #define's for registers
<snip>
More #if 0's
Quoted 3 lines
bsd-user/i386/target_arch_cpu.h new file +3
-0+#if 0 +case EXCP0B_NOSEG : +case EXCP0C_STACK :<snip>
Signature · 1 line
Alex Bennée
Re: [Qemu-devel] [PATCH 04/18] bsd-user: move target arch and host OSdependent code out of main.cc
Quoted 1 line · Stacey Son
The arm code came from another source as noted in the cover letter. It could use a lot more work.
Possibly better to leave it out of this initial patch set and submit it separately
later then?
-- PMM
Re: [Qemu-devel] [PATCH 04/18] bsd-user: move target arch and host OSdependent code out of main.cc
Quoted 6 lines · Peter Maydell
Quoted 1 line · Stacey Son
The arm code came from another source as noted in the cover letter. It could use a lot more work.
Possibly better to leave it out of this initial patch set and submit it separately
later then?
I cleaned up the arm cpu_loop() a bit. You can view the replacement patch it at:
Of course, it is still missing support for things like handling undefined instruction (co-proc) exceptions via "EmulateAll()" but I am hoping someone will pick that up. It is current state, however, it can be used to cross build a good amount of FreeBSD/arm ports. I am hoping one of the BSD/arm guys will find it useful and start contributing. :)
-stacey.
PATCH 5/18 bsd-user: move target arch and host OS dependent code out of syscall.c
In reply to Stacey SonThis 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/arm/target_arch_sigtramp.h | 33 ++++ bsd-user/bsdload.c | 147 ++++++++++++++--- bsd-user/elfload.c | 9 +- bsd-user/freebsd/os-sys.c | 268 +++++++++++++++++++++++++++++++ bsd-user/freebsd/target_os_stack.h | 157 ++++++++++++++++++ bsd-user/i386/target_arch_sigtramp.h | 11 ++ bsd-user/main.c | 6 +- bsd-user/mips/target_arch_sigtramp.h | 23 +++ bsd-user/mips64/target_arch_sigtramp.h | 23 +++ bsd-user/netbsd/os-sys.c | 46 ++++++ bsd-user/netbsd/target_os_stack.h | 33 ++++ bsd-user/openbsd/os-sys.c | 46 ++++++ bsd-user/openbsd/target_os_stack.h | 33 ++++ bsd-user/qemu.h | 30 +++- bsd-user/sparc/target_arch_sigtramp.h | 11 ++ bsd-user/sparc64/target_arch_sigtramp.h | 11 ++ bsd-user/syscall.c | 210 +++--------------------- bsd-user/x86_64/target_arch_sigtramp.h | 11 ++ 19 files changed, 889 insertions(+), 221 deletions(-) create mode 100644 bsd-user/arm/target_arch_sigtramp.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/i386/target_arch_sigtramp.h create mode 100644 bsd-user/mips/target_arch_sigtramp.h create mode 100644 bsd-user/mips64/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_ABI_DIR)/os-sys.o $(TARGET_ABI_DIR)/target_arch_cpu.o
bsd-user/arm/target_arch_sigtramp.h new file +33 -0
@@ -0,0 +1,33 @@ + +#ifndef _TARGET_ARCH_SIGTRAMP_H_ +#define _TARGET_ARCH_SIGTRAMP_H_ + +/* Compare to arm/arm/locore.S ENTRY_NP(sigcode) */ +static inline abi_long setup_sigtramp (abi_ulong offset,unsigned sigf_uc, +unsigned sys_sigreturn) +{ +int i; +uint32_t sys_exit = TARGET_FREEBSD_NR_exit; +/* +* The code has to load r7 manually rather than using +* "ldr r7, =SYS_return to make sure the size of the +* code is correct. +*/ +uint32_t sigtramp_code[] = { +/* 1 */ 0xE1A0000D ,/* mov r0, sp */ +/* 2 */ 0xE59F700C ,/* ldr r7, [pc, #12] */ +/* 3 */ 0xEF000000 + sys_sigreturn,/* swi (SYS_sigreturn) */ +/* 4 */ 0xE59F7008 ,/* ldr r7, [pc, #8] */ +/* 5 */ 0xEF000000 + sys_exit,/* swi (SYS_exit)*/ +/* 6 */ 0xEAFFFFFA ,/* b . -16 */ +/* 7 */ sys_sigreturn, +/* 8 */ sys_exit + }; + +for (i =0 ; i <8 ; i++) { +tswap32s (&sigtramp_code[i]); + } + +return memcpy_to_target (offset, sigtramp_code,TARGET_SZSIGCODE ); +} +#endif /* _TARGET_ARCH_SIGTRAMP_H_ */
bsd-user/bsdload.c +122 -25
188 lines not on this page · raw message
bsd-user/elfload.c +6 -3
@@ -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()
@@ -665,7 +668,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,8 +1150,8 @@ static void load_symbols(struct elfhdr *hdr, int fd) syminfos = s; } -int load_elf_binary (struct linux_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-sys.c new file +268 -0
268 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/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 +5 -1
@@ -192,6 +192,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 bsd_binprm bprm;TaskState ts1, *ts = &ts1;CPUArchState *env;CPUState *cpu;
@@ -344,6 +345,8 @@ int main(int argc, char **argv)/* Zero out regs */ memset (regs,0 ,sizeof (struct target_pt_regs )); +memset (&bprm,0 ,sizeof (bprm)); +/* Zero out image_info */ memset (info,0 ,sizeof (struct image_info ));
@@ -402,7 +405,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 ); }
@@ -447,6 +450,7 @@ int main(int argc, char **argv)memset (ts,0 ,sizeof (TaskState));init_task_state (ts); ts->info = info; + ts->bprm = &bprm; env->opaque = ts;target_cpu_init (env, regs);
bsd-user/mips/target_arch_sigtramp.h new file +23 -0
@@ -0,0 +1,23 @@ + +#ifndef _TARGET_ARCH_SIGTRAMP_H_ +#define _TARGET_ARCH_SIGTRAMP_H_ + +/* Compare to mips/mips/locore.S sigcode() */ +static inline abi_long setup_sigtramp (abi_ulong offset,unsigned sigf_uc, +unsigned sys_sigreturn) +{ +int i; +uint32_t sigtramp_code[TARGET_SZSIGCODE /TARGET_INSN_SIZE ] = { +/* 1 */ 0x67A40000 + sigf_uc,/* daddu $a0, $sp, (sigf_uc) */ +/* 2 */ 0x24020000 + sys_sigreturn,/* li $v0, (sys_sigreturn) */ +/* 3 */ 0x0000000C ,/* syscall */ +/* 4 */ 0x0000000D /* break */ + }; + +for (i =0 ; i <4 ; i++) { +tswap32s (&sigtramp_code[i]); + } + +return memcpy_to_target (offset, sigtramp_code,TARGET_SZSIGCODE ); +} +#endif /* _TARGET_ARCH_SIGTRAMP_H_ */
bsd-user/mips64/target_arch_sigtramp.h new file +23 -0
@@ -0,0 +1,23 @@ + +#ifndef _TARGET_ARCH_SIGTRAMP_H_ +#define _TARGET_ARCH_SIGTRAMP_H_ + +/* Compare to mips/mips/locore.S sigcode() */ +static inline abi_long setup_sigtramp (abi_ulong offset,unsigned sigf_uc, +unsigned sys_sigreturn) +{ +int i; +uint32_t sigtramp_code[TARGET_SZSIGCODE /TARGET_INSN_SIZE ] = { +/* 1 */ 0x67A40000 + sigf_uc,/* daddu $a0, $sp, (sigf_uc) */ +/* 2 */ 0x24020000 + sys_sigreturn,/* li $v0, (sys_sigreturn) */ +/* 3 */ 0x0000000C ,/* syscall */ +/* 4 */ 0x0000000D /* break */ + }; + +for (i =0 ; i <4 ; i++) { +tswap32s (&sigtramp_code[i]); + } + +return memcpy_to_target (offset, sigtramp_code,TARGET_SZSIGCODE ); +} +#endif /* _TARGET_ARCH_SIGTRAMP_H_ */
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-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 +22 -8
@@ -90,6 +90,7 @@ typedef struct TaskState {struct TaskState *next;int used;/* non zero if used */ struct image_info *info; +struct bsd_binprm *bprm;struct emulated_sigtable sigtab[TARGET_NSIG ];struct sigqueue sigqueue_table[MAX_SIGQUEUE_SIZE ];/* siginfo queue */
@@ -118,7 +119,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;
@@ -127,19 +128,23 @@ struct linux_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 linux_binprm * bprm,struct target_pt_regs * regs, -struct image_info * info); -int load_flt_binary (struct linux_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);
@@ -232,6 +237,15 @@ extern unsigned long target_maxssiz;extern unsigned long target_sgrowsiz;extern char qemu_proc_pathname[]; +/* 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 */ #define VERIFY_READ 0
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/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 +27 -183
261 lines not on this page · raw message
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
1.7.8
PATCH 6/18 bsd-user: add support for freebsd time related system calls
In reply to Stacey SonThis change adds support or stubs for time related system calls including nanosleep(2), clock_gettime(2), clock_settime(2), clock_getres(2), gettimeofday(2), settimeofday(2), adjtime(2), ntp_adjtime(2), ntp_gettime(2), utimes(2), lutimes(2), futimes(2), futimesat(2), select(2), pselect(2), kqueue(2), kevent(2), setitimer(2), getitimer(2), and the undocumented ktimer_*() calls.
--- bsd-user/Makefile.objs | 3 +- bsd-user/freebsd/os-time.c | 205 ++++++++++++ bsd-user/freebsd/os-time.h | 643 +++++++++++++++++++++++++++++++++++ bsd-user/freebsd/qemu-os.h | 53 +++ bsd-user/netbsd/os-time.c | 1 + bsd-user/netbsd/os-time.h | 179 ++++++++++ bsd-user/netbsd/qemu-os.h | 1 + bsd-user/openbsd/os-time.c | 1 + bsd-user/openbsd/os-time.h | 179 ++++++++++ bsd-user/openbsd/qemu-os.h | 1 + bsd-user/syscall.c | 102 ++++++ bsd-user/syscall_defs.h | 796 ++++++++++++++++++++++++++++++++++++++------ 12 files changed, 2061 insertions(+), 103 deletions(-) create mode 100644 bsd-user/freebsd/os-time.c create mode 100644 bsd-user/freebsd/os-time.h create mode 100644 bsd-user/freebsd/qemu-os.h create mode 100644 bsd-user/netbsd/os-time.c create mode 100644 bsd-user/netbsd/os-time.h create mode 100644 bsd-user/netbsd/qemu-os.h create mode 100644 bsd-user/openbsd/os-time.c create mode 100644 bsd-user/openbsd/os-time.h create mode 100644 bsd-user/openbsd/qemu-os.h
bsd-user/Makefile.objs +2 -1
@@ -1,2 +1,3 @@ obj-y = main.o bsdload.o elfload.o mmap.o signal.o strace.o syscall.o \ - uaccess.o $(HOST_ABI_DIR)/os-sys.o $(TARGET_ABI_DIR)/target_arch_cpu.o + uaccess.o $(HOST_ABI_DIR)/os-sys.o \ + $(HOST_ABI_DIR)/os-time.o $(TARGET_ABI_DIR)/target_arch_cpu.o
bsd-user/freebsd/os-time.c new file +205 -0
205 lines not on this page · raw message
bsd-user/freebsd/os-time.h new file +643 -0
643 lines not on this page · raw message
bsd-user/freebsd/qemu-os.h new file +53 -0
53 lines not on this page · raw message
bsd-user/netbsd/os-time.c new file +1 -0
@@ -0,0 +1 @@ +/* XXX NetBSD time related helpers */
bsd-user/netbsd/os-time.h new file +179 -0
179 lines not on this page · raw message
bsd-user/netbsd/qemu-os.h new file +1 -0
@@ -0,0 +1 @@ +/* NetBSD conversion extern declarations */
bsd-user/openbsd/os-time.c new file +1 -0
@@ -0,0 +1 @@ +/* XXX OpenBSD time related helpers */
bsd-user/openbsd/os-time.h new file +179 -0
179 lines not on this page · raw message
bsd-user/openbsd/qemu-os.h new file +1 -0
@@ -0,0 +1 @@ +/* OpenBSD conversion extern declarations */
bsd-user/syscall.c +102 -0
114 lines not on this page · raw message
bsd-user/syscall_defs.h +694 -102
802 lines not on this page · raw message
Signature · 1 line
1.7.8
PATCH 7/18 bsd-user: add support for freebsd signal related system calls
In reply to Stacey SonThis change adds support or stubs for signal related system calls including sigtimedwait(2), sigaction(2), sigprocmask(2), sigpending(2), sigsuspend(2), sigreturn(2), sigwait(2), sigwaitinfo(2), sigqueue(2), sigaltstack(2), kill(2), killpg(2), and pdkill(2).
--- bsd-user/arm/target_arch_signal.h | 257 ++++++++++ bsd-user/bsd-signal.h | 232 +++++++++ bsd-user/errno_defs.h | 13 +- bsd-user/freebsd/os-signal.h | 43 ++ bsd-user/freebsd/target_os_siginfo.h | 100 ++++ bsd-user/freebsd/target_os_signal.h | 79 +++ bsd-user/i386/target_arch_signal.h | 94 ++++ bsd-user/mips/target_arch_signal.h | 237 +++++++++ bsd-user/mips64/target_arch_signal.h | 236 +++++++++ bsd-user/netbsd/target_os_siginfo.h | 82 +++ bsd-user/netbsd/target_os_signal.h | 70 +++ bsd-user/openbsd/target_os_siginfo.h | 82 +++ bsd-user/openbsd/target_os_signal.h | 70 +++ bsd-user/qemu.h | 33 +- bsd-user/signal.c | 907 ++++++++++++++++++++++++++++++++- bsd-user/sparc/target_arch_signal.h | 77 +++ bsd-user/sparc64/target_arch_signal.h | 94 ++++ bsd-user/syscall.c | 59 +++ bsd-user/x86_64/target_arch_signal.h | 94 ++++ 19 files changed, 2842 insertions(+), 17 deletions(-) create mode 100644 bsd-user/arm/target_arch_signal.h create mode 100644 bsd-user/bsd-signal.h create mode 100644 bsd-user/freebsd/os-signal.h create mode 100644 bsd-user/freebsd/target_os_siginfo.h create mode 100644 bsd-user/freebsd/target_os_signal.h create mode 100644 bsd-user/i386/target_arch_signal.h create mode 100644 bsd-user/mips/target_arch_signal.h create mode 100644 bsd-user/mips64/target_arch_signal.h create mode 100644 bsd-user/netbsd/target_os_siginfo.h create mode 100644 bsd-user/netbsd/target_os_signal.h create mode 100644 bsd-user/openbsd/target_os_siginfo.h create mode 100644 bsd-user/openbsd/target_os_signal.h create mode 100644 bsd-user/sparc/target_arch_signal.h create mode 100644 bsd-user/sparc64/target_arch_signal.h create mode 100644 bsd-user/x86_64/target_arch_signal.h
bsd-user/arm/target_arch_signal.h new file +257 -0
@@ -0,0 +1,257 @@ +/* +* arm signal 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 _TARGET_ARCH_SIGNAL_H_ +#define _TARGET_ARCH_SIGNAL_H_ + +#include "cpu.h" + +#define TARGET_REG_R0 0 +#define TARGET_REG_R1 1 +#define TARGET_REG_R2 2 +#define TARGET_REG_R3 3 +#define TARGET_REG_R4 4 +#define TARGET_REG_R5 5 +#define TARGET_REG_R6 6 +#define TARGET_REG_R7 7 +#define TARGET_REG_R8 8 +#define TARGET_REG_R9 9 +#define TARGET_REG_R10 10 +#define TARGET_REG_R11 11 +#define TARGET_REG_R12 12 +#define TARGET_REG_R13 13 +#define TARGET_REG_R14 14 +#define TARGET_REG_R15 15 +#define TARGET_REG_CPSR 16 +#define TARGET__NGREG 17 +/* Convenience synonyms */ +#define TARGET_REG_FP TARGET_REG_R11 +#define TARGET_REG_SP TARGET_REG_R13 +#define TARGET_REG_LR TARGET_REG_R14 +#define TARGET_REG_PC TARGET_REG_R15 + +#define TARGET_INSN_SIZE 4/* arm instruction size */ + +/* Size of the signal trampolin code. See _sigtramp(). */ +#define TARGET_SZSIGCODE ((abi_ulong)(8 * TARGET_INSN_SIZE)) + +/* compare to arm/include/_limits.h */ +#define TARGET_MINSIGSTKSZ (1024 * 4)/* min sig stack size */ +#define TARGET_SIGSTKSZ (TARGET_MINSIGSTKSZ + 32768)/* recommended size */ + +/* arm/arm/machdep.c */ +#define TARGET_MC_GET_CLEAR_RET 0x0001 +#define TARGET_MC_ADD_MAGIC 0x0002 +#define TARGET_MC_SET_ONSTACK 0x0004 + +struct target_sigcontext { +target_sigset_t sc_mask;/* signal mask to retstore */ +int32_t sc_onstack;/* sigstack state to restore */ +abi_long sc_pc;/* pc at time of signal */ +abi_long sc_reg[32 ];/* processor regs 0 to 31 */ +abi_long mullo, mulhi;/* mullo and mulhi registers */ +int32_t sc_fpused;/* fp has been used */ +abi_long sc_fpregs[33 ];/* fp regs 0 to 31 & csr */ +abi_long sc_fpc_eir;/* fp exception instr reg */ +/* int32_t reserved[8]; */ +}; + +typedef struct { +uint32_t __fp_fpsr; +struct { +uint32_t __fp_exponent; +uint32_t __fp_mantissa_hi; +uint32_t __fp_mantissa_lo; + } __fp_fr[8 ]; +}target__fpregset_t ; + +typedef struct { +uint32_t __vfp_fpscr; +uint32_t __vfp_fstmx[33 ]; +uint32_t __vfp_fpsid; +}target__vfpregset_t ; + +typedef struct target_mcontext { +uint32_t __gregs[TARGET__NGREG ]; +union { +target__fpregset_t __fpregs; +target__vfpregset_t __vfpregs; + } __fpu; +}target_mcontext_t ; + +typedef struct target_ucontext { +target_sigset_t uc_sigmask; +target_mcontext_t uc_mcontext; +abi_ulong uc_link; +target_stack_t uc_stack; +int32_t uc_flags; +int32_t __spare__[4 ]; +}target_ucontext_t ; + +struct target_sigframe { +target_siginfo_t sf_si;/* saved siginfo */ +target_ucontext_t sf_uc;/* saved ucontext */ +}; + + +/* compare to sys/arm/include/frame.h */ +struct target_trapframe { +abi_ulong tf_spsr;/* Zero on arm26 */ +abi_ulong tf_r0; +abi_ulong tf_r1; +abi_ulong tf_r2; +abi_ulong tf_r3; +abi_ulong tf_r4; +abi_ulong tf_r5; +abi_ulong tf_r6; +abi_ulong tf_r7; +abi_ulong tf_r8; +abi_ulong tf_r9; +abi_ulong tf_r10; +abi_ulong tf_r11; +abi_ulong tf_r12; +abi_ulong tf_usr_sp; +abi_ulong tf_usr_lr; +abi_ulong tf_svc_sp;/* Not used on arm26 */ +abi_ulong tf_svc_lr;/* Not used on arm26 */ +abi_ulong tf_pc; +}; + +/* +* Compare to arm/arm/machdep.c sendsig() +* Assumes that target stack frame memory is locked. +*/ +static inline abi_long +set_sigtramp_args (CPUARMState *regs,int sig,struct target_sigframe *frame, +abi_ulong frame_addr,struct target_sigaction *ka) +{ +/* +* Arguments to signal handler: +* r0 = signal number +* r1 = siginfo pointer +* r2 = ucontext pointer +* r5 = ucontext pointer +* pc = signal handler pointer +* sp = sigframe struct pointer +* lr = sigtramp at base of user stack +*/ + + regs->regs[0 ] = sig; + regs->regs[1 ] = frame_addr + + offsetof(struct target_sigframe , sf_si); + regs->regs[2 ] = frame_addr + + offsetof(struct target_sigframe , sf_uc); + +/* the trampoline uses r5 as the uc address */ + regs->regs[5 ] = frame_addr + + offsetof(struct target_sigframe , sf_uc); + regs->regs[TARGET_REG_PC ] = ka->_sa_handler; + regs->regs[TARGET_REG_SP ] = frame_addr; + regs->regs[TARGET_REG_LR ] =TARGET_PS_STRINGS -TARGET_SZSIGCODE ; + +return 0 ; +} + +/* +* Compare to arm/arm/machdep.c get_mcontext() +* Assumes that the memory is locked if mcp points to user memory. +*/ +static inline abi_long get_mcontext (CPUARMState *regs,target_mcontext_t *mcp, +int flags) +{ +int err =0 ; +uint32_t *gr = mcp->__gregs; + + +if (flags &TARGET_MC_GET_CLEAR_RET ) { + gr[TARGET_REG_R0 ] =0 ; + }else { + gr[TARGET_REG_R0 ] =tswap32 (regs->regs[0 ]); + } + + gr[TARGET_REG_R1 ] =tswap32 (regs->regs[1 ]); + gr[TARGET_REG_R2 ] =tswap32 (regs->regs[2 ]); + gr[TARGET_REG_R3 ] =tswap32 (regs->regs[3 ]); + gr[TARGET_REG_R4 ] =tswap32 (regs->regs[4 ]); + gr[TARGET_REG_R5 ] =tswap32 (regs->regs[5 ]); + gr[TARGET_REG_R6 ] =tswap32 (regs->regs[6 ]); + gr[TARGET_REG_R7 ] =tswap32 (regs->regs[7 ]); + gr[TARGET_REG_R8 ] =tswap32 (regs->regs[8 ]); + gr[TARGET_REG_R9 ] =tswap32 (regs->regs[9 ]); + gr[TARGET_REG_R10 ] =tswap32 (regs->regs[10 ]); + gr[TARGET_REG_R11 ] =tswap32 (regs->regs[11 ]); + gr[TARGET_REG_R12 ] =tswap32 (regs->regs[12 ]); + + gr[TARGET_REG_SP ] =tswap32 (regs->regs[13 ]); + gr[TARGET_REG_LR ] =tswap32 (regs->regs[14 ]); + gr[TARGET_REG_PC ] =tswap32 (regs->regs[15 ]); + gr[TARGET_REG_CPSR ] =tswap32 (cpsr_read (regs)); + +return err; +} + +/* Compare to arm/arm/machdep.c set_mcontext() */ +static inline abi_long set_mcontext (CPUARMState *regs,target_mcontext_t *mcp, +int srflag) +{ +int err =0 ; +const uint32_t *gr = mcp->__gregs; +uint32_t cpsr; + + regs->regs[0 ] =tswap32 (gr[TARGET_REG_R0 ]); + regs->regs[1 ] =tswap32 (gr[TARGET_REG_R1 ]); + regs->regs[2 ] =tswap32 (gr[TARGET_REG_R2 ]); + regs->regs[3 ] =tswap32 (gr[TARGET_REG_R3 ]); + regs->regs[4 ] =tswap32 (gr[TARGET_REG_R4 ]); + regs->regs[5 ] =tswap32 (gr[TARGET_REG_R5 ]); + regs->regs[6 ] =tswap32 (gr[TARGET_REG_R6 ]); + regs->regs[7 ] =tswap32 (gr[TARGET_REG_R7 ]); + regs->regs[8 ] =tswap32 (gr[TARGET_REG_R8 ]); + regs->regs[9 ] =tswap32 (gr[TARGET_REG_R9 ]); + regs->regs[10 ] =tswap32 (gr[TARGET_REG_R10 ]); + regs->regs[11 ] =tswap32 (gr[TARGET_REG_R11 ]); + regs->regs[12 ] =tswap32 (gr[TARGET_REG_R12 ]); + + regs->regs[13 ] =tswap32 (gr[TARGET_REG_SP ]); + regs->regs[14 ] =tswap32 (gr[TARGET_REG_LR ]); + regs->regs[15 ] =tswap32 (gr[TARGET_REG_PC ]); + cpsr =tswap32 (gr[TARGET_REG_CPSR ]); +cpsr_write (regs, cpsr,CPSR_USER |CPSR_EXEC ); + +return err; +} + +/* Compare to arm/arm/machdep.c sys_sigreturn() */ +static inline abi_long get_ucontext_sigreturn (CPUARMState *regs, +abi_ulong target_sf,abi_ulong *target_uc) +{ +uint32_t cpsr =cpsr_read (regs); + + *target_uc =0 ; + +if ((cpsr &CPSR_M ) !=ARM_CPU_MODE_USR || + (cpsr & (CPSR_I |CPSR_F )) !=0 ) { +return -TARGET_EINVAL ; + } + + *target_uc = target_sf + offsetof(struct target_sigframe , sf_uc); + +return 0 ; +} + + +#endif /* !_TARGET_ARCH_SIGNAL_H_ */
bsd-user/bsd-signal.h new file +232 -0
232 lines not on this page · raw message
bsd-user/errno_defs.h +10 -3
@@ -1,6 +1,3 @@ -/* $OpenBSD: errno.h,v 1.20 2007/09/03 14:37:52 millert Exp $ */ -/* $NetBSD: errno.h,v 1.10 1996/01/20 01:33:53 jtc Exp $ */ -/* * Copyright (c) 1982, 1986, 1989, 1993 * The Regents of the University of California. All rights reserved.
@@ -37,6 +34,9 @@* @(#)errno.h 8.5 (Berkeley) 1/21/94 */ +#ifndef _ERRNO_DEFS_H_ +#define _ERRNO_DEFS_H_ +#define TARGET_EPERM 1/* Operation not permitted */ #define TARGET_ENOENT 2/* No such file or directory */ #define TARGET_ESRCH 3/* No such process */
@@ -147,3 +147,10 @@#define TARGET_EIDRM 89/* Identifier removed */ #define TARGET_ENOMSG 90/* No message of desired type */ #define TARGET_ELAST 90/* Must be equal largest errno */ + +/* Internal errors: */ +#define TARGET_EJUSTRETURN 254/* Just return without +modifing regs */ +#define TARGET_ERESTART 255/* Restart syscall */ + +#endif /* ! _ERRNO_DEFS_H_ */
bsd-user/freebsd/os-signal.h new file +43 -0
43 lines not on this page · raw message
bsd-user/freebsd/target_os_siginfo.h new file +100 -0
100 lines not on this page · raw message
bsd-user/freebsd/target_os_signal.h new file +79 -0
79 lines not on this page · raw message
bsd-user/i386/target_arch_signal.h new file +94 -0
94 lines not on this page · raw message
bsd-user/mips/target_arch_signal.h new file +237 -0
237 lines not on this page · raw message
bsd-user/mips64/target_arch_signal.h new file +236 -0
236 lines not on this page · raw message
bsd-user/netbsd/target_os_siginfo.h new file +82 -0
82 lines not on this page · raw message
bsd-user/netbsd/target_os_signal.h new file +70 -0
70 lines not on this page · raw message
bsd-user/openbsd/target_os_siginfo.h new file +82 -0
82 lines not on this page · raw message
bsd-user/openbsd/target_os_signal.h new file +70 -0
70 lines not on this page · raw message
bsd-user/qemu.h +20 -13
@@ -39,7 +39,7 @@ extern enum BSDType bsd_type;#include "syscall_defs.h" #include "syscall.h" #include "target_os_vmparam.h" -#include "target_signal.h" +#include "target_os_signal.h" #include "exec/gdbstub.h" #if defined(CONFIG_USE_NPTL )
@@ -72,16 +72,16 @@ struct image_info {#define MAX_SIGQUEUE_SIZE 1024 -struct sigqueue { -struct sigqueue *next; -//target_siginfo_t info; +struct qemu_sigqueue { +struct qemu_sigqueue *next; +target_siginfo_t info; };struct emulated_sigtable {int pending;/* true if signal is pending */ -struct sigqueue *first; -struct sigqueue info;/* in order to always have memory for the -first signal, we put it here */ +struct qemu_sigqueue *first; +struct qemu_sigqueue info;/* in order to always have memory for the +first signal, we put it here */ };/* NOTE: we force a big alignment so that the stack stored after is
@@ -93,8 +93,8 @@ typedef struct TaskState {struct bsd_binprm *bprm;struct emulated_sigtable sigtab[TARGET_NSIG ]; -struct sigqueue sigqueue_table[MAX_SIGQUEUE_SIZE ];/* siginfo queue */ -struct sigqueue *first_free;/* first free siginfo queue entry */ +struct qemu_sigqueue sigqueue_table[MAX_SIGQUEUE_SIZE ];/* siginfo queue */ +struct qemu_sigqueue *first_free;/* first free siginfo queue entry */ int signal_pending;/* non zero if a signal may be pending */ uint8_t stack[0 ];
@@ -202,12 +202,19 @@ extern int do_strace;/* signal.c */ void process_pending_signals (CPUArchState *cpu_env);void signal_init (void ); -//int queue_signal(CPUArchState *env, int sig, target_siginfo_t *info); -//void host_to_target_siginfo(target_siginfo_t *tinfo, const siginfo_t *info); -//void target_to_host_siginfo(siginfo_t *info, const target_siginfo_t *tinfo); -long do_sigreturn (CPUArchState *env); +int queue_signal (CPUArchState *env,int sig,target_siginfo_t *info); +void host_to_target_siginfo (target_siginfo_t *tinfo,const siginfo_t *info); +void target_to_host_siginfo (siginfo_t *info,const target_siginfo_t *tinfo); +int target_to_host_signal (int sig); +int host_to_target_signal (int sig); +void host_to_target_sigset (target_sigset_t *d,const sigset_t *s); +void target_to_host_sigset (sigset_t *d,const target_sigset_t *s); +long do_sigreturn (CPUArchState *env,abi_ulong addr);long do_rt_sigreturn (CPUArchState *env);abi_long do_sigaltstack (abi_ulong uss_addr,abi_ulong uoss_addr,abi_ulong sp); +int do_sigaction (int sig,const struct target_sigaction *act, +struct target_sigaction *oact); +void QEMU_NORETURN force_sig(int target_sig);/* mmap.c */ int target_mprotect (abi_ulong start,abi_ulong len,int prot);
bsd-user/signal.c +906 -1
928 lines not on this page · raw message
bsd-user/sparc/target_arch_signal.h new file +77 -0
77 lines not on this page · raw message
bsd-user/sparc64/target_arch_signal.h new file +94 -0
94 lines not on this page · raw message
bsd-user/syscall.c +59 -0
73 lines not on this page · raw message
bsd-user/x86_64/target_arch_signal.h new file +94 -0
94 lines not on this page · raw message
Signature · 1 line
1.7.8
PATCH 8/18 bsd-user: move target arch and host OS dependent code out of elfload.c
In reply to Stacey SonThis change moves ELF and thread start up code from elfload.c to the host OS and arch dependent directories. This eliminates many of the #ifdef's in elfload.c and moves the target arch and OS dependent code into its own directories.
--- bsd-user/arm/target_arch_elf.h | 54 ++ bsd-user/arm/target_arch_thread.h | 62 +++ bsd-user/elfload.c | 938 +++++++-------------------------- bsd-user/freebsd/target_os_elf.h | 145 +++++ bsd-user/freebsd/target_os_thread.h | 6 + bsd-user/i386/target_arch_elf.h | 62 +++ bsd-user/i386/target_arch_thread.h | 45 ++ bsd-user/mips/target_arch_elf.h | 36 ++ bsd-user/mips/target_arch_thread.h | 54 ++ bsd-user/mips64/target_arch_elf.h | 36 ++ bsd-user/mips64/target_arch_thread.h | 54 ++ bsd-user/netbsd/target_os_elf.h | 226 ++++++++ bsd-user/netbsd/target_os_thread.h | 6 + bsd-user/openbsd/target_os_elf.h | 226 ++++++++ bsd-user/openbsd/target_os_thread.h | 6 + bsd-user/sparc/target_arch_elf.h | 30 + bsd-user/sparc/target_arch_thread.h | 39 ++ bsd-user/sparc64/target_arch_elf.h | 34 ++ bsd-user/sparc64/target_arch_thread.h | 55 ++ bsd-user/syscall_defs.h | 64 +++ bsd-user/x86_64/target_arch_elf.h | 55 ++ bsd-user/x86_64/target_arch_thread.h | 40 ++ 22 files changed, 1518 insertions(+), 755 deletions(-) create mode 100644 bsd-user/arm/target_arch_elf.h create mode 100644 bsd-user/arm/target_arch_thread.h create mode 100644 bsd-user/freebsd/target_os_elf.h create mode 100644 bsd-user/freebsd/target_os_thread.h create mode 100644 bsd-user/i386/target_arch_elf.h create mode 100644 bsd-user/i386/target_arch_thread.h create mode 100644 bsd-user/mips/target_arch_elf.h create mode 100644 bsd-user/mips/target_arch_thread.h create mode 100644 bsd-user/mips64/target_arch_elf.h create mode 100644 bsd-user/mips64/target_arch_thread.h create mode 100644 bsd-user/netbsd/target_os_elf.h create mode 100644 bsd-user/netbsd/target_os_thread.h create mode 100644 bsd-user/openbsd/target_os_elf.h create mode 100644 bsd-user/openbsd/target_os_thread.h create mode 100644 bsd-user/sparc/target_arch_elf.h create mode 100644 bsd-user/sparc/target_arch_thread.h create mode 100644 bsd-user/sparc64/target_arch_elf.h create mode 100644 bsd-user/sparc64/target_arch_thread.h create mode 100644 bsd-user/x86_64/target_arch_elf.h create mode 100644 bsd-user/x86_64/target_arch_thread.h
bsd-user/arm/target_arch_elf.h new file +54 -0
@@ -0,0 +1,54 @@ +/* +* arm ELF definitions +* +* Copyright (c) 2013 Stacey D. Son +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, see <http://www.gnu.org/licenses/>. +*/ +#ifndef _TARGET_ARCH_ELF_H_ +#define _TARGET_ARCH_ELF_H_ + +#define ELF_START_MMAP 0x80000000 + +#define elf_check_arch (x) ( (x) == EM_ARM ) + +#define ELF_CLASS ELFCLASS32 +#ifdef TARGET_WORDS_BIGENDIAN +#define ELF_DATA ELFDATA2MSB +#else +#define ELF_DATA ELFDATA2LSB +#endif +#define ELF_ARCH EM_ARM + +#define USE_ELF_CORE_DUMP +#define ELF_EXEC_PAGESIZE 4096 + +enum +{ +ARM_HWCAP_ARM_SWP =1 <<0 , +ARM_HWCAP_ARM_HALF =1 <<1 , +ARM_HWCAP_ARM_THUMB =1 <<2 , +ARM_HWCAP_ARM_26BIT =1 <<3 , +ARM_HWCAP_ARM_FAST_MULT =1 <<4 , +ARM_HWCAP_ARM_FPA =1 <<5 , +ARM_HWCAP_ARM_VFP =1 <<6 , +ARM_HWCAP_ARM_EDSP =1 <<7 , +}; + +#define ELF_HWCAP (ARM_HWCAP_ARM_SWP | ARM_HWCAP_ARM_HALF \ + | ARM_HWCAP_ARM_THUMB | ARM_HWCAP_ARM_FAST_MULT \ + | ARM_HWCAP_ARM_FPA | ARM_HWCAP_ARM_VFP) + + +#endif /* _TARGET_ARCH_ELF_H_ */
bsd-user/arm/target_arch_thread.h new file +62 -0
62 lines not on this page · raw message
bsd-user/elfload.c +183 -755
1,132 lines not on this page · raw message
bsd-user/freebsd/target_os_elf.h new file +145 -0
145 lines not on this page · raw message
bsd-user/freebsd/target_os_thread.h new file +6 -0
@@ -0,0 +1,6 @@ +#ifndef _TARGET_OS_THREAD_H_ +#define _TARGET_OS_THREAD_H_ + +#include "target_arch_thread.h" + +#endif /* !_TARGET_OS_THREAD_H_ */
bsd-user/i386/target_arch_elf.h new file +62 -0
62 lines not on this page · raw message
bsd-user/i386/target_arch_thread.h new file +45 -0
45 lines not on this page · raw message
bsd-user/mips/target_arch_elf.h new file +36 -0
@@ -0,0 +1,36 @@ +/* +* mips ELF definitions +* +* Copyright (c) 2013 Stacey D. Son +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, see <http://www.gnu.org/licenses/>. +*/ +#ifndef _TARGET_ARCH_ELF_H_ +#define _TARGET_ARCH_ELF_H_ + +#define elf_check_arch (x) ( (x) == EM_MIPS ) +#define ELF_START_MMAP 0x80000000 +#define ELF_CLASS ELFCLASS32 + +#ifdef TARGET_WORDS_BIGENDIAN +#define ELF_DATA ELFDATA2MSB +#else +#define ELF_DATA ELFDATA2LSB +#endif +#define ELF_ARCH EM_MIPS + +#define USE_ELF_CORE_DUMP +#define ELF_EXEC_PAGESIZE 4096 + +#endif /* _TARGET_ARCH_ELF_H_ */
bsd-user/mips/target_arch_thread.h new file +54 -0
54 lines not on this page · raw message
bsd-user/mips64/target_arch_elf.h new file +36 -0
@@ -0,0 +1,36 @@ +/* +* mips64 ELF definitions +* +* Copyright (c) 2013 Stacey D. Son +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, see <http://www.gnu.org/licenses/>. +*/ +#ifndef _TARGET_ARCH_ELF_H_ +#define _TARGET_ARCH_ELF_H_ + +#define elf_check_arch (x) ( (x) == EM_MIPS ) +#define ELF_START_MMAP 0x2aaaaab000ULL +#define ELF_CLASS ELFCLASS64 + +#ifdef TARGET_WORDS_BIGENDIAN +#define ELF_DATA ELFDATA2MSB +#else +#define ELF_DATA ELFDATA2LSB +#endif +#define ELF_ARCH EM_MIPS + +#define USE_ELF_CORE_DUMP +#define ELF_EXEC_PAGESIZE 4096 + +#endif /* _TARGET_ARCH_ELF_H_ */
bsd-user/mips64/target_arch_thread.h new file +54 -0
54 lines not on this page · raw message
bsd-user/netbsd/target_os_elf.h new file +226 -0
226 lines not on this page · raw message
bsd-user/netbsd/target_os_thread.h new file +6 -0
@@ -0,0 +1,6 @@ +#ifndef _TARGET_OS_THREAD_H_ +#define _TARGET_OS_THREAD_H_ + +#include "target_arch_thread.h" + +#endif /* !_TARGET_OS_THREAD_H_ */
bsd-user/openbsd/target_os_elf.h new file +226 -0
226 lines not on this page · raw message
bsd-user/openbsd/target_os_thread.h new file +6 -0
@@ -0,0 +1,6 @@ +#ifndef _TARGET_OS_THREAD_H_ +#define _TARGET_OS_THREAD_H_ + +#include "target_arch_thread.h" + +#endif /* !_TARGET_OS_THREAD_H_ */
bsd-user/sparc/target_arch_elf.h new file +30 -0
@@ -0,0 +1,30 @@ +/* +* sparc ELF definitions +* +* Copyright (c) 2013 Stacey D. Son +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, see <http://www.gnu.org/licenses/>. +*/ +#ifndef _TARGET_ARCH_ELF_H_ +#define _TARGET_ARCH_ELF_H_ + +#define ELF_START_MMAP 0x80000000 + +#define elf_check_arch (x) ( (x) == EM_SPARC ) + +#define ELF_CLASS ELFCLASS32 +#define ELF_DATA ELFDATA2MSB +#define ELF_ARCH EM_SPARC + +#endif /* _TARGET_ARCH_ELF_H_ */
bsd-user/sparc/target_arch_thread.h new file +39 -0
@@ -0,0 +1,39 @@ +/* +* sparc thread support +* +* Copyright (c) 2013 Stacey D. Son +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, see <http://www.gnu.org/licenses/>. +*/ +#ifndef _TARGET_ARCH_THREAD_H_ +#define _TARGET_ARCH_THREAD_H_ + +/* Compare to vm_machdep.c cpu_set_upcall_kse() */ +static inline void target_thread_set_upcall (CPUSPARCState *regs, +abi_ulong entry,abi_ulong arg,abi_ulong stack_base,abi_ulong stack_size) +{ +/* XXX */ +} + +static inline void target_thread_init (struct target_pt_regs *regs, +struct image_info *infop) +{ + regs->psr =0 ; + regs->pc = infop->entry; + regs->npc = regs->pc +4 ; + regs->y =0 ; + regs->u_regs[14 ] = infop->start_stack -16 *4 ; +} + +#endif /* !_TARGET_ARCH_THREAD_H_ */
bsd-user/sparc64/target_arch_elf.h new file +34 -0
@@ -0,0 +1,34 @@ +/* +* sparc64 ELF definitions +* +* Copyright (c) 2013 Stacey D. Son +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, see <http://www.gnu.org/licenses/>. +*/ +#ifndef _TARGET_ARCH_ELF_H_ +#define _TARGET_ARCH_ELF_H_ + +#define ELF_START_MMAP 0x80000000 + +#ifndef TARGET_ABI32 +#define elf_check_arch (x) ( (x) == EM_SPARCV9 || (x) == EM_SPARC32PLUS ) +#else +#define elf_check_arch (x) ( (x) == EM_SPARC32PLUS || (x) == EM_SPARC ) +#endif + +#define ELF_CLASS ELFCLASS64 +#define ELF_DATA ELFDATA2MSB +#define ELF_ARCH EM_SPARCV9 + +#endif /* _TARGET_ARCH_ELF_H_ */
bsd-user/sparc64/target_arch_thread.h new file +55 -0
55 lines not on this page · raw message
bsd-user/syscall_defs.h +64 -0
68 lines not on this page · raw message
bsd-user/x86_64/target_arch_elf.h new file +55 -0
55 lines not on this page · raw message
bsd-user/x86_64/target_arch_thread.h new file +40 -0
@@ -0,0 +1,40 @@ +/* +* x86_64 thread support +* +* Copyright (c) 2013 Stacey D. Son +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, see <http://www.gnu.org/licenses/>. +*/ +#ifndef _TARGET_ARCH_THREAD_H_ +#define _TARGET_ARCH_THREAD_H_ + +/* Compare to vm_machdep.c cpu_set_upcall_kse() */ +static inline void target_thread_set_upcall (CPUX86State *regs,abi_ulong entry, +abi_ulong arg,abi_ulong stack_base,abi_ulong stack_size) +{ +/* XXX */ +} + +static inline void target_thread_init (struct target_pt_regs *regs, +struct image_info *infop) +{ + regs->rax =0 ; + regs->rsp = infop->start_stack; + regs->rip = infop->entry; +if (bsd_type == target_freebsd) { + regs->rdi = infop->start_stack; + } +} + +#endif /* !_TARGET_ARCH_THREAD_H_ */
Signature · 1 line
1.7.8
PATCH 9/18 bsd-user: add support for freebsd process related system calls
In reply to Stacey SonThis change add support or stubs for process related system calls including fork(2), vfork(2), rfork(2), pdfork(2), execve(2), fexecve(2), wait4(2), exit(2), getgroups(2), setgroups(2), umask(2), setlogin(2), getlogin(2), getrusage(2), getrlimit(2), setrlimit(2), getpid(2), getppid(2), getuid(2), geteuid(2), getgid(2), getegid(2), setuid(2), seteuid(2), setgid(2), setegid(2), getpgrp(2), setreuid(2), setregid(2), getresuid(2), getresgid(2), getsid(2), setsid(2), issetugid(2), profil(2), ktrace(2), setloginclass(2), getloginclass(2), pdgetpid(2), jail*(2), cap_*(2), *audit*(2), utrace(2), ptrace(2), getpriority(2), and setpriority(2).
--- bsd-user/Makefile.objs | 4 +- bsd-user/bsd-proc.c | 160 ++++++++++++++++ bsd-user/bsd-proc.h | 434 ++++++++++++++++++++++++++++++++++++++++++++ bsd-user/freebsd/os-proc.c | 234 ++++++++++++++++++++++++ bsd-user/freebsd/os-proc.h | 428 +++++++++++++++++++++++++++++++++++++++++++ bsd-user/netbsd/os-proc.c | 11 + bsd-user/netbsd/os-proc.h | 243 +++++++++++++++++++++++++ bsd-user/openbsd/os-proc.c | 11 + bsd-user/openbsd/os-proc.h | 243 +++++++++++++++++++++++++ bsd-user/qemu-bsd.h | 43 +++++ bsd-user/qemu.h | 4 + bsd-user/syscall.c | 262 ++++++++++++++++++++++++++- 12 files changed, 2069 insertions(+), 8 deletions(-) create mode 100644 bsd-user/bsd-proc.c create mode 100644 bsd-user/bsd-proc.h create mode 100644 bsd-user/freebsd/os-proc.c create mode 100644 bsd-user/freebsd/os-proc.h create mode 100644 bsd-user/netbsd/os-proc.c create mode 100644 bsd-user/netbsd/os-proc.h create mode 100644 bsd-user/openbsd/os-proc.c create mode 100644 bsd-user/openbsd/os-proc.h create mode 100644 bsd-user/qemu-bsd.h
bsd-user/Makefile.objs +3 -1
@@ -1,3 +1,5 @@ obj-y = main.o bsdload.o elfload.o mmap.o signal.o strace.o syscall.o \ - uaccess.o $(HOST_ABI_DIR)/os-sys.o \ + uaccess.o bsd-proc.o \ + $(HOST_ABI_DIR)/os-proc.o \ + $(HOST_ABI_DIR)/os-sys.o \ $(HOST_ABI_DIR)/os-time.o $(TARGET_ABI_DIR)/target_arch_cpu.o
bsd-user/bsd-proc.c new file +160 -0
160 lines not on this page · raw message
bsd-user/bsd-proc.h new file +434 -0
434 lines not on this page · raw message
bsd-user/freebsd/os-proc.c new file +234 -0
234 lines not on this page · raw message
bsd-user/freebsd/os-proc.h new file +428 -0
428 lines not on this page · raw message
bsd-user/netbsd/os-proc.c new file +11 -0
@@ -0,0 +1,11 @@ +/* +* XXX To support FreeBSD binaries on NetBSD the following will need to be +* emulated. +*/ +abi_long freebsd_exec_common (abi_ulong path_or_fd,abi_ulong guest_argp, +abi_ulong guest_envp,int do_fexec) +{ + +qemu_log ("qemu: Unsupported %s\n" , __func__); +return -TARGET_ENOSYS ; +}
bsd-user/netbsd/os-proc.h new file +243 -0
243 lines not on this page · raw message
bsd-user/openbsd/os-proc.c new file +11 -0
@@ -0,0 +1,11 @@ +/* +* XXX To support FreeBSD binaries on NetBSD the following will need to be +* emulated. +*/ +abi_long freebsd_exec_common (abi_ulong path_or_fd,abi_ulong guest_argp, +abi_ulong guest_envp,int do_fexec) +{ + +qemu_log ("qemu: Unsupported %s\n" , __func__); +return -TARGET_ENOSYS ; +}
bsd-user/openbsd/os-proc.h new file +243 -0
243 lines not on this page · raw message
bsd-user/qemu-bsd.h new file +43 -0
43 lines not on this page · raw message
bsd-user/qemu.h +4 -0
@@ -248,6 +248,10 @@ extern char qemu_proc_pathname[];abi_long get_errno (abi_long ret);int is_error (abi_long ret); +/* os-proc.c */ +abi_long freebsd_exec_common (abi_ulong path_or_fd,abi_ulong guest_argp, +abi_ulong guest_envp,int do_fexec); +/* 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);
bsd-user/syscall.c +255 -7
288 lines not on this page · raw message
Signature · 1 line
1.7.8
PATCH 10/18 bsd-user: add support for file system related system calls
In reply to Stacey SonThis change adds support or stubs for file system (except stat) related system calls including read(2), pread(2), readv(2), write(2), pwrite(2), writev(2), pwritev(2), open(2), openat(2), close(2), closefrom(2), revoke(2), access(2), eaccess(2), faccessat(2), chdir(2), fchdir(2), rename(2), renameat(2), link(2), linkat(2), unlink(2), unlinkat(2), mkdir(2), mkdirat(2), rmdir(2), __getcwd(), dup(2), dup2(2), truncate(2), ftruncate(2), acct(2), sync(2), mount(2), nmount(2), symlink(2), symlinkat(2), readlink(2), readlinkat(2), chmod(2), fchmod(2), lchmod(2), fchmodat(2), mknod(2), mknodat(2), chown(2), fchown(2), lchown(2), fchownat(2), chflags(2), lchflags(2), fchflags(2), chroot(2), flock(2), mkfifo(2), mkfifoat(2), pathconf(2), lpathconf(2), fpathconf(2), undelete(2), poll(2), lseek(2), pipe(2), swapon(2), swapoff(2), and the undocumented openbsd_poll() and freebsd6_*() system calls.
--- bsd-user/bsd-file.h | 1111 +++++++++++++++++++++++++++++++++++++++++++++++++++ bsd-user/qemu.h | 36 ++ bsd-user/syscall.c | 391 ++++++++++++++---- 3 files changed, 1454 insertions(+), 84 deletions(-) create mode 100644 bsd-user/bsd-file.h
bsd-user/bsd-file.h new file +1111 -0
@@ -0,0 +1,1111 @@ +/* +* file related system call shims and definitions +* +* Copyright (c) 2013 Stacey D. Son +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef __BSD_FILE_H_ +#define __BSD_FILE_H_ + +#include <sys/types.h> +#include <sys/mount.h> +#include <sys/uio.h> +#include <fcntl.h> +#include <poll.h> +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> + +#define target_to_host_bitmask (x, tbl) (x) + +#define LOCK_PATH (p, arg) do { \ + (p) = lock_user_string(arg); \ + if ((p) == NULL) { \ + return -TARGET_EFAULT; \ + } \ +} while (0) + +#define UNLOCK_PATH (p, arg) unlock_user((p), (arg), 0) + +struct target_pollfd { +int32_t fd;/* file descriptor */ +int16_t events;/* requested events */ +int16_t revents;/* returned events */ +}; + +static abi_long lock_iovec (int type,struct iovec *vec,abi_ulong target_addr, +int count,int copy); +static abi_long unlock_iovec (struct iovec *vec,abi_ulong target_addr, +int count,int copy); +extern int __getcwd (char *path,size_t len); + +/* read(2) */ +static inline abi_long do_bsd_read (abi_long arg1,abi_long arg2,abi_long arg3) +{ +abi_long ret; +void *p; + + p =lock_user (VERIFY_WRITE , arg2, arg3,0 ); +if (p ==NULL ) { +return -TARGET_EFAULT ; + } + ret =get_errno (read (arg1, p, arg3)); +unlock_user (p, arg2, ret); + +return ret; +} + +/* pread(2) */ +static inline abi_long do_bsd_pread (void *cpu_env,abi_long arg1, +abi_long arg2,abi_long arg3,abi_long arg4,abi_long arg5,abi_long arg6) +{ +abi_long ret; +void *p; + + p =lock_user (VERIFY_WRITE , arg2, arg3,0 ); +if (p ==NULL ) { +return -TARGET_EFAULT ; + } +if (regpairs_aligned (cpu_env) !=0 ) { + arg4 = arg5; + arg5 = arg6; + } + ret =get_errno (pread (arg1, p, arg3,target_offset64 (arg4, arg5))); +unlock_user (p, arg2, ret); + +return ret; +} + +/* readv(2) */ +static inline abi_long do_bsd_readv (abi_long arg1,abi_long arg2,abi_long arg3) +{ +abi_long ret; +int count = arg3; +struct iovec *vec; + + vec =alloca (count *sizeof (struct iovec )); +if (vec ==NULL ) { +return -TARGET_ENOMEM ; + } +if (lock_iovec (VERIFY_WRITE , vec, arg2, count,0 ) <0 ) { +return -TARGET_EFAULT ; + } + ret =get_errno (readv (arg1, vec, count)); +unlock_iovec (vec, arg2, count,1 ); + +return ret; +} + +/* write(2) */ +static inline abi_long do_bsd_write (abi_long arg1,abi_long arg2,abi_long arg3) +{ +abi_long ret; +void *p; + + p =lock_user (VERIFY_READ , arg2, arg3,1 ); +if (p ==NULL ) { +return -TARGET_EFAULT ; + } + ret =get_errno (write (arg1, p, arg3)); +unlock_user (p, arg2,0 ); + +return ret; +} + +/* pwrite(2) */ +static inline abi_long do_bsd_pwrite (void *cpu_env,abi_long arg1, +abi_long arg2,abi_long arg3,abi_long arg4,abi_long arg5,abi_long arg6) +{ +abi_long ret; +void *p; + + p =lock_user (VERIFY_READ , arg2, arg3,1 ); +if (p ==NULL ) { +return -TARGET_EFAULT ; + } +if (regpairs_aligned (cpu_env) !=0 ) { + arg4 = arg5; + arg5 = arg6; + } + ret =get_errno (pwrite (arg1, p, arg3,target_offset64 (arg4, arg5))); +unlock_user (p, arg2,0 ); + +return ret; +} + +/* writev(2) */ +static inline abi_long do_bsd_writev (abi_long arg1,abi_long arg2, +abi_long arg3) +{ +abi_long ret; +int count = arg3; +struct iovec *vec; + + vec =alloca (count *sizeof (struct iovec )); +if (vec ==NULL ) { +return -TARGET_ENOMEM ; + } +if (lock_iovec (VERIFY_READ , vec, arg2, count,1 ) <0 ) { +return -TARGET_EFAULT ; + } + ret =get_errno (writev (arg1, vec, count)); +unlock_iovec (vec, arg2, count,0 ); + +return ret; +} + +/* pwritev(2) */ +static inline abi_long do_bsd_pwritev (void *cpu_env,abi_long arg1, +abi_long arg2,abi_long arg3,abi_long arg4,abi_long arg5,abi_long arg6) +{ +abi_long ret; +int count = arg3; +struct iovec *vec; + + vec =alloca (count *sizeof (struct iovec )); +if (vec ==NULL ) { +return -TARGET_ENOMEM ; + } +if (lock_iovec (VERIFY_READ , vec, arg2, count,1 ) <0 ) { +return -TARGET_EFAULT ; + } +if (regpairs_aligned (cpu_env) !=0 ) { + arg4 = arg5; + arg5 = arg6; + } + ret =get_errno (pwritev (arg1, vec, count,target_offset64 (arg4, arg5))); +unlock_iovec (vec, arg2, count,0 ); + +return ret; +} + +/* open(2) */ +static inline abi_long do_bsd_open (abi_long arg1,abi_long arg2,abi_long arg3) +{ +abi_long ret; +void *p; + +LOCK_PATH (p, arg1); + ret =get_errno (open (path (p),target_to_host_bitmask (arg2, fcntl_flags_tbl), + arg3)); +UNLOCK_PATH (p, arg1); + +return ret; +} + +/* openat(2) */ +static inline abi_long do_bsd_openat (abi_long arg1,abi_long arg2, +abi_long arg3,abi_long arg4) +{ +abi_long ret; +void *p; + +LOCK_PATH (p, arg2); + ret =get_errno (openat (arg1,path (p), +target_to_host_bitmask (arg3, fcntl_flags_tbl), arg4)); +UNLOCK_PATH (p, arg2); + +return ret; +} + +/* close(2) */ +static inline abi_long do_bsd_close (abi_long arg1) +{ + +return get_errno (close (arg1)); +} + +/* closefrom(2) */ +static inline abi_long do_bsd_closefrom (abi_long arg1) +{ + +closefrom (arg1);/* returns void */ +return get_errno (0 ); +} + +/* revoke(2) */ +static inline abi_long do_bsd_revoke (abi_long arg1) +{ +abi_long ret; +void *p; + +LOCK_PATH (p, arg1); + ret =get_errno (revoke (p));/* XXX path(p)? */ +UNLOCK_PATH (p, arg1); + +return ret; +} + +/* creat(2) (obsolete) */ +static inline abi_long do_bsd_creat (abi_long arg1,abi_long arg2) +{ +abi_long ret; +void *p; + +LOCK_PATH (p, arg1); + ret =get_errno (open (path (p),O_CREAT |O_TRUNC |O_WRONLY , arg2)); +UNLOCK_PATH (p, arg1); + +return ret; +} + + +/* access(2) */ +static inline abi_long do_bsd_access (abi_long arg1,abi_long arg2) +{ +abi_long ret; +void *p; + +LOCK_PATH (p, arg1); + ret =get_errno (access (path (p), arg2)); +UNLOCK_PATH (p, arg1); + +return ret; +} + +/* eaccess(2) */ +static inline abi_long do_bsd_eaccess (abi_long arg1,abi_long arg2) +{ +abi_long ret; +void *p; + +LOCK_PATH (p, arg1); + ret =get_errno (eaccess (path (p), arg2)); +UNLOCK_PATH (p, arg1); + +return ret; +} + +/* faccessat(2) */ +static inline abi_long do_bsd_faccessat (abi_long arg1,abi_long arg2, +abi_long arg3,abi_long arg4) +{ +abi_long ret; +void *p; + +LOCK_PATH (p, arg2); + ret =get_errno (faccessat (arg1, p, arg3, arg4));/* XXX path(p)? */ +UNLOCK_PATH (p, arg2); + +return ret; +} + +/* chdir(2) */ +static inline abi_long do_bsd_chdir (abi_long arg1) +{ +abi_long ret; +void *p; + +LOCK_PATH (p, arg1); + ret =get_errno (chdir (p));/* XXX path(p)? */ +UNLOCK_PATH (p, arg1); + +return ret; +} + +/* fchdir(2) */ +static inline abi_long do_bsd_fchdir (abi_long arg1) +{ + +return get_errno (fchdir (arg1)); +} + +/* rename(2) */ +static inline abi_long do_bsd_rename (abi_long arg1,abi_long arg2) +{ +abi_long ret; +void *p1, *p2; + +LOCK_PATH (p1, arg1); +LOCK_PATH (p2, arg2); +if (!p1 || !p2) { + ret = -TARGET_EFAULT ; + }else { + ret =get_errno (rename (p1, p2));/* XXX path(p1), path(p2) */ + } +UNLOCK_PATH (p2, arg2); +UNLOCK_PATH (p1, arg1); + +return ret; +} + +/* renameat(2) */ +static inline abi_long do_bsd_renameat (abi_long arg1,abi_long arg2, +abi_long arg3,abi_long arg4) +{ +abi_long ret; +void *p1, *p2; + +LOCK_PATH (p1, arg1); +LOCK_PATH (p2, arg2); +if (!p1 || !p2) { + ret = -TARGET_EFAULT ; + }else { + ret =get_errno (renameat (arg1, p1, arg3, p2)); + } +UNLOCK_PATH (p2, arg2); +UNLOCK_PATH (p1, arg1); + +return ret; +} + +/* link(2) */ +static inline abi_long do_bsd_link (abi_long arg1,abi_long arg2) +{ +abi_long ret; +void *p1, *p2; + +LOCK_PATH (p1, arg1); +LOCK_PATH (p2, arg2); +if (!p1 || !p2) { + ret = -TARGET_EFAULT ; + }else { + ret =get_errno (link (p1, p2));/* XXX path(p1), path(p2) */ + } +UNLOCK_PATH (p2, arg2); +UNLOCK_PATH (p1, arg1); + +return ret; +} + +/* linkat(2) */ +static inline abi_long do_bsd_linkat (abi_long arg1,abi_long arg2, +abi_long arg3,abi_long arg4,abi_long arg5) +{ +abi_long ret; +void *p1, *p2; + +LOCK_PATH (p1, arg2); +LOCK_PATH (p2, arg4); +if (!p1 || !p2) { + ret = -TARGET_EFAULT ; + }else { + ret =get_errno (linkat (arg1, p1, arg3, p2, arg5)); + } +UNLOCK_PATH (p2, arg4); +UNLOCK_PATH (p1, arg2); + +return ret; +} + +/* unlink(2) */ +static inline abi_long do_bsd_unlink (abi_long arg1) +{ +abi_long ret; +void *p; + +LOCK_PATH (p, arg1); + ret =get_errno (unlink (p));/* XXX path(p) */ +UNLOCK_PATH (p, arg1); + +return ret; +} + +/* unlinkat(2) */ +static inline abi_long do_bsd_unlinkat (abi_long arg1,abi_long arg2, +abi_long arg3) +{ +abi_long ret; +void *p; + +LOCK_PATH (p, arg2); + ret =get_errno (unlinkat (arg1, p, arg3));/* XXX path(p) */ +UNLOCK_PATH (p, arg2); + +return ret; +} + +/* mkdir(2) */ +static inline abi_long do_bsd_mkdir (abi_long arg1,abi_long arg2) +{ +abi_long ret; +void *p; + +LOCK_PATH (p, arg1); + ret =get_errno (mkdir (p, arg2));/* XXX path(p) */ +UNLOCK_PATH (p, arg1); + +return ret; +} + + +/* mkdirat(2) */ +static inline abi_long do_bsd_mkdirat (abi_long arg1,abi_long arg2, +abi_long arg3) +{ +abi_long ret; +void *p; + +LOCK_PATH (p, arg2); + ret =get_errno (mkdirat (arg1, p, arg3)); +UNLOCK_PATH (p, arg2); + +return ret; +} + + +/* rmdir(2) */ +static inline abi_long do_bsd_rmdir (abi_long arg1) +{ +abi_long ret; +void *p; + +LOCK_PATH (p, arg1); + ret =get_errno (rmdir (p));/* XXX path(p)? */ +UNLOCK_PATH (p, arg1); + +return ret; +} + +/* undocumented __getcwd(char *buf, size_t len) system call */ +static inline abi_long do_bsd___getcwd (abi_long arg1,abi_long arg2) +{ +abi_long ret; +void *p; + + p =lock_user (VERIFY_WRITE , arg1, arg2,0 ); +if (p ==NULL ) { +return -TARGET_EFAULT ; + } + ret =get_errno (__getcwd (p, arg2)); +unlock_user (p, arg1, ret); + +return ret; +} + +/* dup(2) */ +static inline abi_long do_bsd_dup (abi_long arg1) +{ + +return get_errno (dup (arg1)); +} + +/* dup2(2) */ +static inline abi_long do_bsd_dup2 (abi_long arg1,abi_long arg2) +{ + +return get_errno (dup2 (arg1, arg2)); +} + +/* truncate(2) */ +static inline abi_long do_bsd_truncate (void *cpu_env,abi_long arg1, +abi_long arg2,abi_long arg3,abi_long arg4) +{ +abi_long ret; +void *p; + +LOCK_PATH (p, arg1); +if (regpairs_aligned (cpu_env) !=0 ) { + arg2 = arg3; + arg3 = arg4; + } + ret =get_errno (truncate (p,target_offset64 (arg2, arg3))); +UNLOCK_PATH (p, arg1); + +return ret; +} + +/* ftruncate(2) */ +static inline abi_long do_bsd_ftruncate (void *cpu_env,abi_long arg1, +abi_long arg2,abi_long arg3,abi_long arg4) +{ + +if (regpairs_aligned (cpu_env) !=0 ) { + arg2 = arg3; + arg3 = arg4; + } +return get_errno (ftruncate (arg1,target_offset64 (arg2, arg3))); +} + +/* acct(2) */ +static inline abi_long do_bsd_acct (abi_long arg1) +{ +abi_long ret; +void *p; + +if (arg1 ==0 ) { + ret =get_errno (acct (NULL )); + }else { +LOCK_PATH (p, arg1); + ret =get_errno (acct (path (p))); +UNLOCK_PATH (p, arg1); + } +return ret; +} + +/* sync(2) */ +static inline abi_long do_bsd_sync (void ) +{ + +sync (); +return 0 ; +} + +/* mount(2) */ +static inline abi_long do_bsd_mount (abi_long arg1,abi_long arg2,abi_long arg3, +abi_long arg4) +{ +abi_long ret; +void *p1, *p2; + +LOCK_PATH (p1, arg1); +LOCK_PATH (p2, arg2); +if (!p1 || !p2) { + ret = -TARGET_EFAULT ; + }else { +/* +* XXX arg4 should be locked, but it isn't clear how to do that +* since it's it may be not be a NULL-terminated string. +*/ +if (arg4 ==0 ) { + ret =get_errno (mount (p1, p2, arg3,NULL ));/* XXX path(p2)? */ + }else { + ret =get_errno (mount (p1, p2, arg3,g2h (arg4)));/* XXX path(p2)? */ + } + } +UNLOCK_PATH (p2, arg2); +UNLOCK_PATH (p1, arg1); + +return ret; +} + +/* unmount(2) */ +static inline abi_long do_bsd_unmount (abi_long arg1,abi_long arg2) +{ +abi_long ret; +void *p; + +LOCK_PATH (p, arg1); + ret =get_errno (unmount (p, arg2));/* XXX path(p)? */ +UNLOCK_PATH (p, arg1); + +return ret; +} + +/* nmount(2) */ +static inline abi_long do_bsd_nmount (abi_long arg1,abi_long count, +abi_long flags) +{ +abi_long ret; +struct iovec *vec; + + vec =alloca (count *sizeof (struct iovec )); +if (lock_iovec (VERIFY_READ , vec, arg1, count,1 ) <0 ) { +return -TARGET_EFAULT ; + } + ret =get_errno (nmount (vec, count, flags)); +unlock_iovec (vec, arg1, count,0 ); + +return ret; +} + +/* symlink(2) */ +static inline abi_long do_bsd_symlink (abi_long arg1,abi_long arg2) +{ +abi_long ret; +void *p1, *p2; + +LOCK_PATH (p1, arg1); +LOCK_PATH (p2, arg2); +if (!p1 || !p2) { + ret = -TARGET_EFAULT ; + }else { + ret =get_errno (symlink (p1, p2));/* XXX path(p1), path(p2) */ + } +UNLOCK_PATH (p2, arg2); +UNLOCK_PATH (p1, arg1); + +return ret; +} + +/* symlinkat(2) */ +static inline abi_long do_bsd_symlinkat (abi_long arg1,abi_long arg2, +abi_long arg3) +{ +abi_long ret; +void *p1, *p2; + +LOCK_PATH (p1, arg1); +LOCK_PATH (p2, arg3); +if (!p1 || !p2) { + ret = -TARGET_EFAULT ; + }else { + ret =get_errno (symlinkat (p1, arg2, p2));/* XXX path(p1), path(p2) */ + } +UNLOCK_PATH (p2, arg3); +UNLOCK_PATH (p1, arg1); + +return ret; +} + +/* readlink(2) */ +static inline abi_long do_bsd_readlink (abi_long arg1,abi_long arg2, +abi_long arg3) +{ +abi_long ret; +void *p1, *p2; + +LOCK_PATH (p1, arg1); + p2 =lock_user (VERIFY_WRITE , arg2, arg3,0 ); +if (!p1 || !p2) { + ret = -TARGET_EFAULT ; + }else { + ret =get_errno (readlink (path (p1), p2, arg3)); + } +unlock_user (p2, arg2, ret); +UNLOCK_PATH (p1, arg1); + +return ret; +} + +/* readlinkat(2) */ +static inline abi_long do_bsd_readlinkat (abi_long arg1,abi_long arg2, +abi_long arg3,abi_long arg4) +{ +abi_long ret; +void *p1, *p2; + +LOCK_PATH (p1, arg2); + p2 =lock_user (VERIFY_WRITE , arg3, arg4,0 ); +if (!p1 || !p2) { + ret = -TARGET_EFAULT ; + }else { + ret =get_errno (readlinkat (arg1, p1, p2, arg4)); + } +unlock_user (p2, arg3, ret); +UNLOCK_PATH (p1, arg2); + +return ret; +} + +/* chmod(2) */ +static inline abi_long do_bsd_chmod (abi_long arg1,abi_long arg2) +{ +abi_long ret; +void *p; + +LOCK_PATH (p, arg1); + ret =get_errno (chmod (p, arg2));/* XXX path(p)? */ +UNLOCK_PATH (p, arg1); + +return ret; +} + +/* fchmod(2) */ +static inline abi_long do_bsd_fchmod (abi_long arg1,abi_long arg2) +{ + +return get_errno (fchmod (arg1, arg2)); +} + +/* lchmod(2) */ +static inline abi_long do_bsd_lchmod (abi_long arg1,abi_long arg2) +{ +abi_long ret; +void *p; + +LOCK_PATH (p, arg1); + ret =get_errno (lchmod (p, arg2));/* XXX path(p)? */ +UNLOCK_PATH (p, arg1); + +return ret; +} + +/* fchmodat(2) */ +static inline abi_long do_bsd_fchmodat (abi_long arg1,abi_long arg2, +abi_long arg3,abi_long arg4) +{ +abi_long ret; +void *p; + +LOCK_PATH (p, arg2); + ret =get_errno (fchmodat (arg1, p, arg3, arg4)); +UNLOCK_PATH (p, arg2); + +return ret; +} + +/* mknod(2) */ +static inline abi_long do_bsd_mknod (abi_long arg1,abi_long arg2,abi_long arg3) +{ +abi_long ret; +void *p; + +LOCK_PATH (p, arg1); + ret =get_errno (mknod (p, arg2, arg3));/* XXX path(p)? */ +UNLOCK_PATH (p, arg1); + +return ret; +} + +/* mknodat(2) */ +static inline abi_long do_bsd_mknodat (abi_long arg1,abi_long arg2, +abi_long arg3,abi_long arg4) +{ +abi_long ret; +void *p; + +LOCK_PATH (p, arg2); + ret =get_errno (mknodat (arg1, p, arg3, arg4)); +UNLOCK_PATH (p, arg2); + +return ret; +} + +/* chown(2) */ +static inline abi_long do_bsd_chown (abi_long arg1,abi_long arg2,abi_long arg3) +{ +abi_long ret; +void *p; + +LOCK_PATH (p, arg1); + ret =get_errno (chown (p, arg2, arg3));/* XXX path(p)? */ +UNLOCK_PATH (p, arg1); + +return ret; +} + +/* fchown(2) */ +static inline abi_long do_bsd_fchown (abi_long arg1,abi_long arg2, +abi_long arg3) +{ + +return get_errno (fchown (arg1, arg2, arg3)); +} + +/* lchown(2) */ +static inline abi_long do_bsd_lchown (abi_long arg1,abi_long arg2, +abi_long arg3) +{ +abi_long ret; +void *p; + +LOCK_PATH (p, arg1); + ret =get_errno (lchown (p, arg2, arg3));/* XXX path(p)? */ +UNLOCK_PATH (p, arg1); + +return ret; +} + +/* fchownat(2) */ +static inline abi_long do_bsd_fchownat (abi_long arg1,abi_long arg2, +abi_long arg3,abi_long arg4,abi_long arg5) +{ +abi_long ret; +void *p; + +LOCK_PATH (p, arg2); + ret =get_errno (fchownat (arg1, p, arg3, arg4, arg5));/* XXX path(p)? */ +UNLOCK_PATH (p, arg2); + +return ret; +} + +/* chflags(2) */ +static inline abi_long do_bsd_chflags (abi_long arg1,abi_long arg2) +{ +abi_long ret; +void *p; + +LOCK_PATH (p, arg1); + ret =get_errno (chflags (p, arg2));/* XXX path(p)? */ +UNLOCK_PATH (p, arg1); + +return ret; +} + +/* lchflags(2) */ +static inline abi_long do_bsd_lchflags (abi_long arg1,abi_long arg2) +{ +abi_long ret; +void *p; + +LOCK_PATH (p, arg1); + ret =get_errno (lchflags (p, arg2));/* XXX path(p)? */ +UNLOCK_PATH (p, arg1); + +return ret; +} + +/* fchflags(2) */ +static inline abi_long do_bsd_fchflags (abi_long arg1,abi_long arg2) +{ + +return get_errno (fchflags (arg1, arg2)); +} + +/* chroot(2) */ +static inline abi_long do_bsd_chroot (abi_long arg1) +{ +abi_long ret; +void *p; + +LOCK_PATH (p, arg1); + ret =get_errno (chroot (p));/* XXX path(p)? */ +UNLOCK_PATH (p, arg1); + +return ret; +} + +/* flock(2) */ +static abi_long do_bsd_flock (abi_long arg1,abi_long arg2) +{ + +return get_errno (flock (arg1, arg2)); +} + +/* mkfifo(2) */ +static inline abi_long do_bsd_mkfifo (abi_long arg1,abi_long arg2) +{ +abi_long ret; +void *p; + +LOCK_PATH (p, arg1); + ret =get_errno (mkfifo (p, arg2));/* XXX path(p)? */ +UNLOCK_PATH (p, arg1); + +return ret; +} + +/* mkfifoat(2) */ +static inline abi_long do_bsd_mkfifoat (abi_long arg1,abi_long arg2, +abi_long arg3) +{ +abi_long ret; +void *p; + +LOCK_PATH (p, arg2); + ret =get_errno (mkfifoat (arg1, p, arg3)); +UNLOCK_PATH (p, arg2); + +return ret; +} + +/* pathconf(2) */ +static inline abi_long do_bsd_pathconf (abi_long arg1,abi_long arg2) +{ +abi_long ret; +void *p; + +LOCK_PATH (p, arg1); + ret =get_errno (pathconf (p, arg2));/* XXX path(p)? */ +UNLOCK_PATH (p, arg1); + +return ret; +} + +/* lpathconf(2) */ +static inline abi_long do_bsd_lpathconf (abi_long arg1,abi_long arg2) +{ +abi_long ret; +void *p; + +LOCK_PATH (p, arg1); + ret =get_errno (lpathconf (p, arg2));/* XXX path(p)? */ +UNLOCK_PATH (p, arg1); + +return ret; +} + +/* fpathconf(2) */ +static inline abi_long do_bsd_fpathconf (abi_long arg1,abi_long arg2) +{ + +return get_errno (fpathconf (arg1, arg2)); +} + +/* undelete(2) */ +static inline abi_long do_bsd_undelete (abi_long arg1) +{ +abi_long ret; +void *p; + +LOCK_PATH (p, arg1); + ret =get_errno (undelete (p));/* XXX path(p)? */ +UNLOCK_PATH (p, arg1); + +return ret; +} + +/* poll(2) */ +static abi_long do_bsd_poll (abi_long arg1,abi_long arg2,abi_long arg3) +{ +abi_long ret; +nfds_t i, nfds = arg2; +int timeout = arg3; +struct pollfd *pfd; +struct target_pollfd *target_pfd; + + target_pfd =lock_user (VERIFY_WRITE , arg1, +sizeof (struct target_pollfd ) * nfds,1 ); +if (!target_pfd) { +return -TARGET_EFAULT ; + } + pfd =alloca (sizeof (struct pollfd ) * nfds); +for (i =0 ; i < nfds; i++) { + pfd[i].fd =tswap32 (target_pfd[i].fd); + pfd[i].events =tswap16 (target_pfd[i].events); + } ret =get_errno (poll (pfd, nfds, timeout)); +if (!is_error (ret)) { +for (i =0 ; i < nfds; i++) { + target_pfd[i].revents =tswap16 (pfd[i].revents); + } + } +unlock_user (target_pfd, arg1,sizeof (struct target_pollfd ) * nfds); + +return ret; +} + +/* +* undocumented openbsd_poll(struct pollfd *fds, u_int nfds, int +* timeout) system call. +*/ +static abi_long do_bsd_openbsd_poll (abi_long arg1,abi_long arg2,abi_long arg3) +{ + +qemu_log ("qemu: Unsupported syscall openbsd_poll()\n" ); +return -TARGET_ENOSYS ; +} + +/* lseek(2) */ +static abi_long do_bsd_lseek (void *cpu_env,abi_long arg1,abi_long arg2, +abi_long arg3,abi_long arg4,abi_long arg5) +{ +abi_long ret; +#if TARGET_ABI_BITS ==32 +int64_t res; + +/* 32-bit arch's use two 32 registers for 64 bit return value */ +if (regpairs_aligned (cpu_env) !=0 ) { + res =lseek (arg1,target_offset64 (arg3, arg4), arg5); + }else { + res =lseek (arg1,target_offset64 (arg2, arg3), arg4); + } +if (res ==-1 ) { + ret =get_errno (res); + }else { + ret = res &0xFFFFFFFF ; +set_second_rval (cpu_env, (res >>32 ) &0xFFFFFFFF ); + } +#else + ret =get_errno (lseek (arg1, arg2, arg3)); +#endif +return ret; +} + +/* pipe(2) */ +static abi_long do_bsd_pipe (void *cpu_env,abi_long arg1) +{ +abi_long ret; +int host_pipe[2 ]; +int host_ret =pipe (host_pipe); + +if (host_ret !=-1 ) { +set_second_rval (cpu_env, host_pipe[1 ]); + ret = host_pipe[0 ]; + }else { + ret =get_errno (host_ret); + } +return ret; +} + +/* swapon(2) */ +static abi_long do_bsd_swapon (abi_long arg1) +{ +abi_long ret; +void *p; + +LOCK_PATH (p, arg1); + ret =get_errno (swapon (path (p))); +UNLOCK_PATH (p, arg1); + +return ret; +} + +/* swapoff(2) */ +static abi_long do_bsd_swapoff (abi_long arg1) +{ +abi_long ret; +void *p; + +LOCK_PATH (p, arg1); + ret =get_errno (swapoff (path (p))); +UNLOCK_PATH (p, arg1); + +return ret; +} + +/* +* undocumented freebsd6_pread(int fd, void *buf, size_t nbyte, int pad, +* off_t offset) system call. +*/ +static abi_long do_bsd_freebsd6_pread (abi_long arg1,abi_long arg2, +abi_long arg3,abi_long arg4,abi_long arg5) +{ + +qemu_log ("qemu: Unsupported syscall freebsd6_pread()\n" ); +return -TARGET_ENOSYS ; +} + +/* +* undocumented freebsd6_pwrite(int fd, void *buf, size_t nbyte, int pad, +* off_t offset) system call. +*/ +static abi_long do_bsd_freebsd6_pwrite (abi_long arg1,abi_long arg2, +abi_long arg3,abi_long arg4,abi_long arg5) +{ + +qemu_log ("qemu: Unsupported syscall freebsd6_pwrite()\n" ); +return -TARGET_ENOSYS ; +} + +/* +* undocumented freebsd6_lseek(int fd, int pad, off_t offset, int whence) +* system call. +*/ +static abi_long do_bsd_freebsd6_lseek (abi_long arg1,abi_long arg2, +abi_long arg3,abi_long arg4) +{ + +qemu_log ("qemu: Unsupported syscall freebsd6_lseek()\n" ); +return -TARGET_ENOSYS ; +} + +/* +* undocumented freebsd6_truncate(char *path, int pad, off_t offset) system +* call. +*/ +static abi_long do_bsd_freebsd6_truncate (abi_long arg1,abi_long arg2, +abi_long arg3) +{ + +qemu_log ("qemu: Unsupported syscall freebsd6_truncate()\n" ); +return -TARGET_ENOSYS ; +} + +/* +* undocumented freebsd6_ftruncate(int fd, int pad, off_t offset) system +* call. +*/ +static abi_long do_bsd_freebsd6_ftruncate (abi_long arg1,abi_long arg2, +abi_long arg3) +{ + +qemu_log ("qemu: Unsupported syscall freebsd6_ftruncate()\n" ); +return -TARGET_ENOSYS ; +} + +#endif /* !__BSD_FILE_H_ */
bsd-user/qemu.h +36 -0
@@ -446,6 +446,42 @@ 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 TARGET_ABI_BITS ==32 +static inline uint64_t +target_offset64 (uint32_t word0,uint32_t word1) +{ +#ifdef TARGET_WORDS_BIGENDIAN +return ((uint64_t )word0 <<32 ) | word1; +#else +return ((uint64_t )word1 <<32 ) | word0; +#endif +} +#else /* TARGET_ABI_BITS != 32 */ +static inline uint64_t +target_offset64 (uint64_t word0,uint64_t word1) +{ +return word0; +} +#endif /* TARGET_ABI_BITS != 32 */ + +/* ARM EABI and MIPS expect 64bit types aligned even on pairs of registers */ +#ifdef TARGET_ARM +static inline int +regpairs_aligned (void *cpu_env) { +return ((((CPUARMState *)cpu_env)->eabi) ==1 ); +} +#elif defined(TARGET_MIPS ) &&TARGET_ABI_BITS ==32 +static inline int regpairs_aligned (void *cpu_env) +{ +return 1 ; +} +#else +static inline int regpairs_aligned (void *cpu_env) +{ +return 0 ; +} +#endif +#if defined(CONFIG_USE_NPTL )#include <pthread.h> #endif
bsd-user/syscall.c +307 -84
488 lines not on this page · raw message
Signature · 1 line
1.7.8
PATCH 11/18 bsd-user: add support for stat, directory, and file control related system calls
In reply to Stacey SonThis change adds support or stubs for stat, directory, and file control related system calls including stat(2), lstat(2), fstat(2), fstatat(2), nstat(), nfstat(), nlstat(), getfh(2), lgetfh(2), fhopen(2), fhstat(2), fhstatfs(2), statfs(2), fstatfs(2), getfsstat(2), getdents(2), getdirentries(2), and fcntl(2).
--- bsd-user/Makefile.objs | 1 + bsd-user/freebsd/os-stat.c | 234 +++++++++++++++++++++++ bsd-user/freebsd/os-stat.h | 437 ++++++++++++++++++++++++++++++++++++++++++++ bsd-user/freebsd/qemu-os.h | 8 + bsd-user/netbsd/os-stat.c | 1 + bsd-user/netbsd/os-stat.h | 1 + bsd-user/openbsd/os-stat.c | 1 + bsd-user/openbsd/os-stat.h | 176 ++++++++++++++++++ bsd-user/syscall.c | 76 ++++++++ 9 files changed, 935 insertions(+), 0 deletions(-) create mode 100644 bsd-user/freebsd/os-stat.c create mode 100644 bsd-user/freebsd/os-stat.h create mode 100644 bsd-user/netbsd/os-stat.c create mode 100644 bsd-user/netbsd/os-stat.h create mode 100644 bsd-user/openbsd/os-stat.c create mode 100644 bsd-user/openbsd/os-stat.h
bsd-user/Makefile.objs +1 -0
@@ -1,5 +1,6 @@ obj-y = main.o bsdload.o elfload.o mmap.o signal.o strace.o syscall.o \ uaccess.o bsd-proc.o \ $(HOST_ABI_DIR)/os-proc.o \ + $(HOST_ABI_DIR)/os-stat.o \ $(HOST_ABI_DIR)/os-sys.o \ $(HOST_ABI_DIR)/os-time.o $(TARGET_ABI_DIR)/target_arch_cpu.o
bsd-user/freebsd/os-stat.c new file +234 -0
234 lines not on this page · raw message
bsd-user/freebsd/os-stat.h new file +437 -0
437 lines not on this page · raw message
bsd-user/freebsd/qemu-os.h +8 -0
@@ -50,4 +50,12 @@ abi_ulong copy_from_user_fdset_ptr(fd_set *fds, fd_set **fds_ptr,abi_long copy_to_user_fdset (abi_ulong target_fds_addr,const fd_set *fds,int n); +/* os-stat.c */ +abi_long h2t_freebsd_stat (abi_ulong target_addr,struct stat *host_st); +abi_long h2t_freebsd_nstat (abi_ulong target_addr,struct stat *host_st); +abi_long t2h_freebsd_fhandle (fhandle_t *host_fh,abi_ulong target_addr); +abi_long h2t_freebsd_fhandle (abi_ulong target_addr,fhandle_t *host_fh); +abi_long h2t_freebsd_statfs (abi_ulong target_addr,struct statfs *host_statfs); +abi_long target_to_host_fcntl_cmd (int cmd); +#endif /* !_QEMU_OS_H_ */
bsd-user/netbsd/os-stat.c new file +1 -0
@@ -0,0 +1 @@ +/* XXX NetBSD stat related helpers */
bsd-user/netbsd/os-stat.h new file +1 -0
@@ -0,0 +1 @@ +/* XXX NetBSD stat related helpers */
bsd-user/openbsd/os-stat.c new file +1 -0
@@ -0,0 +1 @@ +/* XXX OpenBSD stat related helpers */
bsd-user/openbsd/os-stat.h new file +176 -0
176 lines not on this page · raw message
bsd-user/syscall.c +76 -0
88 lines not on this page · raw message
Signature · 1 line
1.7.8
PATCH 12/18 bsd-user: add support for memory management related system calls
In reply to Stacey SonThis change adds support or stubs for memory management related system calls including mmap(2), munmap(2), mprotect(2), msync(2), mlock(2), munlock(2), mlockall(2), munlockall(2), madvise(2), minherit(2), mincore(2), shm_open(2), shm_unlink(2), shmget(2), shmctl(2), shmat(2), shmdt(2), vadvise(), sbrk(), sstk(), and freebsd6_mmap().
--- bsd-user/Makefile.objs | 2 +- bsd-user/bsd-mem.c | 122 +++++++++++++++ bsd-user/bsd-mem.h | 393 ++++++++++++++++++++++++++++++++++++++++++++++++ bsd-user/mmap.c | 160 +++++--------------- bsd-user/qemu-bsd.h | 10 ++ bsd-user/qemu.h | 3 +- bsd-user/syscall.c | 174 +++++++++++++--------- 7 files changed, 670 insertions(+), 194 deletions(-) create mode 100644 bsd-user/bsd-mem.c create mode 100644 bsd-user/bsd-mem.h
bsd-user/Makefile.objs +1 -1
@@ -1,5 +1,5 @@ obj-y = main.o bsdload.o elfload.o mmap.o signal.o strace.o syscall.o \ - uaccess.o bsd-proc.o \ + uaccess.o bsd-mem.o bsd-proc.o \ $(HOST_ABI_DIR)/os-proc.o \ $(HOST_ABI_DIR)/os-stat.o \ $(HOST_ABI_DIR)/os-sys.o \
bsd-user/bsd-mem.c new file +122 -0
122 lines not on this page · raw message
bsd-user/bsd-mem.h new file +393 -0
393 lines not on this page · raw message
bsd-user/mmap.c +37 -123
248 lines not on this page · raw message
bsd-user/qemu-bsd.h +10 -0
@@ -32,6 +32,16 @@#include <sys/wait.h> #include <netinet/in.h> +/* bsd-mem.c */ +abi_long target_to_host_ipc_perm (struct ipc_perm *host_ip, +abi_ulong target_addr); +abi_long host_to_target_ipc_perm (abi_ulong target_addr, +struct ipc_perm *host_ip); +abi_long target_to_host_shmid_ds (struct shmid_ds *host_sd, +abi_ulong target_addr); +abi_long host_to_target_shmid_ds (abi_ulong target_addr, +struct shmid_ds *host_sd); +/* bsd-proc.c */ int target_to_host_resource (int code);rlim_t target_to_host_rlim (abi_ulong target_rlim);
bsd-user/qemu.h +2 -1
@@ -219,7 +219,7 @@ void QEMU_NORETURN force_sig(int target_sig);/* mmap.c */ int target_mprotect (abi_ulong start,abi_ulong len,int prot);abi_long target_mmap (abi_ulong start,abi_ulong len,int prot, -int flags,int fd,abi_ulong offset); +int flags,int fd,off_t offset);int target_munmap (abi_ulong start,abi_ulong len); abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size, abi_ulong new_size, unsigned long flags,
@@ -228,6 +228,7 @@ int target_msync(abi_ulong start, abi_ulong len, int flags);extern unsigned long last_brk;void mmap_lock (void );void mmap_unlock (void ); +abi_ulong mmap_find_vma (abi_ulong start,abi_ulong size);void cpu_list_lock (void );void cpu_list_unlock (void );#if defined(CONFIG_USE_NPTL )
bsd-user/syscall.c +105 -69
274 lines not on this page · raw message
Signature · 1 line
1.7.8
PATCH 13/18 bsd-user: add support for socket related system calls
In reply to Stacey SonThis change adds support or stubs for socket related system calls including accept(2), bind(2), connect(2), getpeername(2), getsockname(2), getsockopt(2), setsockopt(2), listen(2), recvfrom(2), recvmsg(2), sendmsg(2), sendto(2), socket(2), socketpair(2), shutdown(2), setfib(2), sctp_peeloff(2), sctp_generic_sendmsg(2), sctp_generic_recvmsg(2), sendfile(2), and freebsd4_sendfile(2).
--- bsd-user/Makefile.objs | 4 +- bsd-user/bsd-socket.c | 108 +++++++++ bsd-user/bsd-socket.h | 266 ++++++++++++++++++++ bsd-user/freebsd/os-socket.c | 149 ++++++++++++ bsd-user/freebsd/os-socket.h | 548 ++++++++++++++++++++++++++++++++++++++++++ bsd-user/freebsd/qemu-os.h | 6 + bsd-user/netbsd/os-socket.c | 1 + bsd-user/netbsd/os-socket.h | 98 ++++++++ bsd-user/openbsd/os-socket.c | 1 + bsd-user/openbsd/os-socket.h | 98 ++++++++ bsd-user/qemu-bsd.h | 8 + bsd-user/syscall.c | 93 +++++++ 12 files changed, 1378 insertions(+), 2 deletions(-) create mode 100644 bsd-user/bsd-socket.c create mode 100644 bsd-user/bsd-socket.h create mode 100644 bsd-user/freebsd/os-socket.c create mode 100644 bsd-user/freebsd/os-socket.h create mode 100644 bsd-user/netbsd/os-socket.c create mode 100644 bsd-user/netbsd/os-socket.h create mode 100644 bsd-user/openbsd/os-socket.c create mode 100644 bsd-user/openbsd/os-socket.h
bsd-user/Makefile.objs +2 -2
@@ -1,6 +1,6 @@ obj-y = main.o bsdload.o elfload.o mmap.o signal.o strace.o syscall.o \ - uaccess.o bsd-mem.o bsd-proc.o \ + uaccess.o bsd-mem.o bsd-proc.o bsd-socket.o \ $(HOST_ABI_DIR)/os-proc.o \ - $(HOST_ABI_DIR)/os-stat.o \ + $(HOST_ABI_DIR)/os-socket.o $(HOST_ABI_DIR)/os-stat.o \ $(HOST_ABI_DIR)/os-sys.o \ $(HOST_ABI_DIR)/os-time.o $(TARGET_ABI_DIR)/target_arch_cpu.o
bsd-user/bsd-socket.c new file +108 -0
108 lines not on this page · raw message
bsd-user/bsd-socket.h new file +266 -0
266 lines not on this page · raw message
bsd-user/freebsd/os-socket.c new file +149 -0
149 lines not on this page · raw message
bsd-user/freebsd/os-socket.h new file +548 -0
548 lines not on this page · raw message
bsd-user/freebsd/qemu-os.h +6 -0
@@ -50,6 +50,12 @@ abi_ulong copy_from_user_fdset_ptr(fd_set *fds, fd_set **fds_ptr,abi_long copy_to_user_fdset (abi_ulong target_fds_addr,const fd_set *fds,int n); +/* os-socket.c */ +abi_long t2h_freebsd_cmsg (struct msghdr *msgh, +struct target_msghdr *target_msgh); +abi_long h2t_freebsd_cmsg (struct target_msghdr *target_msgh, +struct msghdr *msgh); +/* os-stat.c */ abi_long h2t_freebsd_stat (abi_ulong target_addr,struct stat *host_st);abi_long h2t_freebsd_nstat (abi_ulong target_addr,struct stat *host_st);
bsd-user/netbsd/os-socket.c new file +1 -0
@@ -0,0 +1 @@ +/* XXX NetBSD socket related helpers */
bsd-user/netbsd/os-socket.h new file +98 -0
98 lines not on this page · raw message
bsd-user/openbsd/os-socket.c new file +1 -0
@@ -0,0 +1 @@ +/* XXX OpenBSD socket related helpers */
bsd-user/openbsd/os-socket.h new file +98 -0
98 lines not on this page · raw message
bsd-user/qemu-bsd.h +8 -0
@@ -50,4 +50,12 @@ abi_long host_to_target_rusage(abi_ulong target_addr, const struct rusage *rusage);int host_to_target_waitstatus (int status); +/* bsd-socket.c */ +abi_long target_to_host_sockaddr (struct sockaddr *addr,abi_ulong target_addr, +socklen_t len); +abi_long host_to_target_sockaddr (abi_ulong target_addr,struct sockaddr *addr, +socklen_t len); +abi_long target_to_host_ip_mreq (struct ip_mreqn *mreqn,abi_ulong target_addr, +socklen_t len); +#endif /* !_QEMU_BSD_H_ */
bsd-user/syscall.c +93 -0
110 lines not on this page · raw message
Signature · 1 line
1.7.8
PATCH 14/18 bsd-user: add support for thread related system calls
In reply to Stacey SonThis change adds support or stubs for thread related system calls including thr_create(), thr_new(), thr_set_name(), thr_self(), thr_suspend(), thr_wake(), thr_kill(), thr_kill2(), rtprio_thread(2), getcontext(2), setcontext(2), swapcontext(2), _umtx_lock(), _umtx_unlock(), and _umtx_op().
--- bsd-user/Makefile.objs | 2 +- bsd-user/freebsd/os-thread.c | 936 ++++++++++++++++++++++++++++++++++++++++++ bsd-user/freebsd/os-thread.h | 510 +++++++++++++++++++++++ bsd-user/freebsd/qemu-os.h | 6 + bsd-user/main.c | 94 ++++- bsd-user/mmap.c | 26 ++- bsd-user/netbsd/os-thread.c | 1 + bsd-user/netbsd/os-thread.h | 133 ++++++ bsd-user/openbsd/os-thread.c | 1 + bsd-user/openbsd/os-thread.h | 133 ++++++ bsd-user/qemu.h | 59 +++- bsd-user/syscall.c | 71 +++- 12 files changed, 1954 insertions(+), 18 deletions(-) create mode 100644 bsd-user/freebsd/os-thread.c create mode 100644 bsd-user/freebsd/os-thread.h create mode 100644 bsd-user/netbsd/os-thread.c create mode 100644 bsd-user/netbsd/os-thread.h create mode 100644 bsd-user/openbsd/os-thread.c create mode 100644 bsd-user/openbsd/os-thread.h
bsd-user/Makefile.objs +1 -1
@@ -2,5 +2,5 @@ obj-y = main.o bsdload.o elfload.o mmap.o signal.o strace.o syscall.o \ uaccess.o bsd-mem.o bsd-proc.o bsd-socket.o \ $(HOST_ABI_DIR)/os-proc.o \ $(HOST_ABI_DIR)/os-socket.o $(HOST_ABI_DIR)/os-stat.o \ - $(HOST_ABI_DIR)/os-sys.o \ + $(HOST_ABI_DIR)/os-sys.o $(HOST_ABI_DIR)/os-thread.o \ $(HOST_ABI_DIR)/os-time.o $(TARGET_ABI_DIR)/target_arch_cpu.o
bsd-user/freebsd/os-thread.c new file +936 -0
936 lines not on this page · raw message
bsd-user/freebsd/os-thread.h new file +510 -0
510 lines not on this page · raw message
bsd-user/freebsd/qemu-os.h +6 -0
@@ -64,4 +64,10 @@ abi_long h2t_freebsd_fhandle(abi_ulong target_addr, fhandle_t *host_fh);abi_long h2t_freebsd_statfs (abi_ulong target_addr,struct statfs *host_statfs);abi_long target_to_host_fcntl_cmd (int cmd); +/* os-thread.c */ +abi_long t2h_freebsd_rtprio (struct rtprio *host_rtp,abi_ulong target_addr); +abi_long h2t_freebsd_rtprio (abi_ulong target_addr,struct rtprio *host_rtp); +abi_long do_freebsd_thr_new (CPUArchState *env,abi_ulong target_param_addr, +int32_t param_size); +#endif /* !_QEMU_OS_H_ */
bsd-user/main.c +88 -6
133 lines not on this page · raw message
bsd-user/mmap.c +25 -1
@@ -29,13 +29,37 @@// #define DEBUG_MMAP -/* We aren't threadsafe to start with, so no need to worry about locking. */ +pthread_mutex_t mmap_mutex =PTHREAD_MUTEX_INITIALIZER ; +static __threadint mmap_lock_count; +void mmap_lock (void ) { +if (mmap_lock_count++ ==0 ) { +pthread_mutex_lock (&mmap_mutex); + } }void mmap_unlock (void ) { +if (--mmap_lock_count ==0 ) { +pthread_mutex_unlock (&mmap_mutex); + } +} + +/* Grab lock to make sure things are in a consistent state after fork(). */ +void mmap_fork_start (void ) +{ +if (mmap_lock_count) +abort (); +pthread_mutex_lock (&mmap_mutex); +} + +void mmap_fork_end (int child) +{ +if (child) +pthread_mutex_init (&mmap_mutex,NULL ); +else +pthread_mutex_unlock (&mmap_mutex); }/* NOTE: all the constants are the HOST ones, but addresses are target. */
bsd-user/netbsd/os-thread.c new file +1 -0
@@ -0,0 +1 @@ +/* XXX NetBSD thread related helpers */
bsd-user/netbsd/os-thread.h new file +133 -0
133 lines not on this page · raw message
bsd-user/openbsd/os-thread.c new file +1 -0
@@ -0,0 +1 @@ +/* XXX OpenBSD thread related helpers */
bsd-user/openbsd/os-thread.h new file +133 -0
133 lines not on this page · raw message
bsd-user/qemu.h +51 -8
108 lines not on this page · raw message
bsd-user/syscall.c +69 -2
95 lines not on this page · raw message
Signature · 1 line
1.7.8
PATCH 15/18 bsd-user: add support for the ioctl system call
In reply to Stacey SonThis change adds support for the ioctl system call. This uses the generic thunking code to convert data between the host and target CPU.
--- Makefile.target | 2 +- bsd-user/Makefile.objs | 2 +- bsd-user/bsd-ioctl.c | 448 ++++++++++++++++++++++++++++++++++++ bsd-user/bsd-ioctl.h | 27 +++ bsd-user/freebsd/os-ioctl-cmds.h | 47 ++++ bsd-user/freebsd/os-ioctl-filio.h | 45 ++++ bsd-user/freebsd/os-ioctl-ioccom.h | 54 +++++ bsd-user/freebsd/os-ioctl-ttycom.h | 257 +++++++++++++++++++++ bsd-user/freebsd/os-ioctl-types.h | 7 + bsd-user/netbsd/os-ioctl-cmds.h | 48 ++++ bsd-user/netbsd/os-ioctl-filio.h | 29 +++ bsd-user/netbsd/os-ioctl-ioccom.h | 38 +++ bsd-user/netbsd/os-ioctl-ttycom.h | 240 +++++++++++++++++++ bsd-user/netbsd/os-ioctl-types.h | 7 + bsd-user/openbsd/os-ioctl-cmds.h | 48 ++++ bsd-user/openbsd/os-ioctl-filio.h | 29 +++ bsd-user/openbsd/os-ioctl-ioccom.h | 38 +++ bsd-user/openbsd/os-ioctl-ttycom.h | 240 +++++++++++++++++++ bsd-user/openbsd/os-ioctl-types.h | 7 + bsd-user/qemu.h | 1 + bsd-user/syscall.c | 27 ++- 21 files changed, 1632 insertions(+), 9 deletions(-) create mode 100644 bsd-user/bsd-ioctl.c create mode 100644 bsd-user/bsd-ioctl.h create mode 100644 bsd-user/freebsd/os-ioctl-cmds.h create mode 100644 bsd-user/freebsd/os-ioctl-filio.h create mode 100644 bsd-user/freebsd/os-ioctl-ioccom.h create mode 100644 bsd-user/freebsd/os-ioctl-ttycom.h create mode 100644 bsd-user/freebsd/os-ioctl-types.h create mode 100644 bsd-user/netbsd/os-ioctl-cmds.h create mode 100644 bsd-user/netbsd/os-ioctl-filio.h create mode 100644 bsd-user/netbsd/os-ioctl-ioccom.h create mode 100644 bsd-user/netbsd/os-ioctl-ttycom.h create mode 100644 bsd-user/netbsd/os-ioctl-types.h create mode 100644 bsd-user/openbsd/os-ioctl-cmds.h create mode 100644 bsd-user/openbsd/os-ioctl-filio.h create mode 100644 bsd-user/openbsd/os-ioctl-ioccom.h create mode 100644 bsd-user/openbsd/os-ioctl-ttycom.h create mode 100644 bsd-user/openbsd/os-ioctl-types.h
Makefile.target +1 -1
@@ -107,7 +107,7 @@ QEMU_CFLAGS+=-I$(SRC_PATH)/bsd-user -I$(SRC_PATH)/bsd-user/$(TARGET_ABI_DIR) \ -I$(SRC_PATH)/bsd-user/$(HOST_ABI_DIR) obj-y += bsd-user/ -obj-y += gdbstub.o user-exec.o +obj-y += gdbstub.o thunk.o user-exec.o endif #CONFIG_BSD_USER
bsd-user/Makefile.objs +1 -1
@@ -1,5 +1,5 @@ obj-y = main.o bsdload.o elfload.o mmap.o signal.o strace.o syscall.o \ - uaccess.o bsd-mem.o bsd-proc.o bsd-socket.o \ + uaccess.o bsd-ioctl.o bsd-mem.o bsd-proc.o bsd-socket.o \ $(HOST_ABI_DIR)/os-proc.o \ $(HOST_ABI_DIR)/os-socket.o $(HOST_ABI_DIR)/os-stat.o \ $(HOST_ABI_DIR)/os-sys.o $(HOST_ABI_DIR)/os-thread.o \
bsd-user/bsd-ioctl.c new file +448 -0
448 lines not on this page · raw message
bsd-user/bsd-ioctl.h new file +27 -0
@@ -0,0 +1,27 @@ +/* +* ioctl system call definitions +* +* Copyright (c) 2013 Stacey D. Son +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef __BSD_IOCTL_H_ +#define __BSD_IOCTL_H_ + +abi_long do_bsd_ioctl (int fd,abi_long cmd,abi_long arg); +void init_bsd_ioctl (void ); + +#endif /* !__BSD_IOCTL_H_ */ +
bsd-user/freebsd/os-ioctl-cmds.h new file +47 -0
47 lines not on this page · raw message
bsd-user/freebsd/os-ioctl-filio.h new file +45 -0
45 lines not on this page · raw message
bsd-user/freebsd/os-ioctl-ioccom.h new file +54 -0
54 lines not on this page · raw message
bsd-user/freebsd/os-ioctl-ttycom.h new file +257 -0
257 lines not on this page · raw message
bsd-user/freebsd/os-ioctl-types.h new file +7 -0
@@ -0,0 +1,7 @@ + +STRUCT_SPECIAL(termios) + +STRUCT(winsize, TYPE_SHORT, TYPE_SHORT, TYPE_SHORT, TYPE_SHORT) + +STRUCT(fiodgname_arg, TYPE_INT, TYPE_PTRVOID) +
bsd-user/netbsd/os-ioctl-cmds.h new file +48 -0
48 lines not on this page · raw message
bsd-user/netbsd/os-ioctl-filio.h new file +29 -0
@@ -0,0 +1,29 @@ +#ifndef _IOCTL_FILIO_H_ +#define _IOCTL_FILIO_H_ + +/* XXX needs to be fixed for NetBSD dependencies */ + +/* see sys/filio.h */ +#define TARGET_FIOCLEX TARGET_IO('f', 1) +#define TARGET_FIONCLEX TARGET_IO('f', 2) +#define TARGET_FIONREAD TARGET_IOR('f', 127, int) +#define TARGET_FIONBIO TARGET_IOW('f', 126, int) +#define TARGET_FIOASYNC TARGET_IOW('f', 125, int) +#define TARGET_FIOSETOWN TARGET_IOW('f', 124, int) +#define TARGET_FIOGETOWN TARGET_IOR('f', 123, int) +#define TARGET_FIODTYPE TARGET_IOR('f', 122, int) +#define TARGET_FIOGETLBA TARGET_IOR('f', 121, int) + +struct target_fiodgname_arg { +int32_t len; +abi_ulong buf; +}; + +#define TARGET_FIODGNAME TARGET_IOW('f', 120, \ + struct target_fiodgname_arg) +#define TARGET_FIONWRITE TARGET_IOR('f', 119, int) +#define TARGET_FIONSPACE TARGET_IOR('f', 118, int) +#define TARGET_FIOSEEKDATA TARGET_IOWR('f', 97, off_t) +#define TARGET_FIOSEEKHOLE TARGET_IOWR('f', 98, off_t) + +#endif /* !_IOCTL_FILIO_H_ */
bsd-user/netbsd/os-ioctl-ioccom.h new file +38 -0
@@ -0,0 +1,38 @@ +#ifndef _IOCTL_IOCCOM_H_ +#define _IOCTL_IOCCOM_H_ + +/* XXX needs to be fixed for NetBSD dependencies */ + +/* +* Ioctl's have the command encoded in the lower word, and the size of +* any in or out parameters in the upper word. The high 3 bits of the +* upper word are used to encode the in/out status of the parameter. +*/ +/* number of bits for ioctl size */ +#define TARGET_IOCPARM_SHIFT 13 + +/* parameter length mask */ +#define TARGET_IOCPARM_MASK ((1 << TARGET_IOCPARM_SHIFT) - 1) + +#define TARGET_IOCPARM_LEN (x) (((x) >> 16) & TARGET_IOCPARM_MASK) +#define TARGET_IOCBASECMD (x) ((x) & ~(TARGET_IOCPARM_MASK << 16)) +#define TARGET_IOCGROUP (x) (((x) >> 8) & 0xff) + +#define TARGET_IOCPARM_MAX (1 << TARGET_IOCPARM_SHIFT)/* max size of ioctl */ +#define TARGET_IOC_VOID 0x20000000/* no parameters */ +#define TARGET_IOC_OUT 0x40000000/* copy out parameters */ +#define TARGET_IOC_IN 0x80000000/* copy in parameters */ +#define TARGET_IOC_INOUT (TARGET_IOC_IN|TARGET_IOC_OUT) +#define TARGET_IOC_DIRMASK (TARGET_IOC_VOID|TARGET_IOC_OUT|TARGET_IOC_IN) + +#define TARGET_IOC (inout, group, num, len) ((abi_ulong) \ + ((inout) | (((len) & TARGET_IOCPARM_MASK) << 16) | ((group) << 8) \ + | (num))) +#define TARGET_IO (g, n) TARGET_IOC(IOC_VOID, (g), (n), 0) +#define TARGET_IOWINT (g, n) TARGET_IOC(IOC_VOID, (g), (n), sizeof(int)) +#define TARGET_IOR (g, n, t) TARGET_IOC(IOC_OUT, (g), (n), sizeof(t)) +#define TARGET_IOW (g, n, t) TARGET_IOC(IOC_IN, (g), (n), sizeof(t)) +/* this should be _IORW, but stdio got there first */ +#define TARGET_IOWR (g, n, t) TARGET_IOC(IOC_INOUT, (g), (n), sizeof(t)) + +#endif /* !_IOCTL_IOCCOM_H_ */
bsd-user/netbsd/os-ioctl-ttycom.h new file +240 -0
240 lines not on this page · raw message
bsd-user/netbsd/os-ioctl-types.h new file +7 -0
@@ -0,0 +1,7 @@ +/* XXX should be fixed for NetBSD types and structs */ +STRUCT_SPECIAL(termios) + +STRUCT(winsize, TYPE_SHORT, TYPE_SHORT, TYPE_SHORT, TYPE_SHORT) + +STRUCT(fiodgname_arg, TYPE_INT, TYPE_PTRVOID) +
bsd-user/openbsd/os-ioctl-cmds.h new file +48 -0
48 lines not on this page · raw message
bsd-user/openbsd/os-ioctl-filio.h new file +29 -0
@@ -0,0 +1,29 @@ +#ifndef _IOCTL_FILIO_H_ +#define _IOCTL_FILIO_H_ + +/* XXX needs to be fixed for OpenBSD dependencies */ + +/* see sys/filio.h */ +#define TARGET_FIOCLEX TARGET_IO('f', 1) +#define TARGET_FIONCLEX TARGET_IO('f', 2) +#define TARGET_FIONREAD TARGET_IOR('f', 127, int) +#define TARGET_FIONBIO TARGET_IOW('f', 126, int) +#define TARGET_FIOASYNC TARGET_IOW('f', 125, int) +#define TARGET_FIOSETOWN TARGET_IOW('f', 124, int) +#define TARGET_FIOGETOWN TARGET_IOR('f', 123, int) +#define TARGET_FIODTYPE TARGET_IOR('f', 122, int) +#define TARGET_FIOGETLBA TARGET_IOR('f', 121, int) + +struct target_fiodgname_arg { +int32_t len; +abi_ulong buf; +}; + +#define TARGET_FIODGNAME TARGET_IOW('f', 120, \ + struct target_fiodgname_arg) +#define TARGET_FIONWRITE TARGET_IOR('f', 119, int) +#define TARGET_FIONSPACE TARGET_IOR('f', 118, int) +#define TARGET_FIOSEEKDATA TARGET_IOWR('f', 97, off_t) +#define TARGET_FIOSEEKHOLE TARGET_IOWR('f', 98, off_t) + +#endif /* !_IOCTL_FILIO_H_ */
bsd-user/openbsd/os-ioctl-ioccom.h new file +38 -0
@@ -0,0 +1,38 @@ +#ifndef _IOCTL_IOCCOM_H_ +#define _IOCTL_IOCCOM_H_ + +/* XXX needs to be fixed for OpenBSD dependencies */ + +/* +* Ioctl's have the command encoded in the lower word, and the size of +* any in or out parameters in the upper word. The high 3 bits of the +* upper word are used to encode the in/out status of the parameter. +*/ +/* number of bits for ioctl size */ +#define TARGET_IOCPARM_SHIFT 13 + +/* parameter length mask */ +#define TARGET_IOCPARM_MASK ((1 << TARGET_IOCPARM_SHIFT) - 1) + +#define TARGET_IOCPARM_LEN (x) (((x) >> 16) & TARGET_IOCPARM_MASK) +#define TARGET_IOCBASECMD (x) ((x) & ~(TARGET_IOCPARM_MASK << 16)) +#define TARGET_IOCGROUP (x) (((x) >> 8) & 0xff) + +#define TARGET_IOCPARM_MAX (1 << TARGET_IOCPARM_SHIFT)/* max size of ioctl */ +#define TARGET_IOC_VOID 0x20000000/* no parameters */ +#define TARGET_IOC_OUT 0x40000000/* copy out parameters */ +#define TARGET_IOC_IN 0x80000000/* copy in parameters */ +#define TARGET_IOC_INOUT (TARGET_IOC_IN|TARGET_IOC_OUT) +#define TARGET_IOC_DIRMASK (TARGET_IOC_VOID|TARGET_IOC_OUT|TARGET_IOC_IN) + +#define TARGET_IOC (inout, group, num, len) ((abi_ulong) \ + ((inout) | (((len) & TARGET_IOCPARM_MASK) << 16) | ((group) << 8) \ + | (num))) +#define TARGET_IO (g, n) TARGET_IOC(IOC_VOID, (g), (n), 0) +#define TARGET_IOWINT (g, n) TARGET_IOC(IOC_VOID, (g), (n), sizeof(int)) +#define TARGET_IOR (g, n, t) TARGET_IOC(IOC_OUT, (g), (n), sizeof(t)) +#define TARGET_IOW (g, n, t) TARGET_IOC(IOC_IN, (g), (n), sizeof(t)) +/* this should be _IORW, but stdio got there first */ +#define TARGET_IOWR (g, n, t) TARGET_IOC(IOC_INOUT, (g), (n), sizeof(t)) + +#endif /* !_IOCTL_IOCCOM_H_ */
bsd-user/openbsd/os-ioctl-ttycom.h new file +240 -0
240 lines not on this page · raw message
bsd-user/openbsd/os-ioctl-types.h new file +7 -0
@@ -0,0 +1,7 @@ +/* XXX should be fixed for OpenBSD types and structs */ +STRUCT_SPECIAL(termios) + +STRUCT(winsize, TYPE_SHORT, TYPE_SHORT, TYPE_SHORT, TYPE_SHORT) + +STRUCT(fiodgname_arg, TYPE_INT, TYPE_PTRVOID) +
bsd-user/qemu.h +1 -0
@@ -36,6 +36,7 @@ enum BSDType { };extern enum BSDType bsd_type; +#include "exec/user/thunk.h" #include "syscall_defs.h" #include "syscall.h" #include "target_os_vmparam.h"
bsd-user/syscall.c +20 -7
@@ -35,6 +35,7 @@/* BSD independent syscall shims */ #include "bsd-file.h" +#include "bsd-ioctl.h" #include "bsd-mem.h" #include "bsd-proc.h" #include "bsd-signal.h"
@@ -81,16 +82,18 @@ int is_error(abi_long ret)* other lock functions have a return code of 0 for failure. */ static abi_long lock_iovec (int type,struct iovec *vec,abi_ulong target_addr, -int count,int copy) +int count,int copy) {struct target_iovec *target_vec;abi_ulong base;int i; - target_vec =lock_user (VERIFY_READ , target_addr, count *sizeof (struct target_iovec ),1 ); -if (!target_vec) + target_vec =lock_user (VERIFY_READ , target_addr, + count *sizeof (struct target_iovec ),1 ); +if (!target_vec) {return -TARGET_EFAULT ; -for (i =0 ;i < count; i++) { + } +for (i =0 ; i < count; i++) { base =tswapl (target_vec[i].iov_base); vec[i].iov_len =tswapl (target_vec[i].iov_len);if (vec[i].iov_len !=0 ) {
@@ -107,16 +110,17 @@ static abi_long lock_iovec(int type, struct iovec *vec, abi_ulong target_addr, }static abi_long unlock_iovec (struct iovec *vec,abi_ulong target_addr, -int count,int copy) +int count,int copy) {struct target_iovec *target_vec;abi_ulong base;int i; - target_vec =lock_user (VERIFY_READ , target_addr, count *sizeof (struct target_iovec ),1 ); + target_vec =lock_user (VERIFY_READ , target_addr, + count *sizeof (struct target_iovec ),1 );if (!target_vec)return -TARGET_EFAULT ; -for (i =0 ;i < count; i++) { +for (i =0 ; i < count; i++) {if (target_vec[i].iov_base) { base =tswapl (target_vec[i].iov_base);unlock_user (vec[i].iov_base, base, copy ? vec[i].iov_len :0 );
@@ -1177,6 +1181,13 @@ abi_long do_freebsd_syscall(void *cpu_env, int num, abi_long arg1,break ;/* +* ioctl(2) +*/ +case TARGET_FREEBSD_NR_ioctl:/* ioctl(2) */ + ret =do_bsd_ioctl (arg1, arg2, arg3); +break ; + +/* * sys{ctl, arch, call} */ case TARGET_FREEBSD_NR___sysctl:/* sysctl(3) */
@@ -1309,4 +1320,6 @@ abi_long do_openbsd_syscall(void *cpu_env, int num, abi_long arg1,void syscall_init (void ) { + +init_bsd_ioctl (); }
Signature · 1 line
1.7.8
PATCH 16/18 bsd-user: add support for extended attribute and ACL related syscalls
In reply to Stacey SonThis change add support for extended attribute and Access Control List (ACL) related system calls including extattrctl(), extattr_set_file(2), extattr_delete_file(2), extattr_set_fd(2), extattr_get_fd(2), extattr_delete_fd(2), extattr_get_link(2), extattr_set_link(2), extattr_delete_link(2), extattr_list_fd(2), extattr_list_file(2), extattr_list_link(2), __acl_aclcheck_fd(), __acl_aclcheck_file(), __acl_aclcheck_link(), __acl_delete_fd(), __acl_delete_file(), __acl_delete_link(), __acl_get_fd(), __acl_get_file(), __acl_get_link(), __acl_get_fd(), __acl_set_file(), and __acl_set_link().
--- bsd-user/Makefile.objs | 2 +- bsd-user/freebsd/os-extattr.c | 119 ++++++++ bsd-user/freebsd/os-extattr.h | 644 +++++++++++++++++++++++++++++++++++++++++ bsd-user/freebsd/qemu-os.h | 6 + bsd-user/netbsd/os-extattr.h | 247 ++++++++++++++++ bsd-user/openbsd/os-extattr.h | 247 ++++++++++++++++ bsd-user/syscall.c | 104 +++++++ 7 files changed, 1368 insertions(+), 1 deletions(-) create mode 100644 bsd-user/freebsd/os-extattr.c create mode 100644 bsd-user/freebsd/os-extattr.h create mode 100644 bsd-user/netbsd/os-extattr.h create mode 100644 bsd-user/openbsd/os-extattr.h
bsd-user/Makefile.objs +1 -1
@@ -1,6 +1,6 @@ obj-y = main.o bsdload.o elfload.o mmap.o signal.o strace.o syscall.o \ uaccess.o bsd-ioctl.o bsd-mem.o bsd-proc.o bsd-socket.o \ - $(HOST_ABI_DIR)/os-proc.o \ + $(HOST_ABI_DIR)/os-extattr.o $(HOST_ABI_DIR)/os-proc.o \ $(HOST_ABI_DIR)/os-socket.o $(HOST_ABI_DIR)/os-stat.o \ $(HOST_ABI_DIR)/os-sys.o $(HOST_ABI_DIR)/os-thread.o \ $(HOST_ABI_DIR)/os-time.o $(TARGET_ABI_DIR)/target_arch_cpu.o
bsd-user/freebsd/os-extattr.c new file +119 -0
119 lines not on this page · raw message
bsd-user/freebsd/os-extattr.h new file +644 -0
644 lines not on this page · raw message
bsd-user/freebsd/qemu-os.h +6 -0
@@ -70,4 +70,10 @@ abi_long h2t_freebsd_rtprio(abi_ulong target_addr, struct rtprio *host_rtp);abi_long do_freebsd_thr_new (CPUArchState *env,abi_ulong target_param_addr,int32_t param_size); +/* os-extattr.c */ +struct acl ; +abi_long t2h_freebsd_acl (struct acl *host_acl,abi_ulong target_addr); +abi_long h2t_freebsd_acl (abi_ulong target_addr,struct acl *host_acl); +abi_long t2h_freebsd_acl_type (acl_type_t *host_type,abi_long target_type); +#endif /* !_QEMU_OS_H_ */
bsd-user/netbsd/os-extattr.h new file +247 -0
247 lines not on this page · raw message
bsd-user/openbsd/os-extattr.h new file +247 -0
247 lines not on this page · raw message
bsd-user/syscall.c +104 -0
116 lines not on this page · raw message
Signature · 1 line
1.7.8
Re: [Qemu-devel] [PATCH 16/18] bsd-user: add support for extended attribute and ACL related syscalls
Quoted 10 lines · Stacey Son
This change add support for extended attribute and Access Control List (ACL) related system calls including
extattrctl(),extattr_set_file(2),extattr_delete_file(2),extattr_set_fd(2),extattr_get_fd(2),extattr_delete_fd(2),extattr_get_link(2),extattr_set_link(2),extattr_delete_link(2),extattr_list_fd(2),extattr_list_file(2),extattr_list_link(2),__acl_aclcheck_fd(),__acl_aclcheck_file(),__acl_aclcheck_link(),__acl_delete_fd(),__acl_delete_file(),__acl_delete_link(),__acl_get_fd(),__acl_get_file(),__acl_get_link(),__acl_get_fd(),__acl_set_file(), and__acl_set_link().
Quoted 8 lines
Signed-off-by Stacey Son <[email protected]>--- bsd-user/Makefile.objs | 2 +- bsd-user/freebsd/os-extattr.c | 119 ++++++++ bsd-user/freebsd/os-extattr.h | 644 +++++++++++++++++++++++++++++++++++++++++ bsd-user/freebsd/qemu-os.h | 6 + bsd-user/netbsd/os-extattr.h | 247 ++++++++++++++++ bsd-user/openbsd/os-extattr.h | 247 ++++++++++++++++
This is 500 lines of boilerplate just to say "these system calls aren't implemented for these host OSes". That's way too many; isn't there a better way to do this? (Applies similarly to all these syscall-implementing patches.)
thanks
-- PMM
PATCH 17/18 bsd-user: add support for miscellaneous system calls
In reply to Stacey SonThis change adds support or stubs for miscellaneous system calls including extattr*() (extended attributes), __acl*() (access control lists), sem*() (system V semaphores), msg*() (system V messages), sched_*() (scheduler control), cpuset*() (CPU affinity set management), mod*() and kld*() (kernel module), rctl_*() (resource controls), __mac_*() (Mandatory Access Control), posix_*() (additional posix support), and other miscellaneous system calls.
--- bsd-user/Makefile.objs | 2 +- bsd-user/bsd-misc.c | 209 +++++++++++++++++++++ bsd-user/bsd-misc.h | 339 +++++++++++++++++++++++++++++++++ bsd-user/freebsd/os-misc.h | 442 ++++++++++++++++++++++++++++++++++++++++++++ bsd-user/netbsd/os-misc.h | 375 +++++++++++++++++++++++++++++++++++++ bsd-user/openbsd/os-misc.h | 375 +++++++++++++++++++++++++++++++++++++ bsd-user/qemu-bsd.h | 18 ++ bsd-user/syscall.c | 229 +++++++++++++++++++++++ 8 files changed, 1988 insertions(+), 1 deletions(-) create mode 100644 bsd-user/bsd-misc.c create mode 100644 bsd-user/bsd-misc.h create mode 100644 bsd-user/freebsd/os-misc.h create mode 100644 bsd-user/netbsd/os-misc.h create mode 100644 bsd-user/openbsd/os-misc.h
bsd-user/Makefile.objs +1 -1
@@ -1,5 +1,5 @@ obj-y = main.o bsdload.o elfload.o mmap.o signal.o strace.o syscall.o \ - uaccess.o bsd-ioctl.o bsd-mem.o bsd-proc.o bsd-socket.o \ + uaccess.o bsd-ioctl.o bsd-mem.o bsd-misc.o bsd-proc.o bsd-socket.o \ $(HOST_ABI_DIR)/os-extattr.o $(HOST_ABI_DIR)/os-proc.o \ $(HOST_ABI_DIR)/os-socket.o $(HOST_ABI_DIR)/os-stat.o \ $(HOST_ABI_DIR)/os-sys.o $(HOST_ABI_DIR)/os-thread.o \
bsd-user/bsd-misc.c new file +209 -0
209 lines not on this page · raw message
bsd-user/bsd-misc.h new file +339 -0
339 lines not on this page · raw message
bsd-user/freebsd/os-misc.h new file +442 -0
442 lines not on this page · raw message
bsd-user/netbsd/os-misc.h new file +375 -0
375 lines not on this page · raw message
bsd-user/openbsd/os-misc.h new file +375 -0
375 lines not on this page · raw message
bsd-user/qemu-bsd.h +18 -0
@@ -58,4 +58,22 @@ abi_long host_to_target_sockaddr(abi_ulong target_addr, struct sockaddr *addr,abi_long target_to_host_ip_mreq (struct ip_mreqn *mreqn,abi_ulong target_addr,socklen_t len); +/* bsd-misc.c */ +abi_long host_to_target_uuid (abi_ulong target_addr,struct uuid *host_uuid); + +abi_long target_to_host_semarray (int semid,unsigned short **host_array, +abi_ulong target_addr); +abi_long host_to_target_semarray (int semid,abi_ulong target_addr, +unsigned short **host_array); + +abi_long target_to_host_semid_ds (struct semid_ds *host_sd, +abi_ulong target_addr); +abi_long host_to_target_semid_ds (abi_ulong target_addr, +struct semid_ds *host_sd); + +abi_long target_to_host_msqid_ds (struct msqid_ds *host_md, +abi_ulong target_addr); +abi_long host_to_target_msqid_ds (abi_ulong target_addr, +struct msqid_ds *host_md); +#endif /* !_QEMU_BSD_H_ */
bsd-user/syscall.c +229 -0
247 lines not on this page · raw message
Signature · 1 line
1.7.8
PATCH 18/18 bsd-user: add arm, mips and mips64 options to configure target-list
In reply to Stacey SonThis change adds arm-bsd-user, mips-bsd-user, mips64-bsd-user, mips64el-bsd-user, and mipsel-bsd-user as --target-list options to configure.
--- default-configs/arm-bsd-user.mak | 3 +++ default-configs/mips-bsd-user.mak | 1 + default-configs/mips64-bsd-user.mak | 1 + default-configs/mips64el-bsd-user.mak | 1 + default-configs/mipsel-bsd-user.mak | 1 + 5 files changed, 7 insertions(+), 0 deletions(-) create mode 100644 default-configs/arm-bsd-user.mak create mode 100644 default-configs/mips-bsd-user.mak create mode 100644 default-configs/mips64-bsd-user.mak create mode 100644 default-configs/mips64el-bsd-user.mak create mode 100644 default-configs/mipsel-bsd-user.mak
default-configs/arm-bsd-user.mak new file +3 -0
@@ -0,0 +1,3 @@ +# Default configuration for arm-linux-user + +CONFIG_GDBSTUB_XML=y
default-configs/mips-bsd-user.mak new file +1 -0
@@ -0,0 +1 @@ +# Default configuration for mips-bsd-user
default-configs/mips64-bsd-user.mak new file +1 -0
@@ -0,0 +1 @@ +# Default configuration for mips64-bsd-user
default-configs/mips64el-bsd-user.mak new file +1 -0
@@ -0,0 +1 @@ +# Default configuration for mips64el-bsd-user
default-configs/mipsel-bsd-user.mak new file +1 -0
@@ -0,0 +1 @@ +# Default configuration for mipsel-bsd-user
Signature · 1 line
1.7.8
Re: [Qemu-devel] [PATCH 18/18] bsd-user: add arm, mips and mips64 options to configure target-listt
Quoted 5 lines · [email protected] writes:
This change adds arm-bsd-user, mips-bsd-user, mips64-bsd-user, mips64el-bsd-user, and mipsel-bsd-user as --target-list options to configure.
Signed-off-by Stacey Son <[email protected]>---
<snip>
default-configs/arm-bsd-user.mak line 1
Quoted 6 lines
new file mode 100644
index 0000000..46d4aa2default-configs/arm-bsd-user.mak new file +1
-0@@ -0,0 +1,3 @@ +# Default configuration for arm-linux-user
Comment wrong
default-configs/arm-bsd-user.mak line 3
Quoted 2 lines
default-configs/arm-bsd-user.mak new file +2
-0+ +CONFIG_GDBSTUB_XML=y
<snip>
Given how little is typically in the -user .mak fragments I wonder what the point of them is. Should the build fall-back to a generic .mak fragment if there is no special config for a given build target?
Signature · 1 line
Alex Bennée
Re: [Qemu-devel] [PATCH 18/18] bsd-user: add arm, mips and mips64 options to configure target-listt
Quoted 8 lines · Alex Bennée
Quoted 5 lines · [email protected] writes:
This change adds arm-bsd-user, mips-bsd-user, mips64-bsd-user, mips64el-bsd-user, and mipsel-bsd-user as --target-list options to configure.
Signed-off-by Stacey Son <[email protected]>---
Quoted 8 lines
<snip>
default-configs/arm-bsd-user.mak line 1
Quoted 6 lines
new file mode 100644
index 0000000..46d4aa2default-configs/arm-bsd-user.mak new file +1
-0@@ -0,0 +1,3 @@ +# Default configuration for arm-linux-userComment wrong
Yes, indeed. Now we know the source of this file. I fixed that in the patch set at http://people.freebsd.org/~sson/qemu/qemu-1.6.1/
<snip>
-stacey.
Re: [Qemu-devel] [PATCH 18/18] bsd-user: add arm, mips and mips64 options to configure target-listt
In reply to Alex BennéeQuoted 3 lines · Alex Bennée
Given how little is typically in the -user .mak fragments I wonder what the point of them is. Should the build fall-back to a generic .mak fragment if there is no special config for a given build target?
At the moment our list of "targets that you can build" is exactly "list of targets with a .mak file", so in order to have a generic .mak you'd need to have a list of supported targets somewhere else. Personally I'm not sure that's worth doing (possibly the "move to Kconfig" work will obsolete these files anyway.)
-- PMM
Re: [Qemu-devel] [PATCH 18/18] bsd-user: add arm, mips and mips64 options to configure target-list
In reply to Stacey Sondefault-configs/arm-bsd-user.mak line 1
Quoted 10 lines · Stacey Son
This change adds arm-bsd-user, mips-bsd-user, mips64-bsd-user, mips64el-bsd-user, and mipsel-bsd-user as --target-list options to configure.
default-configs/arm-bsd-user.mak new file +1
-0@@ -0,0 +1,3 @@ +# Default configuration for arm-linux-user
Comment doesn't match filename...
-- PMM
Re: [Qemu-devel] [PATCH 00/18] bsd-user: Add system call and mips/armsupport..
In reply to Stacey SonQuoted 6 lines · [email protected] writes:
This patch series adds a significant number of system calls and mips/arm support for bsd-user. In its current state it can emulate most FreeBSD mips/mips64 and arm target binaries on a x86 host in a simple chroot environment. (see https://wiki.freebsd.org/QemuUserModeHowTo for the details.)
Quoted 7 lines
Besides adding a lot of shims and other support code this change restructures the code significantly to reduce the amount of C preprocessor conditionals for the various target and host arch/OS's. In general, the target cpu depedent code has been moved into into the various arch directories and the host OS dependent code (ie. FreeBSD, NetBSD, OpenBSD) has been moved into the OS directories as much as possible.
<snip>
What has been the approach to test and verification of the shims? Is there a BSD equivalent to the LTP or some other POSIX test suite to exercise all these shim calls?
Signature · 1 line
Alex Bennée
Re: [Qemu-devel] [PATCH 00/18] bsd-user: Add system call and mips/armsupport..
Quoted 16 lines · Alex Bennée
Quoted 6 lines · [email protected] writes:
This patch series adds a significant number of system calls and mips/arm support for bsd-user. In its current state it can emulate most FreeBSD mips/mips64 and arm target binaries on a x86 host in a simple chroot environment. (see https://wiki.freebsd.org/QemuUserModeHowTo for the details.)
Quoted 7 lines
Besides adding a lot of shims and other support code this change restructures the code significantly to reduce the amount of C preprocessor conditionals for the various target and host arch/OS's. In general, the target cpu depedent code has been moved into into the various arch directories and the host OS dependent code (ie. FreeBSD, NetBSD, OpenBSD) has been moved into the OS directories as much as possible.
Quoted 5 lines
<snip>
What has been the approach to test and verification of the shims? Is there a BSD equivalent to the LTP or some other POSIX test suite to exercise all these shim calls?
I did write a lot unit tests which I didn't submit (yet) but my main test was cross building things like perl 5.14 and running its rather large test suite. I also cross built over 8,000 packages for FreeBSD/MIPS64 using Poudrière and qemu-mips64 (see http://people.freebsd.org/~bapt/pres/modern-package-management.pdf for more information).
Regards,
-stacey.
Quoted 6 lines · Stacey Son
This patch series adds a significant number of system calls and mips/arm support for bsd-user. In its current state it can emulate most FreeBSD mips/mips64 and arm target binaries on a x86 host in a simple chroot environment. (see https://wiki.freebsd.org/QemuUserModeHowTo for the details.)
Quoted 7 lines
Besides adding a lot of shims and other support code this change restructures the code significantly to reduce the amount of C preprocessor conditionals for the various target and host arch/OS's. In general, the target cpu depedent code has been moved into into the various arch directories and the host OS dependent code (ie. FreeBSD, NetBSD, OpenBSD) has been moved into the OS directories as much as possible.
Thanks -- this series definitely looks in much better shape than the previous one. I've looked at the (fairly minor) changes to code outside bsd-user/ and I think they're OK.
-- PMM
v2 cover bsd-user: Add system call and mips/arm support.
In reply to Stacey Son[v2]
- Rebases to 1.7.0-rc0. (Requires, however, Andreas Tobler's patch to
build: see
http://lists.nongnu.org/archive/html/qemu-devel/2013-11/msg00000.html)
- Fixes deadlock in the _umtx_op() system call handler.
- Fixes race condition in mmap() system call handler.
- Makes qemu-mips (o32) usable.
- A small code clean up to the ARM cpu_loop().
- Fixes comment in arm-bsd-user.mak to match filename.
- Fixes symbol conflicts with FreeBSD's libcrypto for static link.
[v1]
This patch series adds a significant number of system calls and mips/arm support for bsd-user. In its current state it can emulate most FreeBSD mips/mips64 and arm target binaries on a x86 host in a simple chroot environment. (see https://wiki.freebsd.org/QemuUserModeHowTo for the details.)
Besides adding a lot of shims and other support code this change restructures the code significantly to reduce the amount of C preprocessor conditionals for the various target and host arch/OS's. In general, the target cpu depedent code has been moved into into the various arch directories and the host OS dependent code (ie. FreeBSD, NetBSD, OpenBSD) has been moved into the OS directories as much as possible.
I would like to recognize Olivier Houchard for a lot of the arm dependent code and Juergen Lock, the maintainer of the FreeBSD Qemu port, for their contributions.
Best Regards,
Stacey D. Son
---
Stacey Son (19):
bsd-user: refresh freebsd system call numbers
bsd-user: add HOST_ABI_DIR for the various *BSD dependent code.
bsd-user: move OS/arch dependent code for strace into separate
directories
bsd-user: move target arch and host OS dependent code out of main.c
bsd-user: move target arch and host OS dependent code out of
syscall.c
bsd-user: add support for freebsd time related system calls
bsd-user: add support for freebsd signal related system calls
bsd-user: move target arch and host OS dependent code out of
elfload.c
bsd-user: add support for freebsd process related system calls
bsd-user: add support for file system related system calls
bsd-user: add support for stat, directory, and file control related
system calls
bsd-user: add support for memory management related system calls
bsd-user: add support for socket related system calls
bsd-user: add support for thread related system calls
bsd-user: add support for the ioctl system call
bsd-user: add support for extended attribute and ACL related syscalls
bsd-user: add support for miscellaneous system calls
bsd-user: add arm, mips and mips64 options to configure target-list
bsd-user: fix linking conflicts with FreeBSD libcrypto
Makefile.target | 5 +- bsd-user/Makefile.objs | 6 +- bsd-user/arm/syscall.h | 36 + bsd-user/arm/target_arch.h | 10 + bsd-user/arm/target_arch_cpu.c | 27 + bsd-user/arm/target_arch_cpu.h | 375 ++++++ bsd-user/arm/target_arch_elf.h | 54 + bsd-user/arm/target_arch_signal.h | 257 +++++ bsd-user/arm/target_arch_sigtramp.h | 33 + bsd-user/arm/target_arch_sysarch.h | 78 ++ bsd-user/arm/target_arch_thread.h | 67 ++ bsd-user/arm/target_arch_vmparam.h | 51 + bsd-user/bsd-file.h | 1111 ++++++++++++++++++ bsd-user/bsd-ioctl.c | 448 ++++++++ bsd-user/bsd-ioctl.h | 27 + bsd-user/bsd-mem.c | 122 ++ bsd-user/bsd-mem.h | 393 +++++++ bsd-user/bsd-misc.c | 209 ++++ bsd-user/bsd-misc.h | 339 ++++++ bsd-user/bsd-proc.c | 160 +++ bsd-user/bsd-proc.h | 434 +++++++ bsd-user/bsd-signal.h | 232 ++++ bsd-user/bsd-socket.c | 108 ++ bsd-user/bsd-socket.h | 266 +++++ bsd-user/bsdload.c | 170 ++- bsd-user/elfload.c | 956 ++++------------- bsd-user/errno_defs.h | 13 +- bsd-user/freebsd/host_os.h | 46 + bsd-user/freebsd/os-extattr.c | 119 ++ bsd-user/freebsd/os-extattr.h | 644 +++++++++++ bsd-user/freebsd/os-ioctl-cmds.h | 47 + bsd-user/freebsd/os-ioctl-filio.h | 45 + bsd-user/freebsd/os-ioctl-ioccom.h | 54 + bsd-user/freebsd/os-ioctl-ttycom.h | 257 +++++ bsd-user/freebsd/os-ioctl-types.h | 7 + bsd-user/freebsd/os-misc.h | 442 ++++++++ bsd-user/freebsd/os-proc.c | 234 ++++ bsd-user/freebsd/os-proc.h | 428 +++++++ bsd-user/freebsd/os-signal.h | 43 + bsd-user/freebsd/os-socket.c | 149 +++ bsd-user/freebsd/os-socket.h | 548 +++++++++ bsd-user/freebsd/os-stat.c | 234 ++++ bsd-user/freebsd/os-stat.h | 437 +++++++ bsd-user/freebsd/os-strace.h | 29 + bsd-user/freebsd/os-sys.c | 268 +++++ bsd-user/freebsd/os-thread.c | 1001 ++++++++++++++++ bsd-user/freebsd/os-thread.h | 511 +++++++++ bsd-user/freebsd/os-time.c | 205 ++++ bsd-user/freebsd/os-time.h | 643 +++++++++++ bsd-user/freebsd/qemu-os.h | 79 ++ bsd-user/freebsd/strace.list | 76 ++- bsd-user/freebsd/syscall_nr.h | 813 ++++++++------ bsd-user/freebsd/target_os_elf.h | 145 +++ bsd-user/freebsd/target_os_siginfo.h | 110 ++ bsd-user/freebsd/target_os_signal.h | 79 ++ bsd-user/freebsd/target_os_stack.h | 157 +++ bsd-user/freebsd/target_os_thread.h | 6 + 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 | 302 +++++ bsd-user/i386/target_arch_elf.h | 62 + bsd-user/i386/target_arch_signal.h | 94 ++ bsd-user/i386/target_arch_sigtramp.h | 11 + bsd-user/i386/target_arch_sysarch.h | 78 ++ bsd-user/i386/target_arch_thread.h | 45 + bsd-user/i386/target_arch_vmparam.h | 28 + bsd-user/i386/target_signal.h | 6 - bsd-user/main.c | 926 +++------------ bsd-user/mips/syscall.h | 52 + bsd-user/mips/target_arch.h | 10 + bsd-user/mips/target_arch_cpu.c | 27 + bsd-user/mips/target_arch_cpu.h | 257 +++++ bsd-user/mips/target_arch_elf.h | 36 + bsd-user/mips/target_arch_signal.h | 237 ++++ bsd-user/mips/target_arch_sigtramp.h | 23 + bsd-user/mips/target_arch_sysarch.h | 69 ++ bsd-user/mips/target_arch_thread.h | 54 + bsd-user/mips/target_arch_vmparam.h | 50 + bsd-user/mips64/syscall.h | 53 + bsd-user/mips64/target_arch.h | 10 + bsd-user/mips64/target_arch_cpu.c | 27 + bsd-user/mips64/target_arch_cpu.h | 243 ++++ bsd-user/mips64/target_arch_elf.h | 36 + bsd-user/mips64/target_arch_signal.h | 236 ++++ bsd-user/mips64/target_arch_sigtramp.h | 23 + bsd-user/mips64/target_arch_sysarch.h | 69 ++ bsd-user/mips64/target_arch_thread.h | 54 + bsd-user/mips64/target_arch_vmparam.h | 47 + bsd-user/mmap.c | 473 +++++--- bsd-user/netbsd/host_os.h | 31 + bsd-user/netbsd/os-extattr.h | 247 ++++ bsd-user/netbsd/os-ioctl-cmds.h | 48 + bsd-user/netbsd/os-ioctl-filio.h | 29 + bsd-user/netbsd/os-ioctl-ioccom.h | 38 + bsd-user/netbsd/os-ioctl-ttycom.h | 240 ++++ bsd-user/netbsd/os-ioctl-types.h | 7 + bsd-user/netbsd/os-misc.h | 375 ++++++ bsd-user/netbsd/os-proc.c | 11 + bsd-user/netbsd/os-proc.h | 243 ++++ bsd-user/netbsd/os-socket.c | 1 + bsd-user/netbsd/os-socket.h | 98 ++ bsd-user/netbsd/os-stat.c | 1 + bsd-user/netbsd/os-stat.h | 1 + bsd-user/netbsd/os-strace.h | 1 + bsd-user/netbsd/os-sys.c | 46 + bsd-user/netbsd/os-thread.c | 1 + bsd-user/netbsd/os-thread.h | 133 +++ bsd-user/netbsd/os-time.c | 1 + bsd-user/netbsd/os-time.h | 179 +++ bsd-user/netbsd/qemu-os.h | 1 + bsd-user/netbsd/target_os_elf.h | 226 ++++ bsd-user/netbsd/target_os_siginfo.h | 82 ++ bsd-user/netbsd/target_os_signal.h | 70 ++ bsd-user/netbsd/target_os_stack.h | 33 + bsd-user/netbsd/target_os_thread.h | 6 + bsd-user/openbsd/host_os.h | 31 + bsd-user/openbsd/os-extattr.h | 247 ++++ bsd-user/openbsd/os-ioctl-cmds.h | 48 + bsd-user/openbsd/os-ioctl-filio.h | 29 + bsd-user/openbsd/os-ioctl-ioccom.h | 38 + bsd-user/openbsd/os-ioctl-ttycom.h | 240 ++++ bsd-user/openbsd/os-ioctl-types.h | 7 + bsd-user/openbsd/os-misc.h | 375 ++++++ bsd-user/openbsd/os-proc.c | 11 + bsd-user/openbsd/os-proc.h | 243 ++++ bsd-user/openbsd/os-socket.c | 1 + bsd-user/openbsd/os-socket.h | 98 ++ bsd-user/openbsd/os-stat.c | 1 + bsd-user/openbsd/os-stat.h | 176 +++ bsd-user/openbsd/os-strace.h | 1 + bsd-user/openbsd/os-sys.c | 46 + bsd-user/openbsd/os-thread.c | 1 + bsd-user/openbsd/os-thread.h | 133 +++ bsd-user/openbsd/os-time.c | 1 + bsd-user/openbsd/os-time.h | 179 +++ bsd-user/openbsd/qemu-os.h | 1 + bsd-user/openbsd/target_os_elf.h | 226 ++++ bsd-user/openbsd/target_os_siginfo.h | 82 ++ bsd-user/openbsd/target_os_signal.h | 70 ++ bsd-user/openbsd/target_os_stack.h | 33 + bsd-user/openbsd/target_os_thread.h | 6 + bsd-user/qemu-bsd.h | 79 ++ bsd-user/qemu.h | 202 +++- bsd-user/signal.c | 907 +++++++++++++++- 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_elf.h | 30 + bsd-user/sparc/target_arch_signal.h | 77 ++ bsd-user/sparc/target_arch_sigtramp.h | 11 + bsd-user/sparc/target_arch_sysarch.h | 52 + bsd-user/sparc/target_arch_thread.h | 39 + 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_elf.h | 34 + bsd-user/sparc64/target_arch_signal.h | 94 ++ bsd-user/sparc64/target_arch_sigtramp.h | 11 + bsd-user/sparc64/target_arch_sysarch.h | 52 + bsd-user/sparc64/target_arch_thread.h | 55 + bsd-user/sparc64/target_arch_vmparam.h | 37 + bsd-user/sparc64/target_signal.h | 5 - bsd-user/strace.c | 175 ++- bsd-user/syscall.c | 1884 ++++++++++++++++++++++++------- bsd-user/syscall_defs.h | 860 +++++++++++++-- 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 | 324 ++++++ bsd-user/x86_64/target_arch_elf.h | 55 + bsd-user/x86_64/target_arch_signal.h | 94 ++ bsd-user/x86_64/target_arch_sigtramp.h | 11 + bsd-user/x86_64/target_arch_sysarch.h | 76 ++ bsd-user/x86_64/target_arch_thread.h | 40 + bsd-user/x86_64/target_arch_vmparam.h | 28 + bsd-user/x86_64/target_signal.h | 5 - configure | 11 + default-configs/arm-bsd-user.mak | 3 + default-configs/mips-bsd-user.mak | 1 + default-configs/mips64-bsd-user.mak | 1 + default-configs/mips64el-bsd-user.mak | 1 + default-configs/mipsel-bsd-user.mak | 1 + include/qemu/aes.h | 9 + include/qemu/tls.h | 2 +- 190 files changed, 25475 insertions(+), 2702 deletions(-) create mode 100644 bsd-user/arm/syscall.h create mode 100644 bsd-user/arm/target_arch.h create mode 100644 bsd-user/arm/target_arch_cpu.c create mode 100644 bsd-user/arm/target_arch_cpu.h create mode 100644 bsd-user/arm/target_arch_elf.h create mode 100644 bsd-user/arm/target_arch_signal.h create mode 100644 bsd-user/arm/target_arch_sigtramp.h create mode 100644 bsd-user/arm/target_arch_sysarch.h create mode 100644 bsd-user/arm/target_arch_thread.h create mode 100644 bsd-user/arm/target_arch_vmparam.h create mode 100644 bsd-user/bsd-file.h create mode 100644 bsd-user/bsd-ioctl.c create mode 100644 bsd-user/bsd-ioctl.h create mode 100644 bsd-user/bsd-mem.c create mode 100644 bsd-user/bsd-mem.h create mode 100644 bsd-user/bsd-misc.c create mode 100644 bsd-user/bsd-misc.h create mode 100644 bsd-user/bsd-proc.c create mode 100644 bsd-user/bsd-proc.h create mode 100644 bsd-user/bsd-signal.h create mode 100644 bsd-user/bsd-socket.c create mode 100644 bsd-user/bsd-socket.h create mode 100644 bsd-user/freebsd/host_os.h create mode 100644 bsd-user/freebsd/os-extattr.c create mode 100644 bsd-user/freebsd/os-extattr.h create mode 100644 bsd-user/freebsd/os-ioctl-cmds.h create mode 100644 bsd-user/freebsd/os-ioctl-filio.h create mode 100644 bsd-user/freebsd/os-ioctl-ioccom.h create mode 100644 bsd-user/freebsd/os-ioctl-ttycom.h create mode 100644 bsd-user/freebsd/os-ioctl-types.h create mode 100644 bsd-user/freebsd/os-misc.h create mode 100644 bsd-user/freebsd/os-proc.c create mode 100644 bsd-user/freebsd/os-proc.h create mode 100644 bsd-user/freebsd/os-signal.h create mode 100644 bsd-user/freebsd/os-socket.c create mode 100644 bsd-user/freebsd/os-socket.h create mode 100644 bsd-user/freebsd/os-stat.c create mode 100644 bsd-user/freebsd/os-stat.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/os-thread.c create mode 100644 bsd-user/freebsd/os-thread.h create mode 100644 bsd-user/freebsd/os-time.c create mode 100644 bsd-user/freebsd/os-time.h create mode 100644 bsd-user/freebsd/qemu-os.h create mode 100644 bsd-user/freebsd/target_os_elf.h create mode 100644 bsd-user/freebsd/target_os_siginfo.h create mode 100644 bsd-user/freebsd/target_os_signal.h create mode 100644 bsd-user/freebsd/target_os_stack.h create mode 100644 bsd-user/freebsd/target_os_thread.h create mode 100644 bsd-user/freebsd/target_os_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_elf.h create mode 100644 bsd-user/i386/target_arch_signal.h create mode 100644 bsd-user/i386/target_arch_sigtramp.h create mode 100644 bsd-user/i386/target_arch_sysarch.h create mode 100644 bsd-user/i386/target_arch_thread.h create mode 100644 bsd-user/i386/target_arch_vmparam.h create mode 100644 bsd-user/mips/syscall.h create mode 100644 bsd-user/mips/target_arch.h create mode 100644 bsd-user/mips/target_arch_cpu.c create mode 100644 bsd-user/mips/target_arch_cpu.h create mode 100644 bsd-user/mips/target_arch_elf.h create mode 100644 bsd-user/mips/target_arch_signal.h create mode 100644 bsd-user/mips/target_arch_sigtramp.h create mode 100644 bsd-user/mips/target_arch_sysarch.h create mode 100644 bsd-user/mips/target_arch_thread.h create mode 100644 bsd-user/mips/target_arch_vmparam.h create mode 100644 bsd-user/mips64/syscall.h create mode 100644 bsd-user/mips64/target_arch.h create mode 100644 bsd-user/mips64/target_arch_cpu.c create mode 100644 bsd-user/mips64/target_arch_cpu.h create mode 100644 bsd-user/mips64/target_arch_elf.h create mode 100644 bsd-user/mips64/target_arch_signal.h create mode 100644 bsd-user/mips64/target_arch_sigtramp.h create mode 100644 bsd-user/mips64/target_arch_sysarch.h create mode 100644 bsd-user/mips64/target_arch_thread.h create mode 100644 bsd-user/mips64/target_arch_vmparam.h create mode 100644 bsd-user/netbsd/host_os.h create mode 100644 bsd-user/netbsd/os-extattr.h create mode 100644 bsd-user/netbsd/os-ioctl-cmds.h create mode 100644 bsd-user/netbsd/os-ioctl-filio.h create mode 100644 bsd-user/netbsd/os-ioctl-ioccom.h create mode 100644 bsd-user/netbsd/os-ioctl-ttycom.h create mode 100644 bsd-user/netbsd/os-ioctl-types.h create mode 100644 bsd-user/netbsd/os-misc.h create mode 100644 bsd-user/netbsd/os-proc.c create mode 100644 bsd-user/netbsd/os-proc.h create mode 100644 bsd-user/netbsd/os-socket.c create mode 100644 bsd-user/netbsd/os-socket.h create mode 100644 bsd-user/netbsd/os-stat.c create mode 100644 bsd-user/netbsd/os-stat.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/os-thread.c create mode 100644 bsd-user/netbsd/os-thread.h create mode 100644 bsd-user/netbsd/os-time.c create mode 100644 bsd-user/netbsd/os-time.h create mode 100644 bsd-user/netbsd/qemu-os.h create mode 100644 bsd-user/netbsd/target_os_elf.h create mode 100644 bsd-user/netbsd/target_os_siginfo.h create mode 100644 bsd-user/netbsd/target_os_signal.h create mode 100644 bsd-user/netbsd/target_os_stack.h create mode 100644 bsd-user/netbsd/target_os_thread.h create mode 100644 bsd-user/openbsd/host_os.h create mode 100644 bsd-user/openbsd/os-extattr.h create mode 100644 bsd-user/openbsd/os-ioctl-cmds.h create mode 100644 bsd-user/openbsd/os-ioctl-filio.h create mode 100644 bsd-user/openbsd/os-ioctl-ioccom.h create mode 100644 bsd-user/openbsd/os-ioctl-ttycom.h create mode 100644 bsd-user/openbsd/os-ioctl-types.h create mode 100644 bsd-user/openbsd/os-misc.h create mode 100644 bsd-user/openbsd/os-proc.c create mode 100644 bsd-user/openbsd/os-proc.h create mode 100644 bsd-user/openbsd/os-socket.c create mode 100644 bsd-user/openbsd/os-socket.h create mode 100644 bsd-user/openbsd/os-stat.c create mode 100644 bsd-user/openbsd/os-stat.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/os-thread.c create mode 100644 bsd-user/openbsd/os-thread.h create mode 100644 bsd-user/openbsd/os-time.c create mode 100644 bsd-user/openbsd/os-time.h create mode 100644 bsd-user/openbsd/qemu-os.h create mode 100644 bsd-user/openbsd/target_os_elf.h create mode 100644 bsd-user/openbsd/target_os_siginfo.h create mode 100644 bsd-user/openbsd/target_os_signal.h create mode 100644 bsd-user/openbsd/target_os_stack.h create mode 100644 bsd-user/openbsd/target_os_thread.h create mode 100644 bsd-user/qemu-bsd.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_elf.h create mode 100644 bsd-user/sparc/target_arch_signal.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_thread.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_elf.h create mode 100644 bsd-user/sparc64/target_arch_signal.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_thread.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_elf.h create mode 100644 bsd-user/x86_64/target_arch_signal.h create mode 100644 bsd-user/x86_64/target_arch_sigtramp.h create mode 100644 bsd-user/x86_64/target_arch_sysarch.h create mode 100644 bsd-user/x86_64/target_arch_thread.h create mode 100644 bsd-user/x86_64/target_arch_vmparam.h create mode 100644 default-configs/arm-bsd-user.mak create mode 100644 default-configs/mips-bsd-user.mak create mode 100644 default-configs/mips64-bsd-user.mak create mode 100644 default-configs/mips64el-bsd-user.mak create mode 100644 default-configs/mipsel-bsd-user.mak
Signature · 1 line
1.7.8
PATCH v2 1/19 bsd-user: refresh freebsd system call numbers
Update FreeBSD system call numbers in freebsd/syscall_nr.h.
--- bsd-user/freebsd/syscall_nr.h | 813 ++++++++++++++++++++++------------------- 1 files changed, 445 insertions(+), 368 deletions(-)
bsd-user/freebsd/syscall_nr.h +445 -368
@@ -1,373 +1,450 @@/* * System call numbers. * -* $FreeBSD: src/sys/sys/syscall.h,v 1.224 2008/08/24 21:23:08 rwatson Exp $ -* created from FreeBSD: head/sys/kern/syscalls.master 182123 2008-08-24 21:20:35Z rwatson +* created from FreeBSD: releng/9.1/sys/kern/syscalls.master 229723 +* 2012-01-06 19:29:16Z jhb */ -#define TARGET_FREEBSD_NR_syscall 0 -#define TARGET_FREEBSD_NR_exit 1 -#define TARGET_FREEBSD_NR_fork 2 -#define TARGET_FREEBSD_NR_read 3 -#define TARGET_FREEBSD_NR_write 4 -#define TARGET_FREEBSD_NR_open 5 -#define TARGET_FREEBSD_NR_close 6 -#define TARGET_FREEBSD_NR_wait4 7 -#define TARGET_FREEBSD_NR_link 9 -#define TARGET_FREEBSD_NR_unlink 10 -#define TARGET_FREEBSD_NR_chdir 12 -#define TARGET_FREEBSD_NR_fchdir 13 -#define TARGET_FREEBSD_NR_mknod 14 -#define TARGET_FREEBSD_NR_chmod 15 -#define TARGET_FREEBSD_NR_chown 16 -#define TARGET_FREEBSD_NR_break 17 -#define TARGET_FREEBSD_NR_freebsd4_getfsstat 18 -#define TARGET_FREEBSD_NR_getpid 20 -#define TARGET_FREEBSD_NR_mount 21 -#define TARGET_FREEBSD_NR_unmount 22 -#define TARGET_FREEBSD_NR_setuid 23 -#define TARGET_FREEBSD_NR_getuid 24 -#define TARGET_FREEBSD_NR_geteuid 25 -#define TARGET_FREEBSD_NR_ptrace 26 -#define TARGET_FREEBSD_NR_recvmsg 27 -#define TARGET_FREEBSD_NR_sendmsg 28 -#define TARGET_FREEBSD_NR_recvfrom 29 -#define TARGET_FREEBSD_NR_accept 30 -#define TARGET_FREEBSD_NR_getpeername 31 -#define TARGET_FREEBSD_NR_getsockname 32 -#define TARGET_FREEBSD_NR_access 33 -#define TARGET_FREEBSD_NR_chflags 34 -#define TARGET_FREEBSD_NR_fchflags 35 -#define TARGET_FREEBSD_NR_sync 36 -#define TARGET_FREEBSD_NR_kill 37 -#define TARGET_FREEBSD_NR_getppid 39 -#define TARGET_FREEBSD_NR_dup 41 -#define TARGET_FREEBSD_NR_pipe 42 -#define TARGET_FREEBSD_NR_getegid 43 -#define TARGET_FREEBSD_NR_profil 44 -#define TARGET_FREEBSD_NR_ktrace 45 -#define TARGET_FREEBSD_NR_getgid 47 -#define TARGET_FREEBSD_NR_getlogin 49 -#define TARGET_FREEBSD_NR_setlogin 50 -#define TARGET_FREEBSD_NR_acct 51 -#define TARGET_FREEBSD_NR_sigaltstack 53 -#define TARGET_FREEBSD_NR_ioctl 54 -#define TARGET_FREEBSD_NR_reboot 55 -#define TARGET_FREEBSD_NR_revoke 56 -#define TARGET_FREEBSD_NR_symlink 57 -#define TARGET_FREEBSD_NR_readlink 58 -#define TARGET_FREEBSD_NR_execve 59 -#define TARGET_FREEBSD_NR_umask 60 -#define TARGET_FREEBSD_NR_chroot 61 -#define TARGET_FREEBSD_NR_msync 65 -#define TARGET_FREEBSD_NR_vfork 66 -#define TARGET_FREEBSD_NR_sbrk 69 -#define TARGET_FREEBSD_NR_sstk 70 -#define TARGET_FREEBSD_NR_vadvise 72 -#define TARGET_FREEBSD_NR_munmap 73 -#define TARGET_FREEBSD_NR_mprotect 74 -#define TARGET_FREEBSD_NR_madvise 75 -#define TARGET_FREEBSD_NR_mincore 78 -#define TARGET_FREEBSD_NR_getgroups 79 -#define TARGET_FREEBSD_NR_setgroups 80 -#define TARGET_FREEBSD_NR_getpgrp 81 -#define TARGET_FREEBSD_NR_setpgid 82 -#define TARGET_FREEBSD_NR_setitimer 83 -#define TARGET_FREEBSD_NR_swapon 85 -#define TARGET_FREEBSD_NR_getitimer 86 -#define TARGET_FREEBSD_NR_getdtablesize 89 -#define TARGET_FREEBSD_NR_dup2 90 -#define TARGET_FREEBSD_NR_fcntl 92 -#define TARGET_FREEBSD_NR_select 93 -#define TARGET_FREEBSD_NR_fsync 95 -#define TARGET_FREEBSD_NR_setpriority 96 -#define TARGET_FREEBSD_NR_socket 97 -#define TARGET_FREEBSD_NR_connect 98 -#define TARGET_FREEBSD_NR_getpriority 100 -#define TARGET_FREEBSD_NR_bind 104 -#define TARGET_FREEBSD_NR_setsockopt 105 -#define TARGET_FREEBSD_NR_listen 106 -#define TARGET_FREEBSD_NR_gettimeofday 116 -#define TARGET_FREEBSD_NR_getrusage 117 -#define TARGET_FREEBSD_NR_getsockopt 118 -#define TARGET_FREEBSD_NR_readv 120 -#define TARGET_FREEBSD_NR_writev 121 -#define TARGET_FREEBSD_NR_settimeofday 122 -#define TARGET_FREEBSD_NR_fchown 123 -#define TARGET_FREEBSD_NR_fchmod 124 -#define TARGET_FREEBSD_NR_setreuid 126 -#define TARGET_FREEBSD_NR_setregid 127 -#define TARGET_FREEBSD_NR_rename 128 -#define TARGET_FREEBSD_NR_flock 131 -#define TARGET_FREEBSD_NR_mkfifo 132 -#define TARGET_FREEBSD_NR_sendto 133 -#define TARGET_FREEBSD_NR_shutdown 134 -#define TARGET_FREEBSD_NR_socketpair 135 -#define TARGET_FREEBSD_NR_mkdir 136 -#define TARGET_FREEBSD_NR_rmdir 137 -#define TARGET_FREEBSD_NR_utimes 138 -#define TARGET_FREEBSD_NR_adjtime 140 -#define TARGET_FREEBSD_NR_setsid 147 -#define TARGET_FREEBSD_NR_quotactl 148 -#define TARGET_FREEBSD_NR_nlm_syscall 154 -#define TARGET_FREEBSD_NR_nfssvc 155 -#define TARGET_FREEBSD_NR_freebsd4_statfs 157 -#define TARGET_FREEBSD_NR_freebsd4_fstatfs 158 -#define TARGET_FREEBSD_NR_lgetfh 160 -#define TARGET_FREEBSD_NR_getfh 161 -#define TARGET_FREEBSD_NR_getdomainname 162 -#define TARGET_FREEBSD_NR_setdomainname 163 -#define TARGET_FREEBSD_NR_uname 164 -#define TARGET_FREEBSD_NR_sysarch 165 -#define TARGET_FREEBSD_NR_rtprio 166 -#define TARGET_FREEBSD_NR_semsys 169 -#define TARGET_FREEBSD_NR_msgsys 170 -#define TARGET_FREEBSD_NR_shmsys 171 -#define TARGET_FREEBSD_NR_freebsd6_pread 173 -#define TARGET_FREEBSD_NR_freebsd6_pwrite 174 -#define TARGET_FREEBSD_NR_setfib 175 -#define TARGET_FREEBSD_NR_ntp_adjtime 176 -#define TARGET_FREEBSD_NR_setgid 181 -#define TARGET_FREEBSD_NR_setegid 182 -#define TARGET_FREEBSD_NR_seteuid 183 -#define TARGET_FREEBSD_NR_stat 188 -#define TARGET_FREEBSD_NR_fstat 189 -#define TARGET_FREEBSD_NR_lstat 190 -#define TARGET_FREEBSD_NR_pathconf 191 -#define TARGET_FREEBSD_NR_fpathconf 192 -#define TARGET_FREEBSD_NR_getrlimit 194 -#define TARGET_FREEBSD_NR_setrlimit 195 -#define TARGET_FREEBSD_NR_getdirentries 196 -#define TARGET_FREEBSD_NR_freebsd6_mmap 197 -#define TARGET_FREEBSD_NR___syscall 198 -#define TARGET_FREEBSD_NR_freebsd6_lseek 199 -#define TARGET_FREEBSD_NR_freebsd6_truncate 200 -#define TARGET_FREEBSD_NR_freebsd6_ftruncate 201 -#define TARGET_FREEBSD_NR___sysctl 202 -#define TARGET_FREEBSD_NR_mlock 203 -#define TARGET_FREEBSD_NR_munlock 204 -#define TARGET_FREEBSD_NR_undelete 205 -#define TARGET_FREEBSD_NR_futimes 206 -#define TARGET_FREEBSD_NR_getpgid 207 -#define TARGET_FREEBSD_NR_poll 209 -#define TARGET_FREEBSD_NR___semctl 220 -#define TARGET_FREEBSD_NR_semget 221 -#define TARGET_FREEBSD_NR_semop 222 -#define TARGET_FREEBSD_NR_msgctl 224 -#define TARGET_FREEBSD_NR_msgget 225 -#define TARGET_FREEBSD_NR_msgsnd 226 -#define TARGET_FREEBSD_NR_msgrcv 227 -#define TARGET_FREEBSD_NR_shmat 228 -#define TARGET_FREEBSD_NR_shmctl 229 -#define TARGET_FREEBSD_NR_shmdt 230 -#define TARGET_FREEBSD_NR_shmget 231 -#define TARGET_FREEBSD_NR_clock_gettime 232 -#define TARGET_FREEBSD_NR_clock_settime 233 -#define TARGET_FREEBSD_NR_clock_getres 234 -#define TARGET_FREEBSD_NR_ktimer_create 235 -#define TARGET_FREEBSD_NR_ktimer_delete 236 -#define TARGET_FREEBSD_NR_ktimer_settime 237 -#define TARGET_FREEBSD_NR_ktimer_gettime 238 -#define TARGET_FREEBSD_NR_ktimer_getoverrun 239 -#define TARGET_FREEBSD_NR_nanosleep 240 -#define TARGET_FREEBSD_NR_ntp_gettime 248 -#define TARGET_FREEBSD_NR_minherit 250 -#define TARGET_FREEBSD_NR_rfork 251 -#define TARGET_FREEBSD_NR_openbsd_poll 252 -#define TARGET_FREEBSD_NR_issetugid 253 -#define TARGET_FREEBSD_NR_lchown 254 -#define TARGET_FREEBSD_NR_aio_read 255 -#define TARGET_FREEBSD_NR_aio_write 256 -#define TARGET_FREEBSD_NR_lio_listio 257 -#define TARGET_FREEBSD_NR_getdents 272 -#define TARGET_FREEBSD_NR_lchmod 274 -#define TARGET_FREEBSD_NR_netbsd_lchown 275 -#define TARGET_FREEBSD_NR_lutimes 276 -#define TARGET_FREEBSD_NR_netbsd_msync 277 -#define TARGET_FREEBSD_NR_nstat 278 -#define TARGET_FREEBSD_NR_nfstat 279 -#define TARGET_FREEBSD_NR_nlstat 280 -#define TARGET_FREEBSD_NR_preadv 289 -#define TARGET_FREEBSD_NR_pwritev 290 -#define TARGET_FREEBSD_NR_freebsd4_fhstatfs 297 -#define TARGET_FREEBSD_NR_fhopen 298 -#define TARGET_FREEBSD_NR_fhstat 299 -#define TARGET_FREEBSD_NR_modnext 300 -#define TARGET_FREEBSD_NR_modstat 301 -#define TARGET_FREEBSD_NR_modfnext 302 -#define TARGET_FREEBSD_NR_modfind 303 -#define TARGET_FREEBSD_NR_kldload 304 -#define TARGET_FREEBSD_NR_kldunload 305 -#define TARGET_FREEBSD_NR_kldfind 306 -#define TARGET_FREEBSD_NR_kldnext 307 -#define TARGET_FREEBSD_NR_kldstat 308 -#define TARGET_FREEBSD_NR_kldfirstmod 309 -#define TARGET_FREEBSD_NR_getsid 310 -#define TARGET_FREEBSD_NR_setresuid 311 -#define TARGET_FREEBSD_NR_setresgid 312 -#define TARGET_FREEBSD_NR_aio_return 314 -#define TARGET_FREEBSD_NR_aio_suspend 315 -#define TARGET_FREEBSD_NR_aio_cancel 316 -#define TARGET_FREEBSD_NR_aio_error 317 -#define TARGET_FREEBSD_NR_oaio_read 318 -#define TARGET_FREEBSD_NR_oaio_write 319 -#define TARGET_FREEBSD_NR_olio_listio 320 -#define TARGET_FREEBSD_NR_yield 321 -#define TARGET_FREEBSD_NR_mlockall 324 -#define TARGET_FREEBSD_NR_munlockall 325 -#define TARGET_FREEBSD_NR___getcwd 326 -#define TARGET_FREEBSD_NR_sched_setparam 327 -#define TARGET_FREEBSD_NR_sched_getparam 328 -#define TARGET_FREEBSD_NR_sched_setscheduler 329 -#define TARGET_FREEBSD_NR_sched_getscheduler 330 -#define TARGET_FREEBSD_NR_sched_yield 331 -#define TARGET_FREEBSD_NR_sched_get_priority_max 332 -#define TARGET_FREEBSD_NR_sched_get_priority_min 333 -#define TARGET_FREEBSD_NR_sched_rr_get_interval 334 -#define TARGET_FREEBSD_NR_utrace 335 -#define TARGET_FREEBSD_NR_freebsd4_sendfile 336 -#define TARGET_FREEBSD_NR_kldsym 337 -#define TARGET_FREEBSD_NR_jail 338 -#define TARGET_FREEBSD_NR_sigprocmask 340 -#define TARGET_FREEBSD_NR_sigsuspend 341 -#define TARGET_FREEBSD_NR_freebsd4_sigaction 342 -#define TARGET_FREEBSD_NR_sigpending 343 -#define TARGET_FREEBSD_NR_freebsd4_sigreturn 344 -#define TARGET_FREEBSD_NR_sigtimedwait 345 -#define TARGET_FREEBSD_NR_sigwaitinfo 346 -#define TARGET_FREEBSD_NR___acl_get_file 347 -#define TARGET_FREEBSD_NR___acl_set_file 348 -#define TARGET_FREEBSD_NR___acl_get_fd 349 -#define TARGET_FREEBSD_NR___acl_set_fd 350 -#define TARGET_FREEBSD_NR___acl_delete_file 351 -#define TARGET_FREEBSD_NR___acl_delete_fd 352 -#define TARGET_FREEBSD_NR___acl_aclcheck_file 353 -#define TARGET_FREEBSD_NR___acl_aclcheck_fd 354 -#define TARGET_FREEBSD_NR_extattrctl 355 -#define TARGET_FREEBSD_NR_extattr_set_file 356 -#define TARGET_FREEBSD_NR_extattr_get_file 357 -#define TARGET_FREEBSD_NR_extattr_delete_file 358 -#define TARGET_FREEBSD_NR_aio_waitcomplete 359 -#define TARGET_FREEBSD_NR_getresuid 360 -#define TARGET_FREEBSD_NR_getresgid 361 -#define TARGET_FREEBSD_NR_kqueue 362 -#define TARGET_FREEBSD_NR_kevent 363 -#define TARGET_FREEBSD_NR_extattr_set_fd 371 -#define TARGET_FREEBSD_NR_extattr_get_fd 372 -#define TARGET_FREEBSD_NR_extattr_delete_fd 373 -#define TARGET_FREEBSD_NR___setugid 374 -#define TARGET_FREEBSD_NR_nfsclnt 375 -#define TARGET_FREEBSD_NR_eaccess 376 -#define TARGET_FREEBSD_NR_nmount 378 -#define TARGET_FREEBSD_NR___mac_get_proc 384 -#define TARGET_FREEBSD_NR___mac_set_proc 385 -#define TARGET_FREEBSD_NR___mac_get_fd 386 -#define TARGET_FREEBSD_NR___mac_get_file 387 -#define TARGET_FREEBSD_NR___mac_set_fd 388 -#define TARGET_FREEBSD_NR___mac_set_file 389 -#define TARGET_FREEBSD_NR_kenv 390 -#define TARGET_FREEBSD_NR_lchflags 391 -#define TARGET_FREEBSD_NR_uuidgen 392 -#define TARGET_FREEBSD_NR_sendfile 393 -#define TARGET_FREEBSD_NR_mac_syscall 394 -#define TARGET_FREEBSD_NR_getfsstat 395 -#define TARGET_FREEBSD_NR_statfs 396 -#define TARGET_FREEBSD_NR_fstatfs 397 -#define TARGET_FREEBSD_NR_fhstatfs 398 -#define TARGET_FREEBSD_NR_ksem_close 400 -#define TARGET_FREEBSD_NR_ksem_post 401 -#define TARGET_FREEBSD_NR_ksem_wait 402 -#define TARGET_FREEBSD_NR_ksem_trywait 403 -#define TARGET_FREEBSD_NR_ksem_init 404 -#define TARGET_FREEBSD_NR_ksem_open 405 -#define TARGET_FREEBSD_NR_ksem_unlink 406 -#define TARGET_FREEBSD_NR_ksem_getvalue 407 -#define TARGET_FREEBSD_NR_ksem_destroy 408 -#define TARGET_FREEBSD_NR___mac_get_pid 409 -#define TARGET_FREEBSD_NR___mac_get_link 410 -#define TARGET_FREEBSD_NR___mac_set_link 411 -#define TARGET_FREEBSD_NR_extattr_set_link 412 -#define TARGET_FREEBSD_NR_extattr_get_link 413 -#define TARGET_FREEBSD_NR_extattr_delete_link 414 -#define TARGET_FREEBSD_NR___mac_execve 415 -#define TARGET_FREEBSD_NR_sigaction 416 -#define TARGET_FREEBSD_NR_sigreturn 417 -#define TARGET_FREEBSD_NR_getcontext 421 -#define TARGET_FREEBSD_NR_setcontext 422 -#define TARGET_FREEBSD_NR_swapcontext 423 -#define TARGET_FREEBSD_NR_swapoff 424 -#define TARGET_FREEBSD_NR___acl_get_link 425 -#define TARGET_FREEBSD_NR___acl_set_link 426 -#define TARGET_FREEBSD_NR___acl_delete_link 427 -#define TARGET_FREEBSD_NR___acl_aclcheck_link 428 -#define TARGET_FREEBSD_NR_sigwait 429 -#define TARGET_FREEBSD_NR_thr_create 430 -#define TARGET_FREEBSD_NR_thr_exit 431 -#define TARGET_FREEBSD_NR_thr_self 432 -#define TARGET_FREEBSD_NR_thr_kill 433 -#define TARGET_FREEBSD_NR__umtx_lock 434 -#define TARGET_FREEBSD_NR__umtx_unlock 435 -#define TARGET_FREEBSD_NR_jail_attach 436 -#define TARGET_FREEBSD_NR_extattr_list_fd 437 -#define TARGET_FREEBSD_NR_extattr_list_file 438 -#define TARGET_FREEBSD_NR_extattr_list_link 439 -#define TARGET_FREEBSD_NR_ksem_timedwait 441 -#define TARGET_FREEBSD_NR_thr_suspend 442 -#define TARGET_FREEBSD_NR_thr_wake 443 -#define TARGET_FREEBSD_NR_kldunloadf 444 -#define TARGET_FREEBSD_NR_audit 445 -#define TARGET_FREEBSD_NR_auditon 446 -#define TARGET_FREEBSD_NR_getauid 447 -#define TARGET_FREEBSD_NR_setauid 448 -#define TARGET_FREEBSD_NR_getaudit 449 -#define TARGET_FREEBSD_NR_setaudit 450 -#define TARGET_FREEBSD_NR_getaudit_addr 451 -#define TARGET_FREEBSD_NR_setaudit_addr 452 -#define TARGET_FREEBSD_NR_auditctl 453 -#define TARGET_FREEBSD_NR__umtx_op 454 -#define TARGET_FREEBSD_NR_thr_new 455 -#define TARGET_FREEBSD_NR_sigqueue 456 -#define TARGET_FREEBSD_NR_kmq_open 457 -#define TARGET_FREEBSD_NR_kmq_setattr 458 -#define TARGET_FREEBSD_NR_kmq_timedreceive 459 -#define TARGET_FREEBSD_NR_kmq_timedsend 460 -#define TARGET_FREEBSD_NR_kmq_notify 461 -#define TARGET_FREEBSD_NR_kmq_unlink 462 -#define TARGET_FREEBSD_NR_abort2 463 -#define TARGET_FREEBSD_NR_thr_set_name 464 -#define TARGET_FREEBSD_NR_aio_fsync 465 -#define TARGET_FREEBSD_NR_rtprio_thread 466 -#define TARGET_FREEBSD_NR_sctp_peeloff 471 -#define TARGET_FREEBSD_NR_sctp_generic_sendmsg 472 -#define TARGET_FREEBSD_NR_sctp_generic_sendmsg_iov 473 -#define TARGET_FREEBSD_NR_sctp_generic_recvmsg 474 -#define TARGET_FREEBSD_NR_pread 475 -#define TARGET_FREEBSD_NR_pwrite 476 -#define TARGET_FREEBSD_NR_mmap 477 -#define TARGET_FREEBSD_NR_lseek 478 -#define TARGET_FREEBSD_NR_truncate 479 -#define TARGET_FREEBSD_NR_ftruncate 480 -#define TARGET_FREEBSD_NR_thr_kill2 481 -#define TARGET_FREEBSD_NR_shm_open 482 -#define TARGET_FREEBSD_NR_shm_unlink 483 -#define TARGET_FREEBSD_NR_cpuset 484 -#define TARGET_FREEBSD_NR_cpuset_setid 485 -#define TARGET_FREEBSD_NR_cpuset_getid 486 -#define TARGET_FREEBSD_NR_cpuset_getaffinity 487 -#define TARGET_FREEBSD_NR_cpuset_setaffinity 488 -#define TARGET_FREEBSD_NR_faccessat 489 -#define TARGET_FREEBSD_NR_fchmodat 490 -#define TARGET_FREEBSD_NR_fchownat 491 -#define TARGET_FREEBSD_NR_fexecve 492 -#define TARGET_FREEBSD_NR_fstatat 493 -#define TARGET_FREEBSD_NR_futimesat 494 -#define TARGET_FREEBSD_NR_linkat 495 -#define TARGET_FREEBSD_NR_mkdirat 496 -#define TARGET_FREEBSD_NR_mkfifoat 497 -#define TARGET_FREEBSD_NR_mknodat 498 -#define TARGET_FREEBSD_NR_openat 499 -#define TARGET_FREEBSD_NR_readlinkat 500 -#define TARGET_FREEBSD_NR_renameat 501 -#define TARGET_FREEBSD_NR_symlinkat 502 -#define TARGET_FREEBSD_NR_unlinkat 503 -#define TARGET_FREEBSD_NR_posix_openpt 504 +#define TARGET_FREEBSD_NR_syscall 0 +#define TARGET_FREEBSD_NR_exit 1 +#define TARGET_FREEBSD_NR_fork 2 +#define TARGET_FREEBSD_NR_read 3 +#define TARGET_FREEBSD_NR_write 4 +#define TARGET_FREEBSD_NR_open 5 +#define TARGET_FREEBSD_NR_close 6 +#define TARGET_FREEBSD_NR_wait4 7 +/* 8 is old creat */ +#define TARGET_FREEBSD_NR_link 9 +#define TARGET_FREEBSD_NR_unlink 10 +/* 11 is obsolete execv */ +#define TARGET_FREEBSD_NR_chdir 12 +#define TARGET_FREEBSD_NR_fchdir 13 +#define TARGET_FREEBSD_NR_mknod 14 +#define TARGET_FREEBSD_NR_chmod 15 +#define TARGET_FREEBSD_NR_chown 16 +#define TARGET_FREEBSD_NR_break 17 +#define TARGET_FREEBSD_NR_freebsd4_getfsstat 18 +/* 19 is old lseek */ +#define TARGET_FREEBSD_NR_getpid 20 +#define TARGET_FREEBSD_NR_mount 21 +#define TARGET_FREEBSD_NR_unmount 22 +#define TARGET_FREEBSD_NR_setuid 23 +#define TARGET_FREEBSD_NR_getuid 24 +#define TARGET_FREEBSD_NR_geteuid 25 +#define TARGET_FREEBSD_NR_ptrace 26 +#define TARGET_FREEBSD_NR_recvmsg 27 +#define TARGET_FREEBSD_NR_sendmsg 28 +#define TARGET_FREEBSD_NR_recvfrom 29 +#define TARGET_FREEBSD_NR_accept 30 +#define TARGET_FREEBSD_NR_getpeername 31 +#define TARGET_FREEBSD_NR_getsockname 32 +#define TARGET_FREEBSD_NR_access 33 +#define TARGET_FREEBSD_NR_chflags 34 +#define TARGET_FREEBSD_NR_fchflags 35 +#define TARGET_FREEBSD_NR_sync 36 +#define TARGET_FREEBSD_NR_kill 37 +/* 38 is old stat */ +#define TARGET_FREEBSD_NR_getppid 39 +/* 40 is old lstat */ +#define TARGET_FREEBSD_NR_dup 41 +#define TARGET_FREEBSD_NR_pipe 42 +#define TARGET_FREEBSD_NR_getegid 43 +#define TARGET_FREEBSD_NR_profil 44 +#define TARGET_FREEBSD_NR_ktrace 45 +/* 46 is old sigaction */ +#define TARGET_FREEBSD_NR_getgid 47 +/* 48 is old sigprocmask */ +#define TARGET_FREEBSD_NR_getlogin 49 +#define TARGET_FREEBSD_NR_setlogin 50 +#define TARGET_FREEBSD_NR_acct 51 +/* 52 is old sigpending */ +#define TARGET_FREEBSD_NR_sigaltstack 53 +#define TARGET_FREEBSD_NR_ioctl 54 +#define TARGET_FREEBSD_NR_reboot 55 +#define TARGET_FREEBSD_NR_revoke 56 +#define TARGET_FREEBSD_NR_symlink 57 +#define TARGET_FREEBSD_NR_readlink 58 +#define TARGET_FREEBSD_NR_execve 59 +#define TARGET_FREEBSD_NR_umask 60 +#define TARGET_FREEBSD_NR_chroot 61 +/* 62 is old fstat */ +/* 63 is old getkerninfo */ +/* 64 is old getpagesize */ +#define TARGET_FREEBSD_NR_msync 65 +#define TARGET_FREEBSD_NR_vfork 66 +/* 67 is obsolete vread */ +/* 68 is obsolete vwrite */ +#define TARGET_FREEBSD_NR_sbrk 69 +#define TARGET_FREEBSD_NR_sstk 70 +/* 71 is old mmap */ +#define TARGET_FREEBSD_NR_vadvise 72 +#define TARGET_FREEBSD_NR_munmap 73 +#define TARGET_FREEBSD_NR_mprotect 74 +#define TARGET_FREEBSD_NR_madvise 75 +/* 76 is obsolete vhangup */ +/* 77 is obsolete vlimit */ +#define TARGET_FREEBSD_NR_mincore 78 +#define TARGET_FREEBSD_NR_getgroups 79 +#define TARGET_FREEBSD_NR_setgroups 80 +#define TARGET_FREEBSD_NR_getpgrp 81 +#define TARGET_FREEBSD_NR_setpgid 82 +#define TARGET_FREEBSD_NR_setitimer 83 +/* 84 is old wait */ +#define TARGET_FREEBSD_NR_swapon 85 +#define TARGET_FREEBSD_NR_getitimer 86 +/* 87 is old gethostname */ +/* 88 is old sethostname */ +#define TARGET_FREEBSD_NR_getdtablesize 89 +#define TARGET_FREEBSD_NR_dup2 90 +#define TARGET_FREEBSD_NR_fcntl 92 +#define TARGET_FREEBSD_NR_select 93 +#define TARGET_FREEBSD_NR_fsync 95 +#define TARGET_FREEBSD_NR_setpriority 96 +#define TARGET_FREEBSD_NR_socket 97 +#define TARGET_FREEBSD_NR_connect 98 +/* 99 is old accept */ +#define TARGET_FREEBSD_NR_getpriority 100 +/* 101 is old send */ +/* 102 is old recv */ +/* 103 is old sigreturn */ +#define TARGET_FREEBSD_NR_bind 104 +#define TARGET_FREEBSD_NR_setsockopt 105 +#define TARGET_FREEBSD_NR_listen 106 +/* 107 is obsolete vtimes */ +/* 108 is old sigvec */ +/* 109 is old sigblock */ +/* 110 is old sigsetmask */ +/* 111 is old sigsuspend */ +/* 112 is old sigstack */ +/* 113 is old recvmsg */ +/* 114 is old sendmsg */ +/* 115 is obsolete vtrace */ +#define TARGET_FREEBSD_NR_gettimeofday 116 +#define TARGET_FREEBSD_NR_getrusage 117 +#define TARGET_FREEBSD_NR_getsockopt 118 +#define TARGET_FREEBSD_NR_readv 120 +#define TARGET_FREEBSD_NR_writev 121 +#define TARGET_FREEBSD_NR_settimeofday 122 +#define TARGET_FREEBSD_NR_fchown 123 +#define TARGET_FREEBSD_NR_fchmod 124 +/* 125 is old recvfrom */ +#define TARGET_FREEBSD_NR_setreuid 126 +#define TARGET_FREEBSD_NR_setregid 127 +#define TARGET_FREEBSD_NR_rename 128 +/* 129 is old truncate */ +/* 130 is old ftruncate */ +#define TARGET_FREEBSD_NR_flock 131 +#define TARGET_FREEBSD_NR_mkfifo 132 +#define TARGET_FREEBSD_NR_sendto 133 +#define TARGET_FREEBSD_NR_shutdown 134 +#define TARGET_FREEBSD_NR_socketpair 135 +#define TARGET_FREEBSD_NR_mkdir 136 +#define TARGET_FREEBSD_NR_rmdir 137 +#define TARGET_FREEBSD_NR_utimes 138 +/* 139 is obsolete 4.2 sigreturn */ +#define TARGET_FREEBSD_NR_adjtime 140 +/* 141 is old getpeername */ +/* 142 is old gethostid */ +/* 143 is old sethostid */ +/* 144 is old getrlimit */ +/* 145 is old setrlimit */ +/* 146 is old killpg */ +#define TARGET_FREEBSD_NR_killpg 146/* COMPAT */ +#define TARGET_FREEBSD_NR_setsid 147 +#define TARGET_FREEBSD_NR_quotactl 148 +/* 149 is old quota */ +/* 150 is old getsockname */ +#define TARGET_FREEBSD_NR_nlm_syscall 154 +#define TARGET_FREEBSD_NR_nfssvc 155 +/* 156 is old getdirentries */ +#define TARGET_FREEBSD_NR_freebsd4_statfs 157 +#define TARGET_FREEBSD_NR_freebsd4_fstatfs 158 +#define TARGET_FREEBSD_NR_lgetfh 160 +#define TARGET_FREEBSD_NR_getfh 161 +#define TARGET_FREEBSD_NR_freebsd4_getdomainname 162 +#define TARGET_FREEBSD_NR_freebsd4_setdomainname 163 +#define TARGET_FREEBSD_NR_freebsd4_uname 164 +#define TARGET_FREEBSD_NR_sysarch 165 +#define TARGET_FREEBSD_NR_rtprio 166 +#define TARGET_FREEBSD_NR_semsys 169 +#define TARGET_FREEBSD_NR_msgsys 170 +#define TARGET_FREEBSD_NR_shmsys 171 +#define TARGET_FREEBSD_NR_freebsd6_pread 173 +#define TARGET_FREEBSD_NR_freebsd6_pwrite 174 +#define TARGET_FREEBSD_NR_setfib 175 +#define TARGET_FREEBSD_NR_ntp_adjtime 176 +#define TARGET_FREEBSD_NR_setgid 181 +#define TARGET_FREEBSD_NR_setegid 182 +#define TARGET_FREEBSD_NR_seteuid 183 +#define TARGET_FREEBSD_NR_stat 188 +#define TARGET_FREEBSD_NR_fstat 189 +#define TARGET_FREEBSD_NR_lstat 190 +#define TARGET_FREEBSD_NR_pathconf 191 +#define TARGET_FREEBSD_NR_fpathconf 192 +#define TARGET_FREEBSD_NR_getrlimit 194 +#define TARGET_FREEBSD_NR_setrlimit 195 +#define TARGET_FREEBSD_NR_getdirentries 196 +#define TARGET_FREEBSD_NR_freebsd6_mmap 197 +#define TARGET_FREEBSD_NR___syscall 198 +#define TARGET_FREEBSD_NR_freebsd6_lseek 199 +#define TARGET_FREEBSD_NR_freebsd6_truncate 200 +#define TARGET_FREEBSD_NR_freebsd6_ftruncate 201 +#define TARGET_FREEBSD_NR___sysctl 202 +#define TARGET_FREEBSD_NR_mlock 203 +#define TARGET_FREEBSD_NR_munlock 204 +#define TARGET_FREEBSD_NR_undelete 205 +#define TARGET_FREEBSD_NR_futimes 206 +#define TARGET_FREEBSD_NR_getpgid 207 +#define TARGET_FREEBSD_NR_poll 209 +#define TARGET_FREEBSD_NR_freebsd7___semctl 220 +#define TARGET_FREEBSD_NR_semget 221 +#define TARGET_FREEBSD_NR_semop 222 +#define TARGET_FREEBSD_NR_freebsd7_msgctl 224 +#define TARGET_FREEBSD_NR_msgget 225 +#define TARGET_FREEBSD_NR_msgsnd 226 +#define TARGET_FREEBSD_NR_msgrcv 227 +#define TARGET_FREEBSD_NR_shmat 228 +#define TARGET_FREEBSD_NR_freebsd7_shmctl 229 +#define TARGET_FREEBSD_NR_shmdt 230 +#define TARGET_FREEBSD_NR_shmget 231 +#define TARGET_FREEBSD_NR_clock_gettime 232 +#define TARGET_FREEBSD_NR_clock_settime 233 +#define TARGET_FREEBSD_NR_clock_getres 234 +#define TARGET_FREEBSD_NR_ktimer_create 235 +#define TARGET_FREEBSD_NR_ktimer_delete 236 +#define TARGET_FREEBSD_NR_ktimer_settime 237 +#define TARGET_FREEBSD_NR_ktimer_gettime 238 +#define TARGET_FREEBSD_NR_ktimer_getoverrun 239 +#define TARGET_FREEBSD_NR_nanosleep 240 +#define TARGET_FREEBSD_NR_ntp_gettime 248 +#define TARGET_FREEBSD_NR_minherit 250 +#define TARGET_FREEBSD_NR_rfork 251 +#define TARGET_FREEBSD_NR_openbsd_poll 252 +#define TARGET_FREEBSD_NR_issetugid 253 +#define TARGET_FREEBSD_NR_lchown 254 +#define TARGET_FREEBSD_NR_aio_read 255 +#define TARGET_FREEBSD_NR_aio_write 256 +#define TARGET_FREEBSD_NR_lio_listio 257 +#define TARGET_FREEBSD_NR_getdents 272 +#define TARGET_FREEBSD_NR_lchmod 274 +#define TARGET_FREEBSD_NR_netbsd_lchown 275 +#define TARGET_FREEBSD_NR_lutimes 276 +#define TARGET_FREEBSD_NR_netbsd_msync 277 +#define TARGET_FREEBSD_NR_nstat 278 +#define TARGET_FREEBSD_NR_nfstat 279 +#define TARGET_FREEBSD_NR_nlstat 280 +#define TARGET_FREEBSD_NR_preadv 289 +#define TARGET_FREEBSD_NR_pwritev 290 +#define TARGET_FREEBSD_NR_freebsd4_fhstatfs 297 +#define TARGET_FREEBSD_NR_fhopen 298 +#define TARGET_FREEBSD_NR_fhstat 299 +#define TARGET_FREEBSD_NR_modnext 300 +#define TARGET_FREEBSD_NR_modstat 301 +#define TARGET_FREEBSD_NR_modfnext 302 +#define TARGET_FREEBSD_NR_modfind 303 +#define TARGET_FREEBSD_NR_kldload 304 +#define TARGET_FREEBSD_NR_kldunload 305 +#define TARGET_FREEBSD_NR_kldfind 306 +#define TARGET_FREEBSD_NR_kldnext 307 +#define TARGET_FREEBSD_NR_kldstat 308 +#define TARGET_FREEBSD_NR_kldfirstmod 309 +#define TARGET_FREEBSD_NR_getsid 310 +#define TARGET_FREEBSD_NR_setresuid 311 +#define TARGET_FREEBSD_NR_setresgid 312 +/* 313 is obsolete signanosleep */ +#define TARGET_FREEBSD_NR_aio_return 314 +#define TARGET_FREEBSD_NR_aio_suspend 315 +#define TARGET_FREEBSD_NR_aio_cancel 316 +#define TARGET_FREEBSD_NR_aio_error 317 +#define TARGET_FREEBSD_NR_oaio_read 318 +#define TARGET_FREEBSD_NR_oaio_write 319 +#define TARGET_FREEBSD_NR_olio_listio 320 +#define TARGET_FREEBSD_NR_yield 321 +/* 322 is obsolete thr_sleep */ +/* 323 is obsolete thr_wakeup */ +#define TARGET_FREEBSD_NR_mlockall 324 +#define TARGET_FREEBSD_NR_munlockall 325 +#define TARGET_FREEBSD_NR___getcwd 326 +#define TARGET_FREEBSD_NR_sched_setparam 327 +#define TARGET_FREEBSD_NR_sched_getparam 328 +#define TARGET_FREEBSD_NR_sched_setscheduler 329 +#define TARGET_FREEBSD_NR_sched_getscheduler 330 +#define TARGET_FREEBSD_NR_sched_yield 331 +#define TARGET_FREEBSD_NR_sched_get_priority_max 332 +#define TARGET_FREEBSD_NR_sched_get_priority_min 333 +#define TARGET_FREEBSD_NR_sched_rr_get_interval 334 +#define TARGET_FREEBSD_NR_utrace 335 +#define TARGET_FREEBSD_NR_freebsd4_sendfile 336 +#define TARGET_FREEBSD_NR_kldsym 337 +#define TARGET_FREEBSD_NR_jail 338 +#define TARGET_FREEBSD_NR_nnpfs_syscall 339 +#define TARGET_FREEBSD_NR_sigprocmask 340 +#define TARGET_FREEBSD_NR_sigsuspend 341 +#define TARGET_FREEBSD_NR_freebsd4_sigaction 342 +#define TARGET_FREEBSD_NR_sigpending 343 +#define TARGET_FREEBSD_NR_freebsd4_sigreturn 344 +#define TARGET_FREEBSD_NR_sigtimedwait 345 +#define TARGET_FREEBSD_NR_sigwaitinfo 346 +#define TARGET_FREEBSD_NR___acl_get_file 347 +#define TARGET_FREEBSD_NR___acl_set_file 348 +#define TARGET_FREEBSD_NR___acl_get_fd 349 +#define TARGET_FREEBSD_NR___acl_set_fd 350 +#define TARGET_FREEBSD_NR___acl_delete_file 351 +#define TARGET_FREEBSD_NR___acl_delete_fd 352 +#define TARGET_FREEBSD_NR___acl_aclcheck_file 353 +#define TARGET_FREEBSD_NR___acl_aclcheck_fd 354 +#define TARGET_FREEBSD_NR_extattrctl 355 +#define TARGET_FREEBSD_NR_extattr_set_file 356 +#define TARGET_FREEBSD_NR_extattr_get_file 357 +#define TARGET_FREEBSD_NR_extattr_delete_file 358 +#define TARGET_FREEBSD_NR_aio_waitcomplete 359 +#define TARGET_FREEBSD_NR_getresuid 360 +#define TARGET_FREEBSD_NR_getresgid 361 +#define TARGET_FREEBSD_NR_kqueue 362 +#define TARGET_FREEBSD_NR_kevent 363 +#define TARGET_FREEBSD_NR_extattr_set_fd 371 +#define TARGET_FREEBSD_NR_extattr_get_fd 372 +#define TARGET_FREEBSD_NR_extattr_delete_fd 373 +#define TARGET_FREEBSD_NR___setugid 374 +#define TARGET_FREEBSD_NR_eaccess 376 +#define TARGET_FREEBSD_NR_afs3_syscall 377 +#define TARGET_FREEBSD_NR_nmount 378 +#define TARGET_FREEBSD_NR___mac_get_proc 384 +#define TARGET_FREEBSD_NR___mac_set_proc 385 +#define TARGET_FREEBSD_NR___mac_get_fd 386 +#define TARGET_FREEBSD_NR___mac_get_file 387 +#define TARGET_FREEBSD_NR___mac_set_fd 388 +#define TARGET_FREEBSD_NR___mac_set_file 389 +#define TARGET_FREEBSD_NR_kenv 390 +#define TARGET_FREEBSD_NR_lchflags 391 +#define TARGET_FREEBSD_NR_uuidgen 392 +#define TARGET_FREEBSD_NR_sendfile 393 +#define TARGET_FREEBSD_NR_mac_syscall 394 +#define TARGET_FREEBSD_NR_getfsstat 395 +#define TARGET_FREEBSD_NR_statfs 396 +#define TARGET_FREEBSD_NR_fstatfs 397 +#define TARGET_FREEBSD_NR_fhstatfs 398 +#define TARGET_FREEBSD_NR_ksem_close 400 +#define TARGET_FREEBSD_NR_ksem_post 401 +#define TARGET_FREEBSD_NR_ksem_wait 402 +#define TARGET_FREEBSD_NR_ksem_trywait 403 +#define TARGET_FREEBSD_NR_ksem_init 404 +#define TARGET_FREEBSD_NR_ksem_open 405 +#define TARGET_FREEBSD_NR_ksem_unlink 406 +#define TARGET_FREEBSD_NR_ksem_getvalue 407 +#define TARGET_FREEBSD_NR_ksem_destroy 408 +#define TARGET_FREEBSD_NR___mac_get_pid 409 +#define TARGET_FREEBSD_NR___mac_get_link 410 +#define TARGET_FREEBSD_NR___mac_set_link 411 +#define TARGET_FREEBSD_NR_extattr_set_link 412 +#define TARGET_FREEBSD_NR_extattr_get_link 413 +#define TARGET_FREEBSD_NR_extattr_delete_link 414 +#define TARGET_FREEBSD_NR___mac_execve 415 +#define TARGET_FREEBSD_NR_sigaction 416 +#define TARGET_FREEBSD_NR_sigreturn 417 +#define TARGET_FREEBSD_NR_getcontext 421 +#define TARGET_FREEBSD_NR_setcontext 422 +#define TARGET_FREEBSD_NR_swapcontext 423 +#define TARGET_FREEBSD_NR_swapoff 424 +#define TARGET_FREEBSD_NR___acl_get_link 425 +#define TARGET_FREEBSD_NR___acl_set_link 426 +#define TARGET_FREEBSD_NR___acl_delete_link 427 +#define TARGET_FREEBSD_NR___acl_aclcheck_link 428 +#define TARGET_FREEBSD_NR_sigwait 429 +#define TARGET_FREEBSD_NR_thr_create 430 +#define TARGET_FREEBSD_NR_thr_exit 431 +#define TARGET_FREEBSD_NR_thr_self 432 +#define TARGET_FREEBSD_NR_thr_kill 433 +#define TARGET_FREEBSD_NR__umtx_lock 434 +#define TARGET_FREEBSD_NR__umtx_unlock 435 +#define TARGET_FREEBSD_NR_jail_attach 436 +#define TARGET_FREEBSD_NR_extattr_list_fd 437 +#define TARGET_FREEBSD_NR_extattr_list_file 438 +#define TARGET_FREEBSD_NR_extattr_list_link 439 +#define TARGET_FREEBSD_NR_ksem_timedwait 441 +#define TARGET_FREEBSD_NR_thr_suspend 442 +#define TARGET_FREEBSD_NR_thr_wake 443 +#define TARGET_FREEBSD_NR_kldunloadf 444 +#define TARGET_FREEBSD_NR_audit 445 +#define TARGET_FREEBSD_NR_auditon 446 +#define TARGET_FREEBSD_NR_getauid 447 +#define TARGET_FREEBSD_NR_setauid 448 +#define TARGET_FREEBSD_NR_getaudit 449 +#define TARGET_FREEBSD_NR_setaudit 450 +#define TARGET_FREEBSD_NR_getaudit_addr 451 +#define TARGET_FREEBSD_NR_setaudit_addr 452 +#define TARGET_FREEBSD_NR_auditctl 453 +#define TARGET_FREEBSD_NR__umtx_op 454 +#define TARGET_FREEBSD_NR_thr_new 455 +#define TARGET_FREEBSD_NR_sigqueue 456 +#define TARGET_FREEBSD_NR_kmq_open 457 +#define TARGET_FREEBSD_NR_kmq_setattr 458 +#define TARGET_FREEBSD_NR_kmq_timedreceive 459 +#define TARGET_FREEBSD_NR_kmq_timedsend 460 +#define TARGET_FREEBSD_NR_kmq_notify 461 +#define TARGET_FREEBSD_NR_kmq_unlink 462 +#define TARGET_FREEBSD_NR_abort2 463 +#define TARGET_FREEBSD_NR_thr_set_name 464 +#define TARGET_FREEBSD_NR_aio_fsync 465 +#define TARGET_FREEBSD_NR_rtprio_thread 466 +#define TARGET_FREEBSD_NR_sctp_peeloff 471 +#define TARGET_FREEBSD_NR_sctp_generic_sendmsg 472 +#define TARGET_FREEBSD_NR_sctp_generic_sendmsg_iov 473 +#define TARGET_FREEBSD_NR_sctp_generic_recvmsg 474 +#define TARGET_FREEBSD_NR_pread 475 +#define TARGET_FREEBSD_NR_pwrite 476 +#define TARGET_FREEBSD_NR_mmap 477 +#define TARGET_FREEBSD_NR_lseek 478 +#define TARGET_FREEBSD_NR_truncate 479 +#define TARGET_FREEBSD_NR_ftruncate 480 +#define TARGET_FREEBSD_NR_thr_kill2 481 +#define TARGET_FREEBSD_NR_shm_open 482 +#define TARGET_FREEBSD_NR_shm_unlink 483 +#define TARGET_FREEBSD_NR_cpuset 484 +#define TARGET_FREEBSD_NR_cpuset_setid 485 +#define TARGET_FREEBSD_NR_cpuset_getid 486 +#define TARGET_FREEBSD_NR_cpuset_getaffinity 487 +#define TARGET_FREEBSD_NR_cpuset_setaffinity 488 +#define TARGET_FREEBSD_NR_faccessat 489 +#define TARGET_FREEBSD_NR_fchmodat 490 +#define TARGET_FREEBSD_NR_fchownat 491 +#define TARGET_FREEBSD_NR_fexecve 492 +#define TARGET_FREEBSD_NR_fstatat 493 +#define TARGET_FREEBSD_NR_futimesat 494 +#define TARGET_FREEBSD_NR_linkat 495 +#define TARGET_FREEBSD_NR_mkdirat 496 +#define TARGET_FREEBSD_NR_mkfifoat 497 +#define TARGET_FREEBSD_NR_mknodat 498 +#define TARGET_FREEBSD_NR_openat 499 +#define TARGET_FREEBSD_NR_readlinkat 500 +#define TARGET_FREEBSD_NR_renameat 501 +#define TARGET_FREEBSD_NR_symlinkat 502 +#define TARGET_FREEBSD_NR_unlinkat 503 +#define TARGET_FREEBSD_NR_posix_openpt 504 +#define TARGET_FREEBSD_NR_gssd_syscall 505 +#define TARGET_FREEBSD_NR_jail_get 506 +#define TARGET_FREEBSD_NR_jail_set 507 +#define TARGET_FREEBSD_NR_jail_remove 508 +#define TARGET_FREEBSD_NR_closefrom 509 +#define TARGET_FREEBSD_NR___semctl 510 +#define TARGET_FREEBSD_NR_msgctl 511 +#define TARGET_FREEBSD_NR_shmctl 512 +#define TARGET_FREEBSD_NR_lpathconf 513 +#define TARGET_FREEBSD_NR_cap_new 514 +#define TARGET_FREEBSD_NR_cap_getrights 515 +#define TARGET_FREEBSD_NR_cap_enter 516 +#define TARGET_FREEBSD_NR_cap_getmode 517 +#define TARGET_FREEBSD_NR_pdfork 518 +#define TARGET_FREEBSD_NR_pdkill 519 +#define TARGET_FREEBSD_NR_pdgetpid 520 +#define TARGET_FREEBSD_NR_pselect 522 +#define TARGET_FREEBSD_NR_getloginclass 523 +#define TARGET_FREEBSD_NR_setloginclass 524 +#define TARGET_FREEBSD_NR_rctl_get_racct 525 +#define TARGET_FREEBSD_NR_rctl_get_rules 526 +#define TARGET_FREEBSD_NR_rctl_get_limits 527 +#define TARGET_FREEBSD_NR_rctl_add_rule 528 +#define TARGET_FREEBSD_NR_rctl_remove_rule 529 +#define TARGET_FREEBSD_NR_posix_fallocate 530 +#define TARGET_FREEBSD_NR_posix_fadvise 531 +#define TARGET_FREEBSD_NR_MAXSYSCALL 532
Signature · 1 line
1.7.8
PATCH v2 2/19 bsd-user: add HOST_ABI_DIR for the various *BSD dependent code.
In reply to Stacey SonThis change adds HOST_ABI_DIR (similar to TARGET_ABI_DIR) so the various BSD OS dependent code can be seperated into its own directories rather than using #ifdef's.
--- Makefile.target | 3 ++- configure | 11 +++++++++++ 2 files changed, 13 insertions(+), 1 deletions(-)
Makefile.target +2 -1
@@ -99,7 +99,8 @@ endif #CONFIG_LINUX_USER ifdef CONFIG_BSD_USER -QEMU_CFLAGS+=-I$(SRC_PATH)/bsd-user -I$(SRC_PATH)/bsd-user/$(TARGET_ABI_DIR) +QEMU_CFLAGS+=-I$(SRC_PATH)/bsd-user -I$(SRC_PATH)/bsd-user/$(TARGET_ABI_DIR) \ + -I$(SRC_PATH)/bsd-user/$(HOST_ABI_DIR) obj-y += bsd-user/ obj-y += gdbstub.o user-exec.o
configure +11 -0
@@ -449,6 +449,9 @@ fi # OS specific +# host *BSD for user mode +HOST_ABI_DIR="" + case $targetos in CYGWIN*) mingw32="yes"
@@ -473,12 +476,14 @@ FreeBSD) audio_possible_drivers="oss sdl esd pa" # needed for kinfo_getvmmap(3) in libutil.h LIBS="-lutil $LIBS" + HOST_ABI_DIR="freebsd" ;; DragonFly) bsd="yes" make="${MAKE-gmake}" audio_drv_list="oss" audio_possible_drivers="oss sdl esd pa" + HOST_ABI_DIR="dragonfly" ;; NetBSD) bsd="yes"
@@ -486,12 +491,14 @@ NetBSD) audio_drv_list="oss" audio_possible_drivers="oss sdl esd" oss_lib="-lossaudio" + HOST_ABI_DIR="netbsd" ;; OpenBSD) bsd="yes" make="${MAKE-gmake}" audio_drv_list="sdl" audio_possible_drivers="sdl esd" + HOST_ABI_DIR="openbsd" ;; Darwin) bsd="yes"
@@ -510,6 +517,7 @@ Darwin) # Disable attempts to use ObjectiveC features in os/object.h since they # won't work when we're compiling with gcc as a C compiler. QEMU_CFLAGS="-DOS_OBJECT_USE_OBJC=0 $QEMU_CFLAGS" + HOST_ABI_DIR="darwin" ;; SunOS) solaris="yes"
@@ -4471,6 +4479,9 @@ if [ "$TARGET_ABI_DIR" = "" ]; then TARGET_ABI_DIR=$TARGET_ARCH fi echo "TARGET_ABI_DIR=$TARGET_ABI_DIR" >> $config_target_mak +if [ "$HOST_ABI_DIR" != "" ]; then + echo "HOST_ABI_DIR=$HOST_ABI_DIR" >> $config_target_mak +fi case "$target_name" in i386|x86_64) if test "$xen" = "yes" -a "$target_softmmu" = "yes" ; then
Signature · 1 line
1.7.8
Re: [Qemu-devel] [PATCH v2 02/19] bsd-user: add HOST_ABI_DIR for the various *BSD dependent code.
Il 08/11/2013 17:33, Stacey Son ha scritto:
Quoted 3 lines
This change adds
HOST_ABI_DIR(similar toTARGET_ABI_DIR) so the various BSD OS dependent code can be seperated into its own directories rather than using #ifdef's.
I would say this is not exactly an ABI, so it would be better to call it HOST_VARIANT_DIR.
Also, is it really host-dependent? If you had hypothetically a qemu that ran OpenBSD targets on FreeBSD, would it use bsd-user/freebsd or bsd-user/openbsd?
So, this should be either HOST_VARIANT_DIR or TARGET_VARIANT_DIR, depending on the answer to the above question.
Apart from this, the patch looks good.
Paolo
Quoted 83 lines
Signed-off-by Stacey Son <[email protected]>--- Makefile.target | 3 ++- configure | 11 +++++++++++ 2 files changed, 13 insertions(+), 1 deletions(-)Makefile.target +2
-1@@ -99,7 +99,8 @@ endif #CONFIG_LINUX_USER ifdef CONFIG_BSD_USER -QEMU_CFLAGS+=-I$(SRC_PATH)/bsd-user -I$(SRC_PATH)/bsd-user/$(TARGET_ABI_DIR) +QEMU_CFLAGS+=-I$(SRC_PATH)/bsd-user -I$(SRC_PATH)/bsd-user/$(TARGET_ABI_DIR) \ + -I$(SRC_PATH)/bsd-user/$(HOST_ABI_DIR) obj-y += bsd-user/ obj-y += gdbstub.o user-exec.oconfigure +11
-0@@ -449,6 +449,9 @@ fi # OS specific +# host *BSD for user mode +HOST_ABI_DIR="" + case $targetos in CYGWIN*) mingw32="yes"@@ -473,12 +476,14 @@ FreeBSD) audio_possible_drivers="oss sdl esd pa" # needed for kinfo_getvmmap(3) in libutil.h LIBS="-lutil $LIBS" + HOST_ABI_DIR="freebsd" ;; DragonFly) bsd="yes" make="${MAKE-gmake}" audio_drv_list="oss" audio_possible_drivers="oss sdl esd pa" + HOST_ABI_DIR="dragonfly" ;; NetBSD) bsd="yes"@@ -486,12 +491,14 @@ NetBSD) audio_drv_list="oss" audio_possible_drivers="oss sdl esd" oss_lib="-lossaudio" + HOST_ABI_DIR="netbsd" ;; OpenBSD) bsd="yes" make="${MAKE-gmake}" audio_drv_list="sdl" audio_possible_drivers="sdl esd" + HOST_ABI_DIR="openbsd" ;; Darwin) bsd="yes"@@ -510,6 +517,7 @@ Darwin) # Disable attempts to use ObjectiveC features in os/object.h since they # won't work when we're compiling with gcc as a C compiler. QEMU_CFLAGS="-DOS_OBJECT_USE_OBJC=0 $QEMU_CFLAGS" + HOST_ABI_DIR="darwin" ;; SunOS) solaris="yes"@@ -4471,6 +4479,9 @@ if [ "$TARGET_ABI_DIR" = "" ]; then TARGET_ABI_DIR=$TARGET_ARCH fi echo "TARGET_ABI_DIR=$TARGET_ABI_DIR" >> $config_target_mak +if [ "$HOST_ABI_DIR" != "" ]; then + echo "HOST_ABI_DIR=$HOST_ABI_DIR" >> $config_target_mak +fi case "$target_name" in i386|x86_64) if test "$xen" = "yes" -a "$target_softmmu" = "yes" ; then
PATCH v2 3/19 bsd-user: move OS/arch dependent code for strace into separate directories
In reply to Stacey SonThis change moves host OS and arch dependent code for the sysarch system call related to the -strace functionality into the appropriate HOST_ABI_DIR and TARGET_ABI_DIR directories.
--- bsd-user/arm/syscall.h | 36 +++++++ bsd-user/arm/target_arch_sysarch.h | 78 ++++++++++++++ bsd-user/freebsd/os-strace.h | 29 +++++ bsd-user/freebsd/strace.list | 76 +++++++++++++-- bsd-user/i386/syscall.h | 23 ++++ bsd-user/i386/target_arch_sysarch.h | 78 ++++++++++++++ bsd-user/mips/syscall.h | 52 ++++++++++ bsd-user/mips/target_arch_sysarch.h | 69 +++++++++++++ bsd-user/mips64/syscall.h | 53 ++++++++++ bsd-user/mips64/target_arch_sysarch.h | 69 +++++++++++++ bsd-user/netbsd/os-strace.h | 1 + bsd-user/openbsd/os-strace.h | 1 + bsd-user/qemu.h | 26 +++++ bsd-user/sparc/syscall.h | 29 +++++- bsd-user/sparc/target_arch_sysarch.h | 52 ++++++++++ bsd-user/sparc64/syscall.h | 28 +++++- bsd-user/sparc64/target_arch_sysarch.h | 52 ++++++++++ bsd-user/strace.c | 175 +++++++++++++++++++++---------- bsd-user/x86_64/syscall.h | 26 +++++- bsd-user/x86_64/target_arch_sysarch.h | 76 ++++++++++++++ 20 files changed, 962 insertions(+), 67 deletions(-) create mode 100644 bsd-user/arm/syscall.h create mode 100644 bsd-user/arm/target_arch_sysarch.h create mode 100644 bsd-user/freebsd/os-strace.h create mode 100644 bsd-user/i386/target_arch_sysarch.h create mode 100644 bsd-user/mips/syscall.h create mode 100644 bsd-user/mips/target_arch_sysarch.h create mode 100644 bsd-user/mips64/syscall.h create mode 100644 bsd-user/mips64/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/arm/syscall.h new file +36 -0
@@ -0,0 +1,36 @@ +#ifndef __ARCH_SYSCALL_H_ +#define __ARCH_SYSCALL_H_ + +struct target_pt_regs { +abi_long uregs[17 ]; +}; + +#define ARM_cpsr uregs[16] +#define ARM_pc uregs[15] +#define ARM_lr uregs[14] +#define ARM_sp uregs[13] +#define ARM_ip uregs[12] +#define ARM_fp uregs[11] +#define ARM_r10 uregs[10] +#define ARM_r9 uregs[9] +#define ARM_r8 uregs[8] +#define ARM_r7 uregs[7] +#define ARM_r6 uregs[6] +#define ARM_r5 uregs[5] +#define ARM_r4 uregs[4] +#define ARM_r3 uregs[3] +#define ARM_r2 uregs[2] +#define ARM_r1 uregs[1] +#define ARM_r0 uregs[0] + +#define ARM_SYSCALL_BASE 0/* XXX: FreeBSD only */ + +#define TARGET_FREEBSD_ARM_SYNC_ICACHE 0 +#define TARGET_FREEBSD_ARM_DRAIN_WRITEBUF 1 +#define TARGET_FREEBSD_ARM_SET_TP 2 +#define TARGET_FREEBSD_ARM_GET_TP 3 + +#define TARGET_HW_MACHINE "arm" +#define TARGET_HW_MACHINE_ARCH "armv6" + +#endif /* !__ARCH_SYSCALL_H_ */
bsd-user/arm/target_arch_sysarch.h new file +78 -0
78 lines not on this page · raw message
bsd-user/freebsd/os-strace.h new file +29 -0
@@ -0,0 +1,29 @@ +/* +* 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); +}
bsd-user/freebsd/strace.list +69 -7
147 lines not on this page · raw message
bsd-user/i386/syscall.h +23 -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)
@@ -158,4 +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_sysarch.h new file +78 -0
78 lines not on this page · raw message
bsd-user/mips/syscall.h new file +52 -0
52 lines not on this page · raw message
bsd-user/mips/target_arch_sysarch.h new file +69 -0
69 lines not on this page · raw message
bsd-user/mips64/syscall.h new file +53 -0
53 lines not on this page · raw message
bsd-user/mips64/target_arch_sysarch.h new file +69 -0
69 lines not on this page · raw message
bsd-user/netbsd/os-strace.h new file +1 -0
@@ -0,0 +1 @@ +/* XXX NetBSD dependent strace print functions */
bsd-user/openbsd/os-strace.h new file +1 -0
@@ -0,0 +1 @@ +/* XXX OpenBSD dependent strace print functions */
bsd-user/qemu.h +26 -0
@@ -1,3 +1,19 @@ +/* +* qemu bsd user mode definition +* +* 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 QEMU_H #define QEMU_H
@@ -149,6 +165,16 @@ void fork_end(int child);#include "qemu/log.h" /* strace.c */ +struct syscallname { +int nr; +const char *name; +const char *format; +void (*call)(const struct syscallname *, +abi_long ,abi_long ,abi_long , +abi_long ,abi_long ,abi_long ); +void (*result)(const struct syscallname *,abi_long ); +}; + void print_freebsd_syscall(int num, abi_long arg1, abi_long arg2, abi_long arg3,
bsd-user/sparc/syscall.h +28 -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,11 @@ struct target_pt_regs { abi_ulong u_regs[16]; }; -#define UNAME_MACHINE "sun4" +#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 + +#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 +27 -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,11 @@ struct target_pt_regs { abi_ulong fprs; }; -#define UNAME_MACHINE "sun4u" +#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 + +#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 +118 -57
282 lines not on this page · raw message
bsd-user/x86_64/syscall.h +25 -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,13 @@ struct target_msqid64_ds {#define TARGET_FREEBSD_AMD64_SET_GSBASE 131 -#define UNAME_MACHINE "x86_64" +#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#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
1.7.8
PATCH v2 4/19 bsd-user: move target arch and host OS dependent code out of main.c
In reply to Stacey SonThis 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/arm/target_arch.h | 10 + bsd-user/arm/target_arch_cpu.c | 27 + bsd-user/arm/target_arch_cpu.h | 375 +++++++++++++ bsd-user/arm/target_arch_vmparam.h | 51 ++ 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 | 302 +++++++++++ bsd-user/i386/target_arch_vmparam.h | 28 + bsd-user/i386/target_signal.h | 6 - bsd-user/main.c | 926 +++++++------------------------- bsd-user/mips/target_arch.h | 10 + bsd-user/mips/target_arch_cpu.c | 27 + bsd-user/mips/target_arch_cpu.h | 257 +++++++++ bsd-user/mips/target_arch_vmparam.h | 50 ++ bsd-user/mips64/target_arch.h | 10 + bsd-user/mips64/target_arch_cpu.c | 27 + bsd-user/mips64/target_arch_cpu.h | 243 +++++++++ bsd-user/mips64/target_arch_vmparam.h | 47 ++ bsd-user/netbsd/host_os.h | 31 ++ bsd-user/openbsd/host_os.h | 31 ++ bsd-user/qemu.h | 10 +- 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 | 324 +++++++++++ bsd-user/x86_64/target_arch_vmparam.h | 28 + bsd-user/x86_64/target_signal.h | 5 - 40 files changed, 3004 insertions(+), 764 deletions(-) create mode 100644 bsd-user/arm/target_arch.h create mode 100644 bsd-user/arm/target_arch_cpu.c create mode 100644 bsd-user/arm/target_arch_cpu.h create mode 100644 bsd-user/arm/target_arch_vmparam.h 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/mips/target_arch.h create mode 100644 bsd-user/mips/target_arch_cpu.c create mode 100644 bsd-user/mips/target_arch_cpu.h create mode 100644 bsd-user/mips/target_arch_vmparam.h create mode 100644 bsd-user/mips64/target_arch.h create mode 100644 bsd-user/mips64/target_arch_cpu.c create mode 100644 bsd-user/mips64/target_arch_cpu.h create mode 100644 bsd-user/mips64/target_arch_vmparam.h create mode 100644 bsd-user/netbsd/host_os.h create mode 100644 bsd-user/openbsd/host_os.h create mode 100644 bsd-user/sparc/target_arch.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/arm/target_arch.h new file +10 -0
@@ -0,0 +1,10 @@ + +#ifndef _TARGET_ARCH_H_ +#define _TARGET_ARCH_H_ + +#include "qemu.h" + +void target_cpu_set_tls (CPUARMState *env,target_ulong newtls); +target_ulong target_cpu_get_tls (CPUARMState *env); + +#endif /* !_TARGET_ARCH_H_ */
bsd-user/arm/target_arch_cpu.c new file +27 -0
@@ -0,0 +1,27 @@ +/* +* arm cpu related code +* +* 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.h" + +void target_cpu_set_tls (CPUARMState *env,target_ulong newtls) +{ + env->cp15.c13_tls2 = newtls; +} + +target_ulong target_cpu_get_tls (CPUARMState *env) +{ +return (env->cp15.c13_tls2); +}
bsd-user/arm/target_arch_cpu.h new file +375 -0
375 lines not on this page · raw message
bsd-user/arm/target_arch_vmparam.h new file +51 -0
51 lines not on this page · raw message
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 +302 -0
302 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 +186 -740
1,082 lines not on this page · raw message
bsd-user/mips/target_arch.h new file +10 -0
@@ -0,0 +1,10 @@ + +#ifndef _TARGET_ARCH_H_ +#define _TARGET_ARCH_H_ + +#include "qemu.h" + +void target_cpu_set_tls (CPUMIPSState *env,target_ulong newtls); +target_ulong target_cpu_get_tls (CPUMIPSState *env); + +#endif /* !_TARGET_ARCH_H_ */
bsd-user/mips/target_arch_cpu.c new file +27 -0
@@ -0,0 +1,27 @@ +/* +* mips cpu related code +* +* 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.h" + +void target_cpu_set_tls (CPUMIPSState *env,target_ulong newtls) +{ + env->tls_value = newtls; +} + +target_ulong target_cpu_get_tls (CPUMIPSState *env) +{ +return (env->tls_value); +}
bsd-user/mips/target_arch_cpu.h new file +257 -0
257 lines not on this page · raw message
bsd-user/mips/target_arch_vmparam.h new file +50 -0
50 lines not on this page · raw message
bsd-user/mips64/target_arch.h new file +10 -0
@@ -0,0 +1,10 @@ + +#ifndef _TARGET_ARCH_H_ +#define _TARGET_ARCH_H_ + +#include "qemu.h" + +void target_cpu_set_tls (CPUMIPSState *env,target_ulong newtls); +target_ulong target_cpu_get_tls (CPUMIPSState *env); + +#endif /* !_TARGET_ARCH_H_ */
bsd-user/mips64/target_arch_cpu.c new file +27 -0
@@ -0,0 +1,27 @@ +/* +* mips64 cpu related code +* +* 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.h" + +void target_cpu_set_tls (CPUMIPSState *env,target_ulong newtls) +{ + env->tls_value = newtls; +} + +target_ulong target_cpu_get_tls (CPUMIPSState *env) +{ +return (env->tls_value); +}
bsd-user/mips64/target_arch_cpu.h new file +243 -0
243 lines not on this page · raw message
bsd-user/mips64/target_arch_vmparam.h new file +47 -0
47 lines not on this page · raw message
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/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/qemu.h +9 -1
@@ -38,6 +38,7 @@ 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"
@@ -99,6 +100,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;
@@ -222,7 +224,13 @@ 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[];/* user access */
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
58 lines not on this page · raw message
bsd-user/sparc/target_arch_vmparam.h new file +37 -0
Lines of this file are not shown. View the raw message.
bsd-user/sparc64/target_arch.h new file +11 -0
Lines of this file are not shown. View the raw message.
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
Lines of this file are not shown. View the raw message.
bsd-user/x86_64/target_arch.h new file +13 -0
Lines of this file are not shown. View the raw message.
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 +324 -0
324 lines not on this page · raw message
bsd-user/x86_64/target_arch_vmparam.h new file +28 -0
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Signature · 1 line
1.7.8
Part of the diff is not shown here. View the raw message.
PATCH v2 5/19 bsd-user: move target arch and host OS dependent code out of syscall.c
In reply to Stacey SonThis 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/arm/target_arch_sigtramp.h | 33 ++++ bsd-user/bsdload.c | 170 ++++++++++++++------ bsd-user/elfload.c | 9 +- bsd-user/freebsd/os-sys.c | 268 +++++++++++++++++++++++++++++++ bsd-user/freebsd/target_os_stack.h | 157 ++++++++++++++++++ bsd-user/i386/target_arch_sigtramp.h | 11 ++ bsd-user/mips/target_arch_sigtramp.h | 23 +++ bsd-user/mips64/target_arch_sigtramp.h | 23 +++ bsd-user/netbsd/os-sys.c | 46 ++++++ bsd-user/netbsd/target_os_stack.h | 33 ++++ bsd-user/openbsd/os-sys.c | 46 ++++++ bsd-user/openbsd/target_os_stack.h | 33 ++++ bsd-user/qemu.h | 30 +++- bsd-user/sparc/target_arch_sigtramp.h | 11 ++ bsd-user/sparc64/target_arch_sigtramp.h | 11 ++ bsd-user/syscall.c | 210 +++--------------------- bsd-user/x86_64/target_arch_sigtramp.h | 11 ++ 18 files changed, 884 insertions(+), 243 deletions(-) create mode 100644 bsd-user/arm/target_arch_sigtramp.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/i386/target_arch_sigtramp.h create mode 100644 bsd-user/mips/target_arch_sigtramp.h create mode 100644 bsd-user/mips64/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_ABI_DIR)/os-sys.o $(TARGET_ABI_DIR)/target_arch_cpu.o
bsd-user/arm/target_arch_sigtramp.h new file +33 -0
@@ -0,0 +1,33 @@ + +#ifndef _TARGET_ARCH_SIGTRAMP_H_ +#define _TARGET_ARCH_SIGTRAMP_H_ + +/* Compare to arm/arm/locore.S ENTRY_NP(sigcode) */ +static inline abi_long setup_sigtramp (abi_ulong offset,unsigned sigf_uc, +unsigned sys_sigreturn) +{ +int i; +uint32_t sys_exit = TARGET_FREEBSD_NR_exit; +/* +* The code has to load r7 manually rather than using +* "ldr r7, =SYS_return to make sure the size of the +* code is correct. +*/ +uint32_t sigtramp_code[] = { +/* 1 */ 0xE1A0000D ,/* mov r0, sp */ +/* 2 */ 0xE59F700C ,/* ldr r7, [pc, #12] */ +/* 3 */ 0xEF000000 + sys_sigreturn,/* swi (SYS_sigreturn) */ +/* 4 */ 0xE59F7008 ,/* ldr r7, [pc, #8] */ +/* 5 */ 0xEF000000 + sys_exit,/* swi (SYS_exit)*/ +/* 6 */ 0xEAFFFFFA ,/* b . -16 */ +/* 7 */ sys_sigreturn, +/* 8 */ sys_exit + }; + +for (i =0 ; i <8 ; i++) { +tswap32s (&sigtramp_code[i]); + } + +return memcpy_to_target (offset, sigtramp_code,TARGET_SZSIGCODE ); +} +#endif /* _TARGET_ARCH_SIGTRAMP_H_ */
bsd-user/bsdload.c +122 -48
228 lines not on this page · raw message
bsd-user/elfload.c +6 -3
@@ -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()
@@ -665,7 +668,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,8 +1150,8 @@ static void load_symbols(struct elfhdr *hdr, int fd) syminfos = s; } -int load_elf_binary (struct linux_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-sys.c new file +268 -0
268 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/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/mips/target_arch_sigtramp.h new file +23 -0
@@ -0,0 +1,23 @@ + +#ifndef _TARGET_ARCH_SIGTRAMP_H_ +#define _TARGET_ARCH_SIGTRAMP_H_ + +/* Compare to mips/mips/locore.S sigcode() */ +static inline abi_long setup_sigtramp (abi_ulong offset,unsigned sigf_uc, +unsigned sys_sigreturn) +{ +int i; +uint32_t sigtramp_code[TARGET_SZSIGCODE /TARGET_INSN_SIZE ] = { +/* 1 */ 0x67A40000 + sigf_uc,/* daddu $a0, $sp, (sigf_uc) */ +/* 2 */ 0x24020000 + sys_sigreturn,/* li $v0, (sys_sigreturn) */ +/* 3 */ 0x0000000C ,/* syscall */ +/* 4 */ 0x0000000D /* break */ + }; + +for (i =0 ; i <4 ; i++) { +tswap32s (&sigtramp_code[i]); + } + +return memcpy_to_target (offset, sigtramp_code,TARGET_SZSIGCODE ); +} +#endif /* _TARGET_ARCH_SIGTRAMP_H_ */
bsd-user/mips64/target_arch_sigtramp.h new file +23 -0
@@ -0,0 +1,23 @@ + +#ifndef _TARGET_ARCH_SIGTRAMP_H_ +#define _TARGET_ARCH_SIGTRAMP_H_ + +/* Compare to mips/mips/locore.S sigcode() */ +static inline abi_long setup_sigtramp (abi_ulong offset,unsigned sigf_uc, +unsigned sys_sigreturn) +{ +int i; +uint32_t sigtramp_code[TARGET_SZSIGCODE /TARGET_INSN_SIZE ] = { +/* 1 */ 0x67A40000 + sigf_uc,/* daddu $a0, $sp, (sigf_uc) */ +/* 2 */ 0x24020000 + sys_sigreturn,/* li $v0, (sys_sigreturn) */ +/* 3 */ 0x0000000C ,/* syscall */ +/* 4 */ 0x0000000D /* break */ + }; + +for (i =0 ; i <4 ; i++) { +tswap32s (&sigtramp_code[i]); + } + +return memcpy_to_target (offset, sigtramp_code,TARGET_SZSIGCODE ); +} +#endif /* _TARGET_ARCH_SIGTRAMP_H_ */
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-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 +22 -8
@@ -90,6 +90,7 @@ typedef struct TaskState {struct TaskState *next;int used;/* non zero if used */ struct image_info *info; +struct bsd_binprm *bprm;struct emulated_sigtable sigtab[TARGET_NSIG ];struct sigqueue sigqueue_table[MAX_SIGQUEUE_SIZE ];/* siginfo queue */
@@ -118,7 +119,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;
@@ -127,19 +128,23 @@ struct linux_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 linux_binprm * bprm,struct target_pt_regs * regs, -struct image_info * info); -int load_flt_binary (struct linux_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);
@@ -232,6 +237,15 @@ extern unsigned long target_maxssiz;extern unsigned long target_sgrowsiz;extern char qemu_proc_pathname[]; +/* 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 */ #define VERIFY_READ 0
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/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 +27 -183
261 lines not on this page · raw message
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
1.7.8
PATCH v2 6/19 bsd-user: add support for freebsd time related system calls
In reply to Stacey SonThis change adds support or stubs for time related system calls including nanosleep(2), clock_gettime(2), clock_settime(2), clock_getres(2), gettimeofday(2), settimeofday(2), adjtime(2), ntp_adjtime(2), ntp_gettime(2), utimes(2), lutimes(2), futimes(2), futimesat(2), select(2), pselect(2), kqueue(2), kevent(2), setitimer(2), getitimer(2), and the undocumented ktimer_*() calls.
--- bsd-user/Makefile.objs | 3 +- bsd-user/freebsd/os-time.c | 205 +++++++++++ bsd-user/freebsd/os-time.h | 643 +++++++++++++++++++++++++++++++++++ bsd-user/freebsd/qemu-os.h | 53 +++ bsd-user/netbsd/os-time.c | 1 + bsd-user/netbsd/os-time.h | 179 ++++++++++ bsd-user/netbsd/qemu-os.h | 1 + bsd-user/openbsd/os-time.c | 1 + bsd-user/openbsd/os-time.h | 179 ++++++++++ bsd-user/openbsd/qemu-os.h | 1 + bsd-user/syscall.c | 102 ++++++ bsd-user/syscall_defs.h | 800 ++++++++++++++++++++++++++++++++++++++------ 12 files changed, 2065 insertions(+), 103 deletions(-) create mode 100644 bsd-user/freebsd/os-time.c create mode 100644 bsd-user/freebsd/os-time.h create mode 100644 bsd-user/freebsd/qemu-os.h create mode 100644 bsd-user/netbsd/os-time.c create mode 100644 bsd-user/netbsd/os-time.h create mode 100644 bsd-user/netbsd/qemu-os.h create mode 100644 bsd-user/openbsd/os-time.c create mode 100644 bsd-user/openbsd/os-time.h create mode 100644 bsd-user/openbsd/qemu-os.h
bsd-user/Makefile.objs +2 -1
@@ -1,2 +1,3 @@ obj-y = main.o bsdload.o elfload.o mmap.o signal.o strace.o syscall.o \ - uaccess.o $(HOST_ABI_DIR)/os-sys.o $(TARGET_ABI_DIR)/target_arch_cpu.o + uaccess.o $(HOST_ABI_DIR)/os-sys.o \ + $(HOST_ABI_DIR)/os-time.o $(TARGET_ABI_DIR)/target_arch_cpu.o
bsd-user/freebsd/os-time.c new file +205 -0
205 lines not on this page · raw message
bsd-user/freebsd/os-time.h new file +643 -0
643 lines not on this page · raw message
bsd-user/freebsd/qemu-os.h new file +53 -0
53 lines not on this page · raw message
bsd-user/netbsd/os-time.c new file +1 -0
@@ -0,0 +1 @@ +/* XXX NetBSD time related helpers */
bsd-user/netbsd/os-time.h new file +179 -0
179 lines not on this page · raw message
bsd-user/netbsd/qemu-os.h new file +1 -0
@@ -0,0 +1 @@ +/* NetBSD conversion extern declarations */
bsd-user/openbsd/os-time.c new file +1 -0
@@ -0,0 +1 @@ +/* XXX OpenBSD time related helpers */
bsd-user/openbsd/os-time.h new file +179 -0
179 lines not on this page · raw message
bsd-user/openbsd/qemu-os.h new file +1 -0
@@ -0,0 +1 @@ +/* OpenBSD conversion extern declarations */
bsd-user/syscall.c +102 -0
114 lines not on this page · raw message
bsd-user/syscall_defs.h +698 -102
806 lines not on this page · raw message
Signature · 1 line
1.7.8
PATCH v2 7/19 bsd-user: add support for freebsd signal related system calls
In reply to Stacey SonThis change adds support or stubs for signal related system calls including sigtimedwait(2), sigaction(2), sigprocmask(2), sigpending(2), sigsuspend(2), sigreturn(2), sigwait(2), sigwaitinfo(2), sigqueue(2), sigaltstack(2), kill(2), killpg(2), and pdkill(2).
--- bsd-user/arm/target_arch_signal.h | 257 ++++++++++ bsd-user/bsd-signal.h | 232 +++++++++ bsd-user/errno_defs.h | 13 +- bsd-user/freebsd/os-signal.h | 43 ++ bsd-user/freebsd/target_os_siginfo.h | 110 ++++ bsd-user/freebsd/target_os_signal.h | 79 +++ bsd-user/i386/target_arch_signal.h | 94 ++++ bsd-user/mips/target_arch_signal.h | 237 +++++++++ bsd-user/mips64/target_arch_signal.h | 236 +++++++++ bsd-user/netbsd/target_os_siginfo.h | 82 +++ bsd-user/netbsd/target_os_signal.h | 70 +++ bsd-user/openbsd/target_os_siginfo.h | 82 +++ bsd-user/openbsd/target_os_signal.h | 70 +++ bsd-user/qemu.h | 33 +- bsd-user/signal.c | 907 ++++++++++++++++++++++++++++++++- bsd-user/sparc/target_arch_signal.h | 77 +++ bsd-user/sparc64/target_arch_signal.h | 94 ++++ bsd-user/syscall.c | 59 +++ bsd-user/x86_64/target_arch_signal.h | 94 ++++ 19 files changed, 2852 insertions(+), 17 deletions(-) create mode 100644 bsd-user/arm/target_arch_signal.h create mode 100644 bsd-user/bsd-signal.h create mode 100644 bsd-user/freebsd/os-signal.h create mode 100644 bsd-user/freebsd/target_os_siginfo.h create mode 100644 bsd-user/freebsd/target_os_signal.h create mode 100644 bsd-user/i386/target_arch_signal.h create mode 100644 bsd-user/mips/target_arch_signal.h create mode 100644 bsd-user/mips64/target_arch_signal.h create mode 100644 bsd-user/netbsd/target_os_siginfo.h create mode 100644 bsd-user/netbsd/target_os_signal.h create mode 100644 bsd-user/openbsd/target_os_siginfo.h create mode 100644 bsd-user/openbsd/target_os_signal.h create mode 100644 bsd-user/sparc/target_arch_signal.h create mode 100644 bsd-user/sparc64/target_arch_signal.h create mode 100644 bsd-user/x86_64/target_arch_signal.h
bsd-user/arm/target_arch_signal.h new file +257 -0
@@ -0,0 +1,257 @@ +/* +* arm signal 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 _TARGET_ARCH_SIGNAL_H_ +#define _TARGET_ARCH_SIGNAL_H_ + +#include "cpu.h" + +#define TARGET_REG_R0 0 +#define TARGET_REG_R1 1 +#define TARGET_REG_R2 2 +#define TARGET_REG_R3 3 +#define TARGET_REG_R4 4 +#define TARGET_REG_R5 5 +#define TARGET_REG_R6 6 +#define TARGET_REG_R7 7 +#define TARGET_REG_R8 8 +#define TARGET_REG_R9 9 +#define TARGET_REG_R10 10 +#define TARGET_REG_R11 11 +#define TARGET_REG_R12 12 +#define TARGET_REG_R13 13 +#define TARGET_REG_R14 14 +#define TARGET_REG_R15 15 +#define TARGET_REG_CPSR 16 +#define TARGET__NGREG 17 +/* Convenience synonyms */ +#define TARGET_REG_FP TARGET_REG_R11 +#define TARGET_REG_SP TARGET_REG_R13 +#define TARGET_REG_LR TARGET_REG_R14 +#define TARGET_REG_PC TARGET_REG_R15 + +#define TARGET_INSN_SIZE 4/* arm instruction size */ + +/* Size of the signal trampolin code. See _sigtramp(). */ +#define TARGET_SZSIGCODE ((abi_ulong)(8 * TARGET_INSN_SIZE)) + +/* compare to arm/include/_limits.h */ +#define TARGET_MINSIGSTKSZ (1024 * 4)/* min sig stack size */ +#define TARGET_SIGSTKSZ (TARGET_MINSIGSTKSZ + 32768)/* recommended size */ + +/* arm/arm/machdep.c */ +#define TARGET_MC_GET_CLEAR_RET 0x0001 +#define TARGET_MC_ADD_MAGIC 0x0002 +#define TARGET_MC_SET_ONSTACK 0x0004 + +struct target_sigcontext { +target_sigset_t sc_mask;/* signal mask to retstore */ +int32_t sc_onstack;/* sigstack state to restore */ +abi_long sc_pc;/* pc at time of signal */ +abi_long sc_reg[32 ];/* processor regs 0 to 31 */ +abi_long mullo, mulhi;/* mullo and mulhi registers */ +int32_t sc_fpused;/* fp has been used */ +abi_long sc_fpregs[33 ];/* fp regs 0 to 31 & csr */ +abi_long sc_fpc_eir;/* fp exception instr reg */ +/* int32_t reserved[8]; */ +}; + +typedef struct { +uint32_t __fp_fpsr; +struct { +uint32_t __fp_exponent; +uint32_t __fp_mantissa_hi; +uint32_t __fp_mantissa_lo; + } __fp_fr[8 ]; +}target__fpregset_t ; + +typedef struct { +uint32_t __vfp_fpscr; +uint32_t __vfp_fstmx[33 ]; +uint32_t __vfp_fpsid; +}target__vfpregset_t ; + +typedef struct target_mcontext { +uint32_t __gregs[TARGET__NGREG ]; +union { +target__fpregset_t __fpregs; +target__vfpregset_t __vfpregs; + } __fpu; +}target_mcontext_t ; + +typedef struct target_ucontext { +target_sigset_t uc_sigmask; +target_mcontext_t uc_mcontext; +abi_ulong uc_link; +target_stack_t uc_stack; +int32_t uc_flags; +int32_t __spare__[4 ]; +}target_ucontext_t ; + +struct target_sigframe { +target_siginfo_t sf_si;/* saved siginfo */ +target_ucontext_t sf_uc;/* saved ucontext */ +}; + + +/* compare to sys/arm/include/frame.h */ +struct target_trapframe { +abi_ulong tf_spsr;/* Zero on arm26 */ +abi_ulong tf_r0; +abi_ulong tf_r1; +abi_ulong tf_r2; +abi_ulong tf_r3; +abi_ulong tf_r4; +abi_ulong tf_r5; +abi_ulong tf_r6; +abi_ulong tf_r7; +abi_ulong tf_r8; +abi_ulong tf_r9; +abi_ulong tf_r10; +abi_ulong tf_r11; +abi_ulong tf_r12; +abi_ulong tf_usr_sp; +abi_ulong tf_usr_lr; +abi_ulong tf_svc_sp;/* Not used on arm26 */ +abi_ulong tf_svc_lr;/* Not used on arm26 */ +abi_ulong tf_pc; +}; + +/* +* Compare to arm/arm/machdep.c sendsig() +* Assumes that target stack frame memory is locked. +*/ +static inline abi_long +set_sigtramp_args (CPUARMState *regs,int sig,struct target_sigframe *frame, +abi_ulong frame_addr,struct target_sigaction *ka) +{ +/* +* Arguments to signal handler: +* r0 = signal number +* r1 = siginfo pointer +* r2 = ucontext pointer +* r5 = ucontext pointer +* pc = signal handler pointer +* sp = sigframe struct pointer +* lr = sigtramp at base of user stack +*/ + + regs->regs[0 ] = sig; + regs->regs[1 ] = frame_addr + + offsetof(struct target_sigframe , sf_si); + regs->regs[2 ] = frame_addr + + offsetof(struct target_sigframe , sf_uc); + +/* the trampoline uses r5 as the uc address */ + regs->regs[5 ] = frame_addr + + offsetof(struct target_sigframe , sf_uc); + regs->regs[TARGET_REG_PC ] = ka->_sa_handler; + regs->regs[TARGET_REG_SP ] = frame_addr; + regs->regs[TARGET_REG_LR ] =TARGET_PS_STRINGS -TARGET_SZSIGCODE ; + +return 0 ; +} + +/* +* Compare to arm/arm/machdep.c get_mcontext() +* Assumes that the memory is locked if mcp points to user memory. +*/ +static inline abi_long get_mcontext (CPUARMState *regs,target_mcontext_t *mcp, +int flags) +{ +int err =0 ; +uint32_t *gr = mcp->__gregs; + + +if (flags &TARGET_MC_GET_CLEAR_RET ) { + gr[TARGET_REG_R0 ] =0 ; + }else { + gr[TARGET_REG_R0 ] =tswap32 (regs->regs[0 ]); + } + + gr[TARGET_REG_R1 ] =tswap32 (regs->regs[1 ]); + gr[TARGET_REG_R2 ] =tswap32 (regs->regs[2 ]); + gr[TARGET_REG_R3 ] =tswap32 (regs->regs[3 ]); + gr[TARGET_REG_R4 ] =tswap32 (regs->regs[4 ]); + gr[TARGET_REG_R5 ] =tswap32 (regs->regs[5 ]); + gr[TARGET_REG_R6 ] =tswap32 (regs->regs[6 ]); + gr[TARGET_REG_R7 ] =tswap32 (regs->regs[7 ]); + gr[TARGET_REG_R8 ] =tswap32 (regs->regs[8 ]); + gr[TARGET_REG_R9 ] =tswap32 (regs->regs[9 ]); + gr[TARGET_REG_R10 ] =tswap32 (regs->regs[10 ]); + gr[TARGET_REG_R11 ] =tswap32 (regs->regs[11 ]); + gr[TARGET_REG_R12 ] =tswap32 (regs->regs[12 ]); + + gr[TARGET_REG_SP ] =tswap32 (regs->regs[13 ]); + gr[TARGET_REG_LR ] =tswap32 (regs->regs[14 ]); + gr[TARGET_REG_PC ] =tswap32 (regs->regs[15 ]); + gr[TARGET_REG_CPSR ] =tswap32 (cpsr_read (regs)); + +return err; +} + +/* Compare to arm/arm/machdep.c set_mcontext() */ +static inline abi_long set_mcontext (CPUARMState *regs,target_mcontext_t *mcp, +int srflag) +{ +int err =0 ; +const uint32_t *gr = mcp->__gregs; +uint32_t cpsr; + + regs->regs[0 ] =tswap32 (gr[TARGET_REG_R0 ]); + regs->regs[1 ] =tswap32 (gr[TARGET_REG_R1 ]); + regs->regs[2 ] =tswap32 (gr[TARGET_REG_R2 ]); + regs->regs[3 ] =tswap32 (gr[TARGET_REG_R3 ]); + regs->regs[4 ] =tswap32 (gr[TARGET_REG_R4 ]); + regs->regs[5 ] =tswap32 (gr[TARGET_REG_R5 ]); + regs->regs[6 ] =tswap32 (gr[TARGET_REG_R6 ]); + regs->regs[7 ] =tswap32 (gr[TARGET_REG_R7 ]); + regs->regs[8 ] =tswap32 (gr[TARGET_REG_R8 ]); + regs->regs[9 ] =tswap32 (gr[TARGET_REG_R9 ]); + regs->regs[10 ] =tswap32 (gr[TARGET_REG_R10 ]); + regs->regs[11 ] =tswap32 (gr[TARGET_REG_R11 ]); + regs->regs[12 ] =tswap32 (gr[TARGET_REG_R12 ]); + + regs->regs[13 ] =tswap32 (gr[TARGET_REG_SP ]); + regs->regs[14 ] =tswap32 (gr[TARGET_REG_LR ]); + regs->regs[15 ] =tswap32 (gr[TARGET_REG_PC ]); + cpsr =tswap32 (gr[TARGET_REG_CPSR ]); +cpsr_write (regs, cpsr,CPSR_USER |CPSR_EXEC ); + +return err; +} + +/* Compare to arm/arm/machdep.c sys_sigreturn() */ +static inline abi_long get_ucontext_sigreturn (CPUARMState *regs, +abi_ulong target_sf,abi_ulong *target_uc) +{ +uint32_t cpsr =cpsr_read (regs); + + *target_uc =0 ; + +if ((cpsr &CPSR_M ) !=ARM_CPU_MODE_USR || + (cpsr & (CPSR_I |CPSR_F )) !=0 ) { +return -TARGET_EINVAL ; + } + + *target_uc = target_sf + offsetof(struct target_sigframe , sf_uc); + +return 0 ; +} + + +#endif /* !_TARGET_ARCH_SIGNAL_H_ */
bsd-user/bsd-signal.h new file +232 -0
232 lines not on this page · raw message
bsd-user/errno_defs.h +10 -3
@@ -1,6 +1,3 @@ -/* $OpenBSD: errno.h,v 1.20 2007/09/03 14:37:52 millert Exp $ */ -/* $NetBSD: errno.h,v 1.10 1996/01/20 01:33:53 jtc Exp $ */ -/* * Copyright (c) 1982, 1986, 1989, 1993 * The Regents of the University of California. All rights reserved.
@@ -37,6 +34,9 @@* @(#)errno.h 8.5 (Berkeley) 1/21/94 */ +#ifndef _ERRNO_DEFS_H_ +#define _ERRNO_DEFS_H_ +#define TARGET_EPERM 1/* Operation not permitted */ #define TARGET_ENOENT 2/* No such file or directory */ #define TARGET_ESRCH 3/* No such process */
@@ -147,3 +147,10 @@#define TARGET_EIDRM 89/* Identifier removed */ #define TARGET_ENOMSG 90/* No message of desired type */ #define TARGET_ELAST 90/* Must be equal largest errno */ + +/* Internal errors: */ +#define TARGET_EJUSTRETURN 254/* Just return without +modifing regs */ +#define TARGET_ERESTART 255/* Restart syscall */ + +#endif /* ! _ERRNO_DEFS_H_ */
bsd-user/freebsd/os-signal.h new file +43 -0
43 lines not on this page · raw message
bsd-user/freebsd/target_os_siginfo.h new file +110 -0
110 lines not on this page · raw message
bsd-user/freebsd/target_os_signal.h new file +79 -0
79 lines not on this page · raw message
bsd-user/i386/target_arch_signal.h new file +94 -0
94 lines not on this page · raw message
bsd-user/mips/target_arch_signal.h new file +237 -0
237 lines not on this page · raw message
bsd-user/mips64/target_arch_signal.h new file +236 -0
236 lines not on this page · raw message
bsd-user/netbsd/target_os_siginfo.h new file +82 -0
82 lines not on this page · raw message
bsd-user/netbsd/target_os_signal.h new file +70 -0
70 lines not on this page · raw message
bsd-user/openbsd/target_os_siginfo.h new file +82 -0
82 lines not on this page · raw message
bsd-user/openbsd/target_os_signal.h new file +70 -0
70 lines not on this page · raw message
bsd-user/qemu.h +20 -13
@@ -39,7 +39,7 @@ extern enum BSDType bsd_type;#include "syscall_defs.h" #include "syscall.h" #include "target_os_vmparam.h" -#include "target_signal.h" +#include "target_os_signal.h" #include "exec/gdbstub.h" #if defined(CONFIG_USE_NPTL )
@@ -72,16 +72,16 @@ struct image_info {#define MAX_SIGQUEUE_SIZE 1024 -struct sigqueue { -struct sigqueue *next; -//target_siginfo_t info; +struct qemu_sigqueue { +struct qemu_sigqueue *next; +target_siginfo_t info; };struct emulated_sigtable {int pending;/* true if signal is pending */ -struct sigqueue *first; -struct sigqueue info;/* in order to always have memory for the -first signal, we put it here */ +struct qemu_sigqueue *first; +struct qemu_sigqueue info;/* in order to always have memory for the +first signal, we put it here */ };/* NOTE: we force a big alignment so that the stack stored after is
@@ -93,8 +93,8 @@ typedef struct TaskState {struct bsd_binprm *bprm;struct emulated_sigtable sigtab[TARGET_NSIG ]; -struct sigqueue sigqueue_table[MAX_SIGQUEUE_SIZE ];/* siginfo queue */ -struct sigqueue *first_free;/* first free siginfo queue entry */ +struct qemu_sigqueue sigqueue_table[MAX_SIGQUEUE_SIZE ];/* siginfo queue */ +struct qemu_sigqueue *first_free;/* first free siginfo queue entry */ int signal_pending;/* non zero if a signal may be pending */ uint8_t stack[0 ];
@@ -202,12 +202,19 @@ extern int do_strace;/* signal.c */ void process_pending_signals (CPUArchState *cpu_env);void signal_init (void ); -//int queue_signal(CPUArchState *env, int sig, target_siginfo_t *info); -//void host_to_target_siginfo(target_siginfo_t *tinfo, const siginfo_t *info); -//void target_to_host_siginfo(siginfo_t *info, const target_siginfo_t *tinfo); -long do_sigreturn (CPUArchState *env); +int queue_signal (CPUArchState *env,int sig,target_siginfo_t *info); +void host_to_target_siginfo (target_siginfo_t *tinfo,const siginfo_t *info); +void target_to_host_siginfo (siginfo_t *info,const target_siginfo_t *tinfo); +int target_to_host_signal (int sig); +int host_to_target_signal (int sig); +void host_to_target_sigset (target_sigset_t *d,const sigset_t *s); +void target_to_host_sigset (sigset_t *d,const target_sigset_t *s); +long do_sigreturn (CPUArchState *env,abi_ulong addr);long do_rt_sigreturn (CPUArchState *env);abi_long do_sigaltstack (abi_ulong uss_addr,abi_ulong uoss_addr,abi_ulong sp); +int do_sigaction (int sig,const struct target_sigaction *act, +struct target_sigaction *oact); +void QEMU_NORETURN force_sig(int target_sig);/* mmap.c */ int target_mprotect (abi_ulong start,abi_ulong len,int prot);
bsd-user/signal.c +906 -1
928 lines not on this page · raw message
bsd-user/sparc/target_arch_signal.h new file +77 -0
77 lines not on this page · raw message
bsd-user/sparc64/target_arch_signal.h new file +94 -0
94 lines not on this page · raw message
bsd-user/syscall.c +59 -0
73 lines not on this page · raw message
bsd-user/x86_64/target_arch_signal.h new file +94 -0
94 lines not on this page · raw message
Signature · 1 line
1.7.8
PATCH v2 8/19 bsd-user: move target arch and host OS dependent code out of elfload.c
In reply to Stacey SonThis change moves ELF and thread start up code from elfload.c to the host OS and arch dependent directories. This eliminates many of the #ifdef's in elfload.c and moves the target arch and OS dependent code into its own directories.
--- bsd-user/arm/target_arch_elf.h | 54 ++ bsd-user/arm/target_arch_thread.h | 67 +++ bsd-user/elfload.c | 947 +++++++-------------------------- bsd-user/freebsd/target_os_elf.h | 145 +++++ bsd-user/freebsd/target_os_thread.h | 6 + bsd-user/i386/target_arch_elf.h | 62 +++ bsd-user/i386/target_arch_thread.h | 45 ++ bsd-user/mips/target_arch_elf.h | 36 ++ bsd-user/mips/target_arch_thread.h | 54 ++ bsd-user/mips64/target_arch_elf.h | 36 ++ bsd-user/mips64/target_arch_thread.h | 54 ++ bsd-user/netbsd/target_os_elf.h | 226 ++++++++ bsd-user/netbsd/target_os_thread.h | 6 + bsd-user/openbsd/target_os_elf.h | 226 ++++++++ bsd-user/openbsd/target_os_thread.h | 6 + bsd-user/sparc/target_arch_elf.h | 30 + bsd-user/sparc/target_arch_thread.h | 39 ++ bsd-user/sparc64/target_arch_elf.h | 34 ++ bsd-user/sparc64/target_arch_thread.h | 55 ++ bsd-user/syscall_defs.h | 64 +++ bsd-user/x86_64/target_arch_elf.h | 55 ++ bsd-user/x86_64/target_arch_thread.h | 40 ++ 22 files changed, 1530 insertions(+), 757 deletions(-) create mode 100644 bsd-user/arm/target_arch_elf.h create mode 100644 bsd-user/arm/target_arch_thread.h create mode 100644 bsd-user/freebsd/target_os_elf.h create mode 100644 bsd-user/freebsd/target_os_thread.h create mode 100644 bsd-user/i386/target_arch_elf.h create mode 100644 bsd-user/i386/target_arch_thread.h create mode 100644 bsd-user/mips/target_arch_elf.h create mode 100644 bsd-user/mips/target_arch_thread.h create mode 100644 bsd-user/mips64/target_arch_elf.h create mode 100644 bsd-user/mips64/target_arch_thread.h create mode 100644 bsd-user/netbsd/target_os_elf.h create mode 100644 bsd-user/netbsd/target_os_thread.h create mode 100644 bsd-user/openbsd/target_os_elf.h create mode 100644 bsd-user/openbsd/target_os_thread.h create mode 100644 bsd-user/sparc/target_arch_elf.h create mode 100644 bsd-user/sparc/target_arch_thread.h create mode 100644 bsd-user/sparc64/target_arch_elf.h create mode 100644 bsd-user/sparc64/target_arch_thread.h create mode 100644 bsd-user/x86_64/target_arch_elf.h create mode 100644 bsd-user/x86_64/target_arch_thread.h
bsd-user/arm/target_arch_elf.h new file +54 -0
@@ -0,0 +1,54 @@ +/* +* arm ELF definitions +* +* Copyright (c) 2013 Stacey D. Son +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, see <http://www.gnu.org/licenses/>. +*/ +#ifndef _TARGET_ARCH_ELF_H_ +#define _TARGET_ARCH_ELF_H_ + +#define ELF_START_MMAP 0x80000000 + +#define elf_check_arch (x) ( (x) == EM_ARM ) + +#define ELF_CLASS ELFCLASS32 +#ifdef TARGET_WORDS_BIGENDIAN +#define ELF_DATA ELFDATA2MSB +#else +#define ELF_DATA ELFDATA2LSB +#endif +#define ELF_ARCH EM_ARM + +#define USE_ELF_CORE_DUMP +#define ELF_EXEC_PAGESIZE 4096 + +enum +{ +ARM_HWCAP_ARM_SWP =1 <<0 , +ARM_HWCAP_ARM_HALF =1 <<1 , +ARM_HWCAP_ARM_THUMB =1 <<2 , +ARM_HWCAP_ARM_26BIT =1 <<3 , +ARM_HWCAP_ARM_FAST_MULT =1 <<4 , +ARM_HWCAP_ARM_FPA =1 <<5 , +ARM_HWCAP_ARM_VFP =1 <<6 , +ARM_HWCAP_ARM_EDSP =1 <<7 , +}; + +#define ELF_HWCAP (ARM_HWCAP_ARM_SWP | ARM_HWCAP_ARM_HALF \ + | ARM_HWCAP_ARM_THUMB | ARM_HWCAP_ARM_FAST_MULT \ + | ARM_HWCAP_ARM_FPA | ARM_HWCAP_ARM_VFP) + + +#endif /* _TARGET_ARCH_ELF_H_ */
bsd-user/arm/target_arch_thread.h new file +67 -0
67 lines not on this page · raw message
bsd-user/elfload.c +190 -757
1,157 lines not on this page · raw message
bsd-user/freebsd/target_os_elf.h new file +145 -0
145 lines not on this page · raw message
bsd-user/freebsd/target_os_thread.h new file +6 -0
@@ -0,0 +1,6 @@ +#ifndef _TARGET_OS_THREAD_H_ +#define _TARGET_OS_THREAD_H_ + +#include "target_arch_thread.h" + +#endif /* !_TARGET_OS_THREAD_H_ */
bsd-user/i386/target_arch_elf.h new file +62 -0
62 lines not on this page · raw message
bsd-user/i386/target_arch_thread.h new file +45 -0
45 lines not on this page · raw message
bsd-user/mips/target_arch_elf.h new file +36 -0
@@ -0,0 +1,36 @@ +/* +* mips ELF definitions +* +* Copyright (c) 2013 Stacey D. Son +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, see <http://www.gnu.org/licenses/>. +*/ +#ifndef _TARGET_ARCH_ELF_H_ +#define _TARGET_ARCH_ELF_H_ + +#define elf_check_arch (x) ( (x) == EM_MIPS ) +#define ELF_START_MMAP 0x80000000 +#define ELF_CLASS ELFCLASS32 + +#ifdef TARGET_WORDS_BIGENDIAN +#define ELF_DATA ELFDATA2MSB +#else +#define ELF_DATA ELFDATA2LSB +#endif +#define ELF_ARCH EM_MIPS + +#define USE_ELF_CORE_DUMP +#define ELF_EXEC_PAGESIZE 4096 + +#endif /* _TARGET_ARCH_ELF_H_ */
bsd-user/mips/target_arch_thread.h new file +54 -0
54 lines not on this page · raw message
bsd-user/mips64/target_arch_elf.h new file +36 -0
@@ -0,0 +1,36 @@ +/* +* mips64 ELF definitions +* +* Copyright (c) 2013 Stacey D. Son +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, see <http://www.gnu.org/licenses/>. +*/ +#ifndef _TARGET_ARCH_ELF_H_ +#define _TARGET_ARCH_ELF_H_ + +#define elf_check_arch (x) ( (x) == EM_MIPS ) +#define ELF_START_MMAP 0x2aaaaab000ULL +#define ELF_CLASS ELFCLASS64 + +#ifdef TARGET_WORDS_BIGENDIAN +#define ELF_DATA ELFDATA2MSB +#else +#define ELF_DATA ELFDATA2LSB +#endif +#define ELF_ARCH EM_MIPS + +#define USE_ELF_CORE_DUMP +#define ELF_EXEC_PAGESIZE 4096 + +#endif /* _TARGET_ARCH_ELF_H_ */
bsd-user/mips64/target_arch_thread.h new file +54 -0
54 lines not on this page · raw message
bsd-user/netbsd/target_os_elf.h new file +226 -0
226 lines not on this page · raw message
bsd-user/netbsd/target_os_thread.h new file +6 -0
@@ -0,0 +1,6 @@ +#ifndef _TARGET_OS_THREAD_H_ +#define _TARGET_OS_THREAD_H_ + +#include "target_arch_thread.h" + +#endif /* !_TARGET_OS_THREAD_H_ */
bsd-user/openbsd/target_os_elf.h new file +226 -0
226 lines not on this page · raw message
bsd-user/openbsd/target_os_thread.h new file +6 -0
@@ -0,0 +1,6 @@ +#ifndef _TARGET_OS_THREAD_H_ +#define _TARGET_OS_THREAD_H_ + +#include "target_arch_thread.h" + +#endif /* !_TARGET_OS_THREAD_H_ */
bsd-user/sparc/target_arch_elf.h new file +30 -0
@@ -0,0 +1,30 @@ +/* +* sparc ELF definitions +* +* Copyright (c) 2013 Stacey D. Son +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, see <http://www.gnu.org/licenses/>. +*/ +#ifndef _TARGET_ARCH_ELF_H_ +#define _TARGET_ARCH_ELF_H_ + +#define ELF_START_MMAP 0x80000000 + +#define elf_check_arch (x) ( (x) == EM_SPARC ) + +#define ELF_CLASS ELFCLASS32 +#define ELF_DATA ELFDATA2MSB +#define ELF_ARCH EM_SPARC + +#endif /* _TARGET_ARCH_ELF_H_ */
bsd-user/sparc/target_arch_thread.h new file +39 -0
@@ -0,0 +1,39 @@ +/* +* sparc thread support +* +* Copyright (c) 2013 Stacey D. Son +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, see <http://www.gnu.org/licenses/>. +*/ +#ifndef _TARGET_ARCH_THREAD_H_ +#define _TARGET_ARCH_THREAD_H_ + +/* Compare to vm_machdep.c cpu_set_upcall_kse() */ +static inline void target_thread_set_upcall (CPUSPARCState *regs, +abi_ulong entry,abi_ulong arg,abi_ulong stack_base,abi_ulong stack_size) +{ +/* XXX */ +} + +static inline void target_thread_init (struct target_pt_regs *regs, +struct image_info *infop) +{ + regs->psr =0 ; + regs->pc = infop->entry; + regs->npc = regs->pc +4 ; + regs->y =0 ; + regs->u_regs[14 ] = infop->start_stack -16 *4 ; +} + +#endif /* !_TARGET_ARCH_THREAD_H_ */
bsd-user/sparc64/target_arch_elf.h new file +34 -0
@@ -0,0 +1,34 @@ +/* +* sparc64 ELF definitions +* +* Copyright (c) 2013 Stacey D. Son +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, see <http://www.gnu.org/licenses/>. +*/ +#ifndef _TARGET_ARCH_ELF_H_ +#define _TARGET_ARCH_ELF_H_ + +#define ELF_START_MMAP 0x80000000 + +#ifndef TARGET_ABI32 +#define elf_check_arch (x) ( (x) == EM_SPARCV9 || (x) == EM_SPARC32PLUS ) +#else +#define elf_check_arch (x) ( (x) == EM_SPARC32PLUS || (x) == EM_SPARC ) +#endif + +#define ELF_CLASS ELFCLASS64 +#define ELF_DATA ELFDATA2MSB +#define ELF_ARCH EM_SPARCV9 + +#endif /* _TARGET_ARCH_ELF_H_ */
bsd-user/sparc64/target_arch_thread.h new file +55 -0
55 lines not on this page · raw message
bsd-user/syscall_defs.h +64 -0
68 lines not on this page · raw message
bsd-user/x86_64/target_arch_elf.h new file +55 -0
55 lines not on this page · raw message
bsd-user/x86_64/target_arch_thread.h new file +40 -0
@@ -0,0 +1,40 @@ +/* +* x86_64 thread support +* +* Copyright (c) 2013 Stacey D. Son +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, see <http://www.gnu.org/licenses/>. +*/ +#ifndef _TARGET_ARCH_THREAD_H_ +#define _TARGET_ARCH_THREAD_H_ + +/* Compare to vm_machdep.c cpu_set_upcall_kse() */ +static inline void target_thread_set_upcall (CPUX86State *regs,abi_ulong entry, +abi_ulong arg,abi_ulong stack_base,abi_ulong stack_size) +{ +/* XXX */ +} + +static inline void target_thread_init (struct target_pt_regs *regs, +struct image_info *infop) +{ + regs->rax =0 ; + regs->rsp = infop->start_stack; + regs->rip = infop->entry; +if (bsd_type == target_freebsd) { + regs->rdi = infop->start_stack; + } +} + +#endif /* !_TARGET_ARCH_THREAD_H_ */
Signature · 1 line
1.7.8
PATCH v2 9/19 bsd-user: add support for freebsd process related system calls
In reply to Stacey SonThis change add support or stubs for process related system calls including fork(2), vfork(2), rfork(2), pdfork(2), execve(2), fexecve(2), wait4(2), exit(2), getgroups(2), setgroups(2), umask(2), setlogin(2), getlogin(2), getrusage(2), getrlimit(2), setrlimit(2), getpid(2), getppid(2), getuid(2), geteuid(2), getgid(2), getegid(2), setuid(2), seteuid(2), setgid(2), setegid(2), getpgrp(2), setreuid(2), setregid(2), getresuid(2), getresgid(2), getsid(2), setsid(2), issetugid(2), profil(2), ktrace(2), setloginclass(2), getloginclass(2), pdgetpid(2), jail*(2), cap_*(2), *audit*(2), utrace(2), ptrace(2), getpriority(2), and setpriority(2).
--- bsd-user/Makefile.objs | 4 +- bsd-user/bsd-proc.c | 160 ++++++++++++++++ bsd-user/bsd-proc.h | 434 ++++++++++++++++++++++++++++++++++++++++++++ bsd-user/freebsd/os-proc.c | 234 ++++++++++++++++++++++++ bsd-user/freebsd/os-proc.h | 428 +++++++++++++++++++++++++++++++++++++++++++ bsd-user/netbsd/os-proc.c | 11 + bsd-user/netbsd/os-proc.h | 243 +++++++++++++++++++++++++ bsd-user/openbsd/os-proc.c | 11 + bsd-user/openbsd/os-proc.h | 243 +++++++++++++++++++++++++ bsd-user/qemu-bsd.h | 43 +++++ bsd-user/qemu.h | 4 + bsd-user/syscall.c | 262 ++++++++++++++++++++++++++- 12 files changed, 2069 insertions(+), 8 deletions(-) create mode 100644 bsd-user/bsd-proc.c create mode 100644 bsd-user/bsd-proc.h create mode 100644 bsd-user/freebsd/os-proc.c create mode 100644 bsd-user/freebsd/os-proc.h create mode 100644 bsd-user/netbsd/os-proc.c create mode 100644 bsd-user/netbsd/os-proc.h create mode 100644 bsd-user/openbsd/os-proc.c create mode 100644 bsd-user/openbsd/os-proc.h create mode 100644 bsd-user/qemu-bsd.h
bsd-user/Makefile.objs +3 -1
@@ -1,3 +1,5 @@ obj-y = main.o bsdload.o elfload.o mmap.o signal.o strace.o syscall.o \ - uaccess.o $(HOST_ABI_DIR)/os-sys.o \ + uaccess.o bsd-proc.o \ + $(HOST_ABI_DIR)/os-proc.o \ + $(HOST_ABI_DIR)/os-sys.o \ $(HOST_ABI_DIR)/os-time.o $(TARGET_ABI_DIR)/target_arch_cpu.o
bsd-user/bsd-proc.c new file +160 -0
160 lines not on this page · raw message
bsd-user/bsd-proc.h new file +434 -0
434 lines not on this page · raw message
bsd-user/freebsd/os-proc.c new file +234 -0
234 lines not on this page · raw message
bsd-user/freebsd/os-proc.h new file +428 -0
428 lines not on this page · raw message
bsd-user/netbsd/os-proc.c new file +11 -0
@@ -0,0 +1,11 @@ +/* +* XXX To support FreeBSD binaries on NetBSD the following will need to be +* emulated. +*/ +abi_long freebsd_exec_common (abi_ulong path_or_fd,abi_ulong guest_argp, +abi_ulong guest_envp,int do_fexec) +{ + +qemu_log ("qemu: Unsupported %s\n" , __func__); +return -TARGET_ENOSYS ; +}
bsd-user/netbsd/os-proc.h new file +243 -0
243 lines not on this page · raw message
bsd-user/openbsd/os-proc.c new file +11 -0
@@ -0,0 +1,11 @@ +/* +* XXX To support FreeBSD binaries on NetBSD the following will need to be +* emulated. +*/ +abi_long freebsd_exec_common (abi_ulong path_or_fd,abi_ulong guest_argp, +abi_ulong guest_envp,int do_fexec) +{ + +qemu_log ("qemu: Unsupported %s\n" , __func__); +return -TARGET_ENOSYS ; +}
bsd-user/openbsd/os-proc.h new file +243 -0
243 lines not on this page · raw message
bsd-user/qemu-bsd.h new file +43 -0
43 lines not on this page · raw message
bsd-user/qemu.h +4 -0
@@ -248,6 +248,10 @@ extern char qemu_proc_pathname[];abi_long get_errno (abi_long ret);int is_error (abi_long ret); +/* os-proc.c */ +abi_long freebsd_exec_common (abi_ulong path_or_fd,abi_ulong guest_argp, +abi_ulong guest_envp,int do_fexec); +/* 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);
bsd-user/syscall.c +255 -7
288 lines not on this page · raw message
Signature · 1 line
1.7.8
PATCH v2 10/19 bsd-user: add support for file system related system calls
In reply to Stacey SonThis change adds support or stubs for file system (except stat) related system calls including read(2), pread(2), readv(2), write(2), pwrite(2), writev(2), pwritev(2), open(2), openat(2), close(2), closefrom(2), revoke(2), access(2), eaccess(2), faccessat(2), chdir(2), fchdir(2), rename(2), renameat(2), link(2), linkat(2), unlink(2), unlinkat(2), mkdir(2), mkdirat(2), rmdir(2), __getcwd(), dup(2), dup2(2), truncate(2), ftruncate(2), acct(2), sync(2), mount(2), nmount(2), symlink(2), symlinkat(2), readlink(2), readlinkat(2), chmod(2), fchmod(2), lchmod(2), fchmodat(2), mknod(2), mknodat(2), chown(2), fchown(2), lchown(2), fchownat(2), chflags(2), lchflags(2), fchflags(2), chroot(2), flock(2), mkfifo(2), mkfifoat(2), pathconf(2), lpathconf(2), fpathconf(2), undelete(2), poll(2), lseek(2), pipe(2), swapon(2), swapoff(2), and the undocumented openbsd_poll() and freebsd6_*() system calls.
--- bsd-user/bsd-file.h | 1111 +++++++++++++++++++++++++++++++++++++++++++++++++++ bsd-user/qemu.h | 36 ++ bsd-user/syscall.c | 391 ++++++++++++++---- 3 files changed, 1454 insertions(+), 84 deletions(-) create mode 100644 bsd-user/bsd-file.h
bsd-user/bsd-file.h new file +1111 -0
@@ -0,0 +1,1111 @@ +/* +* file related system call shims and definitions +* +* Copyright (c) 2013 Stacey D. Son +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef __BSD_FILE_H_ +#define __BSD_FILE_H_ + +#include <sys/types.h> +#include <sys/mount.h> +#include <sys/uio.h> +#include <fcntl.h> +#include <poll.h> +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> + +#define target_to_host_bitmask (x, tbl) (x) + +#define LOCK_PATH (p, arg) do { \ + (p) = lock_user_string(arg); \ + if ((p) == NULL) { \ + return -TARGET_EFAULT; \ + } \ +} while (0) + +#define UNLOCK_PATH (p, arg) unlock_user((p), (arg), 0) + +struct target_pollfd { +int32_t fd;/* file descriptor */ +int16_t events;/* requested events */ +int16_t revents;/* returned events */ +}; + +static abi_long lock_iovec (int type,struct iovec *vec,abi_ulong target_addr, +int count,int copy); +static abi_long unlock_iovec (struct iovec *vec,abi_ulong target_addr, +int count,int copy); +extern int __getcwd (char *path,size_t len); + +/* read(2) */ +static inline abi_long do_bsd_read (abi_long arg1,abi_long arg2,abi_long arg3) +{ +abi_long ret; +void *p; + + p =lock_user (VERIFY_WRITE , arg2, arg3,0 ); +if (p ==NULL ) { +return -TARGET_EFAULT ; + } + ret =get_errno (read (arg1, p, arg3)); +unlock_user (p, arg2, ret); + +return ret; +} + +/* pread(2) */ +static inline abi_long do_bsd_pread (void *cpu_env,abi_long arg1, +abi_long arg2,abi_long arg3,abi_long arg4,abi_long arg5,abi_long arg6) +{ +abi_long ret; +void *p; + + p =lock_user (VERIFY_WRITE , arg2, arg3,0 ); +if (p ==NULL ) { +return -TARGET_EFAULT ; + } +if (regpairs_aligned (cpu_env) !=0 ) { + arg4 = arg5; + arg5 = arg6; + } + ret =get_errno (pread (arg1, p, arg3,target_offset64 (arg4, arg5))); +unlock_user (p, arg2, ret); + +return ret; +} + +/* readv(2) */ +static inline abi_long do_bsd_readv (abi_long arg1,abi_long arg2,abi_long arg3) +{ +abi_long ret; +int count = arg3; +struct iovec *vec; + + vec =alloca (count *sizeof (struct iovec )); +if (vec ==NULL ) { +return -TARGET_ENOMEM ; + } +if (lock_iovec (VERIFY_WRITE , vec, arg2, count,0 ) <0 ) { +return -TARGET_EFAULT ; + } + ret =get_errno (readv (arg1, vec, count)); +unlock_iovec (vec, arg2, count,1 ); + +return ret; +} + +/* write(2) */ +static inline abi_long do_bsd_write (abi_long arg1,abi_long arg2,abi_long arg3) +{ +abi_long ret; +void *p; + + p =lock_user (VERIFY_READ , arg2, arg3,1 ); +if (p ==NULL ) { +return -TARGET_EFAULT ; + } + ret =get_errno (write (arg1, p, arg3)); +unlock_user (p, arg2,0 ); + +return ret; +} + +/* pwrite(2) */ +static inline abi_long do_bsd_pwrite (void *cpu_env,abi_long arg1, +abi_long arg2,abi_long arg3,abi_long arg4,abi_long arg5,abi_long arg6) +{ +abi_long ret; +void *p; + + p =lock_user (VERIFY_READ , arg2, arg3,1 ); +if (p ==NULL ) { +return -TARGET_EFAULT ; + } +if (regpairs_aligned (cpu_env) !=0 ) { + arg4 = arg5; + arg5 = arg6; + } + ret =get_errno (pwrite (arg1, p, arg3,target_offset64 (arg4, arg5))); +unlock_user (p, arg2,0 ); + +return ret; +} + +/* writev(2) */ +static inline abi_long do_bsd_writev (abi_long arg1,abi_long arg2, +abi_long arg3) +{ +abi_long ret; +int count = arg3; +struct iovec *vec; + + vec =alloca (count *sizeof (struct iovec )); +if (vec ==NULL ) { +return -TARGET_ENOMEM ; + } +if (lock_iovec (VERIFY_READ , vec, arg2, count,1 ) <0 ) { +return -TARGET_EFAULT ; + } + ret =get_errno (writev (arg1, vec, count)); +unlock_iovec (vec, arg2, count,0 ); + +return ret; +} + +/* pwritev(2) */ +static inline abi_long do_bsd_pwritev (void *cpu_env,abi_long arg1, +abi_long arg2,abi_long arg3,abi_long arg4,abi_long arg5,abi_long arg6) +{ +abi_long ret; +int count = arg3; +struct iovec *vec; + + vec =alloca (count *sizeof (struct iovec )); +if (vec ==NULL ) { +return -TARGET_ENOMEM ; + } +if (lock_iovec (VERIFY_READ , vec, arg2, count,1 ) <0 ) { +return -TARGET_EFAULT ; + } +if (regpairs_aligned (cpu_env) !=0 ) { + arg4 = arg5; + arg5 = arg6; + } + ret =get_errno (pwritev (arg1, vec, count,target_offset64 (arg4, arg5))); +unlock_iovec (vec, arg2, count,0 ); + +return ret; +} + +/* open(2) */ +static inline abi_long do_bsd_open (abi_long arg1,abi_long arg2,abi_long arg3) +{ +abi_long ret; +void *p; + +LOCK_PATH (p, arg1); + ret =get_errno (open (path (p),target_to_host_bitmask (arg2, fcntl_flags_tbl), + arg3)); +UNLOCK_PATH (p, arg1); + +return ret; +} + +/* openat(2) */ +static inline abi_long do_bsd_openat (abi_long arg1,abi_long arg2, +abi_long arg3,abi_long arg4) +{ +abi_long ret; +void *p; + +LOCK_PATH (p, arg2); + ret =get_errno (openat (arg1,path (p), +target_to_host_bitmask (arg3, fcntl_flags_tbl), arg4)); +UNLOCK_PATH (p, arg2); + +return ret; +} + +/* close(2) */ +static inline abi_long do_bsd_close (abi_long arg1) +{ + +return get_errno (close (arg1)); +} + +/* closefrom(2) */ +static inline abi_long do_bsd_closefrom (abi_long arg1) +{ + +closefrom (arg1);/* returns void */ +return get_errno (0 ); +} + +/* revoke(2) */ +static inline abi_long do_bsd_revoke (abi_long arg1) +{ +abi_long ret; +void *p; + +LOCK_PATH (p, arg1); + ret =get_errno (revoke (p));/* XXX path(p)? */ +UNLOCK_PATH (p, arg1); + +return ret; +} + +/* creat(2) (obsolete) */ +static inline abi_long do_bsd_creat (abi_long arg1,abi_long arg2) +{ +abi_long ret; +void *p; + +LOCK_PATH (p, arg1); + ret =get_errno (open (path (p),O_CREAT |O_TRUNC |O_WRONLY , arg2)); +UNLOCK_PATH (p, arg1); + +return ret; +} + + +/* access(2) */ +static inline abi_long do_bsd_access (abi_long arg1,abi_long arg2) +{ +abi_long ret; +void *p; + +LOCK_PATH (p, arg1); + ret =get_errno (access (path (p), arg2)); +UNLOCK_PATH (p, arg1); + +return ret; +} + +/* eaccess(2) */ +static inline abi_long do_bsd_eaccess (abi_long arg1,abi_long arg2) +{ +abi_long ret; +void *p; + +LOCK_PATH (p, arg1); + ret =get_errno (eaccess (path (p), arg2)); +UNLOCK_PATH (p, arg1); + +return ret; +} + +/* faccessat(2) */ +static inline abi_long do_bsd_faccessat (abi_long arg1,abi_long arg2, +abi_long arg3,abi_long arg4) +{ +abi_long ret; +void *p; + +LOCK_PATH (p, arg2); + ret =get_errno (faccessat (arg1, p, arg3, arg4));/* XXX path(p)? */ +UNLOCK_PATH (p, arg2); + +return ret; +} + +/* chdir(2) */ +static inline abi_long do_bsd_chdir (abi_long arg1) +{ +abi_long ret; +void *p; + +LOCK_PATH (p, arg1); + ret =get_errno (chdir (p));/* XXX path(p)? */ +UNLOCK_PATH (p, arg1); + +return ret; +} + +/* fchdir(2) */ +static inline abi_long do_bsd_fchdir (abi_long arg1) +{ + +return get_errno (fchdir (arg1)); +} + +/* rename(2) */ +static inline abi_long do_bsd_rename (abi_long arg1,abi_long arg2) +{ +abi_long ret; +void *p1, *p2; + +LOCK_PATH (p1, arg1); +LOCK_PATH (p2, arg2); +if (!p1 || !p2) { + ret = -TARGET_EFAULT ; + }else { + ret =get_errno (rename (p1, p2));/* XXX path(p1), path(p2) */ + } +UNLOCK_PATH (p2, arg2); +UNLOCK_PATH (p1, arg1); + +return ret; +} + +/* renameat(2) */ +static inline abi_long do_bsd_renameat (abi_long arg1,abi_long arg2, +abi_long arg3,abi_long arg4) +{ +abi_long ret; +void *p1, *p2; + +LOCK_PATH (p1, arg1); +LOCK_PATH (p2, arg2); +if (!p1 || !p2) { + ret = -TARGET_EFAULT ; + }else { + ret =get_errno (renameat (arg1, p1, arg3, p2)); + } +UNLOCK_PATH (p2, arg2); +UNLOCK_PATH (p1, arg1); + +return ret; +} + +/* link(2) */ +static inline abi_long do_bsd_link (abi_long arg1,abi_long arg2) +{ +abi_long ret; +void *p1, *p2; + +LOCK_PATH (p1, arg1); +LOCK_PATH (p2, arg2); +if (!p1 || !p2) { + ret = -TARGET_EFAULT ; + }else { + ret =get_errno (link (p1, p2));/* XXX path(p1), path(p2) */ + } +UNLOCK_PATH (p2, arg2); +UNLOCK_PATH (p1, arg1); + +return ret; +} + +/* linkat(2) */ +static inline abi_long do_bsd_linkat (abi_long arg1,abi_long arg2, +abi_long arg3,abi_long arg4,abi_long arg5) +{ +abi_long ret; +void *p1, *p2; + +LOCK_PATH (p1, arg2); +LOCK_PATH (p2, arg4); +if (!p1 || !p2) { + ret = -TARGET_EFAULT ; + }else { + ret =get_errno (linkat (arg1, p1, arg3, p2, arg5)); + } +UNLOCK_PATH (p2, arg4); +UNLOCK_PATH (p1, arg2); + +return ret; +} + +/* unlink(2) */ +static inline abi_long do_bsd_unlink (abi_long arg1) +{ +abi_long ret; +void *p; + +LOCK_PATH (p, arg1); + ret =get_errno (unlink (p));/* XXX path(p) */ +UNLOCK_PATH (p, arg1); + +return ret; +} + +/* unlinkat(2) */ +static inline abi_long do_bsd_unlinkat (abi_long arg1,abi_long arg2, +abi_long arg3) +{ +abi_long ret; +void *p; + +LOCK_PATH (p, arg2); + ret =get_errno (unlinkat (arg1, p, arg3));/* XXX path(p) */ +UNLOCK_PATH (p, arg2); + +return ret; +} + +/* mkdir(2) */ +static inline abi_long do_bsd_mkdir (abi_long arg1,abi_long arg2) +{ +abi_long ret; +void *p; + +LOCK_PATH (p, arg1); + ret =get_errno (mkdir (p, arg2));/* XXX path(p) */ +UNLOCK_PATH (p, arg1); + +return ret; +} + + +/* mkdirat(2) */ +static inline abi_long do_bsd_mkdirat (abi_long arg1,abi_long arg2, +abi_long arg3) +{ +abi_long ret; +void *p; + +LOCK_PATH (p, arg2); + ret =get_errno (mkdirat (arg1, p, arg3)); +UNLOCK_PATH (p, arg2); + +return ret; +} + + +/* rmdir(2) */ +static inline abi_long do_bsd_rmdir (abi_long arg1) +{ +abi_long ret; +void *p; + +LOCK_PATH (p, arg1); + ret =get_errno (rmdir (p));/* XXX path(p)? */ +UNLOCK_PATH (p, arg1); + +return ret; +} + +/* undocumented __getcwd(char *buf, size_t len) system call */ +static inline abi_long do_bsd___getcwd (abi_long arg1,abi_long arg2) +{ +abi_long ret; +void *p; + + p =lock_user (VERIFY_WRITE , arg1, arg2,0 ); +if (p ==NULL ) { +return -TARGET_EFAULT ; + } + ret =get_errno (__getcwd (p, arg2)); +unlock_user (p, arg1, ret); + +return ret; +} + +/* dup(2) */ +static inline abi_long do_bsd_dup (abi_long arg1) +{ + +return get_errno (dup (arg1)); +} + +/* dup2(2) */ +static inline abi_long do_bsd_dup2 (abi_long arg1,abi_long arg2) +{ + +return get_errno (dup2 (arg1, arg2)); +} + +/* truncate(2) */ +static inline abi_long do_bsd_truncate (void *cpu_env,abi_long arg1, +abi_long arg2,abi_long arg3,abi_long arg4) +{ +abi_long ret; +void *p; + +LOCK_PATH (p, arg1); +if (regpairs_aligned (cpu_env) !=0 ) { + arg2 = arg3; + arg3 = arg4; + } + ret =get_errno (truncate (p,target_offset64 (arg2, arg3))); +UNLOCK_PATH (p, arg1); + +return ret; +} + +/* ftruncate(2) */ +static inline abi_long do_bsd_ftruncate (void *cpu_env,abi_long arg1, +abi_long arg2,abi_long arg3,abi_long arg4) +{ + +if (regpairs_aligned (cpu_env) !=0 ) { + arg2 = arg3; + arg3 = arg4; + } +return get_errno (ftruncate (arg1,target_offset64 (arg2, arg3))); +} + +/* acct(2) */ +static inline abi_long do_bsd_acct (abi_long arg1) +{ +abi_long ret; +void *p; + +if (arg1 ==0 ) { + ret =get_errno (acct (NULL )); + }else { +LOCK_PATH (p, arg1); + ret =get_errno (acct (path (p))); +UNLOCK_PATH (p, arg1); + } +return ret; +} + +/* sync(2) */ +static inline abi_long do_bsd_sync (void ) +{ + +sync (); +return 0 ; +} + +/* mount(2) */ +static inline abi_long do_bsd_mount (abi_long arg1,abi_long arg2,abi_long arg3, +abi_long arg4) +{ +abi_long ret; +void *p1, *p2; + +LOCK_PATH (p1, arg1); +LOCK_PATH (p2, arg2); +if (!p1 || !p2) { + ret = -TARGET_EFAULT ; + }else { +/* +* XXX arg4 should be locked, but it isn't clear how to do that +* since it's it may be not be a NULL-terminated string. +*/ +if (arg4 ==0 ) { + ret =get_errno (mount (p1, p2, arg3,NULL ));/* XXX path(p2)? */ + }else { + ret =get_errno (mount (p1, p2, arg3,g2h (arg4)));/* XXX path(p2)? */ + } + } +UNLOCK_PATH (p2, arg2); +UNLOCK_PATH (p1, arg1); + +return ret; +} + +/* unmount(2) */ +static inline abi_long do_bsd_unmount (abi_long arg1,abi_long arg2) +{ +abi_long ret; +void *p; + +LOCK_PATH (p, arg1); + ret =get_errno (unmount (p, arg2));/* XXX path(p)? */ +UNLOCK_PATH (p, arg1); + +return ret; +} + +/* nmount(2) */ +static inline abi_long do_bsd_nmount (abi_long arg1,abi_long count, +abi_long flags) +{ +abi_long ret; +struct iovec *vec; + + vec =alloca (count *sizeof (struct iovec )); +if (lock_iovec (VERIFY_READ , vec, arg1, count,1 ) <0 ) { +return -TARGET_EFAULT ; + } + ret =get_errno (nmount (vec, count, flags)); +unlock_iovec (vec, arg1, count,0 ); + +return ret; +} + +/* symlink(2) */ +static inline abi_long do_bsd_symlink (abi_long arg1,abi_long arg2) +{ +abi_long ret; +void *p1, *p2; + +LOCK_PATH (p1, arg1); +LOCK_PATH (p2, arg2); +if (!p1 || !p2) { + ret = -TARGET_EFAULT ; + }else { + ret =get_errno (symlink (p1, p2));/* XXX path(p1), path(p2) */ + } +UNLOCK_PATH (p2, arg2); +UNLOCK_PATH (p1, arg1); + +return ret; +} + +/* symlinkat(2) */ +static inline abi_long do_bsd_symlinkat (abi_long arg1,abi_long arg2, +abi_long arg3) +{ +abi_long ret; +void *p1, *p2; + +LOCK_PATH (p1, arg1); +LOCK_PATH (p2, arg3); +if (!p1 || !p2) { + ret = -TARGET_EFAULT ; + }else { + ret =get_errno (symlinkat (p1, arg2, p2));/* XXX path(p1), path(p2) */ + } +UNLOCK_PATH (p2, arg3); +UNLOCK_PATH (p1, arg1); + +return ret; +} + +/* readlink(2) */ +static inline abi_long do_bsd_readlink (abi_long arg1,abi_long arg2, +abi_long arg3) +{ +abi_long ret; +void *p1, *p2; + +LOCK_PATH (p1, arg1); + p2 =lock_user (VERIFY_WRITE , arg2, arg3,0 ); +if (!p1 || !p2) { + ret = -TARGET_EFAULT ; + }else { + ret =get_errno (readlink (path (p1), p2, arg3)); + } +unlock_user (p2, arg2, ret); +UNLOCK_PATH (p1, arg1); + +return ret; +} + +/* readlinkat(2) */ +static inline abi_long do_bsd_readlinkat (abi_long arg1,abi_long arg2, +abi_long arg3,abi_long arg4) +{ +abi_long ret; +void *p1, *p2; + +LOCK_PATH (p1, arg2); + p2 =lock_user (VERIFY_WRITE , arg3, arg4,0 ); +if (!p1 || !p2) { + ret = -TARGET_EFAULT ; + }else { + ret =get_errno (readlinkat (arg1, p1, p2, arg4)); + } +unlock_user (p2, arg3, ret); +UNLOCK_PATH (p1, arg2); + +return ret; +} + +/* chmod(2) */ +static inline abi_long do_bsd_chmod (abi_long arg1,abi_long arg2) +{ +abi_long ret; +void *p; + +LOCK_PATH (p, arg1); + ret =get_errno (chmod (p, arg2));/* XXX path(p)? */ +UNLOCK_PATH (p, arg1); + +return ret; +} + +/* fchmod(2) */ +static inline abi_long do_bsd_fchmod (abi_long arg1,abi_long arg2) +{ + +return get_errno (fchmod (arg1, arg2)); +} + +/* lchmod(2) */ +static inline abi_long do_bsd_lchmod (abi_long arg1,abi_long arg2) +{ +abi_long ret; +void *p; + +LOCK_PATH (p, arg1); + ret =get_errno (lchmod (p, arg2));/* XXX path(p)? */ +UNLOCK_PATH (p, arg1); + +return ret; +} + +/* fchmodat(2) */ +static inline abi_long do_bsd_fchmodat (abi_long arg1,abi_long arg2, +abi_long arg3,abi_long arg4) +{ +abi_long ret; +void *p; + +LOCK_PATH (p, arg2); + ret =get_errno (fchmodat (arg1, p, arg3, arg4)); +UNLOCK_PATH (p, arg2); + +return ret; +} + +/* mknod(2) */ +static inline abi_long do_bsd_mknod (abi_long arg1,abi_long arg2,abi_long arg3) +{ +abi_long ret; +void *p; + +LOCK_PATH (p, arg1); + ret =get_errno (mknod (p, arg2, arg3));/* XXX path(p)? */ +UNLOCK_PATH (p, arg1); + +return ret; +} + +/* mknodat(2) */ +static inline abi_long do_bsd_mknodat (abi_long arg1,abi_long arg2, +abi_long arg3,abi_long arg4) +{ +abi_long ret; +void *p; + +LOCK_PATH (p, arg2); + ret =get_errno (mknodat (arg1, p, arg3, arg4)); +UNLOCK_PATH (p, arg2); + +return ret; +} + +/* chown(2) */ +static inline abi_long do_bsd_chown (abi_long arg1,abi_long arg2,abi_long arg3) +{ +abi_long ret; +void *p; + +LOCK_PATH (p, arg1); + ret =get_errno (chown (p, arg2, arg3));/* XXX path(p)? */ +UNLOCK_PATH (p, arg1); + +return ret; +} + +/* fchown(2) */ +static inline abi_long do_bsd_fchown (abi_long arg1,abi_long arg2, +abi_long arg3) +{ + +return get_errno (fchown (arg1, arg2, arg3)); +} + +/* lchown(2) */ +static inline abi_long do_bsd_lchown (abi_long arg1,abi_long arg2, +abi_long arg3) +{ +abi_long ret; +void *p; + +LOCK_PATH (p, arg1); + ret =get_errno (lchown (p, arg2, arg3));/* XXX path(p)? */ +UNLOCK_PATH (p, arg1); + +return ret; +} + +/* fchownat(2) */ +static inline abi_long do_bsd_fchownat (abi_long arg1,abi_long arg2, +abi_long arg3,abi_long arg4,abi_long arg5) +{ +abi_long ret; +void *p; + +LOCK_PATH (p, arg2); + ret =get_errno (fchownat (arg1, p, arg3, arg4, arg5));/* XXX path(p)? */ +UNLOCK_PATH (p, arg2); + +return ret; +} + +/* chflags(2) */ +static inline abi_long do_bsd_chflags (abi_long arg1,abi_long arg2) +{ +abi_long ret; +void *p; + +LOCK_PATH (p, arg1); + ret =get_errno (chflags (p, arg2));/* XXX path(p)? */ +UNLOCK_PATH (p, arg1); + +return ret; +} + +/* lchflags(2) */ +static inline abi_long do_bsd_lchflags (abi_long arg1,abi_long arg2) +{ +abi_long ret; +void *p; + +LOCK_PATH (p, arg1); + ret =get_errno (lchflags (p, arg2));/* XXX path(p)? */ +UNLOCK_PATH (p, arg1); + +return ret; +} + +/* fchflags(2) */ +static inline abi_long do_bsd_fchflags (abi_long arg1,abi_long arg2) +{ + +return get_errno (fchflags (arg1, arg2)); +} + +/* chroot(2) */ +static inline abi_long do_bsd_chroot (abi_long arg1) +{ +abi_long ret; +void *p; + +LOCK_PATH (p, arg1); + ret =get_errno (chroot (p));/* XXX path(p)? */ +UNLOCK_PATH (p, arg1); + +return ret; +} + +/* flock(2) */ +static abi_long do_bsd_flock (abi_long arg1,abi_long arg2) +{ + +return get_errno (flock (arg1, arg2)); +} + +/* mkfifo(2) */ +static inline abi_long do_bsd_mkfifo (abi_long arg1,abi_long arg2) +{ +abi_long ret; +void *p; + +LOCK_PATH (p, arg1); + ret =get_errno (mkfifo (p, arg2));/* XXX path(p)? */ +UNLOCK_PATH (p, arg1); + +return ret; +} + +/* mkfifoat(2) */ +static inline abi_long do_bsd_mkfifoat (abi_long arg1,abi_long arg2, +abi_long arg3) +{ +abi_long ret; +void *p; + +LOCK_PATH (p, arg2); + ret =get_errno (mkfifoat (arg1, p, arg3)); +UNLOCK_PATH (p, arg2); + +return ret; +} + +/* pathconf(2) */ +static inline abi_long do_bsd_pathconf (abi_long arg1,abi_long arg2) +{ +abi_long ret; +void *p; + +LOCK_PATH (p, arg1); + ret =get_errno (pathconf (p, arg2));/* XXX path(p)? */ +UNLOCK_PATH (p, arg1); + +return ret; +} + +/* lpathconf(2) */ +static inline abi_long do_bsd_lpathconf (abi_long arg1,abi_long arg2) +{ +abi_long ret; +void *p; + +LOCK_PATH (p, arg1); + ret =get_errno (lpathconf (p, arg2));/* XXX path(p)? */ +UNLOCK_PATH (p, arg1); + +return ret; +} + +/* fpathconf(2) */ +static inline abi_long do_bsd_fpathconf (abi_long arg1,abi_long arg2) +{ + +return get_errno (fpathconf (arg1, arg2)); +} + +/* undelete(2) */ +static inline abi_long do_bsd_undelete (abi_long arg1) +{ +abi_long ret; +void *p; + +LOCK_PATH (p, arg1); + ret =get_errno (undelete (p));/* XXX path(p)? */ +UNLOCK_PATH (p, arg1); + +return ret; +} + +/* poll(2) */ +static abi_long do_bsd_poll (abi_long arg1,abi_long arg2,abi_long arg3) +{ +abi_long ret; +nfds_t i, nfds = arg2; +int timeout = arg3; +struct pollfd *pfd; +struct target_pollfd *target_pfd; + + target_pfd =lock_user (VERIFY_WRITE , arg1, +sizeof (struct target_pollfd ) * nfds,1 ); +if (!target_pfd) { +return -TARGET_EFAULT ; + } + pfd =alloca (sizeof (struct pollfd ) * nfds); +for (i =0 ; i < nfds; i++) { + pfd[i].fd =tswap32 (target_pfd[i].fd); + pfd[i].events =tswap16 (target_pfd[i].events); + } ret =get_errno (poll (pfd, nfds, timeout)); +if (!is_error (ret)) { +for (i =0 ; i < nfds; i++) { + target_pfd[i].revents =tswap16 (pfd[i].revents); + } + } +unlock_user (target_pfd, arg1,sizeof (struct target_pollfd ) * nfds); + +return ret; +} + +/* +* undocumented openbsd_poll(struct pollfd *fds, u_int nfds, int +* timeout) system call. +*/ +static abi_long do_bsd_openbsd_poll (abi_long arg1,abi_long arg2,abi_long arg3) +{ + +qemu_log ("qemu: Unsupported syscall openbsd_poll()\n" ); +return -TARGET_ENOSYS ; +} + +/* lseek(2) */ +static abi_long do_bsd_lseek (void *cpu_env,abi_long arg1,abi_long arg2, +abi_long arg3,abi_long arg4,abi_long arg5) +{ +abi_long ret; +#if TARGET_ABI_BITS ==32 +int64_t res; + +/* 32-bit arch's use two 32 registers for 64 bit return value */ +if (regpairs_aligned (cpu_env) !=0 ) { + res =lseek (arg1,target_offset64 (arg3, arg4), arg5); + }else { + res =lseek (arg1,target_offset64 (arg2, arg3), arg4); + } +if (res ==-1 ) { + ret =get_errno (res); + }else { + ret = res &0xFFFFFFFF ; +set_second_rval (cpu_env, (res >>32 ) &0xFFFFFFFF ); + } +#else + ret =get_errno (lseek (arg1, arg2, arg3)); +#endif +return ret; +} + +/* pipe(2) */ +static abi_long do_bsd_pipe (void *cpu_env,abi_long arg1) +{ +abi_long ret; +int host_pipe[2 ]; +int host_ret =pipe (host_pipe); + +if (host_ret !=-1 ) { +set_second_rval (cpu_env, host_pipe[1 ]); + ret = host_pipe[0 ]; + }else { + ret =get_errno (host_ret); + } +return ret; +} + +/* swapon(2) */ +static abi_long do_bsd_swapon (abi_long arg1) +{ +abi_long ret; +void *p; + +LOCK_PATH (p, arg1); + ret =get_errno (swapon (path (p))); +UNLOCK_PATH (p, arg1); + +return ret; +} + +/* swapoff(2) */ +static abi_long do_bsd_swapoff (abi_long arg1) +{ +abi_long ret; +void *p; + +LOCK_PATH (p, arg1); + ret =get_errno (swapoff (path (p))); +UNLOCK_PATH (p, arg1); + +return ret; +} + +/* +* undocumented freebsd6_pread(int fd, void *buf, size_t nbyte, int pad, +* off_t offset) system call. +*/ +static abi_long do_bsd_freebsd6_pread (abi_long arg1,abi_long arg2, +abi_long arg3,abi_long arg4,abi_long arg5) +{ + +qemu_log ("qemu: Unsupported syscall freebsd6_pread()\n" ); +return -TARGET_ENOSYS ; +} + +/* +* undocumented freebsd6_pwrite(int fd, void *buf, size_t nbyte, int pad, +* off_t offset) system call. +*/ +static abi_long do_bsd_freebsd6_pwrite (abi_long arg1,abi_long arg2, +abi_long arg3,abi_long arg4,abi_long arg5) +{ + +qemu_log ("qemu: Unsupported syscall freebsd6_pwrite()\n" ); +return -TARGET_ENOSYS ; +} + +/* +* undocumented freebsd6_lseek(int fd, int pad, off_t offset, int whence) +* system call. +*/ +static abi_long do_bsd_freebsd6_lseek (abi_long arg1,abi_long arg2, +abi_long arg3,abi_long arg4) +{ + +qemu_log ("qemu: Unsupported syscall freebsd6_lseek()\n" ); +return -TARGET_ENOSYS ; +} + +/* +* undocumented freebsd6_truncate(char *path, int pad, off_t offset) system +* call. +*/ +static abi_long do_bsd_freebsd6_truncate (abi_long arg1,abi_long arg2, +abi_long arg3) +{ + +qemu_log ("qemu: Unsupported syscall freebsd6_truncate()\n" ); +return -TARGET_ENOSYS ; +} + +/* +* undocumented freebsd6_ftruncate(int fd, int pad, off_t offset) system +* call. +*/ +static abi_long do_bsd_freebsd6_ftruncate (abi_long arg1,abi_long arg2, +abi_long arg3) +{ + +qemu_log ("qemu: Unsupported syscall freebsd6_ftruncate()\n" ); +return -TARGET_ENOSYS ; +} + +#endif /* !__BSD_FILE_H_ */
bsd-user/qemu.h +36 -0
@@ -446,6 +446,42 @@ 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 TARGET_ABI_BITS ==32 +static inline uint64_t +target_offset64 (uint32_t word0,uint32_t word1) +{ +#ifdef TARGET_WORDS_BIGENDIAN +return ((uint64_t )word0 <<32 ) | word1; +#else +return ((uint64_t )word1 <<32 ) | word0; +#endif +} +#else /* TARGET_ABI_BITS != 32 */ +static inline uint64_t +target_offset64 (uint64_t word0,uint64_t word1) +{ +return word0; +} +#endif /* TARGET_ABI_BITS != 32 */ + +/* ARM EABI and MIPS expect 64bit types aligned even on pairs of registers */ +#ifdef TARGET_ARM +static inline int +regpairs_aligned (void *cpu_env) { +return ((((CPUARMState *)cpu_env)->eabi) ==1 ); +} +#elif defined(TARGET_MIPS ) &&TARGET_ABI_BITS ==32 +static inline int regpairs_aligned (void *cpu_env) +{ +return 1 ; +} +#else +static inline int regpairs_aligned (void *cpu_env) +{ +return 0 ; +} +#endif +#if defined(CONFIG_USE_NPTL )#include <pthread.h> #endif
bsd-user/syscall.c +307 -84
488 lines not on this page · raw message
Signature · 1 line
1.7.8
PATCH v2 11/19 bsd-user: add support for stat, directory, and file control related system calls
In reply to Stacey SonThis change adds support or stubs for stat, directory, and file control related system calls including stat(2), lstat(2), fstat(2), fstatat(2), nstat(), nfstat(), nlstat(), getfh(2), lgetfh(2), fhopen(2), fhstat(2), fhstatfs(2), statfs(2), fstatfs(2), getfsstat(2), getdents(2), getdirentries(2), and fcntl(2).
--- bsd-user/Makefile.objs | 1 + bsd-user/freebsd/os-stat.c | 234 +++++++++++++++++++++++ bsd-user/freebsd/os-stat.h | 437 ++++++++++++++++++++++++++++++++++++++++++++ bsd-user/freebsd/qemu-os.h | 8 + bsd-user/netbsd/os-stat.c | 1 + bsd-user/netbsd/os-stat.h | 1 + bsd-user/openbsd/os-stat.c | 1 + bsd-user/openbsd/os-stat.h | 176 ++++++++++++++++++ bsd-user/syscall.c | 76 ++++++++ 9 files changed, 935 insertions(+), 0 deletions(-) create mode 100644 bsd-user/freebsd/os-stat.c create mode 100644 bsd-user/freebsd/os-stat.h create mode 100644 bsd-user/netbsd/os-stat.c create mode 100644 bsd-user/netbsd/os-stat.h create mode 100644 bsd-user/openbsd/os-stat.c create mode 100644 bsd-user/openbsd/os-stat.h
bsd-user/Makefile.objs +1 -0
@@ -1,5 +1,6 @@ obj-y = main.o bsdload.o elfload.o mmap.o signal.o strace.o syscall.o \ uaccess.o bsd-proc.o \ $(HOST_ABI_DIR)/os-proc.o \ + $(HOST_ABI_DIR)/os-stat.o \ $(HOST_ABI_DIR)/os-sys.o \ $(HOST_ABI_DIR)/os-time.o $(TARGET_ABI_DIR)/target_arch_cpu.o
bsd-user/freebsd/os-stat.c new file +234 -0
234 lines not on this page · raw message
bsd-user/freebsd/os-stat.h new file +437 -0
437 lines not on this page · raw message
bsd-user/freebsd/qemu-os.h +8 -0
@@ -50,4 +50,12 @@ abi_ulong copy_from_user_fdset_ptr(fd_set *fds, fd_set **fds_ptr,abi_long copy_to_user_fdset (abi_ulong target_fds_addr,const fd_set *fds,int n); +/* os-stat.c */ +abi_long h2t_freebsd_stat (abi_ulong target_addr,struct stat *host_st); +abi_long h2t_freebsd_nstat (abi_ulong target_addr,struct stat *host_st); +abi_long t2h_freebsd_fhandle (fhandle_t *host_fh,abi_ulong target_addr); +abi_long h2t_freebsd_fhandle (abi_ulong target_addr,fhandle_t *host_fh); +abi_long h2t_freebsd_statfs (abi_ulong target_addr,struct statfs *host_statfs); +abi_long target_to_host_fcntl_cmd (int cmd); +#endif /* !_QEMU_OS_H_ */
bsd-user/netbsd/os-stat.c new file +1 -0
@@ -0,0 +1 @@ +/* XXX NetBSD stat related helpers */
bsd-user/netbsd/os-stat.h new file +1 -0
@@ -0,0 +1 @@ +/* XXX NetBSD stat related helpers */
bsd-user/openbsd/os-stat.c new file +1 -0
@@ -0,0 +1 @@ +/* XXX OpenBSD stat related helpers */
bsd-user/openbsd/os-stat.h new file +176 -0
176 lines not on this page · raw message
bsd-user/syscall.c +76 -0
88 lines not on this page · raw message
Signature · 1 line
1.7.8
PATCH v2 12/19 bsd-user: add support for memory management related system calls
In reply to Stacey SonThis change adds support or stubs for memory management related system calls including mmap(2), munmap(2), mprotect(2), msync(2), mlock(2), munlock(2), mlockall(2), munlockall(2), madvise(2), minherit(2), mincore(2), shm_open(2), shm_unlink(2), shmget(2), shmctl(2), shmat(2), shmdt(2), vadvise(), sbrk(), sstk(), and freebsd6_mmap().
--- bsd-user/Makefile.objs | 2 +- bsd-user/bsd-mem.c | 122 ++++++++++++ bsd-user/bsd-mem.h | 393 ++++++++++++++++++++++++++++++++++++++ bsd-user/mmap.c | 493 ++++++++++++++++++++++++++++++------------------ bsd-user/qemu-bsd.h | 10 + bsd-user/qemu.h | 3 +- bsd-user/syscall.c | 174 ++++++++++------- 7 files changed, 942 insertions(+), 255 deletions(-) create mode 100644 bsd-user/bsd-mem.c create mode 100644 bsd-user/bsd-mem.h
bsd-user/Makefile.objs +1 -1
@@ -1,5 +1,5 @@ obj-y = main.o bsdload.o elfload.o mmap.o signal.o strace.o syscall.o \ - uaccess.o bsd-proc.o \ + uaccess.o bsd-mem.o bsd-proc.o \ $(HOST_ABI_DIR)/os-proc.o \ $(HOST_ABI_DIR)/os-stat.o \ $(HOST_ABI_DIR)/os-sys.o \
bsd-user/bsd-mem.c new file +122 -0
122 lines not on this page · raw message
bsd-user/bsd-mem.h new file +393 -0
393 lines not on this page · raw message
bsd-user/mmap.c +309 -184
655 lines not on this page · raw message
bsd-user/qemu-bsd.h +10 -0
@@ -32,6 +32,16 @@#include <sys/wait.h> #include <netinet/in.h> +/* bsd-mem.c */ +abi_long target_to_host_ipc_perm (struct ipc_perm *host_ip, +abi_ulong target_addr); +abi_long host_to_target_ipc_perm (abi_ulong target_addr, +struct ipc_perm *host_ip); +abi_long target_to_host_shmid_ds (struct shmid_ds *host_sd, +abi_ulong target_addr); +abi_long host_to_target_shmid_ds (abi_ulong target_addr, +struct shmid_ds *host_sd); +/* bsd-proc.c */ int target_to_host_resource (int code);rlim_t target_to_host_rlim (abi_ulong target_rlim);
bsd-user/qemu.h +2 -1
@@ -219,7 +219,7 @@ void QEMU_NORETURN force_sig(int target_sig);/* mmap.c */ int target_mprotect (abi_ulong start,abi_ulong len,int prot);abi_long target_mmap (abi_ulong start,abi_ulong len,int prot, -int flags,int fd,abi_ulong offset); +int flags,int fd,off_t offset);int target_munmap (abi_ulong start,abi_ulong len); abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size, abi_ulong new_size, unsigned long flags,
@@ -228,6 +228,7 @@ int target_msync(abi_ulong start, abi_ulong len, int flags);extern unsigned long last_brk;void mmap_lock (void );void mmap_unlock (void ); +abi_ulong mmap_find_vma (abi_ulong start,abi_ulong size);void cpu_list_lock (void );void cpu_list_unlock (void );#if defined(CONFIG_USE_NPTL )
bsd-user/syscall.c +105 -69
274 lines not on this page · raw message
Signature · 1 line
1.7.8
PATCH v2 13/19 bsd-user: add support for socket related system calls
In reply to Stacey SonThis change adds support or stubs for socket related system calls including accept(2), bind(2), connect(2), getpeername(2), getsockname(2), getsockopt(2), setsockopt(2), listen(2), recvfrom(2), recvmsg(2), sendmsg(2), sendto(2), socket(2), socketpair(2), shutdown(2), setfib(2), sctp_peeloff(2), sctp_generic_sendmsg(2), sctp_generic_recvmsg(2), sendfile(2), and freebsd4_sendfile(2).
--- bsd-user/Makefile.objs | 4 +- bsd-user/bsd-socket.c | 108 +++++++++ bsd-user/bsd-socket.h | 266 ++++++++++++++++++++ bsd-user/freebsd/os-socket.c | 149 ++++++++++++ bsd-user/freebsd/os-socket.h | 548 ++++++++++++++++++++++++++++++++++++++++++ bsd-user/freebsd/qemu-os.h | 6 + bsd-user/netbsd/os-socket.c | 1 + bsd-user/netbsd/os-socket.h | 98 ++++++++ bsd-user/openbsd/os-socket.c | 1 + bsd-user/openbsd/os-socket.h | 98 ++++++++ bsd-user/qemu-bsd.h | 8 + bsd-user/syscall.c | 93 +++++++ 12 files changed, 1378 insertions(+), 2 deletions(-) create mode 100644 bsd-user/bsd-socket.c create mode 100644 bsd-user/bsd-socket.h create mode 100644 bsd-user/freebsd/os-socket.c create mode 100644 bsd-user/freebsd/os-socket.h create mode 100644 bsd-user/netbsd/os-socket.c create mode 100644 bsd-user/netbsd/os-socket.h create mode 100644 bsd-user/openbsd/os-socket.c create mode 100644 bsd-user/openbsd/os-socket.h
bsd-user/Makefile.objs +2 -2
@@ -1,6 +1,6 @@ obj-y = main.o bsdload.o elfload.o mmap.o signal.o strace.o syscall.o \ - uaccess.o bsd-mem.o bsd-proc.o \ + uaccess.o bsd-mem.o bsd-proc.o bsd-socket.o \ $(HOST_ABI_DIR)/os-proc.o \ - $(HOST_ABI_DIR)/os-stat.o \ + $(HOST_ABI_DIR)/os-socket.o $(HOST_ABI_DIR)/os-stat.o \ $(HOST_ABI_DIR)/os-sys.o \ $(HOST_ABI_DIR)/os-time.o $(TARGET_ABI_DIR)/target_arch_cpu.o
bsd-user/bsd-socket.c new file +108 -0
108 lines not on this page · raw message
bsd-user/bsd-socket.h new file +266 -0
266 lines not on this page · raw message
bsd-user/freebsd/os-socket.c new file +149 -0
149 lines not on this page · raw message
bsd-user/freebsd/os-socket.h new file +548 -0
548 lines not on this page · raw message
bsd-user/freebsd/qemu-os.h +6 -0
@@ -50,6 +50,12 @@ abi_ulong copy_from_user_fdset_ptr(fd_set *fds, fd_set **fds_ptr,abi_long copy_to_user_fdset (abi_ulong target_fds_addr,const fd_set *fds,int n); +/* os-socket.c */ +abi_long t2h_freebsd_cmsg (struct msghdr *msgh, +struct target_msghdr *target_msgh); +abi_long h2t_freebsd_cmsg (struct target_msghdr *target_msgh, +struct msghdr *msgh); +/* os-stat.c */ abi_long h2t_freebsd_stat (abi_ulong target_addr,struct stat *host_st);abi_long h2t_freebsd_nstat (abi_ulong target_addr,struct stat *host_st);
bsd-user/netbsd/os-socket.c new file +1 -0
@@ -0,0 +1 @@ +/* XXX NetBSD socket related helpers */
bsd-user/netbsd/os-socket.h new file +98 -0
98 lines not on this page · raw message
bsd-user/openbsd/os-socket.c new file +1 -0
@@ -0,0 +1 @@ +/* XXX OpenBSD socket related helpers */
bsd-user/openbsd/os-socket.h new file +98 -0
98 lines not on this page · raw message
bsd-user/qemu-bsd.h +8 -0
@@ -50,4 +50,12 @@ abi_long host_to_target_rusage(abi_ulong target_addr, const struct rusage *rusage);int host_to_target_waitstatus (int status); +/* bsd-socket.c */ +abi_long target_to_host_sockaddr (struct sockaddr *addr,abi_ulong target_addr, +socklen_t len); +abi_long host_to_target_sockaddr (abi_ulong target_addr,struct sockaddr *addr, +socklen_t len); +abi_long target_to_host_ip_mreq (struct ip_mreqn *mreqn,abi_ulong target_addr, +socklen_t len); +#endif /* !_QEMU_BSD_H_ */
bsd-user/syscall.c +93 -0
110 lines not on this page · raw message
Signature · 1 line
1.7.8
PATCH v2 14/19 bsd-user: add support for thread related system calls
In reply to Stacey SonThis change adds support or stubs for thread related system calls including thr_create(), thr_new(), thr_set_name(), thr_self(), thr_suspend(), thr_wake(), thr_kill(), thr_kill2(), rtprio_thread(2), getcontext(2), setcontext(2), swapcontext(2), _umtx_lock(), _umtx_unlock(), and _umtx_op().
--- bsd-user/Makefile.objs | 2 +- bsd-user/freebsd/os-thread.c | 1001 ++++++++++++++++++++++++++++++++++++++++++ bsd-user/freebsd/os-thread.h | 511 +++++++++++++++++++++ bsd-user/freebsd/qemu-os.h | 6 + bsd-user/mmap.c | 26 +- bsd-user/netbsd/os-thread.c | 1 + bsd-user/netbsd/os-thread.h | 133 ++++++ bsd-user/openbsd/os-thread.c | 1 + bsd-user/openbsd/os-thread.h | 133 ++++++ bsd-user/qemu.h | 59 +++- bsd-user/syscall.c | 71 +++- bsd-user/syscall_defs.h | 6 +- include/qemu/tls.h | 2 +- 13 files changed, 1934 insertions(+), 18 deletions(-) create mode 100644 bsd-user/freebsd/os-thread.c create mode 100644 bsd-user/freebsd/os-thread.h create mode 100644 bsd-user/netbsd/os-thread.c create mode 100644 bsd-user/netbsd/os-thread.h create mode 100644 bsd-user/openbsd/os-thread.c create mode 100644 bsd-user/openbsd/os-thread.h
bsd-user/Makefile.objs +1 -1
@@ -2,5 +2,5 @@ obj-y = main.o bsdload.o elfload.o mmap.o signal.o strace.o syscall.o \ uaccess.o bsd-mem.o bsd-proc.o bsd-socket.o \ $(HOST_ABI_DIR)/os-proc.o \ $(HOST_ABI_DIR)/os-socket.o $(HOST_ABI_DIR)/os-stat.o \ - $(HOST_ABI_DIR)/os-sys.o \ + $(HOST_ABI_DIR)/os-sys.o $(HOST_ABI_DIR)/os-thread.o \ $(HOST_ABI_DIR)/os-time.o $(TARGET_ABI_DIR)/target_arch_cpu.o
bsd-user/freebsd/os-thread.c new file +1001 -0
1,001 lines not on this page · raw message
bsd-user/freebsd/os-thread.h new file +511 -0
511 lines not on this page · raw message
bsd-user/freebsd/qemu-os.h +6 -0
@@ -64,4 +64,10 @@ abi_long h2t_freebsd_fhandle(abi_ulong target_addr, fhandle_t *host_fh);abi_long h2t_freebsd_statfs (abi_ulong target_addr,struct statfs *host_statfs);abi_long target_to_host_fcntl_cmd (int cmd); +/* os-thread.c */ +abi_long t2h_freebsd_rtprio (struct rtprio *host_rtp,abi_ulong target_addr); +abi_long h2t_freebsd_rtprio (abi_ulong target_addr,struct rtprio *host_rtp); +abi_long do_freebsd_thr_new (CPUArchState *env,abi_ulong target_param_addr, +int32_t param_size); +#endif /* !_QEMU_OS_H_ */
bsd-user/mmap.c +25 -1
@@ -29,13 +29,37 @@// #define DEBUG_MMAP -/* We aren't threadsafe to start with, so no need to worry about locking. */ +pthread_mutex_t mmap_mutex =PTHREAD_MUTEX_INITIALIZER ; +static __threadint mmap_lock_count; +void mmap_lock (void ) { +if (mmap_lock_count++ ==0 ) { +pthread_mutex_lock (&mmap_mutex); + } }void mmap_unlock (void ) { +if (--mmap_lock_count ==0 ) { +pthread_mutex_unlock (&mmap_mutex); + } +} + +/* Grab lock to make sure things are in a consistent state after fork(). */ +void mmap_fork_start (void ) +{ +if (mmap_lock_count) +abort (); +pthread_mutex_lock (&mmap_mutex); +} + +void mmap_fork_end (int child) +{ +if (child) +pthread_mutex_init (&mmap_mutex,NULL ); +else +pthread_mutex_unlock (&mmap_mutex); }/* NOTE: all the constants are the HOST ones, but addresses are target. */
bsd-user/netbsd/os-thread.c new file +1 -0
@@ -0,0 +1 @@ +/* XXX NetBSD thread related helpers */
bsd-user/netbsd/os-thread.h new file +133 -0
133 lines not on this page · raw message
bsd-user/openbsd/os-thread.c new file +1 -0
@@ -0,0 +1 @@ +/* XXX OpenBSD thread related helpers */
bsd-user/openbsd/os-thread.h new file +133 -0
133 lines not on this page · raw message
bsd-user/qemu.h +51 -8
108 lines not on this page · raw message
bsd-user/syscall.c +69 -2
95 lines not on this page · raw message
bsd-user/syscall_defs.h +1 -5
@@ -642,11 +642,7 @@ typedef struct {#define TARGET_UMTX_UNOWNED 0x0#define TARGET_UMUTEX_UNOWNED 0x0 -#if TARGET_ABI_BITS ==32 -# define TARGET_UMTX_CONTESTED 0x80000000 -#else -# define TARGET_UMTX_CONTESTED 0x8000000000000000LL -#endif /* ! TARGET_ABI_BITS == 32 */ +#define TARGET_UMTX_CONTESTED (abi_ulong)(-1)#define TARGET_UMUTEX_CONTESTED 0x80000000U/* flags for umutex */
include/qemu/tls.h +1 -1
@@ -38,7 +38,7 @@* TODO: proper implementations via Win32 .tls sections and * POSIX pthread_getspecific. */ -#ifdef __linux__ +#if defined(__linux__) || defined(__FreeBSD__)#define DECLARE_TLS (type, x) extern DEFINE_TLS(type, x)#define DEFINE_TLS (type, x) __thread __typeof__(type) tls__##x#define tls_var (x) tls__##x
Signature · 1 line
1.7.8
Re: [Qemu-devel] [PATCH v2 14/19] bsd-user: add support for thread related system calls
Il 08/11/2013 17:33, Stacey Son ha scritto:
include/qemu/tls.h line 44
Quoted 13 lines
include/qemu/tls.h +1
-1@@ -38,7 +38,7 @@* TODO: proper implementations via Win32 .tls sections and * POSIX pthread_getspecific. */ -#ifdef __linux__ +#if defined(__linux__) || defined(__FreeBSD__)#define DECLARE_TLS (type, x) extern DEFINE_TLS(type, x)#define DEFINE_TLS (type, x) __thread __typeof__(type) tls__##x#define tls_var (x) tls__##x
PATCH v2 15/19 bsd-user: add support for the ioctl system call
In reply to Stacey SonThis change adds support for the ioctl system call. This uses the generic thunking code to convert data between the host and target CPU.
--- Makefile.target | 2 +- bsd-user/Makefile.objs | 2 +- bsd-user/bsd-ioctl.c | 448 ++++++++++++++++++++++++++++++++++++ bsd-user/bsd-ioctl.h | 27 +++ bsd-user/freebsd/os-ioctl-cmds.h | 47 ++++ bsd-user/freebsd/os-ioctl-filio.h | 45 ++++ bsd-user/freebsd/os-ioctl-ioccom.h | 54 +++++ bsd-user/freebsd/os-ioctl-ttycom.h | 257 +++++++++++++++++++++ bsd-user/freebsd/os-ioctl-types.h | 7 + bsd-user/netbsd/os-ioctl-cmds.h | 48 ++++ bsd-user/netbsd/os-ioctl-filio.h | 29 +++ bsd-user/netbsd/os-ioctl-ioccom.h | 38 +++ bsd-user/netbsd/os-ioctl-ttycom.h | 240 +++++++++++++++++++ bsd-user/netbsd/os-ioctl-types.h | 7 + bsd-user/openbsd/os-ioctl-cmds.h | 48 ++++ bsd-user/openbsd/os-ioctl-filio.h | 29 +++ bsd-user/openbsd/os-ioctl-ioccom.h | 38 +++ bsd-user/openbsd/os-ioctl-ttycom.h | 240 +++++++++++++++++++ bsd-user/openbsd/os-ioctl-types.h | 7 + bsd-user/qemu.h | 1 + bsd-user/syscall.c | 27 ++- 21 files changed, 1632 insertions(+), 9 deletions(-) create mode 100644 bsd-user/bsd-ioctl.c create mode 100644 bsd-user/bsd-ioctl.h create mode 100644 bsd-user/freebsd/os-ioctl-cmds.h create mode 100644 bsd-user/freebsd/os-ioctl-filio.h create mode 100644 bsd-user/freebsd/os-ioctl-ioccom.h create mode 100644 bsd-user/freebsd/os-ioctl-ttycom.h create mode 100644 bsd-user/freebsd/os-ioctl-types.h create mode 100644 bsd-user/netbsd/os-ioctl-cmds.h create mode 100644 bsd-user/netbsd/os-ioctl-filio.h create mode 100644 bsd-user/netbsd/os-ioctl-ioccom.h create mode 100644 bsd-user/netbsd/os-ioctl-ttycom.h create mode 100644 bsd-user/netbsd/os-ioctl-types.h create mode 100644 bsd-user/openbsd/os-ioctl-cmds.h create mode 100644 bsd-user/openbsd/os-ioctl-filio.h create mode 100644 bsd-user/openbsd/os-ioctl-ioccom.h create mode 100644 bsd-user/openbsd/os-ioctl-ttycom.h create mode 100644 bsd-user/openbsd/os-ioctl-types.h
Makefile.target +1 -1
@@ -103,7 +103,7 @@ QEMU_CFLAGS+=-I$(SRC_PATH)/bsd-user -I$(SRC_PATH)/bsd-user/$(TARGET_ABI_DIR) \ -I$(SRC_PATH)/bsd-user/$(HOST_ABI_DIR) obj-y += bsd-user/ -obj-y += gdbstub.o user-exec.o +obj-y += gdbstub.o thunk.o user-exec.o endif #CONFIG_BSD_USER
bsd-user/Makefile.objs +1 -1
@@ -1,5 +1,5 @@ obj-y = main.o bsdload.o elfload.o mmap.o signal.o strace.o syscall.o \ - uaccess.o bsd-mem.o bsd-proc.o bsd-socket.o \ + uaccess.o bsd-ioctl.o bsd-mem.o bsd-proc.o bsd-socket.o \ $(HOST_ABI_DIR)/os-proc.o \ $(HOST_ABI_DIR)/os-socket.o $(HOST_ABI_DIR)/os-stat.o \ $(HOST_ABI_DIR)/os-sys.o $(HOST_ABI_DIR)/os-thread.o \
bsd-user/bsd-ioctl.c new file +448 -0
448 lines not on this page · raw message
bsd-user/bsd-ioctl.h new file +27 -0
@@ -0,0 +1,27 @@ +/* +* ioctl system call definitions +* +* Copyright (c) 2013 Stacey D. Son +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef __BSD_IOCTL_H_ +#define __BSD_IOCTL_H_ + +abi_long do_bsd_ioctl (int fd,abi_long cmd,abi_long arg); +void init_bsd_ioctl (void ); + +#endif /* !__BSD_IOCTL_H_ */ +
bsd-user/freebsd/os-ioctl-cmds.h new file +47 -0
47 lines not on this page · raw message
bsd-user/freebsd/os-ioctl-filio.h new file +45 -0
45 lines not on this page · raw message
bsd-user/freebsd/os-ioctl-ioccom.h new file +54 -0
54 lines not on this page · raw message
bsd-user/freebsd/os-ioctl-ttycom.h new file +257 -0
257 lines not on this page · raw message
bsd-user/freebsd/os-ioctl-types.h new file +7 -0
@@ -0,0 +1,7 @@ + +STRUCT_SPECIAL(termios) + +STRUCT(winsize, TYPE_SHORT, TYPE_SHORT, TYPE_SHORT, TYPE_SHORT) + +STRUCT(fiodgname_arg, TYPE_INT, TYPE_PTRVOID) +
bsd-user/netbsd/os-ioctl-cmds.h new file +48 -0
48 lines not on this page · raw message
bsd-user/netbsd/os-ioctl-filio.h new file +29 -0
@@ -0,0 +1,29 @@ +#ifndef _IOCTL_FILIO_H_ +#define _IOCTL_FILIO_H_ + +/* XXX needs to be fixed for NetBSD dependencies */ + +/* see sys/filio.h */ +#define TARGET_FIOCLEX TARGET_IO('f', 1) +#define TARGET_FIONCLEX TARGET_IO('f', 2) +#define TARGET_FIONREAD TARGET_IOR('f', 127, int) +#define TARGET_FIONBIO TARGET_IOW('f', 126, int) +#define TARGET_FIOASYNC TARGET_IOW('f', 125, int) +#define TARGET_FIOSETOWN TARGET_IOW('f', 124, int) +#define TARGET_FIOGETOWN TARGET_IOR('f', 123, int) +#define TARGET_FIODTYPE TARGET_IOR('f', 122, int) +#define TARGET_FIOGETLBA TARGET_IOR('f', 121, int) + +struct target_fiodgname_arg { +int32_t len; +abi_ulong buf; +}; + +#define TARGET_FIODGNAME TARGET_IOW('f', 120, \ + struct target_fiodgname_arg) +#define TARGET_FIONWRITE TARGET_IOR('f', 119, int) +#define TARGET_FIONSPACE TARGET_IOR('f', 118, int) +#define TARGET_FIOSEEKDATA TARGET_IOWR('f', 97, off_t) +#define TARGET_FIOSEEKHOLE TARGET_IOWR('f', 98, off_t) + +#endif /* !_IOCTL_FILIO_H_ */
bsd-user/netbsd/os-ioctl-ioccom.h new file +38 -0
@@ -0,0 +1,38 @@ +#ifndef _IOCTL_IOCCOM_H_ +#define _IOCTL_IOCCOM_H_ + +/* XXX needs to be fixed for NetBSD dependencies */ + +/* +* Ioctl's have the command encoded in the lower word, and the size of +* any in or out parameters in the upper word. The high 3 bits of the +* upper word are used to encode the in/out status of the parameter. +*/ +/* number of bits for ioctl size */ +#define TARGET_IOCPARM_SHIFT 13 + +/* parameter length mask */ +#define TARGET_IOCPARM_MASK ((1 << TARGET_IOCPARM_SHIFT) - 1) + +#define TARGET_IOCPARM_LEN (x) (((x) >> 16) & TARGET_IOCPARM_MASK) +#define TARGET_IOCBASECMD (x) ((x) & ~(TARGET_IOCPARM_MASK << 16)) +#define TARGET_IOCGROUP (x) (((x) >> 8) & 0xff) + +#define TARGET_IOCPARM_MAX (1 << TARGET_IOCPARM_SHIFT)/* max size of ioctl */ +#define TARGET_IOC_VOID 0x20000000/* no parameters */ +#define TARGET_IOC_OUT 0x40000000/* copy out parameters */ +#define TARGET_IOC_IN 0x80000000/* copy in parameters */ +#define TARGET_IOC_INOUT (TARGET_IOC_IN|TARGET_IOC_OUT) +#define TARGET_IOC_DIRMASK (TARGET_IOC_VOID|TARGET_IOC_OUT|TARGET_IOC_IN) + +#define TARGET_IOC (inout, group, num, len) ((abi_ulong) \ + ((inout) | (((len) & TARGET_IOCPARM_MASK) << 16) | ((group) << 8) \ + | (num))) +#define TARGET_IO (g, n) TARGET_IOC(IOC_VOID, (g), (n), 0) +#define TARGET_IOWINT (g, n) TARGET_IOC(IOC_VOID, (g), (n), sizeof(int)) +#define TARGET_IOR (g, n, t) TARGET_IOC(IOC_OUT, (g), (n), sizeof(t)) +#define TARGET_IOW (g, n, t) TARGET_IOC(IOC_IN, (g), (n), sizeof(t)) +/* this should be _IORW, but stdio got there first */ +#define TARGET_IOWR (g, n, t) TARGET_IOC(IOC_INOUT, (g), (n), sizeof(t)) + +#endif /* !_IOCTL_IOCCOM_H_ */
bsd-user/netbsd/os-ioctl-ttycom.h new file +240 -0
240 lines not on this page · raw message
bsd-user/netbsd/os-ioctl-types.h new file +7 -0
@@ -0,0 +1,7 @@ +/* XXX should be fixed for NetBSD types and structs */ +STRUCT_SPECIAL(termios) + +STRUCT(winsize, TYPE_SHORT, TYPE_SHORT, TYPE_SHORT, TYPE_SHORT) + +STRUCT(fiodgname_arg, TYPE_INT, TYPE_PTRVOID) +
bsd-user/openbsd/os-ioctl-cmds.h new file +48 -0
48 lines not on this page · raw message
bsd-user/openbsd/os-ioctl-filio.h new file +29 -0
@@ -0,0 +1,29 @@ +#ifndef _IOCTL_FILIO_H_ +#define _IOCTL_FILIO_H_ + +/* XXX needs to be fixed for OpenBSD dependencies */ + +/* see sys/filio.h */ +#define TARGET_FIOCLEX TARGET_IO('f', 1) +#define TARGET_FIONCLEX TARGET_IO('f', 2) +#define TARGET_FIONREAD TARGET_IOR('f', 127, int) +#define TARGET_FIONBIO TARGET_IOW('f', 126, int) +#define TARGET_FIOASYNC TARGET_IOW('f', 125, int) +#define TARGET_FIOSETOWN TARGET_IOW('f', 124, int) +#define TARGET_FIOGETOWN TARGET_IOR('f', 123, int) +#define TARGET_FIODTYPE TARGET_IOR('f', 122, int) +#define TARGET_FIOGETLBA TARGET_IOR('f', 121, int) + +struct target_fiodgname_arg { +int32_t len; +abi_ulong buf; +}; + +#define TARGET_FIODGNAME TARGET_IOW('f', 120, \ + struct target_fiodgname_arg) +#define TARGET_FIONWRITE TARGET_IOR('f', 119, int) +#define TARGET_FIONSPACE TARGET_IOR('f', 118, int) +#define TARGET_FIOSEEKDATA TARGET_IOWR('f', 97, off_t) +#define TARGET_FIOSEEKHOLE TARGET_IOWR('f', 98, off_t) + +#endif /* !_IOCTL_FILIO_H_ */
bsd-user/openbsd/os-ioctl-ioccom.h new file +38 -0
@@ -0,0 +1,38 @@ +#ifndef _IOCTL_IOCCOM_H_ +#define _IOCTL_IOCCOM_H_ + +/* XXX needs to be fixed for OpenBSD dependencies */ + +/* +* Ioctl's have the command encoded in the lower word, and the size of +* any in or out parameters in the upper word. The high 3 bits of the +* upper word are used to encode the in/out status of the parameter. +*/ +/* number of bits for ioctl size */ +#define TARGET_IOCPARM_SHIFT 13 + +/* parameter length mask */ +#define TARGET_IOCPARM_MASK ((1 << TARGET_IOCPARM_SHIFT) - 1) + +#define TARGET_IOCPARM_LEN (x) (((x) >> 16) & TARGET_IOCPARM_MASK) +#define TARGET_IOCBASECMD (x) ((x) & ~(TARGET_IOCPARM_MASK << 16)) +#define TARGET_IOCGROUP (x) (((x) >> 8) & 0xff) + +#define TARGET_IOCPARM_MAX (1 << TARGET_IOCPARM_SHIFT)/* max size of ioctl */ +#define TARGET_IOC_VOID 0x20000000/* no parameters */ +#define TARGET_IOC_OUT 0x40000000/* copy out parameters */ +#define TARGET_IOC_IN 0x80000000/* copy in parameters */ +#define TARGET_IOC_INOUT (TARGET_IOC_IN|TARGET_IOC_OUT) +#define TARGET_IOC_DIRMASK (TARGET_IOC_VOID|TARGET_IOC_OUT|TARGET_IOC_IN) + +#define TARGET_IOC (inout, group, num, len) ((abi_ulong) \ + ((inout) | (((len) & TARGET_IOCPARM_MASK) << 16) | ((group) << 8) \ + | (num))) +#define TARGET_IO (g, n) TARGET_IOC(IOC_VOID, (g), (n), 0) +#define TARGET_IOWINT (g, n) TARGET_IOC(IOC_VOID, (g), (n), sizeof(int)) +#define TARGET_IOR (g, n, t) TARGET_IOC(IOC_OUT, (g), (n), sizeof(t)) +#define TARGET_IOW (g, n, t) TARGET_IOC(IOC_IN, (g), (n), sizeof(t)) +/* this should be _IORW, but stdio got there first */ +#define TARGET_IOWR (g, n, t) TARGET_IOC(IOC_INOUT, (g), (n), sizeof(t)) + +#endif /* !_IOCTL_IOCCOM_H_ */
bsd-user/openbsd/os-ioctl-ttycom.h new file +240 -0
240 lines not on this page · raw message
bsd-user/openbsd/os-ioctl-types.h new file +7 -0
@@ -0,0 +1,7 @@ +/* XXX should be fixed for OpenBSD types and structs */ +STRUCT_SPECIAL(termios) + +STRUCT(winsize, TYPE_SHORT, TYPE_SHORT, TYPE_SHORT, TYPE_SHORT) + +STRUCT(fiodgname_arg, TYPE_INT, TYPE_PTRVOID) +
bsd-user/qemu.h +1 -0
@@ -36,6 +36,7 @@ enum BSDType { };extern enum BSDType bsd_type; +#include "exec/user/thunk.h" #include "syscall_defs.h" #include "syscall.h" #include "target_os_vmparam.h"
bsd-user/syscall.c +20 -7
@@ -35,6 +35,7 @@/* BSD independent syscall shims */ #include "bsd-file.h" +#include "bsd-ioctl.h" #include "bsd-mem.h" #include "bsd-proc.h" #include "bsd-signal.h"
@@ -81,16 +82,18 @@ int is_error(abi_long ret)* other lock functions have a return code of 0 for failure. */ static abi_long lock_iovec (int type,struct iovec *vec,abi_ulong target_addr, -int count,int copy) +int count,int copy) {struct target_iovec *target_vec;abi_ulong base;int i; - target_vec =lock_user (VERIFY_READ , target_addr, count *sizeof (struct target_iovec ),1 ); -if (!target_vec) + target_vec =lock_user (VERIFY_READ , target_addr, + count *sizeof (struct target_iovec ),1 ); +if (!target_vec) {return -TARGET_EFAULT ; -for (i =0 ;i < count; i++) { + } +for (i =0 ; i < count; i++) { base =tswapl (target_vec[i].iov_base); vec[i].iov_len =tswapl (target_vec[i].iov_len);if (vec[i].iov_len !=0 ) {
@@ -107,16 +110,17 @@ static abi_long lock_iovec(int type, struct iovec *vec, abi_ulong target_addr, }static abi_long unlock_iovec (struct iovec *vec,abi_ulong target_addr, -int count,int copy) +int count,int copy) {struct target_iovec *target_vec;abi_ulong base;int i; - target_vec =lock_user (VERIFY_READ , target_addr, count *sizeof (struct target_iovec ),1 ); + target_vec =lock_user (VERIFY_READ , target_addr, + count *sizeof (struct target_iovec ),1 );if (!target_vec)return -TARGET_EFAULT ; -for (i =0 ;i < count; i++) { +for (i =0 ; i < count; i++) {if (target_vec[i].iov_base) { base =tswapl (target_vec[i].iov_base);unlock_user (vec[i].iov_base, base, copy ? vec[i].iov_len :0 );
@@ -1177,6 +1181,13 @@ abi_long do_freebsd_syscall(void *cpu_env, int num, abi_long arg1,break ;/* +* ioctl(2) +*/ +case TARGET_FREEBSD_NR_ioctl:/* ioctl(2) */ + ret =do_bsd_ioctl (arg1, arg2, arg3); +break ; + +/* * sys{ctl, arch, call} */ case TARGET_FREEBSD_NR___sysctl:/* sysctl(3) */
@@ -1309,4 +1320,6 @@ abi_long do_openbsd_syscall(void *cpu_env, int num, abi_long arg1,void syscall_init (void ) { + +init_bsd_ioctl (); }
Signature · 1 line
1.7.8
PATCH v2 16/19 bsd-user: add support for extended attribute and ACL related syscalls
In reply to Stacey SonThis change add support for extended attribute and Access Control List (ACL) related system calls including extattrctl(), extattr_set_file(2), extattr_delete_file(2), extattr_set_fd(2), extattr_get_fd(2), extattr_delete_fd(2), extattr_get_link(2), extattr_set_link(2), extattr_delete_link(2), extattr_list_fd(2), extattr_list_file(2), extattr_list_link(2), __acl_aclcheck_fd(), __acl_aclcheck_file(), __acl_aclcheck_link(), __acl_delete_fd(), __acl_delete_file(), __acl_delete_link(), __acl_get_fd(), __acl_get_file(), __acl_get_link(), __acl_get_fd(), __acl_set_file(), and __acl_set_link().
--- bsd-user/Makefile.objs | 2 +- bsd-user/freebsd/os-extattr.c | 119 ++++++++ bsd-user/freebsd/os-extattr.h | 644 +++++++++++++++++++++++++++++++++++++++++ bsd-user/freebsd/qemu-os.h | 6 + bsd-user/netbsd/os-extattr.h | 247 ++++++++++++++++ bsd-user/openbsd/os-extattr.h | 247 ++++++++++++++++ bsd-user/syscall.c | 104 +++++++ 7 files changed, 1368 insertions(+), 1 deletions(-) create mode 100644 bsd-user/freebsd/os-extattr.c create mode 100644 bsd-user/freebsd/os-extattr.h create mode 100644 bsd-user/netbsd/os-extattr.h create mode 100644 bsd-user/openbsd/os-extattr.h
bsd-user/Makefile.objs +1 -1
@@ -1,6 +1,6 @@ obj-y = main.o bsdload.o elfload.o mmap.o signal.o strace.o syscall.o \ uaccess.o bsd-ioctl.o bsd-mem.o bsd-proc.o bsd-socket.o \ - $(HOST_ABI_DIR)/os-proc.o \ + $(HOST_ABI_DIR)/os-extattr.o $(HOST_ABI_DIR)/os-proc.o \ $(HOST_ABI_DIR)/os-socket.o $(HOST_ABI_DIR)/os-stat.o \ $(HOST_ABI_DIR)/os-sys.o $(HOST_ABI_DIR)/os-thread.o \ $(HOST_ABI_DIR)/os-time.o $(TARGET_ABI_DIR)/target_arch_cpu.o
bsd-user/freebsd/os-extattr.c new file +119 -0
119 lines not on this page · raw message
bsd-user/freebsd/os-extattr.h new file +644 -0
644 lines not on this page · raw message
bsd-user/freebsd/qemu-os.h +6 -0
@@ -70,4 +70,10 @@ abi_long h2t_freebsd_rtprio(abi_ulong target_addr, struct rtprio *host_rtp);abi_long do_freebsd_thr_new (CPUArchState *env,abi_ulong target_param_addr,int32_t param_size); +/* os-extattr.c */ +struct acl ; +abi_long t2h_freebsd_acl (struct acl *host_acl,abi_ulong target_addr); +abi_long h2t_freebsd_acl (abi_ulong target_addr,struct acl *host_acl); +abi_long t2h_freebsd_acl_type (acl_type_t *host_type,abi_long target_type); +#endif /* !_QEMU_OS_H_ */
bsd-user/netbsd/os-extattr.h new file +247 -0
247 lines not on this page · raw message
bsd-user/openbsd/os-extattr.h new file +247 -0
247 lines not on this page · raw message
bsd-user/syscall.c +104 -0
116 lines not on this page · raw message
Signature · 1 line
1.7.8
PATCH v2 17/19 bsd-user: add support for miscellaneous system calls
In reply to Stacey SonThis change adds support or stubs for miscellaneous system calls including extattr*() (extended attributes), __acl*() (access control lists), sem*() (system V semaphores), msg*() (system V messages), sched_*() (scheduler control), cpuset*() (CPU affinity set management), mod*() and kld*() (kernel module), rctl_*() (resource controls), __mac_*() (Mandatory Access Control), posix_*() (additional posix support), and other miscellaneous system calls.
--- bsd-user/Makefile.objs | 2 +- bsd-user/bsd-misc.c | 209 +++++++++++++++++++++ bsd-user/bsd-misc.h | 339 +++++++++++++++++++++++++++++++++ bsd-user/freebsd/os-misc.h | 442 ++++++++++++++++++++++++++++++++++++++++++++ bsd-user/netbsd/os-misc.h | 375 +++++++++++++++++++++++++++++++++++++ bsd-user/openbsd/os-misc.h | 375 +++++++++++++++++++++++++++++++++++++ bsd-user/qemu-bsd.h | 18 ++ bsd-user/syscall.c | 229 +++++++++++++++++++++++ 8 files changed, 1988 insertions(+), 1 deletions(-) create mode 100644 bsd-user/bsd-misc.c create mode 100644 bsd-user/bsd-misc.h create mode 100644 bsd-user/freebsd/os-misc.h create mode 100644 bsd-user/netbsd/os-misc.h create mode 100644 bsd-user/openbsd/os-misc.h
bsd-user/Makefile.objs +1 -1
@@ -1,5 +1,5 @@ obj-y = main.o bsdload.o elfload.o mmap.o signal.o strace.o syscall.o \ - uaccess.o bsd-ioctl.o bsd-mem.o bsd-proc.o bsd-socket.o \ + uaccess.o bsd-ioctl.o bsd-mem.o bsd-misc.o bsd-proc.o bsd-socket.o \ $(HOST_ABI_DIR)/os-extattr.o $(HOST_ABI_DIR)/os-proc.o \ $(HOST_ABI_DIR)/os-socket.o $(HOST_ABI_DIR)/os-stat.o \ $(HOST_ABI_DIR)/os-sys.o $(HOST_ABI_DIR)/os-thread.o \
bsd-user/bsd-misc.c new file +209 -0
209 lines not on this page · raw message
bsd-user/bsd-misc.h new file +339 -0
339 lines not on this page · raw message
bsd-user/freebsd/os-misc.h new file +442 -0
442 lines not on this page · raw message
bsd-user/netbsd/os-misc.h new file +375 -0
375 lines not on this page · raw message
bsd-user/openbsd/os-misc.h new file +375 -0
375 lines not on this page · raw message
bsd-user/qemu-bsd.h +18 -0
@@ -58,4 +58,22 @@ abi_long host_to_target_sockaddr(abi_ulong target_addr, struct sockaddr *addr,abi_long target_to_host_ip_mreq (struct ip_mreqn *mreqn,abi_ulong target_addr,socklen_t len); +/* bsd-misc.c */ +abi_long host_to_target_uuid (abi_ulong target_addr,struct uuid *host_uuid); + +abi_long target_to_host_semarray (int semid,unsigned short **host_array, +abi_ulong target_addr); +abi_long host_to_target_semarray (int semid,abi_ulong target_addr, +unsigned short **host_array); + +abi_long target_to_host_semid_ds (struct semid_ds *host_sd, +abi_ulong target_addr); +abi_long host_to_target_semid_ds (abi_ulong target_addr, +struct semid_ds *host_sd); + +abi_long target_to_host_msqid_ds (struct msqid_ds *host_md, +abi_ulong target_addr); +abi_long host_to_target_msqid_ds (abi_ulong target_addr, +struct msqid_ds *host_md); +#endif /* !_QEMU_BSD_H_ */
bsd-user/syscall.c +229 -0
247 lines not on this page · raw message
Signature · 1 line
1.7.8
PATCH v2 18/19 bsd-user: add arm, mips and mips64 options to configure target-list
In reply to Stacey SonThis change adds arm-bsd-user, mips-bsd-user, mips64-bsd-user, mips64el-bsd-user, and mipsel-bsd-user as --target-list options to configure.
--- default-configs/arm-bsd-user.mak | 3 +++ default-configs/mips-bsd-user.mak | 1 + default-configs/mips64-bsd-user.mak | 1 + default-configs/mips64el-bsd-user.mak | 1 + default-configs/mipsel-bsd-user.mak | 1 + 5 files changed, 7 insertions(+), 0 deletions(-) create mode 100644 default-configs/arm-bsd-user.mak create mode 100644 default-configs/mips-bsd-user.mak create mode 100644 default-configs/mips64-bsd-user.mak create mode 100644 default-configs/mips64el-bsd-user.mak create mode 100644 default-configs/mipsel-bsd-user.mak
default-configs/arm-bsd-user.mak new file +3 -0
@@ -0,0 +1,3 @@ +# Default configuration for arm-bsd-user + +CONFIG_GDBSTUB_XML=y
default-configs/mips-bsd-user.mak new file +1 -0
@@ -0,0 +1 @@ +# Default configuration for mips-bsd-user
default-configs/mips64-bsd-user.mak new file +1 -0
@@ -0,0 +1 @@ +# Default configuration for mips64-bsd-user
default-configs/mips64el-bsd-user.mak new file +1 -0
@@ -0,0 +1 @@ +# Default configuration for mips64el-bsd-user
default-configs/mipsel-bsd-user.mak new file +1 -0
@@ -0,0 +1 @@ +# Default configuration for mipsel-bsd-user
Signature · 1 line
1.7.8
PATCH v2 19/19 bsd-user: fix linking conflicts with FreeBSD libcrypto
In reply to Stacey SonFreeBSD has it's own AES_set_decrypt_key, etc. in libcrypto. This change fixes these conflicts and allows statically linking BSD user mode qemu.
--- include/qemu/aes.h | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-)
include/qemu/aes.h +9 -0
@@ -10,6 +10,15 @@ struct aes_key_st { };typedef struct aes_key_st AES_KEY ; +/* FreeBSD has it's own AES_set_decrypt_key in -lcrypto, avoid conflicts. */ +#ifdef __FreeBSD__ +#define AES_set_encrypt_key QEMU_AES_set_encrypt_key +#define AES_set_decrypt_key QEMU_AES_set_decrypt_key +#define AES_encrypt QEMU_AES_encrypt +#define AES_decrypt QEMU_AES_decrypt +#define AES_cbc_encrypt QEMU_AES_cbc_encrypt +#endif +int AES_set_encrypt_key (const unsigned char *userKey,const int bits,AES_KEY *key); int AES_set_decrypt_key(const unsigned char *userKey, const int bits,
Signature · 1 line
1.7.8
Re: [Qemu-devel] [PATCH v2 19/19] bsd-user: fix linking conflicts with FreeBSD libcrypto
Il 08/11/2013 17:33, Stacey Son ha scritto:
Quoted 20 lines
FreeBSD has it's own
AES_set_decrypt_key, etc. in libcrypto. This change fixes these conflicts and allows statically linking BSD user mode qemu.Signed-off-by Stacey Son <[email protected]>--- include/qemu/aes.h | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-)include/qemu/aes.h +2
-0@@ -10,6 +10,15 @@ struct aes_key_st { };typedef struct aes_key_st AES_KEY ; +/* FreeBSD has it's own AES_set_decrypt_key in -lcrypto, avoid conflicts. */ +#ifdef __FreeBSD__
include/qemu/aes.h struct aes_key_st { · line 24
Quoted 10 lines
include/qemu/aes.h +7
-0+#define AES_set_encrypt_key QEMU_AES_set_encrypt_key +#define AES_set_decrypt_key QEMU_AES_set_decrypt_key +#define AES_encrypt QEMU_AES_encrypt +#define AES_decrypt QEMU_AES_decrypt +#define AES_cbc_encrypt QEMU_AES_cbc_encrypt +#endif +int AES_set_encrypt_key (const unsigned char *userKey,const int bits,AES_KEY *key); int AES_set_decrypt_key(const unsigned char *userKey, const int bits,
What is the error? Do the functions have different signatures or semantics between QEMU and FreeBSD?
Paolo
Quoted 11 lines · Stacey Son
[v2]
- Rebases to 1.7.0-rc0. (Requires, however, Andreas Tobler's patch to
build: see
http://lists.nongnu.org/archive/html/qemu-devel/2013-11/msg00000.html)
- Fixes deadlock in the_umtx_op()system call handler.
- Fixes race condition inmmap()system call handler.
- Makes qemu-mips (o32) usable.
- A small code clean up to the ARMcpu_loop().
- Fixes comment in arm-bsd-user.mak to match filename.
- Fixes symbol conflicts with FreeBSD's libcrypto for static link.
Ping.
This is a large change in an area that hasn't had a lot of activity of late; what are the next steps here?
-Ed
Il 26/11/2013 22:01, Ed Maste ha scritto:
Quoted 13 lines · Stacey Son
Quoted 11 lines
[v2]
- Rebases to 1.7.0-rc0. (Requires, however, Andreas Tobler's patch to
build: see
http://lists.nongnu.org/archive/html/qemu-devel/2013-11/msg00000.html)
- Fixes deadlock in the_umtx_op()system call handler.
- Fixes race condition inmmap()system call handler.
- Makes qemu-mips (o32) usable.
- A small code clean up to the ARMcpu_loop().
- Fixes comment in arm-bsd-user.mak to match filename.
- Fixes symbol conflicts with FreeBSD's libcrypto for static link.
Quoted 4 lines
Ping.
This is a large change in an area that hasn't had a lot of activity of late; what are the next steps here?
We're now in hard freeze, so the next step is to wait for 1.8 to be released.
I reviewed the parts out of bsd-user, and had only one question.
Paolo
Quoted 16 lines · Paolo Bonzini
Il 26/11/2013 22:01, Ed Maste ha scritto:
Quoted 15 lines · Stacey Son
Quoted 11 lines
[v2]
- Rebases to 1.7.0-rc0. (Requires, however, Andreas Tobler's patch to
build: see
http://lists.nongnu.org/archive/html/qemu-devel/2013-11/msg00000.html)
- Fixes deadlock in the_umtx_op()system call handler.
- Fixes race condition inmmap()system call handler.
- Makes qemu-mips (o32) usable.
- A small code clean up to the ARMcpu_loop().
- Fixes comment in arm-bsd-user.mak to match filename.
- Fixes symbol conflicts with FreeBSD's libcrypto for static link.Ping.
Quoted 7 lines
Quoted 2 lines
This is a large change in an area that hasn't had a lot of activity of late; what are the next steps here?
We're now in hard freeze, so the next step is to wait for 1.8 to be released.
I reviewed the parts out of bsd-user, and had only one question.
Ok, 1.7's now out, and we'll sort out the HOST_ABI vs. HOST_VARIANT question. What's our next step after that?
Quoted 8 lines · Ed Maste
Quoted 7 lines · Paolo Bonzini
Il 26/11/2013 22:01, Ed Maste ha scritto:
Quoted 5 lines
Ping.
This is a large change in an area that hasn't had a lot of activity of late; what are the next steps here?
Quoted 7 lines
Quoted 4 lines
We're now in hard freeze, so the next step is to wait for 1.8 to be released.
I reviewed the parts out of bsd-user, and had only one question.
Ok, 1.7's now out, and we'll sort out the
HOST_ABIvs.HOST_VARIANTquestion. What's our next step after that?
FYI, I have some addition bug fixes that I will be adding in a new patch set (v3) and will be rebasing to HEAD.
Also, I'll make the change from HOST_ABI_DIR to HOST_VARIANT_DIR. The idea is if someone wanted to run, say, OpenBSD targets on a FreeBSD host it would use the code in the bsd-user/freebsd directory to do that. The code would need to support emulation for OpenBSD system calls that are not already natively supported by FreeBSD.
Best Regards,
-stacey.
Il 12/12/2013 20:57, Ed Maste ha scritto:
Quoted 9 lines
Quoted 7 lines
Quoted 7 lines
Quoted 2 lines
Quoted 2 lines
This is a large change in an area that hasn't had a lot of activity of late; what are the next steps here?
We're now in hard freeze, so the next step is to wait for 1.8 to be released.
I reviewed the parts out of bsd-user, and had only one question.
Ok, 1.7's now out, and we'll sort out the
HOST_ABIvs.HOST_VARIANTquestion. What's our next step after that?
Post the patches. I'll review the non-bsd-user parts again. And then the next step is to find someone who commits them... shouldn't be hard since you probably know much more about this code than anyone else.
Paolo
v3 cover bsd-user: Add system call and mips/arm support.
In reply to Stacey Son[v3]
- Rebases to commit f46e720a82ccdf1a521cf459448f3f96ed895d43 (HEAD).
- Changes 'HOST_API_DIR' to 'HOST_VARIANT_DIR' for the BSD variant.
- Fixes boundry condition bug in mmap() system call handler.
- Fixes floating point support for MIPS64.
- Fixes execve() syscall handler so shell scripts are properly exec'ed.
- Fixes uninitialized data bug for extended attribute syscall handlers.
- Fixes minor typos in ACL syscall structures.
[v2]
- Rebases to 1.7.0-rc0. (Requires, however, Andreas Tobler's patch to
build: see
http://lists.nongnu.org/archive/html/qemu-devel/2013-11/msg00000.html)
- Fixes deadlock in the _umtx_op() system call handler.
- Fixes race condition in mmap() system call handler.
- Makes qemu-mips (o32) usable.
- A small code clean up to the ARM cpu_loop().
- Fixes comment in arm-bsd-user.mak to match filename.
- Fixes symbol conflicts with FreeBSD's libcrypto for static link.
[v1]
This patch series adds a significant number of system calls and mips/arm support for bsd-user. In its current state it can emulate most FreeBSD mips/mips64 and arm target binaries on a x86 host in a simple chroot environment. (see https://wiki.freebsd.org/QemuUserModeHowTo for the details.)
Besides adding a lot of shims and other support code this change restructures the code significantly to reduce the amount of C preprocessor conditionals for the various target and host arch/OS's. In general, the target cpu depedent code has been moved into into the various arch directories and the host OS dependent code (ie. FreeBSD, NetBSD, OpenBSD) has been moved into the OS directories as much as possible.
I would like to recognize Olivier Houchard for a lot of the arm dependent code and Juergen Lock, the maintainer of the FreeBSD Qemu port, for their contributions.
Note that these patches are also available at:
http://people.freebsd.org/~sson/qemu/qemu-bsd-user/
and on github in the 'bsd-user' branch of the following repository:
https://github.com/staceyson/qemu-bsd-user
Best Regards,
Stacey D. Son
---
Stacey Son (19):
bsd-user: refresh freebsd system call numbers
bsd-user: add HOST_VARIANT_DIR for various *BSD dependent code
bsd-user: move strace OS/arch dependent code to host/arch dirs
bsd-user: move arch/OS dependent code out of main.c
bsd-user: move arch/OS dependent code out of syscall.c
bsd-user: add support for freebsd time related system calls
bsd-user: add support for freebsd signal related system calls
bsd-user: move arch/OS dependent code out of elfload.c
bsd-user: add support for freebsd process related system calls
bsd-user: add support for file system related system calls
bsd-user: add support for stat, dir, and fcntl related syscalls
bsd-user: add support for memory management related syscalls
bsd-user: add support for socket related system calls
bsd-user: add support for thread related system calls
bsd-user: add support for the ioctl system call
bsd-user: add support for extattr and ACL related syscalls
bsd-user: add support for miscellaneous system calls
bsd-user: add arm, mips and mips64 options to configure target-list
bsd-user: fix linking conflicts with FreeBSD libcrypto
Makefile.target | 5 +- bsd-user/Makefile.objs | 6 +- bsd-user/arm/syscall.h | 36 + bsd-user/arm/target_arch.h | 10 + bsd-user/arm/target_arch_cpu.c | 27 + bsd-user/arm/target_arch_cpu.h | 375 ++++++ bsd-user/arm/target_arch_elf.h | 54 + bsd-user/arm/target_arch_signal.h | 257 +++++ bsd-user/arm/target_arch_sigtramp.h | 33 + bsd-user/arm/target_arch_sysarch.h | 78 ++ bsd-user/arm/target_arch_thread.h | 67 ++ bsd-user/arm/target_arch_vmparam.h | 48 + bsd-user/bsd-file.h | 1111 ++++++++++++++++++ bsd-user/bsd-ioctl.c | 448 ++++++++ bsd-user/bsd-ioctl.h | 27 + bsd-user/bsd-mem.c | 122 ++ bsd-user/bsd-mem.h | 393 +++++++ bsd-user/bsd-misc.c | 209 ++++ bsd-user/bsd-misc.h | 339 ++++++ bsd-user/bsd-proc.c | 160 +++ bsd-user/bsd-proc.h | 434 +++++++ bsd-user/bsd-signal.h | 232 ++++ bsd-user/bsd-socket.c | 108 ++ bsd-user/bsd-socket.h | 266 +++++ bsd-user/bsdload.c | 170 ++- bsd-user/elfload.c | 956 ++++------------- bsd-user/errno_defs.h | 13 +- bsd-user/freebsd/host_os.h | 46 + bsd-user/freebsd/os-extattr.c | 118 ++ bsd-user/freebsd/os-extattr.h | 654 +++++++++++ bsd-user/freebsd/os-ioctl-cmds.h | 47 + bsd-user/freebsd/os-ioctl-filio.h | 45 + bsd-user/freebsd/os-ioctl-ioccom.h | 54 + bsd-user/freebsd/os-ioctl-ttycom.h | 257 +++++ bsd-user/freebsd/os-ioctl-types.h | 7 + bsd-user/freebsd/os-misc.h | 442 ++++++++ bsd-user/freebsd/os-proc.c | 309 +++++ bsd-user/freebsd/os-proc.h | 428 +++++++ bsd-user/freebsd/os-signal.h | 43 + bsd-user/freebsd/os-socket.c | 149 +++ bsd-user/freebsd/os-socket.h | 548 +++++++++ bsd-user/freebsd/os-stat.c | 234 ++++ bsd-user/freebsd/os-stat.h | 437 +++++++ bsd-user/freebsd/os-strace.h | 29 + bsd-user/freebsd/os-sys.c | 284 +++++ bsd-user/freebsd/os-thread.c | 1001 ++++++++++++++++ bsd-user/freebsd/os-thread.h | 511 +++++++++ bsd-user/freebsd/os-time.c | 205 ++++ bsd-user/freebsd/os-time.h | 643 +++++++++++ bsd-user/freebsd/qemu-os.h | 79 ++ bsd-user/freebsd/strace.list | 76 ++- bsd-user/freebsd/syscall_nr.h | 813 ++++++++------ bsd-user/freebsd/target_os_elf.h | 145 +++ bsd-user/freebsd/target_os_siginfo.h | 110 ++ bsd-user/freebsd/target_os_signal.h | 79 ++ bsd-user/freebsd/target_os_stack.h | 157 +++ bsd-user/freebsd/target_os_thread.h | 6 + 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 | 302 +++++ bsd-user/i386/target_arch_elf.h | 62 + bsd-user/i386/target_arch_signal.h | 94 ++ bsd-user/i386/target_arch_sigtramp.h | 11 + bsd-user/i386/target_arch_sysarch.h | 78 ++ bsd-user/i386/target_arch_thread.h | 45 + bsd-user/i386/target_arch_vmparam.h | 28 + bsd-user/i386/target_signal.h | 6 - bsd-user/main.c | 927 +++------------ bsd-user/mips/syscall.h | 52 + bsd-user/mips/target_arch.h | 10 + bsd-user/mips/target_arch_cpu.c | 27 + bsd-user/mips/target_arch_cpu.h | 257 +++++ bsd-user/mips/target_arch_elf.h | 36 + bsd-user/mips/target_arch_signal.h | 237 ++++ bsd-user/mips/target_arch_sigtramp.h | 23 + bsd-user/mips/target_arch_sysarch.h | 69 ++ bsd-user/mips/target_arch_thread.h | 54 + bsd-user/mips/target_arch_vmparam.h | 50 + bsd-user/mips64/syscall.h | 53 + bsd-user/mips64/target_arch.h | 10 + bsd-user/mips64/target_arch_cpu.c | 27 + bsd-user/mips64/target_arch_cpu.h | 243 ++++ bsd-user/mips64/target_arch_elf.h | 36 + bsd-user/mips64/target_arch_signal.h | 214 ++++ bsd-user/mips64/target_arch_sigtramp.h | 23 + bsd-user/mips64/target_arch_sysarch.h | 69 ++ bsd-user/mips64/target_arch_thread.h | 54 + bsd-user/mips64/target_arch_vmparam.h | 47 + bsd-user/mmap.c | 178 ++-- bsd-user/netbsd/host_os.h | 31 + bsd-user/netbsd/os-extattr.h | 247 ++++ bsd-user/netbsd/os-ioctl-cmds.h | 48 + bsd-user/netbsd/os-ioctl-filio.h | 29 + bsd-user/netbsd/os-ioctl-ioccom.h | 38 + bsd-user/netbsd/os-ioctl-ttycom.h | 240 ++++ bsd-user/netbsd/os-ioctl-types.h | 7 + bsd-user/netbsd/os-misc.h | 375 ++++++ bsd-user/netbsd/os-proc.c | 11 + bsd-user/netbsd/os-proc.h | 243 ++++ bsd-user/netbsd/os-socket.c | 1 + bsd-user/netbsd/os-socket.h | 98 ++ bsd-user/netbsd/os-stat.c | 1 + bsd-user/netbsd/os-stat.h | 1 + bsd-user/netbsd/os-strace.h | 1 + bsd-user/netbsd/os-sys.c | 46 + bsd-user/netbsd/os-thread.c | 1 + bsd-user/netbsd/os-thread.h | 133 +++ bsd-user/netbsd/os-time.c | 1 + bsd-user/netbsd/os-time.h | 179 +++ bsd-user/netbsd/qemu-os.h | 1 + bsd-user/netbsd/target_os_elf.h | 226 ++++ bsd-user/netbsd/target_os_siginfo.h | 82 ++ bsd-user/netbsd/target_os_signal.h | 70 ++ bsd-user/netbsd/target_os_stack.h | 33 + bsd-user/netbsd/target_os_thread.h | 6 + bsd-user/openbsd/host_os.h | 31 + bsd-user/openbsd/os-extattr.h | 247 ++++ bsd-user/openbsd/os-ioctl-cmds.h | 48 + bsd-user/openbsd/os-ioctl-filio.h | 29 + bsd-user/openbsd/os-ioctl-ioccom.h | 38 + bsd-user/openbsd/os-ioctl-ttycom.h | 240 ++++ bsd-user/openbsd/os-ioctl-types.h | 7 + bsd-user/openbsd/os-misc.h | 375 ++++++ bsd-user/openbsd/os-proc.c | 11 + bsd-user/openbsd/os-proc.h | 243 ++++ bsd-user/openbsd/os-socket.c | 1 + bsd-user/openbsd/os-socket.h | 98 ++ bsd-user/openbsd/os-stat.c | 1 + bsd-user/openbsd/os-stat.h | 176 +++ bsd-user/openbsd/os-strace.h | 1 + bsd-user/openbsd/os-sys.c | 46 + bsd-user/openbsd/os-thread.c | 1 + bsd-user/openbsd/os-thread.h | 133 +++ bsd-user/openbsd/os-time.c | 1 + bsd-user/openbsd/os-time.h | 179 +++ bsd-user/openbsd/qemu-os.h | 1 + bsd-user/openbsd/target_os_elf.h | 226 ++++ bsd-user/openbsd/target_os_siginfo.h | 82 ++ bsd-user/openbsd/target_os_signal.h | 70 ++ bsd-user/openbsd/target_os_stack.h | 33 + bsd-user/openbsd/target_os_thread.h | 6 + bsd-user/qemu-bsd.h | 79 ++ bsd-user/qemu.h | 202 +++- bsd-user/signal.c | 907 +++++++++++++++- 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_elf.h | 30 + bsd-user/sparc/target_arch_signal.h | 77 ++ bsd-user/sparc/target_arch_sigtramp.h | 11 + bsd-user/sparc/target_arch_sysarch.h | 52 + bsd-user/sparc/target_arch_thread.h | 39 + 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_elf.h | 34 + bsd-user/sparc64/target_arch_signal.h | 94 ++ bsd-user/sparc64/target_arch_sigtramp.h | 11 + bsd-user/sparc64/target_arch_sysarch.h | 52 + bsd-user/sparc64/target_arch_thread.h | 55 + bsd-user/sparc64/target_arch_vmparam.h | 37 + bsd-user/sparc64/target_signal.h | 5 - bsd-user/strace.c | 175 ++- bsd-user/syscall.c | 1884 ++++++++++++++++++++++++------- bsd-user/syscall_defs.h | 860 +++++++++++++-- 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 | 324 ++++++ bsd-user/x86_64/target_arch_elf.h | 55 + bsd-user/x86_64/target_arch_signal.h | 94 ++ bsd-user/x86_64/target_arch_sigtramp.h | 11 + bsd-user/x86_64/target_arch_sysarch.h | 76 ++ bsd-user/x86_64/target_arch_thread.h | 40 + bsd-user/x86_64/target_arch_vmparam.h | 28 + bsd-user/x86_64/target_signal.h | 5 - configure | 11 + default-configs/arm-bsd-user.mak | 3 + default-configs/mips-bsd-user.mak | 1 + default-configs/mips64-bsd-user.mak | 1 + default-configs/mips64el-bsd-user.mak | 1 + default-configs/mipsel-bsd-user.mak | 1 + include/qemu/aes.h | 9 + include/qemu/tls.h | 2 +- 190 files changed, 25306 insertions(+), 2652 deletions(-) create mode 100644 bsd-user/arm/syscall.h create mode 100644 bsd-user/arm/target_arch.h create mode 100644 bsd-user/arm/target_arch_cpu.c create mode 100644 bsd-user/arm/target_arch_cpu.h create mode 100644 bsd-user/arm/target_arch_elf.h create mode 100644 bsd-user/arm/target_arch_signal.h create mode 100644 bsd-user/arm/target_arch_sigtramp.h create mode 100644 bsd-user/arm/target_arch_sysarch.h create mode 100644 bsd-user/arm/target_arch_thread.h create mode 100644 bsd-user/arm/target_arch_vmparam.h create mode 100644 bsd-user/bsd-file.h create mode 100644 bsd-user/bsd-ioctl.c create mode 100644 bsd-user/bsd-ioctl.h create mode 100644 bsd-user/bsd-mem.c create mode 100644 bsd-user/bsd-mem.h create mode 100644 bsd-user/bsd-misc.c create mode 100644 bsd-user/bsd-misc.h create mode 100644 bsd-user/bsd-proc.c create mode 100644 bsd-user/bsd-proc.h create mode 100644 bsd-user/bsd-signal.h create mode 100644 bsd-user/bsd-socket.c create mode 100644 bsd-user/bsd-socket.h create mode 100644 bsd-user/freebsd/host_os.h create mode 100644 bsd-user/freebsd/os-extattr.c create mode 100644 bsd-user/freebsd/os-extattr.h create mode 100644 bsd-user/freebsd/os-ioctl-cmds.h create mode 100644 bsd-user/freebsd/os-ioctl-filio.h create mode 100644 bsd-user/freebsd/os-ioctl-ioccom.h create mode 100644 bsd-user/freebsd/os-ioctl-ttycom.h create mode 100644 bsd-user/freebsd/os-ioctl-types.h create mode 100644 bsd-user/freebsd/os-misc.h create mode 100644 bsd-user/freebsd/os-proc.c create mode 100644 bsd-user/freebsd/os-proc.h create mode 100644 bsd-user/freebsd/os-signal.h create mode 100644 bsd-user/freebsd/os-socket.c create mode 100644 bsd-user/freebsd/os-socket.h create mode 100644 bsd-user/freebsd/os-stat.c create mode 100644 bsd-user/freebsd/os-stat.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/os-thread.c create mode 100644 bsd-user/freebsd/os-thread.h create mode 100644 bsd-user/freebsd/os-time.c create mode 100644 bsd-user/freebsd/os-time.h create mode 100644 bsd-user/freebsd/qemu-os.h create mode 100644 bsd-user/freebsd/target_os_elf.h create mode 100644 bsd-user/freebsd/target_os_siginfo.h create mode 100644 bsd-user/freebsd/target_os_signal.h create mode 100644 bsd-user/freebsd/target_os_stack.h create mode 100644 bsd-user/freebsd/target_os_thread.h create mode 100644 bsd-user/freebsd/target_os_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_elf.h create mode 100644 bsd-user/i386/target_arch_signal.h create mode 100644 bsd-user/i386/target_arch_sigtramp.h create mode 100644 bsd-user/i386/target_arch_sysarch.h create mode 100644 bsd-user/i386/target_arch_thread.h create mode 100644 bsd-user/i386/target_arch_vmparam.h create mode 100644 bsd-user/mips/syscall.h create mode 100644 bsd-user/mips/target_arch.h create mode 100644 bsd-user/mips/target_arch_cpu.c create mode 100644 bsd-user/mips/target_arch_cpu.h create mode 100644 bsd-user/mips/target_arch_elf.h create mode 100644 bsd-user/mips/target_arch_signal.h create mode 100644 bsd-user/mips/target_arch_sigtramp.h create mode 100644 bsd-user/mips/target_arch_sysarch.h create mode 100644 bsd-user/mips/target_arch_thread.h create mode 100644 bsd-user/mips/target_arch_vmparam.h create mode 100644 bsd-user/mips64/syscall.h create mode 100644 bsd-user/mips64/target_arch.h create mode 100644 bsd-user/mips64/target_arch_cpu.c create mode 100644 bsd-user/mips64/target_arch_cpu.h create mode 100644 bsd-user/mips64/target_arch_elf.h create mode 100644 bsd-user/mips64/target_arch_signal.h create mode 100644 bsd-user/mips64/target_arch_sigtramp.h create mode 100644 bsd-user/mips64/target_arch_sysarch.h create mode 100644 bsd-user/mips64/target_arch_thread.h create mode 100644 bsd-user/mips64/target_arch_vmparam.h create mode 100644 bsd-user/netbsd/host_os.h create mode 100644 bsd-user/netbsd/os-extattr.h create mode 100644 bsd-user/netbsd/os-ioctl-cmds.h create mode 100644 bsd-user/netbsd/os-ioctl-filio.h create mode 100644 bsd-user/netbsd/os-ioctl-ioccom.h create mode 100644 bsd-user/netbsd/os-ioctl-ttycom.h create mode 100644 bsd-user/netbsd/os-ioctl-types.h create mode 100644 bsd-user/netbsd/os-misc.h create mode 100644 bsd-user/netbsd/os-proc.c create mode 100644 bsd-user/netbsd/os-proc.h create mode 100644 bsd-user/netbsd/os-socket.c create mode 100644 bsd-user/netbsd/os-socket.h create mode 100644 bsd-user/netbsd/os-stat.c create mode 100644 bsd-user/netbsd/os-stat.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/os-thread.c create mode 100644 bsd-user/netbsd/os-thread.h create mode 100644 bsd-user/netbsd/os-time.c create mode 100644 bsd-user/netbsd/os-time.h create mode 100644 bsd-user/netbsd/qemu-os.h create mode 100644 bsd-user/netbsd/target_os_elf.h create mode 100644 bsd-user/netbsd/target_os_siginfo.h create mode 100644 bsd-user/netbsd/target_os_signal.h create mode 100644 bsd-user/netbsd/target_os_stack.h create mode 100644 bsd-user/netbsd/target_os_thread.h create mode 100644 bsd-user/openbsd/host_os.h create mode 100644 bsd-user/openbsd/os-extattr.h create mode 100644 bsd-user/openbsd/os-ioctl-cmds.h create mode 100644 bsd-user/openbsd/os-ioctl-filio.h create mode 100644 bsd-user/openbsd/os-ioctl-ioccom.h create mode 100644 bsd-user/openbsd/os-ioctl-ttycom.h create mode 100644 bsd-user/openbsd/os-ioctl-types.h create mode 100644 bsd-user/openbsd/os-misc.h create mode 100644 bsd-user/openbsd/os-proc.c create mode 100644 bsd-user/openbsd/os-proc.h create mode 100644 bsd-user/openbsd/os-socket.c create mode 100644 bsd-user/openbsd/os-socket.h create mode 100644 bsd-user/openbsd/os-stat.c create mode 100644 bsd-user/openbsd/os-stat.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/os-thread.c create mode 100644 bsd-user/openbsd/os-thread.h create mode 100644 bsd-user/openbsd/os-time.c create mode 100644 bsd-user/openbsd/os-time.h create mode 100644 bsd-user/openbsd/qemu-os.h create mode 100644 bsd-user/openbsd/target_os_elf.h create mode 100644 bsd-user/openbsd/target_os_siginfo.h create mode 100644 bsd-user/openbsd/target_os_signal.h create mode 100644 bsd-user/openbsd/target_os_stack.h create mode 100644 bsd-user/openbsd/target_os_thread.h create mode 100644 bsd-user/qemu-bsd.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_elf.h create mode 100644 bsd-user/sparc/target_arch_signal.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_thread.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_elf.h create mode 100644 bsd-user/sparc64/target_arch_signal.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_thread.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_elf.h create mode 100644 bsd-user/x86_64/target_arch_signal.h create mode 100644 bsd-user/x86_64/target_arch_sigtramp.h create mode 100644 bsd-user/x86_64/target_arch_sysarch.h create mode 100644 bsd-user/x86_64/target_arch_thread.h create mode 100644 bsd-user/x86_64/target_arch_vmparam.h create mode 100644 default-configs/arm-bsd-user.mak create mode 100644 default-configs/mips-bsd-user.mak create mode 100644 default-configs/mips64-bsd-user.mak create mode 100644 default-configs/mips64el-bsd-user.mak create mode 100644 default-configs/mipsel-bsd-user.mak
Signature · 1 line
1.7.8