* [Qemu-devel] [PATCH 01/10 v4] bsd-user: add HOST_VARIANT_DIR for various *BSD dependent code
2014-06-08 16:57 [Qemu-devel] [PATCH 00/10 v4] bsd-user: update strace syscalls and breakout BSD distros Sean Bruno
@ 2014-06-08 16:57 ` Sean Bruno
2014-06-08 16:57 ` [Qemu-devel] [PATCH 02/10 v4] bsd-user: GPL v2 attribution update and style Sean Bruno
` (9 subsequent siblings)
10 siblings, 0 replies; 18+ messages in thread
From: Sean Bruno @ 2014-06-08 16:57 UTC (permalink / raw)
To: qemu-devel; +Cc: Sean Bruno
From: Stacey Son <sson@FreeBSD.org>
This change adds HOST_VARIANT_DIR so the various BSD OS dependent
code can be separated into its own directories rather than
using #ifdef's.
This may also allow an BSD variant OS to host another BSD variant's
executable as a target.
Signed-off-by: Sean Bruno <sbruno@freebsd.org>
---
Makefile.target | 3 ++-
configure | 11 +++++++++++
2 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/Makefile.target b/Makefile.target
index 9986047..60c1ca6 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -102,7 +102,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_VARIANT_DIR)
obj-y += bsd-user/
obj-y += gdbstub.o user-exec.o
diff --git a/configure b/configure
index 0e516f9..3db9726 100755
--- a/configure
+++ b/configure
@@ -537,6 +537,9 @@ fi
# OS specific
+# host *BSD for user mode
+HOST_VARIANT_DIR=""
+
case $targetos in
CYGWIN*)
mingw32="yes"
@@ -562,12 +565,14 @@ FreeBSD)
# needed for kinfo_getvmmap(3) in libutil.h
LIBS="-lutil $LIBS"
netmap="" # enable netmap autodetect
+ HOST_VARIANT_DIR="freebsd"
;;
DragonFly)
bsd="yes"
make="${MAKE-gmake}"
audio_drv_list="oss"
audio_possible_drivers="oss sdl esd pa"
+ HOST_VARIANT_DIR="dragonfly"
;;
NetBSD)
bsd="yes"
@@ -575,12 +580,14 @@ NetBSD)
audio_drv_list="oss"
audio_possible_drivers="oss sdl esd"
oss_lib="-lossaudio"
+ HOST_VARIANT_DIR="netbsd"
;;
OpenBSD)
bsd="yes"
make="${MAKE-gmake}"
audio_drv_list="sdl"
audio_possible_drivers="sdl esd"
+ HOST_VARIANT_DIR="openbsd"
;;
Darwin)
bsd="yes"
@@ -598,6 +605,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_VARIANT_DIR="darwin"
;;
SunOS)
solaris="yes"
@@ -4982,6 +4990,9 @@ if [ "$TARGET_ABI_DIR" = "" ]; then
TARGET_ABI_DIR=$TARGET_ARCH
fi
echo "TARGET_ABI_DIR=$TARGET_ABI_DIR" >> $config_target_mak
+if [ "$HOST_VARIANT_DIR" != "" ]; then
+ echo "HOST_VARIANT_DIR=$HOST_VARIANT_DIR" >> $config_target_mak
+fi
case "$target_name" in
i386|x86_64)
if test "$xen" = "yes" -a "$target_softmmu" = "yes" ; then
--
1.9.3
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [Qemu-devel] [PATCH 02/10 v4] bsd-user: GPL v2 attribution update and style
2014-06-08 16:57 [Qemu-devel] [PATCH 00/10 v4] bsd-user: update strace syscalls and breakout BSD distros Sean Bruno
2014-06-08 16:57 ` [Qemu-devel] [PATCH 01/10 v4] bsd-user: add HOST_VARIANT_DIR for various *BSD dependent code Sean Bruno
@ 2014-06-08 16:57 ` Sean Bruno
2014-06-08 16:57 ` [Qemu-devel] [PATCH 03/10 v4] bsd-user: Implement strace support for print_sysctl syscall Sean Bruno
` (8 subsequent siblings)
10 siblings, 0 replies; 18+ messages in thread
From: Sean Bruno @ 2014-06-08 16:57 UTC (permalink / raw)
To: qemu-devel; +Cc: Sean Bruno
Signed-off-by: Sean Bruno <sbruno@freebsd.org>
---
bsd-user/qemu.h | 26 +++++++++++
bsd-user/strace.c | 126 +++++++++++++++++++++++++++++-------------------------
2 files changed, 94 insertions(+), 58 deletions(-)
diff --git a/bsd-user/qemu.h b/bsd-user/qemu.h
index ddc74ed..b8a34c7 100644
--- a/bsd-user/qemu.h
+++ b/bsd-user/qemu.h
@@ -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,
diff --git a/bsd-user/strace.c b/bsd-user/strace.c
index d73bbca..47e5e76 100644
--- a/bsd-user/strace.c
+++ b/bsd-user/strace.c
@@ -1,37 +1,49 @@
+/*
+ * System call tracing and debugging
+ *
+ *
+ * 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 <stdio.h>
#include <errno.h>
#include <sys/select.h>
#include <sys/types.h>
#include <unistd.h>
#include <sys/syscall.h>
-#include "qemu.h"
+#include <sys/ioccom.h>
+#include <ctype.h>
-int do_strace=0;
+#include "qemu.h"
-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);
-};
+int do_strace;
/*
* Utility functions
*/
-static void
-print_execve(const struct syscallname *name,
- abi_long arg1, abi_long arg2, abi_long arg3,
- abi_long arg4, abi_long arg5, abi_long arg6)
+static void print_execve(const struct syscallname *name, abi_long arg1,
+ abi_long arg2, abi_long arg3, abi_long arg4, abi_long arg5,
+ abi_long arg6)
{
abi_ulong arg_ptr_addr;
char *s;
- if (!(s = lock_user_string(arg1)))
+ s = lock_user_string(arg1);
+ if (s == NULL) {
return;
+ }
gemu_log("%s(\"%s\",{", name->name, s);
unlock_user(s, arg1, 0);
@@ -39,18 +51,19 @@ print_execve(const struct syscallname *name,
abi_ulong *arg_ptr, arg_addr;
arg_ptr = lock_user(VERIFY_READ, arg_ptr_addr, sizeof(abi_ulong), 1);
- if (!arg_ptr)
+ if (!arg_ptr) {
return;
+ }
arg_addr = tswapl(*arg_ptr);
unlock_user(arg_ptr, arg_ptr_addr, 0);
- if (!arg_addr)
+ if (!arg_addr) {
break;
+ }
if ((s = lock_user_string(arg_addr))) {
gemu_log("\"%s\",", s);
unlock_user(s, arg_addr, 0);
}
}
-
gemu_log("NULL})");
}
@@ -58,10 +71,9 @@ print_execve(const struct syscallname *name,
* Variants for the return value output function
*/
-static void
-print_syscall_ret_addr(const struct syscallname *name, abi_long ret)
+static void print_syscall_ret_addr(const struct syscallname *name, abi_long ret)
{
-if( ret == -1 ) {
+ if (ret == -1) {
gemu_log(" = -1 errno=%d (%s)\n", errno, strerror(errno));
} else {
gemu_log(" = 0x" TARGET_ABI_FMT_lx "\n", ret);
@@ -90,10 +102,9 @@ static const struct syscallname openbsd_scnames[] = {
#include "openbsd/strace.list"
};
-static void
-print_syscall(int num, const struct syscallname *scnames, unsigned int nscnames,
- abi_long arg1, abi_long arg2, abi_long arg3,
- abi_long arg4, abi_long arg5, abi_long arg6)
+static void print_syscall(int num, const struct syscallname *scnames,
+ unsigned int nscnames, abi_long arg1, abi_long arg2, abi_long arg3,
+ abi_long arg4, abi_long arg5, abi_long arg6)
{
unsigned int i;
const char *format="%s(" TARGET_ABI_FMT_ld "," TARGET_ABI_FMT_ld ","
@@ -102,36 +113,37 @@ print_syscall(int num, const struct syscallname *scnames, unsigned int nscnames,
gemu_log("%d ", getpid() );
- for (i = 0; i < nscnames; i++)
+ for (i = 0; i < nscnames; i++) {
if (scnames[i].nr == num) {
if (scnames[i].call != NULL) {
scnames[i].call(&scnames[i], arg1, arg2, arg3, arg4, arg5,
- arg6);
+ arg6);
} else {
/* XXX: this format system is broken because it uses
host types and host pointers for strings */
- if (scnames[i].format != NULL)
+ if (scnames[i].format != NULL) {
format = scnames[i].format;
- gemu_log(format, scnames[i].name, arg1, arg2, arg3, arg4,
- arg5, arg6);
+ }
+ gemu_log(format, scnames[i].name, arg1, arg2, arg3, arg4, arg5,
+ arg6);
}
return;
}
+ }
gemu_log("Unknown syscall %d\n", num);
}
-static void
-print_syscall_ret(int num, abi_long ret, const struct syscallname *scnames,
- unsigned int nscnames)
+static void print_syscall_ret(int num, abi_long ret,
+ const struct syscallname *scnames, unsigned int nscnames)
{
unsigned int i;
- for (i = 0; i < nscnames; i++)
+ for (i = 0; i < nscnames; i++) {
if (scnames[i].nr == num) {
if (scnames[i].result != NULL) {
scnames[i].result(&scnames[i], ret);
} else {
- if( ret < 0 ) {
+ if (ret < 0) {
gemu_log(" = -1 errno=" TARGET_ABI_FMT_ld " (%s)\n", -ret,
strerror(-ret));
} else {
@@ -140,52 +152,50 @@ print_syscall_ret(int num, abi_long ret, const struct syscallname *scnames,
}
break;
}
+ }
}
/*
* The public interface to this module.
*/
-void
-print_freebsd_syscall(int num,
- abi_long arg1, abi_long arg2, abi_long arg3,
- abi_long arg4, abi_long arg5, abi_long arg6)
+void print_freebsd_syscall(int num, abi_long arg1, abi_long arg2, abi_long arg3,
+ abi_long arg4, abi_long arg5, abi_long arg6)
{
- print_syscall(num, freebsd_scnames, ARRAY_SIZE(freebsd_scnames),
- arg1, arg2, arg3, arg4, arg5, arg6);
+
+ print_syscall(num, freebsd_scnames, ARRAY_SIZE(freebsd_scnames), arg1, arg2,
+ arg3, arg4, arg5, arg6);
}
-void
-print_freebsd_syscall_ret(int num, abi_long ret)
+void print_freebsd_syscall_ret(int num, abi_long ret)
{
+
print_syscall_ret(num, ret, freebsd_scnames, ARRAY_SIZE(freebsd_scnames));
}
-void
-print_netbsd_syscall(int num,
- abi_long arg1, abi_long arg2, abi_long arg3,
- abi_long arg4, abi_long arg5, abi_long arg6)
+void print_netbsd_syscall(int num, abi_long arg1, abi_long arg2, abi_long arg3,
+ abi_long arg4, abi_long arg5, abi_long arg6)
{
+
print_syscall(num, netbsd_scnames, ARRAY_SIZE(netbsd_scnames),
arg1, arg2, arg3, arg4, arg5, arg6);
}
-void
-print_netbsd_syscall_ret(int num, abi_long ret)
+void print_netbsd_syscall_ret(int num, abi_long ret)
{
+
print_syscall_ret(num, ret, netbsd_scnames, ARRAY_SIZE(netbsd_scnames));
}
-void
-print_openbsd_syscall(int num,
- abi_long arg1, abi_long arg2, abi_long arg3,
- abi_long arg4, abi_long arg5, abi_long arg6)
+void print_openbsd_syscall(int num, abi_long arg1, abi_long arg2, abi_long arg3,
+ abi_long arg4, abi_long arg5, abi_long arg6)
{
- print_syscall(num, openbsd_scnames, ARRAY_SIZE(openbsd_scnames),
- arg1, arg2, arg3, arg4, arg5, arg6);
+
+ print_syscall(num, openbsd_scnames, ARRAY_SIZE(openbsd_scnames), arg1, arg2,
+ arg3, arg4, arg5, arg6);
}
-void
-print_openbsd_syscall_ret(int num, abi_long ret)
+void print_openbsd_syscall_ret(int num, abi_long ret)
{
+
print_syscall_ret(num, ret, openbsd_scnames, ARRAY_SIZE(openbsd_scnames));
}
--
1.9.3
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [Qemu-devel] [PATCH 03/10 v4] bsd-user: Implement strace support for print_sysctl syscall
2014-06-08 16:57 [Qemu-devel] [PATCH 00/10 v4] bsd-user: update strace syscalls and breakout BSD distros Sean Bruno
2014-06-08 16:57 ` [Qemu-devel] [PATCH 01/10 v4] bsd-user: add HOST_VARIANT_DIR for various *BSD dependent code Sean Bruno
2014-06-08 16:57 ` [Qemu-devel] [PATCH 02/10 v4] bsd-user: GPL v2 attribution update and style Sean Bruno
@ 2014-06-08 16:57 ` Sean Bruno
2014-06-08 16:57 ` [Qemu-devel] [PATCH 04/10 v4] bsd-user: Implement strace support for print_ioctl syscall Sean Bruno
` (7 subsequent siblings)
10 siblings, 0 replies; 18+ messages in thread
From: Sean Bruno @ 2014-06-08 16:57 UTC (permalink / raw)
To: qemu-devel; +Cc: Sean Bruno
Signed-off-by: Sean Bruno <sbruno@freebsd.org>
---
bsd-user/freebsd/strace.list | 21 +++++++++++++++++++--
bsd-user/strace.c | 22 ++++++++++++++++++++++
2 files changed, 41 insertions(+), 2 deletions(-)
diff --git a/bsd-user/freebsd/strace.list b/bsd-user/freebsd/strace.list
index 1edf412..3235f16 100644
--- a/bsd-user/freebsd/strace.list
+++ b/bsd-user/freebsd/strace.list
@@ -1,7 +1,24 @@
-{ TARGET_FREEBSD_NR___getcwd, "__getcwd", NULL, NULL, NULL },
+/*
+ * FreeBSD strace list
+ *
+ *
+ * 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/>.
+ */
+
{ TARGET_FREEBSD_NR___semctl, "__semctl", NULL, NULL, NULL },
{ TARGET_FREEBSD_NR___syscall, "__syscall", NULL, NULL, NULL },
-{ TARGET_FREEBSD_NR___sysctl, "__sysctl", NULL, NULL, NULL },
+{ TARGET_FREEBSD_NR___sysctl, "__sysctl", NULL, print_sysctl, NULL },
{ TARGET_FREEBSD_NR_accept, "accept", "%s(%d,%#x,%#x)", NULL, NULL },
{ TARGET_FREEBSD_NR_access, "access", "%s(\"%s\",%#o)", NULL, NULL },
{ TARGET_FREEBSD_NR_acct, "acct", NULL, NULL, NULL },
diff --git a/bsd-user/strace.c b/bsd-user/strace.c
index 47e5e76..b2633d0 100644
--- a/bsd-user/strace.c
+++ b/bsd-user/strace.c
@@ -33,6 +33,28 @@ int do_strace;
* Utility functions
*/
+static void print_sysctl(const struct syscallname *name, abi_long arg1,
+ abi_long arg2, abi_long arg3, abi_long arg4, abi_long arg5,
+ abi_long arg6)
+{
+ uint32_t i;
+ int32_t *namep;
+
+ gemu_log("%s({ ", name->name);
+ namep = lock_user(VERIFY_READ, arg1, sizeof(int32_t) * arg2, 1);
+ if (namep) {
+ int32_t *p = namep;
+
+ for (i = 0; i < (uint32_t)arg2; i++) {
+ gemu_log("%d ", tswap32(*p++));
+ }
+ unlock_user(namep, arg1, 0);
+ }
+ gemu_log("}, %u, 0x" TARGET_ABI_FMT_lx ", 0x" TARGET_ABI_FMT_lx ", 0x"
+ TARGET_ABI_FMT_lx ", 0x" TARGET_ABI_FMT_lx ")",
+ (uint32_t)arg2, arg3, arg4, arg5, arg6);
+}
+
static void print_execve(const struct syscallname *name, abi_long arg1,
abi_long arg2, abi_long arg3, abi_long arg4, abi_long arg5,
abi_long arg6)
--
1.9.3
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [Qemu-devel] [PATCH 04/10 v4] bsd-user: Implement strace support for print_ioctl syscall
2014-06-08 16:57 [Qemu-devel] [PATCH 00/10 v4] bsd-user: update strace syscalls and breakout BSD distros Sean Bruno
` (2 preceding siblings ...)
2014-06-08 16:57 ` [Qemu-devel] [PATCH 03/10 v4] bsd-user: Implement strace support for print_sysctl syscall Sean Bruno
@ 2014-06-08 16:57 ` Sean Bruno
2014-06-08 16:57 ` [Qemu-devel] [PATCH 05/10 v4] bsd-user: Implement new syscall print_sysarch and add strace support Sean Bruno
` (6 subsequent siblings)
10 siblings, 0 replies; 18+ messages in thread
From: Sean Bruno @ 2014-06-08 16:57 UTC (permalink / raw)
To: qemu-devel; +Cc: Sean Bruno
Signed-off-by: Sean Bruno <sbruno@freebsd.org>
---
bsd-user/freebsd/strace.list | 2 +-
bsd-user/strace.c | 19 +++++++++++++++++++
2 files changed, 20 insertions(+), 1 deletion(-)
diff --git a/bsd-user/freebsd/strace.list b/bsd-user/freebsd/strace.list
index 3235f16..718357b 100644
--- a/bsd-user/freebsd/strace.list
+++ b/bsd-user/freebsd/strace.list
@@ -80,7 +80,7 @@
{ TARGET_FREEBSD_NR_getsockopt, "getsockopt", NULL, NULL, NULL },
{ TARGET_FREEBSD_NR_gettimeofday, "gettimeofday", NULL, NULL, NULL },
{ TARGET_FREEBSD_NR_getuid, "getuid", "%s()", NULL, NULL },
-{ TARGET_FREEBSD_NR_ioctl, "ioctl", NULL, NULL, NULL },
+{ TARGET_FREEBSD_NR_ioctl, "ioctl", NULL, print_ioctl, NULL },
{ TARGET_FREEBSD_NR_issetugid, "issetugid", "%s()", NULL, NULL },
{ TARGET_FREEBSD_NR_kevent, "kevent", NULL, NULL, NULL },
{ TARGET_FREEBSD_NR_kill, "kill", NULL, NULL, NULL },
diff --git a/bsd-user/strace.c b/bsd-user/strace.c
index b2633d0..e33dd4d 100644
--- a/bsd-user/strace.c
+++ b/bsd-user/strace.c
@@ -89,6 +89,25 @@ static void print_execve(const struct syscallname *name, abi_long arg1,
gemu_log("NULL})");
}
+static void print_ioctl(const struct syscallname *name,
+ abi_long arg1, abi_long arg2, abi_long arg3, abi_long arg4,
+ abi_long arg5, abi_long arg6)
+{
+ /* Decode the ioctl request */
+ gemu_log("%s(%d, 0x%0lx { IO%s%s GRP:0x%x('%c') CMD:%d LEN:%d }, 0x"
+ TARGET_ABI_FMT_lx ", ...)",
+ name->name,
+ (int)arg1,
+ (unsigned long)arg2,
+ arg2 & IOC_OUT ? "R" : "",
+ arg2 & IOC_IN ? "W" : "",
+ (unsigned)IOCGROUP(arg2),
+ isprint(IOCGROUP(arg2)) ? (char)IOCGROUP(arg2) : '?',
+ (int)arg2 & 0xFF,
+ (int)IOCPARM_LEN(arg2),
+ arg3);
+}
+
/*
* Variants for the return value output function
*/
--
1.9.3
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [Qemu-devel] [PATCH 05/10 v4] bsd-user: Implement new syscall print_sysarch and add strace support
2014-06-08 16:57 [Qemu-devel] [PATCH 00/10 v4] bsd-user: update strace syscalls and breakout BSD distros Sean Bruno
` (3 preceding siblings ...)
2014-06-08 16:57 ` [Qemu-devel] [PATCH 04/10 v4] bsd-user: Implement strace support for print_ioctl syscall Sean Bruno
@ 2014-06-08 16:57 ` Sean Bruno
2014-06-10 22:53 ` Peter Maydell
2014-06-08 16:57 ` [Qemu-devel] [PATCH 06/10 v4] bsd-user: Implement strace support for __acl_* syscalls Sean Bruno
` (5 subsequent siblings)
10 siblings, 1 reply; 18+ messages in thread
From: Sean Bruno @ 2014-06-08 16:57 UTC (permalink / raw)
To: qemu-devel; +Cc: Sean Bruno
Signed-off-by: Sean Bruno <sbruno@freebsd.org>
---
bsd-user/freebsd/os-strace.h | 29 +++++++++++++
bsd-user/freebsd/strace.list | 2 +-
bsd-user/i386/syscall.h | 21 +++++++++
bsd-user/i386/target_arch_sysarch.h | 78 ++++++++++++++++++++++++++++++++++
bsd-user/netbsd/os-strace.h | 1 +
bsd-user/openbsd/os-strace.h | 1 +
bsd-user/sparc/syscall.h | 27 +++++++++++-
bsd-user/sparc/target_arch_sysarch.h | 52 +++++++++++++++++++++++
bsd-user/sparc64/syscall.h | 26 +++++++++++-
bsd-user/sparc64/target_arch_sysarch.h | 52 +++++++++++++++++++++++
bsd-user/strace.c | 10 +++++
bsd-user/x86_64/syscall.h | 24 ++++++++++-
bsd-user/x86_64/target_arch_sysarch.h | 76 +++++++++++++++++++++++++++++++++
13 files changed, 395 insertions(+), 4 deletions(-)
create mode 100644 bsd-user/freebsd/os-strace.h
create mode 100644 bsd-user/i386/target_arch_sysarch.h
create mode 100644 bsd-user/netbsd/os-strace.h
create mode 100644 bsd-user/openbsd/os-strace.h
create mode 100644 bsd-user/sparc/target_arch_sysarch.h
create mode 100644 bsd-user/sparc64/target_arch_sysarch.h
create mode 100644 bsd-user/x86_64/target_arch_sysarch.h
diff --git a/bsd-user/freebsd/os-strace.h b/bsd-user/freebsd/os-strace.h
new file mode 100644
index 0000000..a222f09
--- /dev/null
+++ b/bsd-user/freebsd/os-strace.h
@@ -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);
+}
diff --git a/bsd-user/freebsd/strace.list b/bsd-user/freebsd/strace.list
index 718357b..32b3c55 100644
--- a/bsd-user/freebsd/strace.list
+++ b/bsd-user/freebsd/strace.list
@@ -175,7 +175,7 @@
{ TARGET_FREEBSD_NR_statfs, "statfs", "%s(\"%s\",%p)", NULL, NULL },
{ TARGET_FREEBSD_NR_symlink, "symlink", "%s(\"%s\",\"%s\")", NULL, NULL },
{ TARGET_FREEBSD_NR_sync, "sync", NULL, NULL, NULL },
-{ TARGET_FREEBSD_NR_sysarch, "sysarch", NULL, NULL, NULL },
+{ TARGET_FREEBSD_NR_sysarch, "sysarch", NULL, print_sysarch, NULL },
{ TARGET_FREEBSD_NR_syscall, "syscall", NULL, NULL, NULL },
{ TARGET_FREEBSD_NR_truncate, "truncate", NULL, NULL, NULL },
{ TARGET_FREEBSD_NR_umask, "umask", "%s(%#o)", NULL, NULL },
diff --git a/bsd-user/i386/syscall.h b/bsd-user/i386/syscall.h
index 9b34c61..8028fc8 100644
--- a/bsd-user/i386/syscall.h
+++ b/bsd-user/i386/syscall.h
@@ -1,3 +1,23 @@
+/*
+ * i386 system call definitions
+ *
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
+ */
+#ifndef _I386_SYSCALL_H_
+#define _I386_SYSCALL_H_
+
/* default linux values for the selectors */
#define __USER_CS (0x23)
#define __USER_DS (0x2B)
@@ -159,3 +179,4 @@ struct target_vm86plus_struct {
#define UNAME_MACHINE "i386"
+#endif /* ! _I386_SYSCALL_H_ */
diff --git a/bsd-user/i386/target_arch_sysarch.h b/bsd-user/i386/target_arch_sysarch.h
new file mode 100644
index 0000000..4fa6698
--- /dev/null
+++ b/bsd-user/i386/target_arch_sysarch.h
@@ -0,0 +1,78 @@
+/*
+ * i386 sysarch system call emulation
+ *
+ * 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 __ARCH_SYSARCH_H_
+#define __ARCH_SYSARCH_H_
+
+#include "syscall.h"
+
+static inline abi_long do_freebsd_arch_sysarch(CPUX86State *env, int op,
+ abi_ulong parms)
+{
+ abi_long ret = 0;
+ abi_ulong val;
+ int idx;
+
+ switch (op) {
+ case TARGET_FREEBSD_I386_SET_GSBASE:
+ case TARGET_FREEBSD_I386_SET_FSBASE:
+ if (op == TARGET_FREEBSD_I386_SET_GSBASE) {
+ idx = R_GS;
+ } else {
+ idx = R_FS;
+ }
+ if (get_user(val, parms, abi_ulong)) {
+ return -TARGET_EFAULT;
+ }
+ cpu_x86_load_seg(env, idx, 0);
+ env->segs[idx].base = val;
+ break;
+
+ case TARGET_FREEBSD_I386_GET_GSBASE:
+ case TARGET_FREEBSD_I386_GET_FSBASE:
+ if (op == TARGET_FREEBSD_I386_GET_GSBASE) {
+ idx = R_GS;
+ } else {
+ idx = R_FS;
+ }
+ val = env->segs[idx].base;
+ if (put_user(val, parms, abi_ulong)) {
+ return -TARGET_EFAULT;
+ }
+ break;
+
+ /* XXX handle the others... */
+ default:
+ ret = -TARGET_EINVAL;
+ break;
+ }
+ return ret;
+}
+
+static inline void do_freebsd_arch_print_sysarch(
+ const struct syscallname *name, abi_long arg1, abi_long arg2,
+ abi_long arg3, abi_long arg4, abi_long arg5, abi_long arg6)
+{
+
+ gemu_log("%s(%d, " TARGET_ABI_FMT_lx ", " TARGET_ABI_FMT_lx ", "
+ TARGET_ABI_FMT_lx ")", name->name, (int)arg1, arg2, arg3, arg4);
+}
+
+#endif /* !__ARCH_SYSARCH_H_ */
+
diff --git a/bsd-user/netbsd/os-strace.h b/bsd-user/netbsd/os-strace.h
new file mode 100644
index 0000000..70cf51d
--- /dev/null
+++ b/bsd-user/netbsd/os-strace.h
@@ -0,0 +1 @@
+/* XXX NetBSD dependent strace print functions */
diff --git a/bsd-user/openbsd/os-strace.h b/bsd-user/openbsd/os-strace.h
new file mode 100644
index 0000000..9161390
--- /dev/null
+++ b/bsd-user/openbsd/os-strace.h
@@ -0,0 +1 @@
+/* XXX OpenBSD dependent strace print functions */
diff --git a/bsd-user/sparc/syscall.h b/bsd-user/sparc/syscall.h
index 5a9bb7e..7ed2152 100644
--- a/bsd-user/sparc/syscall.h
+++ b/bsd-user/sparc/syscall.h
@@ -1,3 +1,23 @@
+/*
+ * sparc dependent system call definitions
+ *
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
+ */
+#ifndef _SPARC_SYSCALL_H_
+#define _SPARC_SYSCALL_H_
+
struct target_pt_regs {
abi_ulong psr;
abi_ulong pc;
@@ -6,4 +26,9 @@ struct target_pt_regs {
abi_ulong u_regs[16];
};
-#define UNAME_MACHINE "sun4"
+#define UNAME_MACHINE "sun4"
+
+#define TARGET_SPARC_UTRAP_INSTALL 1
+#define TARGET_SPARC_SIGTRAMP_INSTALL 2
+
+#endif /* ! _SPARC_SYSCALL_H_ */
diff --git a/bsd-user/sparc/target_arch_sysarch.h b/bsd-user/sparc/target_arch_sysarch.h
new file mode 100644
index 0000000..454c084
--- /dev/null
+++ b/bsd-user/sparc/target_arch_sysarch.h
@@ -0,0 +1,52 @@
+/*
+ * SPARC sysarch() system call emulation
+ *
+ * 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 __ARCH_SYSARCH_H_
+#define __ARCH_SYSARCH_H_
+
+#include "syscall.h"
+
+static inline abi_long do_freebsd_arch_sysarch(void *env, int op,
+ abi_ulong parms)
+{
+ int ret = 0;
+
+ switch (op) {
+ case TARGET_SPARC_SIGTRAMP_INSTALL:
+ /* XXX not currently handled */
+ case TARGET_SPARC_UTRAP_INSTALL:
+ /* XXX not currently handled */
+ default:
+ ret = -TARGET_EINVAL;
+ break;
+ }
+
+ return ret;
+}
+
+static inline void do_freebsd_arch_print_sysarch(
+ const struct syscallname *name, abi_long arg1, abi_long arg2,
+ abi_long arg3, abi_long arg4, abi_long arg5, abi_long arg6)
+{
+
+ gemu_log("%s(%d, " TARGET_ABI_FMT_lx ", " TARGET_ABI_FMT_lx ", "
+ TARGET_ABI_FMT_lx ")", name->name, (int)arg1, arg2, arg3, arg4);
+}
+
+#endif /*!__ARCH_SYSARCH_H_ */
diff --git a/bsd-user/sparc64/syscall.h b/bsd-user/sparc64/syscall.h
index 81a816d..8571092 100644
--- a/bsd-user/sparc64/syscall.h
+++ b/bsd-user/sparc64/syscall.h
@@ -1,3 +1,22 @@
+/*
+ * sparc64 dependent system call definitions
+ *
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
+ */
+#ifndef _SPARC64_SYSCALL_H_
+#define _SPARC64_SYSCALL_H_
struct target_pt_regs {
abi_ulong u_regs[16];
abi_ulong tstate;
@@ -7,4 +26,9 @@ struct target_pt_regs {
abi_ulong fprs;
};
-#define UNAME_MACHINE "sun4u"
+#define UNAME_MACHINE "sun4u"
+
+#define TARGET_SPARC_UTRAP_INSTALL 1
+#define TARGET_SPARC_SIGTRAMP_INSTALL 2
+
+#endif /* !_SPARC64_SYSCALL_H_ */
diff --git a/bsd-user/sparc64/target_arch_sysarch.h b/bsd-user/sparc64/target_arch_sysarch.h
new file mode 100644
index 0000000..84e1339
--- /dev/null
+++ b/bsd-user/sparc64/target_arch_sysarch.h
@@ -0,0 +1,52 @@
+/*
+ * SPARC64 sysarch() system call emulation
+ *
+ * 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 __ARCH_SYSARCH_H_
+#define __ARCH_SYSARCH_H_
+
+#include "syscall.h"
+
+static inline abi_long do_freebsd_arch_sysarch(void *env, int op,
+ abi_ulong parms)
+{
+ int ret = 0;
+
+ switch (op) {
+ case TARGET_SPARC_SIGTRAMP_INSTALL:
+ /* XXX not currently handled */
+ case TARGET_SPARC_UTRAP_INSTALL:
+ /* XXX not currently handled */
+ default:
+ ret = -TARGET_EINVAL;
+ break;
+ }
+
+ return ret;
+}
+
+static inline void do_freebsd_arch_print_sysarch(
+ const struct syscallname *name, abi_long arg1, abi_long arg2,
+ abi_long arg3, abi_long arg4, abi_long arg5, abi_long arg6)
+{
+
+ gemu_log("%s(%d, " TARGET_ABI_FMT_lx ", " TARGET_ABI_FMT_lx ", "
+ TARGET_ABI_FMT_lx ")", name->name, (int)arg1, arg2, arg3, arg4);
+}
+
+#endif /*!__ARCH_SYSARCH_H_ */
diff --git a/bsd-user/strace.c b/bsd-user/strace.c
index e33dd4d..60aabc3 100644
--- a/bsd-user/strace.c
+++ b/bsd-user/strace.c
@@ -27,6 +27,8 @@
#include "qemu.h"
+#include "os-strace.h" /* OS dependent strace print functions */
+
int do_strace;
/*
@@ -108,6 +110,14 @@ static void print_ioctl(const struct syscallname *name,
arg3);
}
+static void print_sysarch(const struct syscallname *name, abi_long arg1,
+ abi_long arg2, abi_long arg3, abi_long arg4, abi_long arg5,
+ abi_long arg6)
+{
+ /* This is os dependent. */
+ do_os_print_sysarch(name, arg1, arg2, arg3, arg4, arg5, arg6);
+}
+
/*
* Variants for the return value output function
*/
diff --git a/bsd-user/x86_64/syscall.h b/bsd-user/x86_64/syscall.h
index 630514a..4e77235 100644
--- a/bsd-user/x86_64/syscall.h
+++ b/bsd-user/x86_64/syscall.h
@@ -1,3 +1,23 @@
+/*
+ * x86_64 system call definitions
+ *
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
+ */
+#ifndef _X86_64_SYSCALL_H_
+#define _X86_64_SYSCALL_H_
+
#define __USER_CS (0x33)
#define __USER_DS (0x2B)
@@ -108,9 +128,11 @@ struct target_msqid64_ds {
#define TARGET_FREEBSD_AMD64_SET_GSBASE 131
-#define UNAME_MACHINE "x86_64"
+#define UNAME_MACHINE "x86_64"
#define TARGET_ARCH_SET_GS 0x1001
#define TARGET_ARCH_SET_FS 0x1002
#define TARGET_ARCH_GET_FS 0x1003
#define TARGET_ARCH_GET_GS 0x1004
+
+#endif /* ! _X86_64_SYSCALL_H_ */
diff --git a/bsd-user/x86_64/target_arch_sysarch.h b/bsd-user/x86_64/target_arch_sysarch.h
new file mode 100644
index 0000000..6d09d50
--- /dev/null
+++ b/bsd-user/x86_64/target_arch_sysarch.h
@@ -0,0 +1,76 @@
+/*
+ * x86_64 sysarch() syscall emulation
+ *
+ *
+ * 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 __ARCH_SYSARCH_H_
+#define __ARCH_SYSARCH_H_
+
+#include "syscall.h"
+
+static inline abi_long do_freebsd_arch_sysarch(CPUX86State *env, int op,
+ abi_ulong parms)
+{
+ abi_long ret = 0;
+ abi_ulong val;
+ int idx;
+
+ switch (op) {
+ case TARGET_FREEBSD_AMD64_SET_GSBASE:
+ case TARGET_FREEBSD_AMD64_SET_FSBASE:
+ if (op == TARGET_FREEBSD_AMD64_SET_GSBASE) {
+ idx = R_GS;
+ } else {
+ idx = R_FS;
+ }
+ if (get_user(val, parms, abi_ulong)) {
+ return -TARGET_EFAULT;
+ }
+ cpu_x86_load_seg(env, idx, 0);
+ env->segs[idx].base = val;
+ break;
+
+ case TARGET_FREEBSD_AMD64_GET_GSBASE:
+ case TARGET_FREEBSD_AMD64_GET_FSBASE:
+ if (op == TARGET_FREEBSD_AMD64_GET_GSBASE) {
+ idx = R_GS;
+ } else {
+ idx = R_FS;
+ }
+ val = env->segs[idx].base;
+ if (put_user(val, parms, abi_ulong)) {
+ return -TARGET_EFAULT;
+ }
+ break;
+
+ /* XXX handle the others... */
+ default:
+ ret = -TARGET_EINVAL;
+ break;
+ }
+ return ret;
+}
+
+static inline void do_freebsd_arch_print_sysarch(
+ const struct syscallname *name, abi_long arg1, abi_long arg2,
+ abi_long arg3, abi_long arg4, abi_long arg5, abi_long arg6)
+{
+
+ gemu_log("%s(%d, " TARGET_ABI_FMT_lx ", " TARGET_ABI_FMT_lx ", "
+ TARGET_ABI_FMT_lx ")", name->name, (int)arg1, arg2, arg3, arg4);
+}
+
+#endif /*! __ARCH_SYSARCH_H_ */
--
1.9.3
^ permalink raw reply related [flat|nested] 18+ messages in thread
* Re: [Qemu-devel] [PATCH 05/10 v4] bsd-user: Implement new syscall print_sysarch and add strace support
2014-06-08 16:57 ` [Qemu-devel] [PATCH 05/10 v4] bsd-user: Implement new syscall print_sysarch and add strace support Sean Bruno
@ 2014-06-10 22:53 ` Peter Maydell
2014-06-11 18:52 ` Sean Bruno
2014-06-15 15:33 ` Sean Bruno
0 siblings, 2 replies; 18+ messages in thread
From: Peter Maydell @ 2014-06-10 22:53 UTC (permalink / raw)
To: Sean Bruno; +Cc: QEMU Developers
On 8 June 2014 17:57, Sean Bruno <sbruno@freebsd.org> wrote:
> Signed-off-by: Sean Bruno <sbruno@freebsd.org>
> ---
> bsd-user/freebsd/os-strace.h | 29 +++++++++++++
> bsd-user/freebsd/strace.list | 2 +-
> bsd-user/i386/syscall.h | 21 +++++++++
> bsd-user/i386/target_arch_sysarch.h | 78 ++++++++++++++++++++++++++++++++++
> bsd-user/netbsd/os-strace.h | 1 +
> bsd-user/openbsd/os-strace.h | 1 +
> bsd-user/sparc/syscall.h | 27 +++++++++++-
> bsd-user/sparc/target_arch_sysarch.h | 52 +++++++++++++++++++++++
> bsd-user/sparc64/syscall.h | 26 +++++++++++-
> bsd-user/sparc64/target_arch_sysarch.h | 52 +++++++++++++++++++++++
> bsd-user/strace.c | 10 +++++
> bsd-user/x86_64/syscall.h | 24 ++++++++++-
> bsd-user/x86_64/target_arch_sysarch.h | 76 +++++++++++++++++++++++++++++++++
> 13 files changed, 395 insertions(+), 4 deletions(-)
> create mode 100644 bsd-user/freebsd/os-strace.h
> create mode 100644 bsd-user/i386/target_arch_sysarch.h
> create mode 100644 bsd-user/netbsd/os-strace.h
> create mode 100644 bsd-user/openbsd/os-strace.h
> create mode 100644 bsd-user/sparc/target_arch_sysarch.h
> create mode 100644 bsd-user/sparc64/target_arch_sysarch.h
> create mode 100644 bsd-user/x86_64/target_arch_sysarch.h
Unfortunately this breaks build of bsd-user on OpenBSD
and NetBSD, because they don't provide a do_os_print_sysarch().
> --- /dev/null
> +++ b/bsd-user/i386/target_arch_sysarch.h
> @@ -0,0 +1,78 @@
> +/*
> + * i386 sysarch system call emulation
> + *
> + * 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 __ARCH_SYSARCH_H_
> +#define __ARCH_SYSARCH_H_
> +
> +#include "syscall.h"
> +
> +static inline abi_long do_freebsd_arch_sysarch(CPUX86State *env, int op,
> + abi_ulong parms)
> +{
> + abi_long ret = 0;
> + abi_ulong val;
> + int idx;
> +
> + switch (op) {
> + case TARGET_FREEBSD_I386_SET_GSBASE:
> + case TARGET_FREEBSD_I386_SET_FSBASE:
Something's wrong here too -- this patch adds these functions
for each architecture, but it doesn't add the code that calls them,
and it doesn't delete the copies of this code from syscall.c.
thanks
-- PMM
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [Qemu-devel] [PATCH 05/10 v4] bsd-user: Implement new syscall print_sysarch and add strace support
2014-06-10 22:53 ` Peter Maydell
@ 2014-06-11 18:52 ` Sean Bruno
2014-06-15 15:33 ` Sean Bruno
1 sibling, 0 replies; 18+ messages in thread
From: Sean Bruno @ 2014-06-11 18:52 UTC (permalink / raw)
To: Peter Maydell; +Cc: QEMU Developers
On Tue, 2014-06-10 at 23:53 +0100, Peter Maydell wrote:
> On 8 June 2014 17:57, Sean Bruno <sbruno@freebsd.org> wrote:
> > Signed-off-by: Sean Bruno <sbruno@freebsd.org>
> > ---
> > bsd-user/freebsd/os-strace.h | 29 +++++++++++++
> > bsd-user/freebsd/strace.list | 2 +-
> > bsd-user/i386/syscall.h | 21 +++++++++
> > bsd-user/i386/target_arch_sysarch.h | 78 ++++++++++++++++++++++++++++++++++
> > bsd-user/netbsd/os-strace.h | 1 +
> > bsd-user/openbsd/os-strace.h | 1 +
> > bsd-user/sparc/syscall.h | 27 +++++++++++-
> > bsd-user/sparc/target_arch_sysarch.h | 52 +++++++++++++++++++++++
> > bsd-user/sparc64/syscall.h | 26 +++++++++++-
> > bsd-user/sparc64/target_arch_sysarch.h | 52 +++++++++++++++++++++++
> > bsd-user/strace.c | 10 +++++
> > bsd-user/x86_64/syscall.h | 24 ++++++++++-
> > bsd-user/x86_64/target_arch_sysarch.h | 76 +++++++++++++++++++++++++++++++++
> > 13 files changed, 395 insertions(+), 4 deletions(-)
> > create mode 100644 bsd-user/freebsd/os-strace.h
> > create mode 100644 bsd-user/i386/target_arch_sysarch.h
> > create mode 100644 bsd-user/netbsd/os-strace.h
> > create mode 100644 bsd-user/openbsd/os-strace.h
> > create mode 100644 bsd-user/sparc/target_arch_sysarch.h
> > create mode 100644 bsd-user/sparc64/target_arch_sysarch.h
> > create mode 100644 bsd-user/x86_64/target_arch_sysarch.h
>
> Unfortunately this breaks build of bsd-user on OpenBSD
> and NetBSD, because they don't provide a do_os_print_sysarch().
>
Ok, time to fire up a netbsd and openbsd vm here. I'll take a look.
> > --- /dev/null
> > +++ b/bsd-user/i386/target_arch_sysarch.h
> > @@ -0,0 +1,78 @@
> > +/*
> > + * i386 sysarch system call emulation
> > + *
> > + * 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 __ARCH_SYSARCH_H_
> > +#define __ARCH_SYSARCH_H_
> > +
> > +#include "syscall.h"
> > +
> > +static inline abi_long do_freebsd_arch_sysarch(CPUX86State *env, int op,
> > + abi_ulong parms)
> > +{
> > + abi_long ret = 0;
> > + abi_ulong val;
> > + int idx;
> > +
> > + switch (op) {
> > + case TARGET_FREEBSD_I386_SET_GSBASE:
> > + case TARGET_FREEBSD_I386_SET_FSBASE:
>
> Something's wrong here too -- this patch adds these functions
> for each architecture, but it doesn't add the code that calls them,
> and it doesn't delete the copies of this code from syscall.c.
>
> thanks
> -- PMM
Ok, I'll review this one again. Hrm ... I wonder what I dropped.
sean
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [Qemu-devel] [PATCH 05/10 v4] bsd-user: Implement new syscall print_sysarch and add strace support
2014-06-10 22:53 ` Peter Maydell
2014-06-11 18:52 ` Sean Bruno
@ 2014-06-15 15:33 ` Sean Bruno
2014-06-15 19:20 ` Peter Maydell
1 sibling, 1 reply; 18+ messages in thread
From: Sean Bruno @ 2014-06-15 15:33 UTC (permalink / raw)
To: Peter Maydell; +Cc: QEMU Developers
On Tue, 2014-06-10 at 23:53 +0100, Peter Maydell wrote:
> On 8 June 2014 17:57, Sean Bruno <sbruno@freebsd.org> wrote:
> > Signed-off-by: Sean Bruno <sbruno@freebsd.org>
> > ---
> > bsd-user/freebsd/os-strace.h | 29 +++++++++++++
> > bsd-user/freebsd/strace.list | 2 +-
> > bsd-user/i386/syscall.h | 21 +++++++++
> > bsd-user/i386/target_arch_sysarch.h | 78 ++++++++++++++++++++++++++++++++++
> > bsd-user/netbsd/os-strace.h | 1 +
> > bsd-user/openbsd/os-strace.h | 1 +
> > bsd-user/sparc/syscall.h | 27 +++++++++++-
> > bsd-user/sparc/target_arch_sysarch.h | 52 +++++++++++++++++++++++
> > bsd-user/sparc64/syscall.h | 26 +++++++++++-
> > bsd-user/sparc64/target_arch_sysarch.h | 52 +++++++++++++++++++++++
> > bsd-user/strace.c | 10 +++++
> > bsd-user/x86_64/syscall.h | 24 ++++++++++-
> > bsd-user/x86_64/target_arch_sysarch.h | 76 +++++++++++++++++++++++++++++++++
> > 13 files changed, 395 insertions(+), 4 deletions(-)
> > create mode 100644 bsd-user/freebsd/os-strace.h
> > create mode 100644 bsd-user/i386/target_arch_sysarch.h
> > create mode 100644 bsd-user/netbsd/os-strace.h
> > create mode 100644 bsd-user/openbsd/os-strace.h
> > create mode 100644 bsd-user/sparc/target_arch_sysarch.h
> > create mode 100644 bsd-user/sparc64/target_arch_sysarch.h
> > create mode 100644 bsd-user/x86_64/target_arch_sysarch.h
>
> Unfortunately this breaks build of bsd-user on OpenBSD
> and NetBSD, because they don't provide a do_os_print_sysarch().
>
Right, I've stubbed out a no-op function and tested on open/netbsd.
I'll send an update today.
<more comments below>
> > --- /dev/null
> > +++ b/bsd-user/i386/target_arch_sysarch.h
> > @@ -0,0 +1,78 @@
> > +/*
> > + * i386 sysarch system call emulation
> > + *
> > + * 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 __ARCH_SYSARCH_H_
> > +#define __ARCH_SYSARCH_H_
> > +
> > +#include "syscall.h"
> > +
> > +static inline abi_long do_freebsd_arch_sysarch(CPUX86State *env, int op,
> > + abi_ulong parms)
> > +{
> > + abi_long ret = 0;
> > + abi_ulong val;
> > + int idx;
> > +
> > + switch (op) {
> > + case TARGET_FREEBSD_I386_SET_GSBASE:
> > + case TARGET_FREEBSD_I386_SET_FSBASE:
>
> Something's wrong here too -- this patch adds these functions
> for each architecture, but it doesn't add the code that calls them,
> and it doesn't delete the copies of this code from syscall.c.
>
> thanks
> -- PMM
>
Digging through this for the last couple of days. Sorry for the slow
response, lots of code flow to follow here.
I think there's some confusion between the strace support for the new
print_sysarch() and the existing syscall do_freebsd_sysarch().
If I follow the code, the existing do_freebsd_sysarch() syscall is a
programtical way of figuring out what arch is running. Whereas
print_sysarch() spams the arch into your strace output.
Bearing that in mind, I think that the changes here are indeed correct
for this patchset.
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [Qemu-devel] [PATCH 05/10 v4] bsd-user: Implement new syscall print_sysarch and add strace support
2014-06-15 15:33 ` Sean Bruno
@ 2014-06-15 19:20 ` Peter Maydell
2014-06-15 19:30 ` Sean Bruno
0 siblings, 1 reply; 18+ messages in thread
From: Peter Maydell @ 2014-06-15 19:20 UTC (permalink / raw)
To: Sean Bruno; +Cc: QEMU Developers
On 15 June 2014 16:33, Sean Bruno <sbruno@ignoranthack.me> wrote:
> I think there's some confusion between the strace support for the new
> print_sysarch() and the existing syscall do_freebsd_sysarch().
Only because you've put parts of both in the same patch :-)
> If I follow the code, the existing do_freebsd_sysarch() syscall is a
> programtical way of figuring out what arch is running. Whereas
> print_sysarch() spams the arch into your strace output.
The existing do_freebsd_sysarch() is a bunch of functions in
syscall.c, with TARGET_* ifdefs selecting which one you get.
This patch seems to be attempting to change that to having
the per-arch implementations in the per-arch files. That's a
good idea, but this patch is only doing half of the job -- you
need to remove the old implementations and wire up the new.
Really the changes to the implementation and to the strace
support should go in separate patches.
> Bearing that in mind, I think that the changes here are indeed correct
> for this patchset.
I still disagree here. Look at the TARGET_I386 implementation
of do_freebsd_sysarch() in the existing syscall.c, and at the
new function do_freebsd_arch_sysarch() you've added in this patch in
bsd-user/x86_64/target_arch_sysarch.h. They're basically
identical -- this should be a code-move change, but you've
only got the 'add new version', not the 'and remove the old'.
I think if you remove all the do_freebsd_arch_sysarch()
functions from this patch you're left with just the strace
support (the strace related functions all have 'print' in
their names).
thanks
-- PMM
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [Qemu-devel] [PATCH 05/10 v4] bsd-user: Implement new syscall print_sysarch and add strace support
2014-06-15 19:20 ` Peter Maydell
@ 2014-06-15 19:30 ` Sean Bruno
0 siblings, 0 replies; 18+ messages in thread
From: Sean Bruno @ 2014-06-15 19:30 UTC (permalink / raw)
To: Peter Maydell; +Cc: QEMU Developers
On Sun, 2014-06-15 at 20:20 +0100, Peter Maydell wrote:
> On 15 June 2014 16:33, Sean Bruno <sbruno@ignoranthack.me> wrote:
> > I think there's some confusion between the strace support for the new
> > print_sysarch() and the existing syscall do_freebsd_sysarch().
>
> Only because you've put parts of both in the same patch :-)
>
Oh, I didn't say *where* the confusion was. It is most definitely on my
side. :-)
> > If I follow the code, the existing do_freebsd_sysarch() syscall is a
> > programtical way of figuring out what arch is running. Whereas
> > print_sysarch() spams the arch into your strace output.
>
> The existing do_freebsd_sysarch() is a bunch of functions in
> syscall.c, with TARGET_* ifdefs selecting which one you get.
> This patch seems to be attempting to change that to having
> the per-arch implementations in the per-arch files. That's a
> good idea, but this patch is only doing half of the job -- you
> need to remove the old implementations and wire up the new.
> Really the changes to the implementation and to the strace
> support should go in separate patches.
>
> > Bearing that in mind, I think that the changes here are indeed correct
> > for this patchset.
>
> I still disagree here. Look at the TARGET_I386 implementation
> of do_freebsd_sysarch() in the existing syscall.c, and at the
> new function do_freebsd_arch_sysarch() you've added in this patch in
> bsd-user/x86_64/target_arch_sysarch.h. They're basically
> identical -- this should be a code-move change, but you've
> only got the 'add new version', not the 'and remove the old'.
>
> I think if you remove all the do_freebsd_arch_sysarch()
> functions from this patch you're left with just the strace
> support (the strace related functions all have 'print' in
> their names).
>
> thanks
> -- PMM
Ok, more staring required.
sean
^ permalink raw reply [flat|nested] 18+ messages in thread
* [Qemu-devel] [PATCH 06/10 v4] bsd-user: Implement strace support for __acl_* syscalls
2014-06-08 16:57 [Qemu-devel] [PATCH 00/10 v4] bsd-user: update strace syscalls and breakout BSD distros Sean Bruno
` (4 preceding siblings ...)
2014-06-08 16:57 ` [Qemu-devel] [PATCH 05/10 v4] bsd-user: Implement new syscall print_sysarch and add strace support Sean Bruno
@ 2014-06-08 16:57 ` Sean Bruno
2014-06-08 16:57 ` [Qemu-devel] [PATCH 07/10 v4] bsd-user: Implement strace support for extattr_* syscalls Sean Bruno
` (4 subsequent siblings)
10 siblings, 0 replies; 18+ messages in thread
From: Sean Bruno @ 2014-06-08 16:57 UTC (permalink / raw)
To: qemu-devel; +Cc: Sean Bruno
Signed-off-by: Sean Bruno <sbruno@freebsd.org>
---
bsd-user/freebsd/strace.list | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/bsd-user/freebsd/strace.list b/bsd-user/freebsd/strace.list
index 32b3c55..0deff16 100644
--- a/bsd-user/freebsd/strace.list
+++ b/bsd-user/freebsd/strace.list
@@ -16,6 +16,18 @@
* along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
+{ TARGET_FREEBSD_NR___acl_aclcheck_fd, "__acl_aclcheck_fd", "%s(%d, %d, %#x)", NULL, NULL },
+{ TARGET_FREEBSD_NR___acl_aclcheck_file, "__acl_aclcheck_file", "%s(\"%s\", %d, %#x)", NULL, NULL },
+{ TARGET_FREEBSD_NR___acl_aclcheck_link, "__acl_aclcheck_link", "%s(\"%s\", %d, %#x)", NULL, NULL },
+{ TARGET_FREEBSD_NR___acl_delete_fd, "__acl_delete_fd", "%s(%d, %d)", NULL, NULL },
+{ TARGET_FREEBSD_NR___acl_delete_file, "__acl_delete_file", "%s(\"%s\", %d)", NULL, NULL },
+{ TARGET_FREEBSD_NR___acl_delete_link, "__acl_delete_link", "%s(\"%s\", %d)", NULL, NULL },
+{ TARGET_FREEBSD_NR___acl_get_fd, "__acl_get_fd", "%s(%d, %d, %#x)", NULL, NULL },
+{ TARGET_FREEBSD_NR___acl_get_file, "__acl_get_file", "%s(\"%s\", %d, %#x)", NULL, NULL },
+{ TARGET_FREEBSD_NR___acl_get_link, "__acl_get_link", "%s(\"%s\", %d, %#x)", NULL, NULL },
+{ TARGET_FREEBSD_NR___acl_set_fd, "__acl_set_fd", "%s(%d, %d, %#x)", NULL, NULL },
+{ TARGET_FREEBSD_NR___acl_set_file, "__acl_set_file", "%s(\"%s\", %d, %#x)", NULL, NULL },
+{ TARGET_FREEBSD_NR___acl_set_link, "__acl_set_link", "%s(\"%s\", %d, %#x)", NULL, NULL },
{ TARGET_FREEBSD_NR___semctl, "__semctl", NULL, NULL, NULL },
{ TARGET_FREEBSD_NR___syscall, "__syscall", NULL, NULL, NULL },
{ TARGET_FREEBSD_NR___sysctl, "__sysctl", NULL, print_sysctl, NULL },
--
1.9.3
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [Qemu-devel] [PATCH 07/10 v4] bsd-user: Implement strace support for extattr_* syscalls
2014-06-08 16:57 [Qemu-devel] [PATCH 00/10 v4] bsd-user: update strace syscalls and breakout BSD distros Sean Bruno
` (5 preceding siblings ...)
2014-06-08 16:57 ` [Qemu-devel] [PATCH 06/10 v4] bsd-user: Implement strace support for __acl_* syscalls Sean Bruno
@ 2014-06-08 16:57 ` Sean Bruno
2014-06-08 16:57 ` [Qemu-devel] [PATCH 08/10 v4] bsd-user: Implement strace support for thr_* syscalls Sean Bruno
` (3 subsequent siblings)
10 siblings, 0 replies; 18+ messages in thread
From: Sean Bruno @ 2014-06-08 16:57 UTC (permalink / raw)
To: qemu-devel; +Cc: Sean Bruno
Signed-off-by: Sean Bruno <sbruno@freebsd.org>
---
bsd-user/freebsd/strace.list | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/bsd-user/freebsd/strace.list b/bsd-user/freebsd/strace.list
index 0deff16..ed8ead3 100644
--- a/bsd-user/freebsd/strace.list
+++ b/bsd-user/freebsd/strace.list
@@ -51,6 +51,19 @@
{ TARGET_FREEBSD_NR_dup2, "dup2", NULL, NULL, NULL },
{ TARGET_FREEBSD_NR_execve, "execve", NULL, print_execve, NULL },
{ TARGET_FREEBSD_NR_exit, "exit", "%s(%d)\n", NULL, NULL },
+{ TARGET_FREEBSD_NR_extattrctl, "extattrctl", "%s(\"%s\", %d, \"%s\", %d, \"%s\"", NULL, NULL },
+{ TARGET_FREEBSD_NR_extattr_delete_fd, "extattr_delete_fd", "%s(%d, %d, \"%s\")", NULL, NULL },
+{ TARGET_FREEBSD_NR_extattr_delete_file, "extattr_delete_file", "%s(\"%s\", %d, \"%s\")", NULL, NULL },
+{ TARGET_FREEBSD_NR_extattr_delete_link, "extattr_delete_link", "%s(\"%s\", %d, \"%s\")", NULL, NULL },
+{ TARGET_FREEBSD_NR_extattr_get_fd, "extattr_get_fd", "%s(%d, %d, \"%s\", %#x, %d)", NULL, NULL },
+{ TARGET_FREEBSD_NR_extattr_get_file, "extattr_get_file", "%s(\"%s\", %d, \"%s\", %#x, %d)", NULL, NULL },
+{ TARGET_FREEBSD_NR_extattr_get_file, "extattr_get_link", "%s(\"%s\", %d, \"%s\", %#x, %d)", NULL, NULL },
+{ TARGET_FREEBSD_NR_extattr_list_fd, "extattr_list_fd", "%s(%d, %d, %#x, %d)", NULL, NULL },
+{ TARGET_FREEBSD_NR_extattr_list_file, "extattr_list_file", "%s(\"%s\", %d, %#x, %d)", NULL, NULL },
+{ TARGET_FREEBSD_NR_extattr_list_link, "extattr_list_link", "%s(\"%s\", %d, %#x, %d)", NULL, NULL },
+{ TARGET_FREEBSD_NR_extattr_set_fd, "extattr_set_fd", "%s(%d, %d, \"%s\", %#x, %d)", NULL, NULL },
+{ TARGET_FREEBSD_NR_extattr_set_file, "extattr_set_file", "%s(\"%s\", %d, \"%s\", %#x, %d)", NULL, NULL },
+{ TARGET_FREEBSD_NR_extattr_set_link, "extattr_set_link", "%s(\"%s\", %d, \"%s\", %#x, %d)", NULL, NULL },
{ TARGET_FREEBSD_NR_fchdir, "fchdir", NULL, NULL, NULL },
{ TARGET_FREEBSD_NR_fchflags, "fchflags", NULL, NULL, NULL },
{ TARGET_FREEBSD_NR_fchmod, "fchmod", "%s(%d,%#o)", NULL, NULL },
--
1.9.3
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [Qemu-devel] [PATCH 08/10 v4] bsd-user: Implement strace support for thr_* syscalls
2014-06-08 16:57 [Qemu-devel] [PATCH 00/10 v4] bsd-user: update strace syscalls and breakout BSD distros Sean Bruno
` (6 preceding siblings ...)
2014-06-08 16:57 ` [Qemu-devel] [PATCH 07/10 v4] bsd-user: Implement strace support for extattr_* syscalls Sean Bruno
@ 2014-06-08 16:57 ` Sean Bruno
2014-06-08 16:57 ` [Qemu-devel] [PATCH 09/10 v4] bsd-user: Fix syscall format, add strace support for more syscalls Sean Bruno
` (2 subsequent siblings)
10 siblings, 0 replies; 18+ messages in thread
From: Sean Bruno @ 2014-06-08 16:57 UTC (permalink / raw)
To: qemu-devel; +Cc: Sean Bruno
Signed-off-by: Sean Bruno <sbruno@freebsd.org>
---
bsd-user/freebsd/strace.list | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/bsd-user/freebsd/strace.list b/bsd-user/freebsd/strace.list
index ed8ead3..ef4fa85 100644
--- a/bsd-user/freebsd/strace.list
+++ b/bsd-user/freebsd/strace.list
@@ -202,6 +202,15 @@
{ TARGET_FREEBSD_NR_sync, "sync", NULL, NULL, NULL },
{ TARGET_FREEBSD_NR_sysarch, "sysarch", NULL, print_sysarch, NULL },
{ TARGET_FREEBSD_NR_syscall, "syscall", NULL, NULL, NULL },
+{ TARGET_FREEBSD_NR_thr_create, "thr_create", "%s(%#x, %#x, %d)", NULL, NULL },
+{ TARGET_FREEBSD_NR_thr_exit, "thr_exit", "%s(%#x)", NULL, NULL },
+{ TARGET_FREEBSD_NR_thr_kill, "thr_kill", "%s(%d, %#x)", NULL, NULL },
+{ TARGET_FREEBSD_NR_thr_kill2, "thr_kill2", "%s(%d, %d, %d)", NULL, NULL },
+{ TARGET_FREEBSD_NR_thr_new, "thr_new", "%s(%#x, %d)", NULL, NULL },
+{ TARGET_FREEBSD_NR_thr_self, "thr_self", "%s(%#x)", NULL, NULL },
+{ TARGET_FREEBSD_NR_thr_set_name, "thr_set_name", "%s(%d, \"%s\")", NULL, NULL },
+{ TARGET_FREEBSD_NR_thr_suspend, "thr_suspend", "%s(%d, %#x)", NULL, NULL },
+{ TARGET_FREEBSD_NR_thr_wake, "thr_wake", "%s(%d)", NULL, NULL },
{ TARGET_FREEBSD_NR_truncate, "truncate", NULL, NULL, NULL },
{ TARGET_FREEBSD_NR_umask, "umask", "%s(%#o)", NULL, NULL },
{ TARGET_FREEBSD_NR_unlink, "unlink", "%s(\"%s\")", NULL, NULL },
--
1.9.3
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [Qemu-devel] [PATCH 09/10 v4] bsd-user: Fix syscall format, add strace support for more syscalls
2014-06-08 16:57 [Qemu-devel] [PATCH 00/10 v4] bsd-user: update strace syscalls and breakout BSD distros Sean Bruno
` (7 preceding siblings ...)
2014-06-08 16:57 ` [Qemu-devel] [PATCH 08/10 v4] bsd-user: Implement strace support for thr_* syscalls Sean Bruno
@ 2014-06-08 16:57 ` Sean Bruno
2014-06-08 16:57 ` [Qemu-devel] [PATCH 10/10 v4] bsd-user: Add TARGET_HW_MACHINE TARGET_HW_MACHINE_ARCH for future use Sean Bruno
2014-06-10 23:29 ` [Qemu-devel] [PATCH 00/10 v4] bsd-user: update strace syscalls and breakout BSD distros Peter Maydell
10 siblings, 0 replies; 18+ messages in thread
From: Sean Bruno @ 2014-06-08 16:57 UTC (permalink / raw)
To: qemu-devel; +Cc: Sean Bruno
Signed-off-by: Sean Bruno <sbruno@freebsd.org>
---
bsd-user/freebsd/strace.list | 19 ++++++++++++++-----
1 file changed, 14 insertions(+), 5 deletions(-)
diff --git a/bsd-user/freebsd/strace.list b/bsd-user/freebsd/strace.list
index ef4fa85..55f5ff8 100644
--- a/bsd-user/freebsd/strace.list
+++ b/bsd-user/freebsd/strace.list
@@ -31,6 +31,7 @@
{ TARGET_FREEBSD_NR___semctl, "__semctl", NULL, NULL, NULL },
{ TARGET_FREEBSD_NR___syscall, "__syscall", NULL, NULL, NULL },
{ TARGET_FREEBSD_NR___sysctl, "__sysctl", NULL, print_sysctl, NULL },
+{ TARGET_FREEBSD_NR__umtx_op, "_umtx_op", "%s(%#x, %d, %d, %#x, %#x)", NULL, NULL },
{ TARGET_FREEBSD_NR_accept, "accept", "%s(%d,%#x,%#x)", NULL, NULL },
{ TARGET_FREEBSD_NR_access, "access", "%s(\"%s\",%#o)", NULL, NULL },
{ TARGET_FREEBSD_NR_acct, "acct", NULL, NULL, NULL },
@@ -49,6 +50,7 @@
{ TARGET_FREEBSD_NR_connect, "connect", "%s(%d,%#x,%d)", NULL, NULL },
{ TARGET_FREEBSD_NR_dup, "dup", NULL, NULL, NULL },
{ TARGET_FREEBSD_NR_dup2, "dup2", NULL, NULL, NULL },
+{ TARGET_FREEBSD_NR_eaccess, "eaccess", "%s(\"%s\",%#x)", NULL, NULL },
{ TARGET_FREEBSD_NR_execve, "execve", NULL, print_execve, NULL },
{ TARGET_FREEBSD_NR_exit, "exit", "%s(%d)\n", NULL, NULL },
{ TARGET_FREEBSD_NR_extattrctl, "extattrctl", "%s(\"%s\", %d, \"%s\", %d, \"%s\"", NULL, NULL },
@@ -67,19 +69,22 @@
{ TARGET_FREEBSD_NR_fchdir, "fchdir", NULL, NULL, NULL },
{ TARGET_FREEBSD_NR_fchflags, "fchflags", NULL, NULL, NULL },
{ TARGET_FREEBSD_NR_fchmod, "fchmod", "%s(%d,%#o)", NULL, NULL },
-{ TARGET_FREEBSD_NR_fchown, "fchown", "%s(\"%s\",%d,%d)", NULL, NULL },
+{ TARGET_FREEBSD_NR_fchown, "fchown", "%s(%d,%d,%d)", NULL, NULL },
{ TARGET_FREEBSD_NR_fcntl, "fcntl", NULL, NULL, NULL },
+{ TARGET_FREEBSD_NR_fexecve, "fexecve", NULL, print_execve, NULL },
{ TARGET_FREEBSD_NR_fhopen, "fhopen", NULL, NULL, NULL },
{ TARGET_FREEBSD_NR_fhstat, "fhstat", NULL, NULL, NULL },
{ TARGET_FREEBSD_NR_fhstatfs, "fhstatfs", NULL, NULL, NULL },
{ TARGET_FREEBSD_NR_flock, "flock", NULL, NULL, NULL },
{ TARGET_FREEBSD_NR_fork, "fork", "%s()", NULL, NULL },
{ TARGET_FREEBSD_NR_fpathconf, "fpathconf", NULL, NULL, NULL },
-{ TARGET_FREEBSD_NR_fstat, "fstat", "%s(%d,%p)", NULL, NULL },
-{ TARGET_FREEBSD_NR_fstatfs, "fstatfs", "%s(%d,%p)", NULL, NULL },
+{ TARGET_FREEBSD_NR_fstat, "fstat", "%s(%d,%#x)", NULL, NULL },
+{ TARGET_FREEBSD_NR_fstatat, "fstatat", "%s(%d,\"%s\", %#x, %d)", NULL, NULL },
+{ TARGET_FREEBSD_NR_fstatfs, "fstatfs", "%s(%d,%#x)", NULL, NULL },
{ TARGET_FREEBSD_NR_fsync, "fsync", NULL, NULL, NULL },
{ TARGET_FREEBSD_NR_ftruncate, "ftruncate", NULL, NULL, NULL },
{ TARGET_FREEBSD_NR_futimes, "futimes", NULL, NULL, NULL },
+{ TARGET_FREEBSD_NR_getcontext, "getcontext", "%s(%#x)", NULL, NULL },
{ TARGET_FREEBSD_NR_getdirentries, "getdirentries", NULL, NULL, NULL },
{ TARGET_FREEBSD_NR_freebsd6_mmap, "freebsd6_mmap", NULL, NULL, NULL },
{ TARGET_FREEBSD_NR_getegid, "getegid", "%s()", NULL, NULL },
@@ -114,6 +119,7 @@
{ TARGET_FREEBSD_NR_lchown, "lchown", NULL, NULL, NULL },
{ TARGET_FREEBSD_NR_link, "link", "%s(\"%s\",\"%s\")", NULL, NULL },
{ TARGET_FREEBSD_NR_listen, "listen", NULL, NULL, NULL },
+{ TARGET_FREEBSD_NR_lpathconf, "lpathconf", "%s(\"%s\", %d)", NULL, NULL },
{ TARGET_FREEBSD_NR_lseek, "lseek", NULL, NULL, NULL },
{ TARGET_FREEBSD_NR_lstat, "lstat", "%s(\"%s\",%p)", NULL, NULL },
{ TARGET_FREEBSD_NR_madvise, "madvise", NULL, NULL, NULL },
@@ -138,7 +144,8 @@
{ TARGET_FREEBSD_NR_nanosleep, "nanosleep", NULL, NULL, NULL },
{ TARGET_FREEBSD_NR_nfssvc, "nfssvc", NULL, NULL, NULL },
{ TARGET_FREEBSD_NR_open, "open", "%s(\"%s\",%#x,%#o)", NULL, NULL },
-{ TARGET_FREEBSD_NR_pathconf, "pathconf", NULL, NULL, NULL },
+{ TARGET_FREEBSD_NR_openat, "openat", "%s(%d, \"%s\",%#x,%#o)", NULL, NULL },
+{ TARGET_FREEBSD_NR_pathconf, "pathconf", "%s(\"%s\", %d)", NULL, NULL },
{ TARGET_FREEBSD_NR_pipe, "pipe", NULL, NULL, NULL },
{ TARGET_FREEBSD_NR_poll, "poll", NULL, NULL, NULL },
{ TARGET_FREEBSD_NR_pread, "pread", NULL, NULL, NULL },
@@ -158,6 +165,7 @@
{ TARGET_FREEBSD_NR_revoke, "revoke", NULL, NULL, NULL },
{ TARGET_FREEBSD_NR_rfork, "rfork", NULL, NULL, NULL },
{ TARGET_FREEBSD_NR_rmdir, "rmdir", NULL, NULL, NULL },
+{ TARGET_FREEBSD_NR_rtprio_thread, "rtprio_thread", "%s(%d, %d, %p)", NULL, NULL },
{ TARGET_FREEBSD_NR_sbrk, "sbrk", NULL, NULL, NULL },
{ TARGET_FREEBSD_NR_sched_yield, "sched_yield", NULL, NULL, NULL },
{ TARGET_FREEBSD_NR_select, "select", NULL, NULL, NULL },
@@ -165,6 +173,7 @@
{ TARGET_FREEBSD_NR_semop, "semop", NULL, NULL, NULL },
{ TARGET_FREEBSD_NR_sendmsg, "sendmsg", NULL, NULL, NULL },
{ TARGET_FREEBSD_NR_sendto, "sendto", NULL, NULL, NULL },
+{ TARGET_FREEBSD_NR_setcontext, "setcontext", "%s(%#x)", NULL, NULL },
{ TARGET_FREEBSD_NR_setegid, "setegid", NULL, NULL, NULL },
{ TARGET_FREEBSD_NR_seteuid, "seteuid", NULL, NULL, NULL },
{ TARGET_FREEBSD_NR_setgid, "setgid", NULL, NULL, NULL },
@@ -193,7 +202,7 @@
{ TARGET_FREEBSD_NR_sigprocmask, "sigprocmask", NULL, NULL, NULL },
{ TARGET_FREEBSD_NR_sigreturn, "sigreturn", NULL, NULL, NULL },
{ TARGET_FREEBSD_NR_sigsuspend, "sigsuspend", NULL, NULL, NULL },
-{ TARGET_FREEBSD_NR_socket, "socket", NULL, NULL, NULL },
+{ TARGET_FREEBSD_NR_socket, "socket", "%s(%d,%d,%d)", NULL, NULL },
{ TARGET_FREEBSD_NR_socketpair, "socketpair", NULL, NULL, NULL },
{ TARGET_FREEBSD_NR_sstk, "sstk", NULL, NULL, NULL },
{ TARGET_FREEBSD_NR_stat, "stat", "%s(\"%s\",%p)", NULL, NULL },
--
1.9.3
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [Qemu-devel] [PATCH 10/10 v4] bsd-user: Add TARGET_HW_MACHINE TARGET_HW_MACHINE_ARCH for future use
2014-06-08 16:57 [Qemu-devel] [PATCH 00/10 v4] bsd-user: update strace syscalls and breakout BSD distros Sean Bruno
` (8 preceding siblings ...)
2014-06-08 16:57 ` [Qemu-devel] [PATCH 09/10 v4] bsd-user: Fix syscall format, add strace support for more syscalls Sean Bruno
@ 2014-06-08 16:57 ` Sean Bruno
2014-06-10 23:00 ` Peter Maydell
2014-06-10 23:29 ` [Qemu-devel] [PATCH 00/10 v4] bsd-user: update strace syscalls and breakout BSD distros Peter Maydell
10 siblings, 1 reply; 18+ messages in thread
From: Sean Bruno @ 2014-06-08 16:57 UTC (permalink / raw)
To: qemu-devel; +Cc: Sean Bruno
Signed-off-by: Sean Bruno <sbruno@freebsd.org>
---
bsd-user/i386/syscall.h | 2 ++
bsd-user/sparc/syscall.h | 2 ++
bsd-user/sparc64/syscall.h | 2 ++
bsd-user/x86_64/syscall.h | 2 ++
4 files changed, 8 insertions(+)
diff --git a/bsd-user/i386/syscall.h b/bsd-user/i386/syscall.h
index 8028fc8..52de302 100644
--- a/bsd-user/i386/syscall.h
+++ b/bsd-user/i386/syscall.h
@@ -178,5 +178,7 @@ struct target_vm86plus_struct {
#define UNAME_MACHINE "i386"
+#define TARGET_HW_MACHINE UNAME_MACHINE
+#define TARGET_HW_MACHINE_ARCH UNAME_MACHINE
#endif /* ! _I386_SYSCALL_H_ */
diff --git a/bsd-user/sparc/syscall.h b/bsd-user/sparc/syscall.h
index 7ed2152..3a5b1e2 100644
--- a/bsd-user/sparc/syscall.h
+++ b/bsd-user/sparc/syscall.h
@@ -27,6 +27,8 @@ struct target_pt_regs {
};
#define UNAME_MACHINE "sun4"
+#define TARGET_HW_MACHINE "sparc"
+#define TARGET_HW_MACHINE_ARCH "sparc"
#define TARGET_SPARC_UTRAP_INSTALL 1
#define TARGET_SPARC_SIGTRAMP_INSTALL 2
diff --git a/bsd-user/sparc64/syscall.h b/bsd-user/sparc64/syscall.h
index 8571092..58cc38d 100644
--- a/bsd-user/sparc64/syscall.h
+++ b/bsd-user/sparc64/syscall.h
@@ -27,6 +27,8 @@ struct target_pt_regs {
};
#define UNAME_MACHINE "sun4u"
+#define TARGET_HW_MACHINE "sparc"
+#define TARGET_HW_MACHINE_ARCH "sparc64"
#define TARGET_SPARC_UTRAP_INSTALL 1
#define TARGET_SPARC_SIGTRAMP_INSTALL 2
diff --git a/bsd-user/x86_64/syscall.h b/bsd-user/x86_64/syscall.h
index 4e77235..4fff6a5 100644
--- a/bsd-user/x86_64/syscall.h
+++ b/bsd-user/x86_64/syscall.h
@@ -129,6 +129,8 @@ struct target_msqid64_ds {
#define UNAME_MACHINE "x86_64"
+#define TARGET_HW_MACHINE "amd64"
+#define TARGET_HW_MACHINE_ARCH "amd64"
#define TARGET_ARCH_SET_GS 0x1001
#define TARGET_ARCH_SET_FS 0x1002
--
1.9.3
^ permalink raw reply related [flat|nested] 18+ messages in thread
* Re: [Qemu-devel] [PATCH 00/10 v4] bsd-user: update strace syscalls and breakout BSD distros
2014-06-08 16:57 [Qemu-devel] [PATCH 00/10 v4] bsd-user: update strace syscalls and breakout BSD distros Sean Bruno
` (9 preceding siblings ...)
2014-06-08 16:57 ` [Qemu-devel] [PATCH 10/10 v4] bsd-user: Add TARGET_HW_MACHINE TARGET_HW_MACHINE_ARCH for future use Sean Bruno
@ 2014-06-10 23:29 ` Peter Maydell
10 siblings, 0 replies; 18+ messages in thread
From: Peter Maydell @ 2014-06-10 23:29 UTC (permalink / raw)
To: Sean Bruno; +Cc: QEMU Developers
On 8 June 2014 17:57, Sean Bruno <sbruno@freebsd.org> wrote:
> Sean Bruno (9):
> bsd-user: GPL v2 attribution update and style
> bsd-user: Implement strace support for print_sysctl syscall
> bsd-user: Implement strace support for print_ioctl syscall
> bsd-user: Implement new syscall print_sysarch and add strace support
> bsd-user: Implement strace support for __acl_* syscalls
> bsd-user: Implement strace support for extattr_* syscalls
> bsd-user: Implement strace support for thr_* syscalls
> bsd-user: Fix syscall format, add strace support for more syscalls
> bsd-user: Add TARGET_HW_MACHINE TARGET_HW_MACHINE_ARCH for future use
>
> Stacey Son (1):
> bsd-user: add HOST_VARIANT_DIR for various *BSD dependent code
Patch 5 still needs some work, and I think 10 should be kept
until the patches that use those constants. The rest are
good and I've added them to bsd-user.next, so you don't
need to resend them next time round.
(I'll send a pullreq for the bsd-user patches tomorrow, since
we're up to 15 in that queue now.)
thanks
-- PMM
^ permalink raw reply [flat|nested] 18+ messages in thread