1 #include "qemu/osdep.h"
6 #include <sys/select.h>
17 void (*call
)(const struct syscallname
*,
18 abi_long
, abi_long
, abi_long
,
19 abi_long
, abi_long
, abi_long
);
20 void (*result
)(const struct syscallname
*, abi_long
);
25 * It is possible that target doesn't have syscall that uses
26 * following flags but we don't want the compiler to warn
27 * us about them being unused. Same applies to utility print
28 * functions. It is ok to keep them while not used.
30 #define UNUSED __attribute__ ((unused))
36 * Structure used to translate flag values into strings. This is
37 * similar that is in the actual strace tool.
40 abi_long f_value
; /* flag */
41 const char *f_string
; /* stringified flag */
44 /* common flags for all architectures */
45 #define FLAG_GENERIC(name) { name, #name }
46 /* target specific flags (syscall_defs.h has TARGET_<flag>) */
47 #define FLAG_TARGET(name) { TARGET_ ## name, #name }
48 /* end of flags array */
49 #define FLAG_END { 0, NULL }
51 UNUSED
static const char *get_comma(int);
52 UNUSED
static void print_pointer(abi_long
, int);
53 UNUSED
static void print_flags(const struct flags
*, abi_long
, int);
54 UNUSED
static void print_at_dirfd(abi_long
, int);
55 UNUSED
static void print_file_mode(abi_long
, int);
56 UNUSED
static void print_open_flags(abi_long
, int);
57 UNUSED
static void print_syscall_prologue(const struct syscallname
*);
58 UNUSED
static void print_syscall_epilogue(const struct syscallname
*);
59 UNUSED
static void print_string(abi_long
, int);
60 UNUSED
static void print_raw_param(const char *, abi_long
, int);
61 UNUSED
static void print_timeval(abi_ulong
, int);
62 UNUSED
static void print_number(abi_long
, int);
63 UNUSED
static void print_signal(abi_ulong
, int);
69 print_ipc_cmd(int cmd
)
71 #define output_cmd(val) \
79 /* General IPC commands */
80 output_cmd( IPC_RMID
);
81 output_cmd( IPC_SET
);
82 output_cmd( IPC_STAT
);
83 output_cmd( IPC_INFO
);
84 /* msgctl() commands */
86 output_cmd( MSG_STAT
);
87 output_cmd( MSG_INFO
);
89 /* shmctl() commands */
90 output_cmd( SHM_LOCK
);
91 output_cmd( SHM_UNLOCK
);
92 output_cmd( SHM_STAT
);
93 output_cmd( SHM_INFO
);
94 /* semctl() commands */
98 output_cmd( GETNCNT
);
99 output_cmd( GETZCNT
);
100 output_cmd( SETVAL
);
101 output_cmd( SETALL
);
102 output_cmd( SEM_STAT
);
103 output_cmd( SEM_INFO
);
104 output_cmd( IPC_RMID
);
105 output_cmd( IPC_RMID
);
106 output_cmd( IPC_RMID
);
107 output_cmd( IPC_RMID
);
108 output_cmd( IPC_RMID
);
109 output_cmd( IPC_RMID
);
110 output_cmd( IPC_RMID
);
111 output_cmd( IPC_RMID
);
112 output_cmd( IPC_RMID
);
114 /* Some value we don't recognize */
119 print_signal(abi_ulong arg
, int last
)
121 const char *signal_name
= NULL
;
123 case TARGET_SIGHUP
: signal_name
= "SIGHUP"; break;
124 case TARGET_SIGINT
: signal_name
= "SIGINT"; break;
125 case TARGET_SIGQUIT
: signal_name
= "SIGQUIT"; break;
126 case TARGET_SIGILL
: signal_name
= "SIGILL"; break;
127 case TARGET_SIGABRT
: signal_name
= "SIGABRT"; break;
128 case TARGET_SIGFPE
: signal_name
= "SIGFPE"; break;
129 case TARGET_SIGKILL
: signal_name
= "SIGKILL"; break;
130 case TARGET_SIGSEGV
: signal_name
= "SIGSEGV"; break;
131 case TARGET_SIGPIPE
: signal_name
= "SIGPIPE"; break;
132 case TARGET_SIGALRM
: signal_name
= "SIGALRM"; break;
133 case TARGET_SIGTERM
: signal_name
= "SIGTERM"; break;
134 case TARGET_SIGUSR1
: signal_name
= "SIGUSR1"; break;
135 case TARGET_SIGUSR2
: signal_name
= "SIGUSR2"; break;
136 case TARGET_SIGCHLD
: signal_name
= "SIGCHLD"; break;
137 case TARGET_SIGCONT
: signal_name
= "SIGCONT"; break;
138 case TARGET_SIGSTOP
: signal_name
= "SIGSTOP"; break;
139 case TARGET_SIGTTIN
: signal_name
= "SIGTTIN"; break;
140 case TARGET_SIGTTOU
: signal_name
= "SIGTTOU"; break;
142 if (signal_name
== NULL
) {
143 print_raw_param("%ld", arg
, last
);
146 gemu_log("%s%s", signal_name
, get_comma(last
));
149 #ifdef TARGET_NR__newselect
151 print_fdset(int n
, abi_ulong target_fds_addr
)
156 if( target_fds_addr
) {
157 abi_long
*target_fds
;
159 target_fds
= lock_user(VERIFY_READ
,
161 sizeof(*target_fds
)*(n
/ TARGET_ABI_BITS
+ 1),
167 for (i
=n
; i
>=0; i
--) {
168 if ((tswapal(target_fds
[i
/ TARGET_ABI_BITS
]) >> (i
& (TARGET_ABI_BITS
- 1))) & 1)
171 unlock_user(target_fds
, target_fds_addr
, 0);
178 * Sysycall specific output functions
182 #ifdef TARGET_NR__newselect
183 static long newselect_arg1
= 0;
184 static long newselect_arg2
= 0;
185 static long newselect_arg3
= 0;
186 static long newselect_arg4
= 0;
187 static long newselect_arg5
= 0;
190 print_newselect(const struct syscallname
*name
,
191 abi_long arg1
, abi_long arg2
, abi_long arg3
,
192 abi_long arg4
, abi_long arg5
, abi_long arg6
)
194 gemu_log("%s(" TARGET_ABI_FMT_ld
",", name
->name
, arg1
);
195 print_fdset(arg1
, arg2
);
197 print_fdset(arg1
, arg3
);
199 print_fdset(arg1
, arg4
);
201 print_timeval(arg5
, 1);
204 /* save for use in the return output function below */
213 #ifdef TARGET_NR_semctl
215 print_semctl(const struct syscallname
*name
,
216 abi_long arg1
, abi_long arg2
, abi_long arg3
,
217 abi_long arg4
, abi_long arg5
, abi_long arg6
)
219 gemu_log("%s(" TARGET_ABI_FMT_ld
"," TARGET_ABI_FMT_ld
",", name
->name
, arg1
, arg2
);
221 gemu_log(",0x" TARGET_ABI_FMT_lx
")", arg4
);
226 print_execve(const struct syscallname
*name
,
227 abi_long arg1
, abi_long arg2
, abi_long arg3
,
228 abi_long arg4
, abi_long arg5
, abi_long arg6
)
230 abi_ulong arg_ptr_addr
;
233 if (!(s
= lock_user_string(arg1
)))
235 gemu_log("%s(\"%s\",{", name
->name
, s
);
236 unlock_user(s
, arg1
, 0);
238 for (arg_ptr_addr
= arg2
; ; arg_ptr_addr
+= sizeof(abi_ulong
)) {
239 abi_ulong
*arg_ptr
, arg_addr
;
241 arg_ptr
= lock_user(VERIFY_READ
, arg_ptr_addr
, sizeof(abi_ulong
), 1);
244 arg_addr
= tswapal(*arg_ptr
);
245 unlock_user(arg_ptr
, arg_ptr_addr
, 0);
248 if ((s
= lock_user_string(arg_addr
))) {
249 gemu_log("\"%s\",", s
);
250 unlock_user(s
, arg_addr
, 0);
259 print_ipc(const struct syscallname
*name
,
260 abi_long arg1
, abi_long arg2
, abi_long arg3
,
261 abi_long arg4
, abi_long arg5
, abi_long arg6
)
265 gemu_log("semctl(" TARGET_ABI_FMT_ld
"," TARGET_ABI_FMT_ld
",", arg1
, arg2
);
267 gemu_log(",0x" TARGET_ABI_FMT_lx
")", arg4
);
270 gemu_log("%s(" TARGET_ABI_FMT_ld
"," TARGET_ABI_FMT_ld
"," TARGET_ABI_FMT_ld
"," TARGET_ABI_FMT_ld
")",
271 name
->name
, arg1
, arg2
, arg3
, arg4
);
277 * Variants for the return value output function
281 print_syscall_ret_addr(const struct syscallname
*name
, abi_long ret
)
283 const char *errstr
= NULL
;
286 errstr
= target_strerror(-ret
);
289 gemu_log(" = -1 errno=%d (%s)\n", (int)-ret
, errstr
);
291 gemu_log(" = 0x" TARGET_ABI_FMT_lx
"\n", ret
);
295 #if 0 /* currently unused */
297 print_syscall_ret_raw(struct syscallname
*name
, abi_long ret
)
299 gemu_log(" = 0x" TARGET_ABI_FMT_lx
"\n", ret
);
303 #ifdef TARGET_NR__newselect
305 print_syscall_ret_newselect(const struct syscallname
*name
, abi_long ret
)
307 gemu_log(" = 0x" TARGET_ABI_FMT_lx
" (", ret
);
308 print_fdset(newselect_arg1
,newselect_arg2
);
310 print_fdset(newselect_arg1
,newselect_arg3
);
312 print_fdset(newselect_arg1
,newselect_arg4
);
314 print_timeval(newselect_arg5
, 1);
319 UNUSED
static struct flags access_flags
[] = {
327 UNUSED
static struct flags at_file_flags
[] = {
329 FLAG_GENERIC(AT_EACCESS
),
331 #ifdef AT_SYMLINK_NOFOLLOW
332 FLAG_GENERIC(AT_SYMLINK_NOFOLLOW
),
337 UNUSED
static struct flags unlinkat_flags
[] = {
339 FLAG_GENERIC(AT_REMOVEDIR
),
344 UNUSED
static struct flags mode_flags
[] = {
345 FLAG_GENERIC(S_IFSOCK
),
346 FLAG_GENERIC(S_IFLNK
),
347 FLAG_GENERIC(S_IFREG
),
348 FLAG_GENERIC(S_IFBLK
),
349 FLAG_GENERIC(S_IFDIR
),
350 FLAG_GENERIC(S_IFCHR
),
351 FLAG_GENERIC(S_IFIFO
),
355 UNUSED
static struct flags open_access_flags
[] = {
356 FLAG_TARGET(O_RDONLY
),
357 FLAG_TARGET(O_WRONLY
),
362 UNUSED
static struct flags open_flags
[] = {
363 FLAG_TARGET(O_APPEND
),
364 FLAG_TARGET(O_CREAT
),
365 FLAG_TARGET(O_DIRECTORY
),
367 FLAG_TARGET(O_LARGEFILE
),
368 FLAG_TARGET(O_NOCTTY
),
369 FLAG_TARGET(O_NOFOLLOW
),
370 FLAG_TARGET(O_NONBLOCK
), /* also O_NDELAY */
371 FLAG_TARGET(O_DSYNC
),
372 FLAG_TARGET(__O_SYNC
),
373 FLAG_TARGET(O_TRUNC
),
375 FLAG_TARGET(O_DIRECT
),
378 FLAG_TARGET(O_NOATIME
),
381 FLAG_TARGET(O_CLOEXEC
),
389 UNUSED
static struct flags mount_flags
[] = {
391 FLAG_GENERIC(MS_BIND
),
394 FLAG_GENERIC(MS_DIRSYNC
),
396 FLAG_GENERIC(MS_MANDLOCK
),
398 FLAG_GENERIC(MS_MOVE
),
400 FLAG_GENERIC(MS_NOATIME
),
401 FLAG_GENERIC(MS_NODEV
),
402 FLAG_GENERIC(MS_NODIRATIME
),
403 FLAG_GENERIC(MS_NOEXEC
),
404 FLAG_GENERIC(MS_NOSUID
),
405 FLAG_GENERIC(MS_RDONLY
),
407 FLAG_GENERIC(MS_RELATIME
),
409 FLAG_GENERIC(MS_REMOUNT
),
410 FLAG_GENERIC(MS_SYNCHRONOUS
),
414 UNUSED
static struct flags umount2_flags
[] = {
416 FLAG_GENERIC(MNT_FORCE
),
419 FLAG_GENERIC(MNT_DETACH
),
422 FLAG_GENERIC(MNT_EXPIRE
),
427 UNUSED
static struct flags mmap_prot_flags
[] = {
428 FLAG_GENERIC(PROT_NONE
),
429 FLAG_GENERIC(PROT_EXEC
),
430 FLAG_GENERIC(PROT_READ
),
431 FLAG_GENERIC(PROT_WRITE
),
432 FLAG_TARGET(PROT_SEM
),
433 FLAG_GENERIC(PROT_GROWSDOWN
),
434 FLAG_GENERIC(PROT_GROWSUP
),
438 UNUSED
static struct flags mmap_flags
[] = {
439 FLAG_TARGET(MAP_SHARED
),
440 FLAG_TARGET(MAP_PRIVATE
),
441 FLAG_TARGET(MAP_ANONYMOUS
),
442 FLAG_TARGET(MAP_DENYWRITE
),
443 FLAG_TARGET(MAP_FIXED
),
444 FLAG_TARGET(MAP_GROWSDOWN
),
445 FLAG_TARGET(MAP_EXECUTABLE
),
447 FLAG_TARGET(MAP_LOCKED
),
450 FLAG_TARGET(MAP_NONBLOCK
),
452 FLAG_TARGET(MAP_NORESERVE
),
454 FLAG_TARGET(MAP_POPULATE
),
456 #ifdef TARGET_MAP_UNINITIALIZED
457 FLAG_TARGET(MAP_UNINITIALIZED
),
462 UNUSED
static struct flags clone_flags
[] = {
463 FLAG_GENERIC(CLONE_VM
),
464 FLAG_GENERIC(CLONE_FS
),
465 FLAG_GENERIC(CLONE_FILES
),
466 FLAG_GENERIC(CLONE_SIGHAND
),
467 FLAG_GENERIC(CLONE_PTRACE
),
468 FLAG_GENERIC(CLONE_VFORK
),
469 FLAG_GENERIC(CLONE_PARENT
),
470 FLAG_GENERIC(CLONE_THREAD
),
471 FLAG_GENERIC(CLONE_NEWNS
),
472 FLAG_GENERIC(CLONE_SYSVSEM
),
473 FLAG_GENERIC(CLONE_SETTLS
),
474 FLAG_GENERIC(CLONE_PARENT_SETTID
),
475 FLAG_GENERIC(CLONE_CHILD_CLEARTID
),
476 FLAG_GENERIC(CLONE_DETACHED
),
477 FLAG_GENERIC(CLONE_UNTRACED
),
478 FLAG_GENERIC(CLONE_CHILD_SETTID
),
479 #if defined(CLONE_NEWUTS)
480 FLAG_GENERIC(CLONE_NEWUTS
),
482 #if defined(CLONE_NEWIPC)
483 FLAG_GENERIC(CLONE_NEWIPC
),
485 #if defined(CLONE_NEWUSER)
486 FLAG_GENERIC(CLONE_NEWUSER
),
488 #if defined(CLONE_NEWPID)
489 FLAG_GENERIC(CLONE_NEWPID
),
491 #if defined(CLONE_NEWNET)
492 FLAG_GENERIC(CLONE_NEWNET
),
494 #if defined(CLONE_IO)
495 FLAG_GENERIC(CLONE_IO
),
501 * print_xxx utility functions. These are used to print syscall
502 * parameters in certain format. All of these have parameter
503 * named 'last'. This parameter is used to add comma to output
510 return ((last
) ? "" : ",");
514 print_flags(const struct flags
*f
, abi_long flags
, int last
)
516 const char *sep
= "";
519 if ((flags
== 0) && (f
->f_value
== 0)) {
520 gemu_log("%s%s", f
->f_string
, get_comma(last
));
523 for (n
= 0; f
->f_string
!= NULL
; f
++) {
524 if ((f
->f_value
!= 0) && ((flags
& f
->f_value
) == f
->f_value
)) {
525 gemu_log("%s%s", sep
, f
->f_string
);
526 flags
&= ~f
->f_value
;
533 /* print rest of the flags as numeric */
535 gemu_log("%s%#x%s", sep
, (unsigned int)flags
, get_comma(last
));
537 gemu_log("%s", get_comma(last
));
540 /* no string version of flags found, print them in hex then */
541 gemu_log("%#x%s", (unsigned int)flags
, get_comma(last
));
546 print_at_dirfd(abi_long dirfd
, int last
)
549 if (dirfd
== AT_FDCWD
) {
550 gemu_log("AT_FDCWD%s", get_comma(last
));
554 gemu_log("%d%s", (int)dirfd
, get_comma(last
));
558 print_file_mode(abi_long mode
, int last
)
560 const char *sep
= "";
561 const struct flags
*m
;
563 for (m
= &mode_flags
[0]; m
->f_string
!= NULL
; m
++) {
564 if ((m
->f_value
& mode
) == m
->f_value
) {
565 gemu_log("%s%s", m
->f_string
, sep
);
573 /* print rest of the mode as octal */
575 gemu_log("%s%#o", sep
, (unsigned int)mode
);
577 gemu_log("%s", get_comma(last
));
581 print_open_flags(abi_long flags
, int last
)
583 print_flags(open_access_flags
, flags
& TARGET_O_ACCMODE
, 1);
584 flags
&= ~TARGET_O_ACCMODE
;
586 gemu_log("%s", get_comma(last
));
590 print_flags(open_flags
, flags
, last
);
594 print_syscall_prologue(const struct syscallname
*sc
)
596 gemu_log("%s(", sc
->name
);
601 print_syscall_epilogue(const struct syscallname
*sc
)
608 print_string(abi_long addr
, int last
)
612 if ((s
= lock_user_string(addr
)) != NULL
) {
613 gemu_log("\"%s\"%s", s
, get_comma(last
));
614 unlock_user(s
, addr
, 0);
616 /* can't get string out of it, so print it as pointer */
617 print_pointer(addr
, last
);
622 * Prints out raw parameter using given format. Caller needs
623 * to do byte swapping if needed.
626 print_raw_param(const char *fmt
, abi_long param
, int last
)
630 (void) snprintf(format
, sizeof (format
), "%s%s", fmt
, get_comma(last
));
631 gemu_log(format
, param
);
635 print_pointer(abi_long p
, int last
)
638 gemu_log("NULL%s", get_comma(last
));
640 gemu_log("0x" TARGET_ABI_FMT_lx
"%s", p
, get_comma(last
));
644 * Reads 32-bit (int) number from guest address space from
645 * address 'addr' and prints it.
648 print_number(abi_long addr
, int last
)
651 gemu_log("NULL%s", get_comma(last
));
655 get_user_s32(num
, addr
);
656 gemu_log("[%d]%s", num
, get_comma(last
));
661 print_timeval(abi_ulong tv_addr
, int last
)
664 struct target_timeval
*tv
;
666 tv
= lock_user(VERIFY_READ
, tv_addr
, sizeof(*tv
), 1);
669 gemu_log("{" TARGET_ABI_FMT_ld
"," TARGET_ABI_FMT_ld
"}%s",
670 tswapal(tv
->tv_sec
), tswapal(tv
->tv_usec
), get_comma(last
));
671 unlock_user(tv
, tv_addr
, 0);
673 gemu_log("NULL%s", get_comma(last
));
678 #ifdef TARGET_NR_accept
680 print_accept(const struct syscallname
*name
,
681 abi_long arg0
, abi_long arg1
, abi_long arg2
,
682 abi_long arg3
, abi_long arg4
, abi_long arg5
)
684 print_syscall_prologue(name
);
685 print_raw_param("%d", arg0
, 0);
686 print_pointer(arg1
, 0);
687 print_number(arg2
, 1);
688 print_syscall_epilogue(name
);
692 #ifdef TARGET_NR_access
694 print_access(const struct syscallname
*name
,
695 abi_long arg0
, abi_long arg1
, abi_long arg2
,
696 abi_long arg3
, abi_long arg4
, abi_long arg5
)
698 print_syscall_prologue(name
);
699 print_string(arg0
, 0);
700 print_flags(access_flags
, arg1
, 1);
701 print_syscall_epilogue(name
);
707 print_brk(const struct syscallname
*name
,
708 abi_long arg0
, abi_long arg1
, abi_long arg2
,
709 abi_long arg3
, abi_long arg4
, abi_long arg5
)
711 print_syscall_prologue(name
);
712 print_pointer(arg0
, 1);
713 print_syscall_epilogue(name
);
717 #ifdef TARGET_NR_chdir
719 print_chdir(const struct syscallname
*name
,
720 abi_long arg0
, abi_long arg1
, abi_long arg2
,
721 abi_long arg3
, abi_long arg4
, abi_long arg5
)
723 print_syscall_prologue(name
);
724 print_string(arg0
, 1);
725 print_syscall_epilogue(name
);
729 #ifdef TARGET_NR_chmod
731 print_chmod(const struct syscallname
*name
,
732 abi_long arg0
, abi_long arg1
, abi_long arg2
,
733 abi_long arg3
, abi_long arg4
, abi_long arg5
)
735 print_syscall_prologue(name
);
736 print_string(arg0
, 0);
737 print_file_mode(arg1
, 1);
738 print_syscall_epilogue(name
);
742 #ifdef TARGET_NR_clone
744 print_clone(const struct syscallname
*name
,
745 abi_long arg0
, abi_long arg1
, abi_long arg2
,
746 abi_long arg3
, abi_long arg4
, abi_long arg5
)
748 print_syscall_prologue(name
);
749 #if defined(TARGET_M68K)
750 print_flags(clone_flags
, arg0
, 0);
751 print_raw_param("newsp=0x" TARGET_ABI_FMT_lx
, arg1
, 1);
752 #elif defined(TARGET_SH4) || defined(TARGET_ALPHA)
753 print_flags(clone_flags
, arg0
, 0);
754 print_raw_param("child_stack=0x" TARGET_ABI_FMT_lx
, arg1
, 0);
755 print_raw_param("parent_tidptr=0x" TARGET_ABI_FMT_lx
, arg2
, 0);
756 print_raw_param("child_tidptr=0x" TARGET_ABI_FMT_lx
, arg3
, 0);
757 print_raw_param("tls=0x" TARGET_ABI_FMT_lx
, arg4
, 1);
758 #elif defined(TARGET_CRIS)
759 print_raw_param("child_stack=0x" TARGET_ABI_FMT_lx
, arg0
, 0);
760 print_flags(clone_flags
, arg1
, 0);
761 print_raw_param("parent_tidptr=0x" TARGET_ABI_FMT_lx
, arg2
, 0);
762 print_raw_param("tls=0x" TARGET_ABI_FMT_lx
, arg3
, 0);
763 print_raw_param("child_tidptr=0x" TARGET_ABI_FMT_lx
, arg4
, 1);
765 print_flags(clone_flags
, arg0
, 0);
766 print_raw_param("child_stack=0x" TARGET_ABI_FMT_lx
, arg1
, 0);
767 print_raw_param("parent_tidptr=0x" TARGET_ABI_FMT_lx
, arg2
, 0);
768 print_raw_param("tls=0x" TARGET_ABI_FMT_lx
, arg3
, 0);
769 print_raw_param("child_tidptr=0x" TARGET_ABI_FMT_lx
, arg4
, 1);
771 print_syscall_epilogue(name
);
775 #ifdef TARGET_NR_creat
777 print_creat(const struct syscallname
*name
,
778 abi_long arg0
, abi_long arg1
, abi_long arg2
,
779 abi_long arg3
, abi_long arg4
, abi_long arg5
)
781 print_syscall_prologue(name
);
782 print_string(arg0
, 0);
783 print_file_mode(arg1
, 1);
784 print_syscall_epilogue(name
);
788 #ifdef TARGET_NR_execv
790 print_execv(const struct syscallname
*name
,
791 abi_long arg0
, abi_long arg1
, abi_long arg2
,
792 abi_long arg3
, abi_long arg4
, abi_long arg5
)
794 print_syscall_prologue(name
);
795 print_string(arg0
, 0);
796 print_raw_param("0x" TARGET_ABI_FMT_lx
, arg1
, 1);
797 print_syscall_epilogue(name
);
801 #ifdef TARGET_NR_faccessat
803 print_faccessat(const struct syscallname
*name
,
804 abi_long arg0
, abi_long arg1
, abi_long arg2
,
805 abi_long arg3
, abi_long arg4
, abi_long arg5
)
807 print_syscall_prologue(name
);
808 print_at_dirfd(arg0
, 0);
809 print_string(arg1
, 0);
810 print_flags(access_flags
, arg2
, 0);
811 print_flags(at_file_flags
, arg3
, 1);
812 print_syscall_epilogue(name
);
816 #ifdef TARGET_NR_fchmodat
818 print_fchmodat(const struct syscallname
*name
,
819 abi_long arg0
, abi_long arg1
, abi_long arg2
,
820 abi_long arg3
, abi_long arg4
, abi_long arg5
)
822 print_syscall_prologue(name
);
823 print_at_dirfd(arg0
, 0);
824 print_string(arg1
, 0);
825 print_file_mode(arg2
, 0);
826 print_flags(at_file_flags
, arg3
, 1);
827 print_syscall_epilogue(name
);
831 #ifdef TARGET_NR_fchownat
833 print_fchownat(const struct syscallname
*name
,
834 abi_long arg0
, abi_long arg1
, abi_long arg2
,
835 abi_long arg3
, abi_long arg4
, abi_long arg5
)
837 print_syscall_prologue(name
);
838 print_at_dirfd(arg0
, 0);
839 print_string(arg1
, 0);
840 print_raw_param("%d", arg2
, 0);
841 print_raw_param("%d", arg3
, 0);
842 print_flags(at_file_flags
, arg4
, 1);
843 print_syscall_epilogue(name
);
847 #if defined(TARGET_NR_fcntl) || defined(TARGET_NR_fcntl64)
849 print_fcntl(const struct syscallname
*name
,
850 abi_long arg0
, abi_long arg1
, abi_long arg2
,
851 abi_long arg3
, abi_long arg4
, abi_long arg5
)
853 print_syscall_prologue(name
);
854 print_raw_param("%d", arg0
, 0);
857 gemu_log("F_DUPFD,");
858 print_raw_param(TARGET_ABI_FMT_ld
, arg2
, 1);
864 gemu_log("F_SETFD,");
865 print_raw_param(TARGET_ABI_FMT_ld
, arg2
, 1);
871 gemu_log("F_SETFL,");
872 print_open_flags(arg2
, 1);
875 gemu_log("F_GETLK,");
876 print_pointer(arg2
, 1);
879 gemu_log("F_SETLK,");
880 print_pointer(arg2
, 1);
882 case TARGET_F_SETLKW
:
883 gemu_log("F_SETLKW,");
884 print_pointer(arg2
, 1);
886 case TARGET_F_GETOWN
:
887 gemu_log("F_GETOWN");
889 case TARGET_F_SETOWN
:
890 gemu_log("F_SETOWN,");
891 print_raw_param(TARGET_ABI_FMT_ld
, arg2
, 0);
893 case TARGET_F_GETSIG
:
894 gemu_log("F_GETSIG");
896 case TARGET_F_SETSIG
:
897 gemu_log("F_SETSIG,");
898 print_raw_param(TARGET_ABI_FMT_ld
, arg2
, 0);
900 #if TARGET_ABI_BITS == 32
901 case TARGET_F_GETLK64
:
902 gemu_log("F_GETLK64,");
903 print_pointer(arg2
, 1);
905 case TARGET_F_SETLK64
:
906 gemu_log("F_SETLK64,");
907 print_pointer(arg2
, 1);
909 case TARGET_F_SETLKW64
:
910 gemu_log("F_SETLKW64,");
911 print_pointer(arg2
, 1);
914 case TARGET_F_SETLEASE
:
915 gemu_log("F_SETLEASE,");
916 print_raw_param(TARGET_ABI_FMT_ld
, arg2
, 0);
918 case TARGET_F_GETLEASE
:
919 gemu_log("F_GETLEASE");
921 case TARGET_F_DUPFD_CLOEXEC
:
922 gemu_log("F_DUPFD_CLOEXEC,");
923 print_raw_param(TARGET_ABI_FMT_ld
, arg2
, 1);
925 case TARGET_F_NOTIFY
:
926 gemu_log("F_NOTIFY,");
927 print_raw_param(TARGET_ABI_FMT_ld
, arg2
, 0);
930 print_raw_param(TARGET_ABI_FMT_ld
, arg1
, 0);
931 print_pointer(arg2
, 1);
934 print_syscall_epilogue(name
);
936 #define print_fcntl64 print_fcntl
940 #ifdef TARGET_NR_futimesat
942 print_futimesat(const struct syscallname
*name
,
943 abi_long arg0
, abi_long arg1
, abi_long arg2
,
944 abi_long arg3
, abi_long arg4
, abi_long arg5
)
946 print_syscall_prologue(name
);
947 print_at_dirfd(arg0
, 0);
948 print_string(arg1
, 0);
949 print_timeval(arg2
, 0);
950 print_timeval(arg2
+ sizeof (struct target_timeval
), 1);
951 print_syscall_epilogue(name
);
955 #ifdef TARGET_NR_link
957 print_link(const struct syscallname
*name
,
958 abi_long arg0
, abi_long arg1
, abi_long arg2
,
959 abi_long arg3
, abi_long arg4
, abi_long arg5
)
961 print_syscall_prologue(name
);
962 print_string(arg0
, 0);
963 print_string(arg1
, 1);
964 print_syscall_epilogue(name
);
968 #ifdef TARGET_NR_linkat
970 print_linkat(const struct syscallname
*name
,
971 abi_long arg0
, abi_long arg1
, abi_long arg2
,
972 abi_long arg3
, abi_long arg4
, abi_long arg5
)
974 print_syscall_prologue(name
);
975 print_at_dirfd(arg0
, 0);
976 print_string(arg1
, 0);
977 print_at_dirfd(arg2
, 0);
978 print_string(arg3
, 0);
979 print_flags(at_file_flags
, arg4
, 1);
980 print_syscall_epilogue(name
);
984 #ifdef TARGET_NR__llseek
986 print__llseek(const struct syscallname
*name
,
987 abi_long arg0
, abi_long arg1
, abi_long arg2
,
988 abi_long arg3
, abi_long arg4
, abi_long arg5
)
990 const char *whence
= "UNKNOWN";
991 print_syscall_prologue(name
);
992 print_raw_param("%d", arg0
, 0);
993 print_raw_param("%ld", arg1
, 0);
994 print_raw_param("%ld", arg2
, 0);
995 print_pointer(arg3
, 0);
997 case SEEK_SET
: whence
= "SEEK_SET"; break;
998 case SEEK_CUR
: whence
= "SEEK_CUR"; break;
999 case SEEK_END
: whence
= "SEEK_END"; break;
1001 gemu_log("%s",whence
);
1002 print_syscall_epilogue(name
);
1006 #if defined(TARGET_NR_stat) || defined(TARGET_NR_stat64) || \
1007 defined(TARGET_NR_lstat) || defined(TARGET_NR_lstat64)
1009 print_stat(const struct syscallname
*name
,
1010 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1011 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1013 print_syscall_prologue(name
);
1014 print_string(arg0
, 0);
1015 print_pointer(arg1
, 1);
1016 print_syscall_epilogue(name
);
1018 #define print_lstat print_stat
1019 #define print_stat64 print_stat
1020 #define print_lstat64 print_stat
1023 #if defined(TARGET_NR_fstat) || defined(TARGET_NR_fstat64)
1025 print_fstat(const struct syscallname
*name
,
1026 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1027 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1029 print_syscall_prologue(name
);
1030 print_raw_param("%d", arg0
, 0);
1031 print_pointer(arg1
, 1);
1032 print_syscall_epilogue(name
);
1034 #define print_fstat64 print_fstat
1037 #ifdef TARGET_NR_mkdir
1039 print_mkdir(const struct syscallname
*name
,
1040 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1041 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1043 print_syscall_prologue(name
);
1044 print_string(arg0
, 0);
1045 print_file_mode(arg1
, 1);
1046 print_syscall_epilogue(name
);
1050 #ifdef TARGET_NR_mkdirat
1052 print_mkdirat(const struct syscallname
*name
,
1053 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1054 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1056 print_syscall_prologue(name
);
1057 print_at_dirfd(arg0
, 0);
1058 print_string(arg1
, 0);
1059 print_file_mode(arg2
, 1);
1060 print_syscall_epilogue(name
);
1064 #ifdef TARGET_NR_rmdir
1066 print_rmdir(const struct syscallname
*name
,
1067 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1068 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1070 print_syscall_prologue(name
);
1071 print_string(arg0
, 0);
1072 print_syscall_epilogue(name
);
1076 #ifdef TARGET_NR_rt_sigaction
1078 print_rt_sigaction(const struct syscallname
*name
,
1079 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1080 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1082 print_syscall_prologue(name
);
1083 print_signal(arg0
, 0);
1084 print_pointer(arg1
, 0);
1085 print_pointer(arg2
, 1);
1086 print_syscall_epilogue(name
);
1090 #ifdef TARGET_NR_rt_sigprocmask
1092 print_rt_sigprocmask(const struct syscallname
*name
,
1093 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1094 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1096 const char *how
= "UNKNOWN";
1097 print_syscall_prologue(name
);
1099 case TARGET_SIG_BLOCK
: how
= "SIG_BLOCK"; break;
1100 case TARGET_SIG_UNBLOCK
: how
= "SIG_UNBLOCK"; break;
1101 case TARGET_SIG_SETMASK
: how
= "SIG_SETMASK"; break;
1103 gemu_log("%s,",how
);
1104 print_pointer(arg1
, 0);
1105 print_pointer(arg2
, 1);
1106 print_syscall_epilogue(name
);
1110 #ifdef TARGET_NR_mknod
1112 print_mknod(const struct syscallname
*name
,
1113 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1114 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1116 int hasdev
= (arg1
& (S_IFCHR
|S_IFBLK
));
1118 print_syscall_prologue(name
);
1119 print_string(arg0
, 0);
1120 print_file_mode(arg1
, (hasdev
== 0));
1122 print_raw_param("makedev(%d", major(arg2
), 0);
1123 print_raw_param("%d)", minor(arg2
), 1);
1125 print_syscall_epilogue(name
);
1129 #ifdef TARGET_NR_mknodat
1131 print_mknodat(const struct syscallname
*name
,
1132 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1133 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1135 int hasdev
= (arg2
& (S_IFCHR
|S_IFBLK
));
1137 print_syscall_prologue(name
);
1138 print_at_dirfd(arg0
, 0);
1139 print_string(arg1
, 0);
1140 print_file_mode(arg2
, (hasdev
== 0));
1142 print_raw_param("makedev(%d", major(arg3
), 0);
1143 print_raw_param("%d)", minor(arg3
), 1);
1145 print_syscall_epilogue(name
);
1149 #ifdef TARGET_NR_mq_open
1151 print_mq_open(const struct syscallname
*name
,
1152 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1153 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1155 int is_creat
= (arg1
& TARGET_O_CREAT
);
1157 print_syscall_prologue(name
);
1158 print_string(arg0
, 0);
1159 print_open_flags(arg1
, (is_creat
== 0));
1161 print_file_mode(arg2
, 0);
1162 print_pointer(arg3
, 1);
1164 print_syscall_epilogue(name
);
1168 #ifdef TARGET_NR_open
1170 print_open(const struct syscallname
*name
,
1171 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1172 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1174 int is_creat
= (arg1
& TARGET_O_CREAT
);
1176 print_syscall_prologue(name
);
1177 print_string(arg0
, 0);
1178 print_open_flags(arg1
, (is_creat
== 0));
1180 print_file_mode(arg2
, 1);
1181 print_syscall_epilogue(name
);
1185 #ifdef TARGET_NR_openat
1187 print_openat(const struct syscallname
*name
,
1188 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1189 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1191 int is_creat
= (arg2
& TARGET_O_CREAT
);
1193 print_syscall_prologue(name
);
1194 print_at_dirfd(arg0
, 0);
1195 print_string(arg1
, 0);
1196 print_open_flags(arg2
, (is_creat
== 0));
1198 print_file_mode(arg3
, 1);
1199 print_syscall_epilogue(name
);
1203 #ifdef TARGET_NR_mq_unlink
1205 print_mq_unlink(const struct syscallname
*name
,
1206 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1207 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1209 print_syscall_prologue(name
);
1210 print_string(arg0
, 1);
1211 print_syscall_epilogue(name
);
1215 #if defined(TARGET_NR_fstatat64) || defined(TARGET_NR_newfstatat)
1217 print_fstatat64(const struct syscallname
*name
,
1218 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1219 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1221 print_syscall_prologue(name
);
1222 print_at_dirfd(arg0
, 0);
1223 print_string(arg1
, 0);
1224 print_pointer(arg2
, 0);
1225 print_flags(at_file_flags
, arg3
, 1);
1226 print_syscall_epilogue(name
);
1228 #define print_newfstatat print_fstatat64
1231 #ifdef TARGET_NR_readlink
1233 print_readlink(const struct syscallname
*name
,
1234 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1235 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1237 print_syscall_prologue(name
);
1238 print_string(arg0
, 0);
1239 print_pointer(arg1
, 0);
1240 print_raw_param("%u", arg2
, 1);
1241 print_syscall_epilogue(name
);
1245 #ifdef TARGET_NR_readlinkat
1247 print_readlinkat(const struct syscallname
*name
,
1248 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1249 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1251 print_syscall_prologue(name
);
1252 print_at_dirfd(arg0
, 0);
1253 print_string(arg1
, 0);
1254 print_pointer(arg2
, 0);
1255 print_raw_param("%u", arg3
, 1);
1256 print_syscall_epilogue(name
);
1260 #ifdef TARGET_NR_rename
1262 print_rename(const struct syscallname
*name
,
1263 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1264 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1266 print_syscall_prologue(name
);
1267 print_string(arg0
, 0);
1268 print_string(arg1
, 1);
1269 print_syscall_epilogue(name
);
1273 #ifdef TARGET_NR_renameat
1275 print_renameat(const struct syscallname
*name
,
1276 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1277 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1279 print_syscall_prologue(name
);
1280 print_at_dirfd(arg0
, 0);
1281 print_string(arg1
, 0);
1282 print_at_dirfd(arg2
, 0);
1283 print_string(arg3
, 1);
1284 print_syscall_epilogue(name
);
1288 #ifdef TARGET_NR_statfs
1290 print_statfs(const struct syscallname
*name
,
1291 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1292 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1294 print_syscall_prologue(name
);
1295 print_string(arg0
, 0);
1296 print_pointer(arg1
, 1);
1297 print_syscall_epilogue(name
);
1299 #define print_statfs64 print_statfs
1302 #ifdef TARGET_NR_symlink
1304 print_symlink(const struct syscallname
*name
,
1305 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1306 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1308 print_syscall_prologue(name
);
1309 print_string(arg0
, 0);
1310 print_string(arg1
, 1);
1311 print_syscall_epilogue(name
);
1315 #ifdef TARGET_NR_symlinkat
1317 print_symlinkat(const struct syscallname
*name
,
1318 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1319 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1321 print_syscall_prologue(name
);
1322 print_string(arg0
, 0);
1323 print_at_dirfd(arg1
, 0);
1324 print_string(arg2
, 1);
1325 print_syscall_epilogue(name
);
1329 #ifdef TARGET_NR_mount
1331 print_mount(const struct syscallname
*name
,
1332 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1333 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1335 print_syscall_prologue(name
);
1336 print_string(arg0
, 0);
1337 print_string(arg1
, 0);
1338 print_string(arg2
, 0);
1339 print_flags(mount_flags
, arg3
, 0);
1340 print_pointer(arg4
, 1);
1341 print_syscall_epilogue(name
);
1345 #ifdef TARGET_NR_umount
1347 print_umount(const struct syscallname
*name
,
1348 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1349 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1351 print_syscall_prologue(name
);
1352 print_string(arg0
, 1);
1353 print_syscall_epilogue(name
);
1357 #ifdef TARGET_NR_umount2
1359 print_umount2(const struct syscallname
*name
,
1360 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1361 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1363 print_syscall_prologue(name
);
1364 print_string(arg0
, 0);
1365 print_flags(umount2_flags
, arg1
, 1);
1366 print_syscall_epilogue(name
);
1370 #ifdef TARGET_NR_unlink
1372 print_unlink(const struct syscallname
*name
,
1373 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1374 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1376 print_syscall_prologue(name
);
1377 print_string(arg0
, 1);
1378 print_syscall_epilogue(name
);
1382 #ifdef TARGET_NR_unlinkat
1384 print_unlinkat(const struct syscallname
*name
,
1385 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1386 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1388 print_syscall_prologue(name
);
1389 print_at_dirfd(arg0
, 0);
1390 print_string(arg1
, 0);
1391 print_flags(unlinkat_flags
, arg2
, 1);
1392 print_syscall_epilogue(name
);
1396 #ifdef TARGET_NR_utime
1398 print_utime(const struct syscallname
*name
,
1399 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1400 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1402 print_syscall_prologue(name
);
1403 print_string(arg0
, 0);
1404 print_pointer(arg1
, 1);
1405 print_syscall_epilogue(name
);
1409 #ifdef TARGET_NR_utimes
1411 print_utimes(const struct syscallname
*name
,
1412 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1413 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1415 print_syscall_prologue(name
);
1416 print_string(arg0
, 0);
1417 print_pointer(arg1
, 1);
1418 print_syscall_epilogue(name
);
1422 #ifdef TARGET_NR_utimensat
1424 print_utimensat(const struct syscallname
*name
,
1425 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1426 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1428 print_syscall_prologue(name
);
1429 print_at_dirfd(arg0
, 0);
1430 print_string(arg1
, 0);
1431 print_pointer(arg2
, 0);
1432 print_flags(at_file_flags
, arg3
, 1);
1433 print_syscall_epilogue(name
);
1437 #if defined(TARGET_NR_mmap) || defined(TARGET_NR_mmap2)
1439 print_mmap(const struct syscallname
*name
,
1440 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1441 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1443 print_syscall_prologue(name
);
1444 print_pointer(arg0
, 0);
1445 print_raw_param("%d", arg1
, 0);
1446 print_flags(mmap_prot_flags
, arg2
, 0);
1447 print_flags(mmap_flags
, arg3
, 0);
1448 print_raw_param("%d", arg4
, 0);
1449 print_raw_param("%#x", arg5
, 1);
1450 print_syscall_epilogue(name
);
1452 #define print_mmap2 print_mmap
1455 #ifdef TARGET_NR_mprotect
1457 print_mprotect(const struct syscallname
*name
,
1458 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1459 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1461 print_syscall_prologue(name
);
1462 print_pointer(arg0
, 0);
1463 print_raw_param("%d", arg1
, 0);
1464 print_flags(mmap_prot_flags
, arg2
, 1);
1465 print_syscall_epilogue(name
);
1469 #ifdef TARGET_NR_munmap
1471 print_munmap(const struct syscallname
*name
,
1472 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1473 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1475 print_syscall_prologue(name
);
1476 print_pointer(arg0
, 0);
1477 print_raw_param("%d", arg1
, 1);
1478 print_syscall_epilogue(name
);
1482 #ifdef TARGET_NR_futex
1483 static void print_futex_op(abi_long tflag
, int last
)
1485 #define print_op(val) \
1486 if( cmd == val ) { \
1491 int cmd
= (int)tflag
;
1492 #ifdef FUTEX_PRIVATE_FLAG
1493 if (cmd
& FUTEX_PRIVATE_FLAG
) {
1494 gemu_log("FUTEX_PRIVATE_FLAG|");
1495 cmd
&= ~FUTEX_PRIVATE_FLAG
;
1498 #ifdef FUTEX_CLOCK_REALTIME
1499 if (cmd
& FUTEX_CLOCK_REALTIME
) {
1500 gemu_log("FUTEX_CLOCK_REALTIME|");
1501 cmd
&= ~FUTEX_CLOCK_REALTIME
;
1504 print_op(FUTEX_WAIT
)
1505 print_op(FUTEX_WAKE
)
1507 print_op(FUTEX_REQUEUE
)
1508 print_op(FUTEX_CMP_REQUEUE
)
1509 print_op(FUTEX_WAKE_OP
)
1510 print_op(FUTEX_LOCK_PI
)
1511 print_op(FUTEX_UNLOCK_PI
)
1512 print_op(FUTEX_TRYLOCK_PI
)
1513 #ifdef FUTEX_WAIT_BITSET
1514 print_op(FUTEX_WAIT_BITSET
)
1516 #ifdef FUTEX_WAKE_BITSET
1517 print_op(FUTEX_WAKE_BITSET
)
1519 /* unknown values */
1524 print_futex(const struct syscallname
*name
,
1525 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1526 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1528 print_syscall_prologue(name
);
1529 print_pointer(arg0
, 0);
1530 print_futex_op(arg1
, 0);
1531 print_raw_param(",%d", arg2
, 0);
1532 print_pointer(arg3
, 0); /* struct timespec */
1533 print_pointer(arg4
, 0);
1534 print_raw_param("%d", arg4
, 1);
1535 print_syscall_epilogue(name
);
1539 #ifdef TARGET_NR_kill
1541 print_kill(const struct syscallname
*name
,
1542 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1543 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1545 print_syscall_prologue(name
);
1546 print_raw_param("%d", arg0
, 0);
1547 print_signal(arg1
, 1);
1548 print_syscall_epilogue(name
);
1553 * An array of all of the syscalls we know about
1556 static const struct syscallname scnames
[] = {
1557 #include "strace.list"
1560 static int nsyscalls
= ARRAY_SIZE(scnames
);
1563 * The public interface to this module.
1566 print_syscall(int num
,
1567 abi_long arg1
, abi_long arg2
, abi_long arg3
,
1568 abi_long arg4
, abi_long arg5
, abi_long arg6
)
1571 const char *format
="%s(" TARGET_ABI_FMT_ld
"," TARGET_ABI_FMT_ld
"," TARGET_ABI_FMT_ld
"," TARGET_ABI_FMT_ld
"," TARGET_ABI_FMT_ld
"," TARGET_ABI_FMT_ld
")";
1573 gemu_log("%d ", getpid() );
1575 for(i
=0;i
<nsyscalls
;i
++)
1576 if( scnames
[i
].nr
== num
) {
1577 if( scnames
[i
].call
!= NULL
) {
1578 scnames
[i
].call(&scnames
[i
],arg1
,arg2
,arg3
,arg4
,arg5
,arg6
);
1580 /* XXX: this format system is broken because it uses
1581 host types and host pointers for strings */
1582 if( scnames
[i
].format
!= NULL
)
1583 format
= scnames
[i
].format
;
1584 gemu_log(format
,scnames
[i
].name
, arg1
,arg2
,arg3
,arg4
,arg5
,arg6
);
1588 gemu_log("Unknown syscall %d\n", num
);
1593 print_syscall_ret(int num
, abi_long ret
)
1596 const char *errstr
= NULL
;
1598 for(i
=0;i
<nsyscalls
;i
++)
1599 if( scnames
[i
].nr
== num
) {
1600 if( scnames
[i
].result
!= NULL
) {
1601 scnames
[i
].result(&scnames
[i
],ret
);
1604 errstr
= target_strerror(-ret
);
1607 gemu_log(" = -1 errno=" TARGET_ABI_FMT_ld
" (%s)\n",
1610 gemu_log(" = " TARGET_ABI_FMT_ld
"\n", ret
);