@@ -383,7 +383,9 @@ int host_to_target_waitstatus(int status);
void print_syscall(int num,
abi_long arg1, abi_long arg2, abi_long arg3,
abi_long arg4, abi_long arg5, abi_long arg6);
-void print_syscall_ret(int num, abi_long arg1);
+void print_syscall_ret(int num, abi_long ret,
+ abi_long arg1, abi_long arg2, abi_long arg3,
+ abi_long arg4, abi_long arg5, abi_long arg6);
/**
* print_taken_signal:
* @target_signum: target signal being taken
@@ -19,7 +19,9 @@ struct syscallname {
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 (*result)(const struct syscallname *, abi_long,
+ abi_long, abi_long, abi_long,
+ abi_long, abi_long, abi_long);
};
#ifdef __GNUC__
@@ -631,18 +633,12 @@ print_clockid(int clockid, int last)
/* select */
#ifdef TARGET_NR__newselect
-static long newselect_arg1 = 0;
-static long newselect_arg2 = 0;
-static long newselect_arg3 = 0;
-static long newselect_arg4 = 0;
-static long newselect_arg5 = 0;
-
static void
print_newselect(const struct syscallname *name,
abi_long arg1, abi_long arg2, abi_long arg3,
abi_long arg4, abi_long arg5, abi_long arg6)
{
- qemu_log("%s(" TARGET_ABI_FMT_ld ",", name->name, arg1);
+ print_syscall_prologue(name);
print_fdset(arg1, arg2);
qemu_log(",");
print_fdset(arg1, arg3);
@@ -650,14 +646,7 @@ print_newselect(const struct syscallname *name,
print_fdset(arg1, arg4);
qemu_log(",");
print_timeval(arg5, 1);
- qemu_log(")");
-
- /* save for use in the return output function below */
- newselect_arg1=arg1;
- newselect_arg2=arg2;
- newselect_arg3=arg3;
- newselect_arg4=arg4;
- newselect_arg5=arg5;
+ print_syscall_epilogue(name);
}
#endif
@@ -736,17 +725,29 @@ print_ipc(const struct syscallname *name,
*/
static void
-print_syscall_ret_addr(const struct syscallname *name, abi_long ret)
+print_syscall_err(abi_long ret)
{
const char *errstr = NULL;
+ qemu_log(" = ");
if (ret < 0) {
+ qemu_log("-1 errno=%d", errno);
errstr = target_strerror(-ret);
+ if (errstr) {
+ qemu_log(" (%s)", errstr);
+ }
}
- if (errstr) {
- qemu_log(" = -1 errno=%d (%s)\n", (int)-ret, errstr);
- } else {
- qemu_log(" = 0x" TARGET_ABI_FMT_lx "\n", ret);
+}
+
+static void
+print_syscall_ret_addr(const struct syscallname *name, abi_long ret,
+ abi_long arg0, abi_long arg1, abi_long arg2,
+ abi_long arg3, abi_long arg4, abi_long arg5)
+{
+ print_syscall_err(ret);
+
+ if (ret >= 0) {
+ qemu_log("0x" TARGET_ABI_FMT_lx "\n", ret);
}
}
@@ -760,17 +761,25 @@ print_syscall_ret_raw(struct syscallname *name, abi_long ret)
#ifdef TARGET_NR__newselect
static void
-print_syscall_ret_newselect(const struct syscallname *name, abi_long ret)
-{
- qemu_log(" = 0x" TARGET_ABI_FMT_lx " (", ret);
- print_fdset(newselect_arg1,newselect_arg2);
- qemu_log(",");
- print_fdset(newselect_arg1,newselect_arg3);
- qemu_log(",");
- print_fdset(newselect_arg1,newselect_arg4);
- qemu_log(",");
- print_timeval(newselect_arg5, 1);
- qemu_log(")\n");
+print_syscall_ret_newselect(const struct syscallname *name, abi_long ret,
+ abi_long arg0, abi_long arg1, abi_long arg2,
+ abi_long arg3, abi_long arg4, abi_long arg5)
+{
+ print_syscall_err(ret);
+
+ if (ret >= 0) {
+ qemu_log(" = 0x" TARGET_ABI_FMT_lx " (", ret);
+ print_fdset(arg0, arg1);
+ qemu_log(",");
+ print_fdset(arg0, arg2);
+ qemu_log(",");
+ print_fdset(arg0, arg3);
+ qemu_log(",");
+ print_timeval(arg4, 1);
+ qemu_log(")");
+ }
+
+ qemu_log("\n");
}
#endif
@@ -783,18 +792,13 @@ print_syscall_ret_newselect(const struct syscallname *name, abi_long ret)
#define TARGET_TIME_ERROR 5 /* clock not synchronized */
#ifdef TARGET_NR_adjtimex
static void
-print_syscall_ret_adjtimex(const struct syscallname *name, abi_long ret)
+print_syscall_ret_adjtimex(const struct syscallname *name, abi_long ret,
+ abi_long arg0, abi_long arg1, abi_long arg2,
+ abi_long arg3, abi_long arg4, abi_long arg5)
{
- const char *errstr = NULL;
+ print_syscall_err(ret);
- qemu_log(" = ");
- if (ret < 0) {
- qemu_log("-1 errno=%d", errno);
- errstr = target_strerror(-ret);
- if (errstr) {
- qemu_log(" (%s)", errstr);
- }
- } else {
+ if (ret >= 0) {
qemu_log(TARGET_ABI_FMT_ld, ret);
switch (ret) {
case TARGET_TIME_OK:
@@ -2847,25 +2851,25 @@ print_syscall(int num,
void
-print_syscall_ret(int num, abi_long ret)
+print_syscall_ret(int num, abi_long ret,
+ abi_long arg1, abi_long arg2, abi_long arg3,
+ abi_long arg4, abi_long arg5, abi_long arg6)
{
int i;
- const char *errstr = NULL;
for(i=0;i<nsyscalls;i++)
if( scnames[i].nr == num ) {
if( scnames[i].result != NULL ) {
- scnames[i].result(&scnames[i], ret);
+ scnames[i].result(&scnames[i], ret,
+ arg1, arg2, arg3,
+ arg4, arg5, arg6);
} else {
- if (ret < 0) {
- errstr = target_strerror(-ret);
- }
- if (errstr) {
- qemu_log(" = -1 errno=" TARGET_ABI_FMT_ld " (%s)\n",
- -ret, errstr);
- } else {
- qemu_log(" = " TARGET_ABI_FMT_ld "\n", ret);
+ print_syscall_err(ret);
+
+ if (ret >= 0) {
+ qemu_log(TARGET_ABI_FMT_ld, ret);
}
+ qemu_log("\n");
}
break;
}
@@ -12441,7 +12441,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
arg5, arg6, arg7, arg8);
if (unlikely(qemu_loglevel_mask(LOG_STRACE))) {
- print_syscall_ret(num, ret);
+ print_syscall_ret(num, ret, arg1, arg2, arg3, arg4, arg5, arg6);
}
record_syscall_return(cpu, num, ret);