1 #include "qemu/osdep.h"
6 #include <sys/select.h>
9 #include <netinet/tcp.h>
10 #include <linux/if_packet.h>
20 void (*call
)(const struct syscallname
*,
21 abi_long
, abi_long
, abi_long
,
22 abi_long
, abi_long
, abi_long
);
23 void (*result
)(const struct syscallname
*, abi_long
);
28 * It is possible that target doesn't have syscall that uses
29 * following flags but we don't want the compiler to warn
30 * us about them being unused. Same applies to utility print
31 * functions. It is ok to keep them while not used.
33 #define UNUSED __attribute__ ((unused))
39 * Structure used to translate flag values into strings. This is
40 * similar that is in the actual strace tool.
43 abi_long f_value
; /* flag */
44 const char *f_string
; /* stringified flag */
47 /* common flags for all architectures */
48 #define FLAG_GENERIC(name) { name, #name }
49 /* target specific flags (syscall_defs.h has TARGET_<flag>) */
50 #define FLAG_TARGET(name) { TARGET_ ## name, #name }
51 /* end of flags array */
52 #define FLAG_END { 0, NULL }
54 UNUSED
static const char *get_comma(int);
55 UNUSED
static void print_pointer(abi_long
, int);
56 UNUSED
static void print_flags(const struct flags
*, abi_long
, int);
57 UNUSED
static void print_at_dirfd(abi_long
, int);
58 UNUSED
static void print_file_mode(abi_long
, int);
59 UNUSED
static void print_open_flags(abi_long
, int);
60 UNUSED
static void print_syscall_prologue(const struct syscallname
*);
61 UNUSED
static void print_syscall_epilogue(const struct syscallname
*);
62 UNUSED
static void print_string(abi_long
, int);
63 UNUSED
static void print_buf(abi_long addr
, abi_long len
, int last
);
64 UNUSED
static void print_raw_param(const char *, abi_long
, int);
65 UNUSED
static void print_timeval(abi_ulong
, int);
66 UNUSED
static void print_number(abi_long
, int);
67 UNUSED
static void print_signal(abi_ulong
, int);
68 UNUSED
static void print_sockaddr(abi_ulong addr
, abi_long addrlen
);
69 UNUSED
static void print_socket_domain(int domain
);
70 UNUSED
static void print_socket_type(int type
);
71 UNUSED
static void print_socket_protocol(int domain
, int type
, int protocol
);
77 print_ipc_cmd(int cmd
)
79 #define output_cmd(val) \
87 /* General IPC commands */
88 output_cmd( IPC_RMID
);
89 output_cmd( IPC_SET
);
90 output_cmd( IPC_STAT
);
91 output_cmd( IPC_INFO
);
92 /* msgctl() commands */
94 output_cmd( MSG_STAT
);
95 output_cmd( MSG_INFO
);
97 /* shmctl() commands */
98 output_cmd( SHM_LOCK
);
99 output_cmd( SHM_UNLOCK
);
100 output_cmd( SHM_STAT
);
101 output_cmd( SHM_INFO
);
102 /* semctl() commands */
103 output_cmd( GETPID
);
104 output_cmd( GETVAL
);
105 output_cmd( GETALL
);
106 output_cmd( GETNCNT
);
107 output_cmd( GETZCNT
);
108 output_cmd( SETVAL
);
109 output_cmd( SETALL
);
110 output_cmd( SEM_STAT
);
111 output_cmd( SEM_INFO
);
112 output_cmd( IPC_RMID
);
113 output_cmd( IPC_RMID
);
114 output_cmd( IPC_RMID
);
115 output_cmd( IPC_RMID
);
116 output_cmd( IPC_RMID
);
117 output_cmd( IPC_RMID
);
118 output_cmd( IPC_RMID
);
119 output_cmd( IPC_RMID
);
120 output_cmd( IPC_RMID
);
122 /* Some value we don't recognize */
127 print_signal(abi_ulong arg
, int last
)
129 const char *signal_name
= NULL
;
131 case TARGET_SIGHUP
: signal_name
= "SIGHUP"; break;
132 case TARGET_SIGINT
: signal_name
= "SIGINT"; break;
133 case TARGET_SIGQUIT
: signal_name
= "SIGQUIT"; break;
134 case TARGET_SIGILL
: signal_name
= "SIGILL"; break;
135 case TARGET_SIGABRT
: signal_name
= "SIGABRT"; break;
136 case TARGET_SIGFPE
: signal_name
= "SIGFPE"; break;
137 case TARGET_SIGKILL
: signal_name
= "SIGKILL"; break;
138 case TARGET_SIGSEGV
: signal_name
= "SIGSEGV"; break;
139 case TARGET_SIGPIPE
: signal_name
= "SIGPIPE"; break;
140 case TARGET_SIGALRM
: signal_name
= "SIGALRM"; break;
141 case TARGET_SIGTERM
: signal_name
= "SIGTERM"; break;
142 case TARGET_SIGUSR1
: signal_name
= "SIGUSR1"; break;
143 case TARGET_SIGUSR2
: signal_name
= "SIGUSR2"; break;
144 case TARGET_SIGCHLD
: signal_name
= "SIGCHLD"; break;
145 case TARGET_SIGCONT
: signal_name
= "SIGCONT"; break;
146 case TARGET_SIGSTOP
: signal_name
= "SIGSTOP"; break;
147 case TARGET_SIGTTIN
: signal_name
= "SIGTTIN"; break;
148 case TARGET_SIGTTOU
: signal_name
= "SIGTTOU"; break;
150 if (signal_name
== NULL
) {
151 print_raw_param("%ld", arg
, last
);
154 gemu_log("%s%s", signal_name
, get_comma(last
));
157 static void print_si_code(int arg
)
159 const char *codename
= NULL
;
163 codename
= "SI_USER";
166 codename
= "SI_KERNEL";
169 codename
= "SI_QUEUE";
172 codename
= "SI_TIMER";
175 codename
= "SI_MESGQ";
178 codename
= "SI_ASYNCIO";
181 codename
= "SI_SIGIO";
184 codename
= "SI_TKILL";
190 gemu_log("%s", codename
);
193 static void print_siginfo(const target_siginfo_t
*tinfo
)
195 /* Print a target_siginfo_t in the format desired for printing
196 * signals being taken. We assume the target_siginfo_t is in the
197 * internal form where the top 16 bits of si_code indicate which
198 * part of the union is valid, rather than in the guest-visible
199 * form where the bottom 16 bits are sign-extended into the top 16.
201 int si_type
= extract32(tinfo
->si_code
, 16, 16);
202 int si_code
= sextract32(tinfo
->si_code
, 0, 16);
204 gemu_log("{si_signo=");
205 print_signal(tinfo
->si_signo
, 1);
206 gemu_log(", si_code=");
207 print_si_code(si_code
);
211 gemu_log(", si_pid = %u, si_uid = %u",
212 (unsigned int)tinfo
->_sifields
._kill
._pid
,
213 (unsigned int)tinfo
->_sifields
._kill
._uid
);
216 gemu_log(", si_timer1 = %u, si_timer2 = %u",
217 tinfo
->_sifields
._timer
._timer1
,
218 tinfo
->_sifields
._timer
._timer2
);
221 gemu_log(", si_band = %d, si_fd = %d",
222 tinfo
->_sifields
._sigpoll
._band
,
223 tinfo
->_sifields
._sigpoll
._fd
);
226 gemu_log(", si_addr = ");
227 print_pointer(tinfo
->_sifields
._sigfault
._addr
, 1);
230 gemu_log(", si_pid = %u, si_uid = %u, si_status = %d"
231 ", si_utime=" TARGET_ABI_FMT_ld
232 ", si_stime=" TARGET_ABI_FMT_ld
,
233 (unsigned int)(tinfo
->_sifields
._sigchld
._pid
),
234 (unsigned int)(tinfo
->_sifields
._sigchld
._uid
),
235 tinfo
->_sifields
._sigchld
._status
,
236 tinfo
->_sifields
._sigchld
._utime
,
237 tinfo
->_sifields
._sigchld
._stime
);
240 gemu_log(", si_pid = %u, si_uid = %u, si_sigval = " TARGET_ABI_FMT_ld
,
241 (unsigned int)tinfo
->_sifields
._rt
._pid
,
242 (unsigned int)tinfo
->_sifields
._rt
._uid
,
243 tinfo
->_sifields
._rt
._sigval
.sival_ptr
);
246 g_assert_not_reached();
252 print_sockaddr(abi_ulong addr
, abi_long addrlen
)
254 struct target_sockaddr
*sa
;
258 sa
= lock_user(VERIFY_READ
, addr
, addrlen
, 1);
260 sa_family
= tswap16(sa
->sa_family
);
263 struct target_sockaddr_un
*un
= (struct target_sockaddr_un
*)sa
;
265 gemu_log("{sun_family=AF_UNIX,sun_path=\"");
266 for (i
= 0; i
< addrlen
-
267 offsetof(struct target_sockaddr_un
, sun_path
) &&
268 un
->sun_path
[i
]; i
++) {
269 gemu_log("%c", un
->sun_path
[i
]);
275 struct target_sockaddr_in
*in
= (struct target_sockaddr_in
*)sa
;
276 uint8_t *c
= (uint8_t *)&in
->sin_addr
.s_addr
;
277 gemu_log("{sin_family=AF_INET,sin_port=htons(%d),",
278 ntohs(in
->sin_port
));
279 gemu_log("sin_addr=inet_addr(\"%d.%d.%d.%d\")",
280 c
[0], c
[1], c
[2], c
[3]);
285 struct target_sockaddr_ll
*ll
= (struct target_sockaddr_ll
*)sa
;
286 uint8_t *c
= (uint8_t *)&ll
->sll_addr
;
287 gemu_log("{sll_family=AF_PACKET,"
288 "sll_protocol=htons(0x%04x),if%d,pkttype=",
289 ntohs(ll
->sll_protocol
), ll
->sll_ifindex
);
290 switch (ll
->sll_pkttype
) {
292 gemu_log("PACKET_HOST");
294 case PACKET_BROADCAST
:
295 gemu_log("PACKET_BROADCAST");
297 case PACKET_MULTICAST
:
298 gemu_log("PACKET_MULTICAST");
300 case PACKET_OTHERHOST
:
301 gemu_log("PACKET_OTHERHOST");
303 case PACKET_OUTGOING
:
304 gemu_log("PACKET_OUTGOING");
307 gemu_log("%d", ll
->sll_pkttype
);
310 gemu_log(",sll_addr=%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x",
311 c
[0], c
[1], c
[2], c
[3], c
[4], c
[5], c
[6], c
[7]);
316 gemu_log("{sa_family=%d, sa_data={", sa
->sa_family
);
317 for (i
= 0; i
< 13; i
++) {
318 gemu_log("%02x, ", sa
->sa_data
[i
]);
320 gemu_log("%02x}", sa
->sa_data
[i
]);
324 unlock_user(sa
, addr
, 0);
326 print_raw_param("0x"TARGET_ABI_FMT_lx
, addr
, 0);
328 gemu_log(", "TARGET_ABI_FMT_ld
, addrlen
);
332 print_socket_domain(int domain
)
342 gemu_log("PF_PACKET");
345 gemu_log("%d", domain
);
351 print_socket_type(int type
)
354 case TARGET_SOCK_DGRAM
:
355 gemu_log("SOCK_DGRAM");
357 case TARGET_SOCK_STREAM
:
358 gemu_log("SOCK_STREAM");
360 case TARGET_SOCK_RAW
:
361 gemu_log("SOCK_RAW");
363 case TARGET_SOCK_RDM
:
364 gemu_log("SOCK_RDM");
366 case TARGET_SOCK_SEQPACKET
:
367 gemu_log("SOCK_SEQPACKET");
369 case TARGET_SOCK_PACKET
:
370 gemu_log("SOCK_PACKET");
376 print_socket_protocol(int domain
, int type
, int protocol
)
378 if (domain
== AF_PACKET
||
379 (domain
== AF_INET
&& type
== TARGET_SOCK_PACKET
)) {
382 gemu_log("ETH_P_ALL");
385 gemu_log("%d", protocol
);
392 gemu_log("IPPROTO_IP");
395 gemu_log("IPPROTO_TCP");
398 gemu_log("IPPROTO_UDP");
401 gemu_log("IPPROTO_RAW");
404 gemu_log("%d", protocol
);
410 #ifdef TARGET_NR__newselect
412 print_fdset(int n
, abi_ulong target_fds_addr
)
417 if( target_fds_addr
) {
418 abi_long
*target_fds
;
420 target_fds
= lock_user(VERIFY_READ
,
422 sizeof(*target_fds
)*(n
/ TARGET_ABI_BITS
+ 1),
428 for (i
=n
; i
>=0; i
--) {
429 if ((tswapal(target_fds
[i
/ TARGET_ABI_BITS
]) >> (i
& (TARGET_ABI_BITS
- 1))) & 1)
432 unlock_user(target_fds
, target_fds_addr
, 0);
439 * Sysycall specific output functions
443 #ifdef TARGET_NR__newselect
444 static long newselect_arg1
= 0;
445 static long newselect_arg2
= 0;
446 static long newselect_arg3
= 0;
447 static long newselect_arg4
= 0;
448 static long newselect_arg5
= 0;
451 print_newselect(const struct syscallname
*name
,
452 abi_long arg1
, abi_long arg2
, abi_long arg3
,
453 abi_long arg4
, abi_long arg5
, abi_long arg6
)
455 gemu_log("%s(" TARGET_ABI_FMT_ld
",", name
->name
, arg1
);
456 print_fdset(arg1
, arg2
);
458 print_fdset(arg1
, arg3
);
460 print_fdset(arg1
, arg4
);
462 print_timeval(arg5
, 1);
465 /* save for use in the return output function below */
474 #ifdef TARGET_NR_semctl
476 print_semctl(const struct syscallname
*name
,
477 abi_long arg1
, abi_long arg2
, abi_long arg3
,
478 abi_long arg4
, abi_long arg5
, abi_long arg6
)
480 gemu_log("%s(" TARGET_ABI_FMT_ld
"," TARGET_ABI_FMT_ld
",", name
->name
, arg1
, arg2
);
482 gemu_log(",0x" TARGET_ABI_FMT_lx
")", arg4
);
487 print_execve(const struct syscallname
*name
,
488 abi_long arg1
, abi_long arg2
, abi_long arg3
,
489 abi_long arg4
, abi_long arg5
, abi_long arg6
)
491 abi_ulong arg_ptr_addr
;
494 if (!(s
= lock_user_string(arg1
)))
496 gemu_log("%s(\"%s\",{", name
->name
, s
);
497 unlock_user(s
, arg1
, 0);
499 for (arg_ptr_addr
= arg2
; ; arg_ptr_addr
+= sizeof(abi_ulong
)) {
500 abi_ulong
*arg_ptr
, arg_addr
;
502 arg_ptr
= lock_user(VERIFY_READ
, arg_ptr_addr
, sizeof(abi_ulong
), 1);
505 arg_addr
= tswapal(*arg_ptr
);
506 unlock_user(arg_ptr
, arg_ptr_addr
, 0);
509 if ((s
= lock_user_string(arg_addr
))) {
510 gemu_log("\"%s\",", s
);
511 unlock_user(s
, arg_addr
, 0);
520 print_ipc(const struct syscallname
*name
,
521 abi_long arg1
, abi_long arg2
, abi_long arg3
,
522 abi_long arg4
, abi_long arg5
, abi_long arg6
)
526 gemu_log("semctl(" TARGET_ABI_FMT_ld
"," TARGET_ABI_FMT_ld
",", arg1
, arg2
);
528 gemu_log(",0x" TARGET_ABI_FMT_lx
")", arg4
);
531 gemu_log("%s(" TARGET_ABI_FMT_ld
"," TARGET_ABI_FMT_ld
"," TARGET_ABI_FMT_ld
"," TARGET_ABI_FMT_ld
")",
532 name
->name
, arg1
, arg2
, arg3
, arg4
);
538 * Variants for the return value output function
542 print_syscall_ret_addr(const struct syscallname
*name
, abi_long ret
)
544 const char *errstr
= NULL
;
547 errstr
= target_strerror(-ret
);
550 gemu_log(" = -1 errno=%d (%s)\n", (int)-ret
, errstr
);
552 gemu_log(" = 0x" TARGET_ABI_FMT_lx
"\n", ret
);
556 #if 0 /* currently unused */
558 print_syscall_ret_raw(struct syscallname
*name
, abi_long ret
)
560 gemu_log(" = 0x" TARGET_ABI_FMT_lx
"\n", ret
);
564 #ifdef TARGET_NR__newselect
566 print_syscall_ret_newselect(const struct syscallname
*name
, abi_long ret
)
568 gemu_log(" = 0x" TARGET_ABI_FMT_lx
" (", ret
);
569 print_fdset(newselect_arg1
,newselect_arg2
);
571 print_fdset(newselect_arg1
,newselect_arg3
);
573 print_fdset(newselect_arg1
,newselect_arg4
);
575 print_timeval(newselect_arg5
, 1);
580 /* special meanings of adjtimex()' non-negative return values */
581 #define TARGET_TIME_OK 0 /* clock synchronized, no leap second */
582 #define TARGET_TIME_INS 1 /* insert leap second */
583 #define TARGET_TIME_DEL 2 /* delete leap second */
584 #define TARGET_TIME_OOP 3 /* leap second in progress */
585 #define TARGET_TIME_WAIT 4 /* leap second has occurred */
586 #define TARGET_TIME_ERROR 5 /* clock not synchronized */
588 print_syscall_ret_adjtimex(const struct syscallname
*name
, abi_long ret
)
590 const char *errstr
= NULL
;
594 gemu_log("-1 errno=%d", errno
);
595 errstr
= target_strerror(-ret
);
597 gemu_log(" (%s)", errstr
);
600 gemu_log(TARGET_ABI_FMT_ld
, ret
);
603 gemu_log(" TIME_OK (clock synchronized, no leap second)");
605 case TARGET_TIME_INS
:
606 gemu_log(" TIME_INS (insert leap second)");
608 case TARGET_TIME_DEL
:
609 gemu_log(" TIME_DEL (delete leap second)");
611 case TARGET_TIME_OOP
:
612 gemu_log(" TIME_OOP (leap second in progress)");
614 case TARGET_TIME_WAIT
:
615 gemu_log(" TIME_WAIT (leap second has occurred)");
617 case TARGET_TIME_ERROR
:
618 gemu_log(" TIME_ERROR (clock not synchronized)");
626 UNUSED
static struct flags access_flags
[] = {
634 UNUSED
static struct flags at_file_flags
[] = {
636 FLAG_GENERIC(AT_EACCESS
),
638 #ifdef AT_SYMLINK_NOFOLLOW
639 FLAG_GENERIC(AT_SYMLINK_NOFOLLOW
),
644 UNUSED
static struct flags unlinkat_flags
[] = {
646 FLAG_GENERIC(AT_REMOVEDIR
),
651 UNUSED
static struct flags mode_flags
[] = {
652 FLAG_GENERIC(S_IFSOCK
),
653 FLAG_GENERIC(S_IFLNK
),
654 FLAG_GENERIC(S_IFREG
),
655 FLAG_GENERIC(S_IFBLK
),
656 FLAG_GENERIC(S_IFDIR
),
657 FLAG_GENERIC(S_IFCHR
),
658 FLAG_GENERIC(S_IFIFO
),
662 UNUSED
static struct flags open_access_flags
[] = {
663 FLAG_TARGET(O_RDONLY
),
664 FLAG_TARGET(O_WRONLY
),
669 UNUSED
static struct flags open_flags
[] = {
670 FLAG_TARGET(O_APPEND
),
671 FLAG_TARGET(O_CREAT
),
672 FLAG_TARGET(O_DIRECTORY
),
674 FLAG_TARGET(O_LARGEFILE
),
675 FLAG_TARGET(O_NOCTTY
),
676 FLAG_TARGET(O_NOFOLLOW
),
677 FLAG_TARGET(O_NONBLOCK
), /* also O_NDELAY */
678 FLAG_TARGET(O_DSYNC
),
679 FLAG_TARGET(__O_SYNC
),
680 FLAG_TARGET(O_TRUNC
),
682 FLAG_TARGET(O_DIRECT
),
685 FLAG_TARGET(O_NOATIME
),
688 FLAG_TARGET(O_CLOEXEC
),
696 UNUSED
static struct flags mount_flags
[] = {
698 FLAG_GENERIC(MS_BIND
),
701 FLAG_GENERIC(MS_DIRSYNC
),
703 FLAG_GENERIC(MS_MANDLOCK
),
705 FLAG_GENERIC(MS_MOVE
),
707 FLAG_GENERIC(MS_NOATIME
),
708 FLAG_GENERIC(MS_NODEV
),
709 FLAG_GENERIC(MS_NODIRATIME
),
710 FLAG_GENERIC(MS_NOEXEC
),
711 FLAG_GENERIC(MS_NOSUID
),
712 FLAG_GENERIC(MS_RDONLY
),
714 FLAG_GENERIC(MS_RELATIME
),
716 FLAG_GENERIC(MS_REMOUNT
),
717 FLAG_GENERIC(MS_SYNCHRONOUS
),
721 UNUSED
static struct flags umount2_flags
[] = {
723 FLAG_GENERIC(MNT_FORCE
),
726 FLAG_GENERIC(MNT_DETACH
),
729 FLAG_GENERIC(MNT_EXPIRE
),
734 UNUSED
static struct flags mmap_prot_flags
[] = {
735 FLAG_GENERIC(PROT_NONE
),
736 FLAG_GENERIC(PROT_EXEC
),
737 FLAG_GENERIC(PROT_READ
),
738 FLAG_GENERIC(PROT_WRITE
),
739 FLAG_TARGET(PROT_SEM
),
740 FLAG_GENERIC(PROT_GROWSDOWN
),
741 FLAG_GENERIC(PROT_GROWSUP
),
745 UNUSED
static struct flags mmap_flags
[] = {
746 FLAG_TARGET(MAP_SHARED
),
747 FLAG_TARGET(MAP_PRIVATE
),
748 FLAG_TARGET(MAP_ANONYMOUS
),
749 FLAG_TARGET(MAP_DENYWRITE
),
750 FLAG_TARGET(MAP_FIXED
),
751 FLAG_TARGET(MAP_GROWSDOWN
),
752 FLAG_TARGET(MAP_EXECUTABLE
),
754 FLAG_TARGET(MAP_LOCKED
),
757 FLAG_TARGET(MAP_NONBLOCK
),
759 FLAG_TARGET(MAP_NORESERVE
),
761 FLAG_TARGET(MAP_POPULATE
),
763 #ifdef TARGET_MAP_UNINITIALIZED
764 FLAG_TARGET(MAP_UNINITIALIZED
),
769 UNUSED
static struct flags clone_flags
[] = {
770 FLAG_GENERIC(CLONE_VM
),
771 FLAG_GENERIC(CLONE_FS
),
772 FLAG_GENERIC(CLONE_FILES
),
773 FLAG_GENERIC(CLONE_SIGHAND
),
774 FLAG_GENERIC(CLONE_PTRACE
),
775 FLAG_GENERIC(CLONE_VFORK
),
776 FLAG_GENERIC(CLONE_PARENT
),
777 FLAG_GENERIC(CLONE_THREAD
),
778 FLAG_GENERIC(CLONE_NEWNS
),
779 FLAG_GENERIC(CLONE_SYSVSEM
),
780 FLAG_GENERIC(CLONE_SETTLS
),
781 FLAG_GENERIC(CLONE_PARENT_SETTID
),
782 FLAG_GENERIC(CLONE_CHILD_CLEARTID
),
783 FLAG_GENERIC(CLONE_DETACHED
),
784 FLAG_GENERIC(CLONE_UNTRACED
),
785 FLAG_GENERIC(CLONE_CHILD_SETTID
),
786 #if defined(CLONE_NEWUTS)
787 FLAG_GENERIC(CLONE_NEWUTS
),
789 #if defined(CLONE_NEWIPC)
790 FLAG_GENERIC(CLONE_NEWIPC
),
792 #if defined(CLONE_NEWUSER)
793 FLAG_GENERIC(CLONE_NEWUSER
),
795 #if defined(CLONE_NEWPID)
796 FLAG_GENERIC(CLONE_NEWPID
),
798 #if defined(CLONE_NEWNET)
799 FLAG_GENERIC(CLONE_NEWNET
),
801 #if defined(CLONE_IO)
802 FLAG_GENERIC(CLONE_IO
),
807 UNUSED
static struct flags msg_flags
[] = {
809 FLAG_GENERIC(MSG_CONFIRM
),
810 FLAG_GENERIC(MSG_DONTROUTE
),
811 FLAG_GENERIC(MSG_DONTWAIT
),
812 FLAG_GENERIC(MSG_EOR
),
813 FLAG_GENERIC(MSG_MORE
),
814 FLAG_GENERIC(MSG_NOSIGNAL
),
815 FLAG_GENERIC(MSG_OOB
),
817 FLAG_GENERIC(MSG_CMSG_CLOEXEC
),
818 FLAG_GENERIC(MSG_ERRQUEUE
),
819 FLAG_GENERIC(MSG_PEEK
),
820 FLAG_GENERIC(MSG_TRUNC
),
821 FLAG_GENERIC(MSG_WAITALL
),
823 FLAG_GENERIC(MSG_CTRUNC
),
828 * print_xxx utility functions. These are used to print syscall
829 * parameters in certain format. All of these have parameter
830 * named 'last'. This parameter is used to add comma to output
837 return ((last
) ? "" : ",");
841 print_flags(const struct flags
*f
, abi_long flags
, int last
)
843 const char *sep
= "";
846 if ((flags
== 0) && (f
->f_value
== 0)) {
847 gemu_log("%s%s", f
->f_string
, get_comma(last
));
850 for (n
= 0; f
->f_string
!= NULL
; f
++) {
851 if ((f
->f_value
!= 0) && ((flags
& f
->f_value
) == f
->f_value
)) {
852 gemu_log("%s%s", sep
, f
->f_string
);
853 flags
&= ~f
->f_value
;
860 /* print rest of the flags as numeric */
862 gemu_log("%s%#x%s", sep
, (unsigned int)flags
, get_comma(last
));
864 gemu_log("%s", get_comma(last
));
867 /* no string version of flags found, print them in hex then */
868 gemu_log("%#x%s", (unsigned int)flags
, get_comma(last
));
873 print_at_dirfd(abi_long dirfd
, int last
)
876 if (dirfd
== AT_FDCWD
) {
877 gemu_log("AT_FDCWD%s", get_comma(last
));
881 gemu_log("%d%s", (int)dirfd
, get_comma(last
));
885 print_file_mode(abi_long mode
, int last
)
887 const char *sep
= "";
888 const struct flags
*m
;
890 for (m
= &mode_flags
[0]; m
->f_string
!= NULL
; m
++) {
891 if ((m
->f_value
& mode
) == m
->f_value
) {
892 gemu_log("%s%s", m
->f_string
, sep
);
900 /* print rest of the mode as octal */
902 gemu_log("%s%#o", sep
, (unsigned int)mode
);
904 gemu_log("%s", get_comma(last
));
908 print_open_flags(abi_long flags
, int last
)
910 print_flags(open_access_flags
, flags
& TARGET_O_ACCMODE
, 1);
911 flags
&= ~TARGET_O_ACCMODE
;
913 gemu_log("%s", get_comma(last
));
917 print_flags(open_flags
, flags
, last
);
921 print_syscall_prologue(const struct syscallname
*sc
)
923 gemu_log("%s(", sc
->name
);
928 print_syscall_epilogue(const struct syscallname
*sc
)
935 print_string(abi_long addr
, int last
)
939 if ((s
= lock_user_string(addr
)) != NULL
) {
940 gemu_log("\"%s\"%s", s
, get_comma(last
));
941 unlock_user(s
, addr
, 0);
943 /* can't get string out of it, so print it as pointer */
944 print_pointer(addr
, last
);
948 #define MAX_PRINT_BUF 40
950 print_buf(abi_long addr
, abi_long len
, int last
)
955 s
= lock_user(VERIFY_READ
, addr
, len
, 1);
958 for (i
= 0; i
< MAX_PRINT_BUF
&& i
< len
; i
++) {
960 gemu_log("%c", s
[i
]);
962 gemu_log("\\%o", s
[i
]);
972 unlock_user(s
, addr
, 0);
974 print_pointer(addr
, last
);
979 * Prints out raw parameter using given format. Caller needs
980 * to do byte swapping if needed.
983 print_raw_param(const char *fmt
, abi_long param
, int last
)
987 (void) snprintf(format
, sizeof (format
), "%s%s", fmt
, get_comma(last
));
988 gemu_log(format
, param
);
992 print_pointer(abi_long p
, int last
)
995 gemu_log("NULL%s", get_comma(last
));
997 gemu_log("0x" TARGET_ABI_FMT_lx
"%s", p
, get_comma(last
));
1001 * Reads 32-bit (int) number from guest address space from
1002 * address 'addr' and prints it.
1005 print_number(abi_long addr
, int last
)
1008 gemu_log("NULL%s", get_comma(last
));
1012 get_user_s32(num
, addr
);
1013 gemu_log("[%d]%s", num
, get_comma(last
));
1018 print_timeval(abi_ulong tv_addr
, int last
)
1021 struct target_timeval
*tv
;
1023 tv
= lock_user(VERIFY_READ
, tv_addr
, sizeof(*tv
), 1);
1026 gemu_log("{" TARGET_ABI_FMT_ld
"," TARGET_ABI_FMT_ld
"}%s",
1027 tswapal(tv
->tv_sec
), tswapal(tv
->tv_usec
), get_comma(last
));
1028 unlock_user(tv
, tv_addr
, 0);
1030 gemu_log("NULL%s", get_comma(last
));
1035 #ifdef TARGET_NR_accept
1037 print_accept(const struct syscallname
*name
,
1038 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1039 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1041 print_syscall_prologue(name
);
1042 print_raw_param("%d", arg0
, 0);
1043 print_pointer(arg1
, 0);
1044 print_number(arg2
, 1);
1045 print_syscall_epilogue(name
);
1049 #ifdef TARGET_NR_access
1051 print_access(const struct syscallname
*name
,
1052 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1053 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1055 print_syscall_prologue(name
);
1056 print_string(arg0
, 0);
1057 print_flags(access_flags
, arg1
, 1);
1058 print_syscall_epilogue(name
);
1062 #ifdef TARGET_NR_brk
1064 print_brk(const struct syscallname
*name
,
1065 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1066 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1068 print_syscall_prologue(name
);
1069 print_pointer(arg0
, 1);
1070 print_syscall_epilogue(name
);
1074 #ifdef TARGET_NR_chdir
1076 print_chdir(const struct syscallname
*name
,
1077 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1078 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1080 print_syscall_prologue(name
);
1081 print_string(arg0
, 1);
1082 print_syscall_epilogue(name
);
1086 #ifdef TARGET_NR_chmod
1088 print_chmod(const struct syscallname
*name
,
1089 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1090 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1092 print_syscall_prologue(name
);
1093 print_string(arg0
, 0);
1094 print_file_mode(arg1
, 1);
1095 print_syscall_epilogue(name
);
1099 #ifdef TARGET_NR_clone
1100 static void do_print_clone(unsigned int flags
, abi_ulong newsp
,
1101 abi_ulong parent_tidptr
, target_ulong newtls
,
1102 abi_ulong child_tidptr
)
1104 print_flags(clone_flags
, flags
, 0);
1105 print_raw_param("child_stack=0x" TARGET_ABI_FMT_lx
, newsp
, 0);
1106 print_raw_param("parent_tidptr=0x" TARGET_ABI_FMT_lx
, parent_tidptr
, 0);
1107 print_raw_param("tls=0x" TARGET_ABI_FMT_lx
, newtls
, 0);
1108 print_raw_param("child_tidptr=0x" TARGET_ABI_FMT_lx
, child_tidptr
, 1);
1112 print_clone(const struct syscallname
*name
,
1113 abi_long arg1
, abi_long arg2
, abi_long arg3
,
1114 abi_long arg4
, abi_long arg5
, abi_long arg6
)
1116 print_syscall_prologue(name
);
1117 #if defined(TARGET_MICROBLAZE)
1118 do_print_clone(arg1
, arg2
, arg4
, arg6
, arg5
);
1119 #elif defined(TARGET_CLONE_BACKWARDS)
1120 do_print_clone(arg1
, arg2
, arg3
, arg4
, arg5
);
1121 #elif defined(TARGET_CLONE_BACKWARDS2)
1122 do_print_clone(arg2
, arg1
, arg3
, arg5
, arg4
);
1124 do_print_clone(arg1
, arg2
, arg3
, arg5
, arg4
);
1126 print_syscall_epilogue(name
);
1130 #ifdef TARGET_NR_creat
1132 print_creat(const struct syscallname
*name
,
1133 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1134 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1136 print_syscall_prologue(name
);
1137 print_string(arg0
, 0);
1138 print_file_mode(arg1
, 1);
1139 print_syscall_epilogue(name
);
1143 #ifdef TARGET_NR_execv
1145 print_execv(const struct syscallname
*name
,
1146 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1147 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1149 print_syscall_prologue(name
);
1150 print_string(arg0
, 0);
1151 print_raw_param("0x" TARGET_ABI_FMT_lx
, arg1
, 1);
1152 print_syscall_epilogue(name
);
1156 #ifdef TARGET_NR_faccessat
1158 print_faccessat(const struct syscallname
*name
,
1159 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1160 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1162 print_syscall_prologue(name
);
1163 print_at_dirfd(arg0
, 0);
1164 print_string(arg1
, 0);
1165 print_flags(access_flags
, arg2
, 0);
1166 print_flags(at_file_flags
, arg3
, 1);
1167 print_syscall_epilogue(name
);
1171 #ifdef TARGET_NR_fchmodat
1173 print_fchmodat(const struct syscallname
*name
,
1174 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1175 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1177 print_syscall_prologue(name
);
1178 print_at_dirfd(arg0
, 0);
1179 print_string(arg1
, 0);
1180 print_file_mode(arg2
, 0);
1181 print_flags(at_file_flags
, arg3
, 1);
1182 print_syscall_epilogue(name
);
1186 #ifdef TARGET_NR_fchownat
1188 print_fchownat(const struct syscallname
*name
,
1189 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1190 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1192 print_syscall_prologue(name
);
1193 print_at_dirfd(arg0
, 0);
1194 print_string(arg1
, 0);
1195 print_raw_param("%d", arg2
, 0);
1196 print_raw_param("%d", arg3
, 0);
1197 print_flags(at_file_flags
, arg4
, 1);
1198 print_syscall_epilogue(name
);
1202 #if defined(TARGET_NR_fcntl) || defined(TARGET_NR_fcntl64)
1204 print_fcntl(const struct syscallname
*name
,
1205 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1206 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1208 print_syscall_prologue(name
);
1209 print_raw_param("%d", arg0
, 0);
1211 case TARGET_F_DUPFD
:
1212 gemu_log("F_DUPFD,");
1213 print_raw_param(TARGET_ABI_FMT_ld
, arg2
, 1);
1215 case TARGET_F_GETFD
:
1216 gemu_log("F_GETFD");
1218 case TARGET_F_SETFD
:
1219 gemu_log("F_SETFD,");
1220 print_raw_param(TARGET_ABI_FMT_ld
, arg2
, 1);
1222 case TARGET_F_GETFL
:
1223 gemu_log("F_GETFL");
1225 case TARGET_F_SETFL
:
1226 gemu_log("F_SETFL,");
1227 print_open_flags(arg2
, 1);
1229 case TARGET_F_GETLK
:
1230 gemu_log("F_GETLK,");
1231 print_pointer(arg2
, 1);
1233 case TARGET_F_SETLK
:
1234 gemu_log("F_SETLK,");
1235 print_pointer(arg2
, 1);
1237 case TARGET_F_SETLKW
:
1238 gemu_log("F_SETLKW,");
1239 print_pointer(arg2
, 1);
1241 case TARGET_F_GETOWN
:
1242 gemu_log("F_GETOWN");
1244 case TARGET_F_SETOWN
:
1245 gemu_log("F_SETOWN,");
1246 print_raw_param(TARGET_ABI_FMT_ld
, arg2
, 0);
1248 case TARGET_F_GETSIG
:
1249 gemu_log("F_GETSIG");
1251 case TARGET_F_SETSIG
:
1252 gemu_log("F_SETSIG,");
1253 print_raw_param(TARGET_ABI_FMT_ld
, arg2
, 0);
1255 #if TARGET_ABI_BITS == 32
1256 case TARGET_F_GETLK64
:
1257 gemu_log("F_GETLK64,");
1258 print_pointer(arg2
, 1);
1260 case TARGET_F_SETLK64
:
1261 gemu_log("F_SETLK64,");
1262 print_pointer(arg2
, 1);
1264 case TARGET_F_SETLKW64
:
1265 gemu_log("F_SETLKW64,");
1266 print_pointer(arg2
, 1);
1269 case TARGET_F_SETLEASE
:
1270 gemu_log("F_SETLEASE,");
1271 print_raw_param(TARGET_ABI_FMT_ld
, arg2
, 0);
1273 case TARGET_F_GETLEASE
:
1274 gemu_log("F_GETLEASE");
1276 case TARGET_F_SETPIPE_SZ
:
1277 gemu_log("F_SETPIPE_SZ,");
1278 print_raw_param(TARGET_ABI_FMT_ld
, arg2
, 1);
1280 case TARGET_F_GETPIPE_SZ
:
1281 gemu_log("F_GETPIPE_SZ");
1283 case TARGET_F_DUPFD_CLOEXEC
:
1284 gemu_log("F_DUPFD_CLOEXEC,");
1285 print_raw_param(TARGET_ABI_FMT_ld
, arg2
, 1);
1287 case TARGET_F_NOTIFY
:
1288 gemu_log("F_NOTIFY,");
1289 print_raw_param(TARGET_ABI_FMT_ld
, arg2
, 0);
1292 print_raw_param(TARGET_ABI_FMT_ld
, arg1
, 0);
1293 print_pointer(arg2
, 1);
1296 print_syscall_epilogue(name
);
1298 #define print_fcntl64 print_fcntl
1302 #ifdef TARGET_NR_futimesat
1304 print_futimesat(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_at_dirfd(arg0
, 0);
1310 print_string(arg1
, 0);
1311 print_timeval(arg2
, 0);
1312 print_timeval(arg2
+ sizeof (struct target_timeval
), 1);
1313 print_syscall_epilogue(name
);
1317 #ifdef TARGET_NR_link
1319 print_link(const struct syscallname
*name
,
1320 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1321 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1323 print_syscall_prologue(name
);
1324 print_string(arg0
, 0);
1325 print_string(arg1
, 1);
1326 print_syscall_epilogue(name
);
1330 #ifdef TARGET_NR_linkat
1332 print_linkat(const struct syscallname
*name
,
1333 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1334 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1336 print_syscall_prologue(name
);
1337 print_at_dirfd(arg0
, 0);
1338 print_string(arg1
, 0);
1339 print_at_dirfd(arg2
, 0);
1340 print_string(arg3
, 0);
1341 print_flags(at_file_flags
, arg4
, 1);
1342 print_syscall_epilogue(name
);
1346 #ifdef TARGET_NR__llseek
1348 print__llseek(const struct syscallname
*name
,
1349 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1350 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1352 const char *whence
= "UNKNOWN";
1353 print_syscall_prologue(name
);
1354 print_raw_param("%d", arg0
, 0);
1355 print_raw_param("%ld", arg1
, 0);
1356 print_raw_param("%ld", arg2
, 0);
1357 print_pointer(arg3
, 0);
1359 case SEEK_SET
: whence
= "SEEK_SET"; break;
1360 case SEEK_CUR
: whence
= "SEEK_CUR"; break;
1361 case SEEK_END
: whence
= "SEEK_END"; break;
1363 gemu_log("%s",whence
);
1364 print_syscall_epilogue(name
);
1368 #if defined(TARGET_NR_socket)
1370 print_socket(const struct syscallname
*name
,
1371 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1372 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1374 abi_ulong domain
= arg0
, type
= arg1
, protocol
= arg2
;
1376 print_syscall_prologue(name
);
1377 print_socket_domain(domain
);
1379 print_socket_type(type
);
1381 if (domain
== AF_PACKET
||
1382 (domain
== AF_INET
&& type
== TARGET_SOCK_PACKET
)) {
1383 protocol
= tswap16(protocol
);
1385 print_socket_protocol(domain
, type
, protocol
);
1386 print_syscall_epilogue(name
);
1391 #if defined(TARGET_NR_socketcall)
1393 #define get_user_ualx(x, gaddr, idx) \
1394 get_user_ual(x, (gaddr) + (idx) * sizeof(abi_long))
1396 static void do_print_socket(const char *name
, abi_long arg1
)
1398 abi_ulong domain
, type
, protocol
;
1400 get_user_ualx(domain
, arg1
, 0);
1401 get_user_ualx(type
, arg1
, 1);
1402 get_user_ualx(protocol
, arg1
, 2);
1403 gemu_log("%s(", name
);
1404 print_socket_domain(domain
);
1406 print_socket_type(type
);
1408 if (domain
== AF_PACKET
||
1409 (domain
== AF_INET
&& type
== TARGET_SOCK_PACKET
)) {
1410 protocol
= tswap16(protocol
);
1412 print_socket_protocol(domain
, type
, protocol
);
1416 static void do_print_sockaddr(const char *name
, abi_long arg1
)
1418 abi_ulong sockfd
, addr
, addrlen
;
1420 get_user_ualx(sockfd
, arg1
, 0);
1421 get_user_ualx(addr
, arg1
, 1);
1422 get_user_ualx(addrlen
, arg1
, 2);
1424 gemu_log("%s(", name
);
1425 print_raw_param(TARGET_ABI_FMT_ld
, sockfd
, 0);
1426 print_sockaddr(addr
, addrlen
);
1430 static void do_print_listen(const char *name
, abi_long arg1
)
1432 abi_ulong sockfd
, backlog
;
1434 get_user_ualx(sockfd
, arg1
, 0);
1435 get_user_ualx(backlog
, arg1
, 1);
1437 gemu_log("%s(", name
);
1438 print_raw_param(TARGET_ABI_FMT_ld
, sockfd
, 0);
1439 print_raw_param(TARGET_ABI_FMT_ld
, backlog
, 1);
1443 static void do_print_socketpair(const char *name
, abi_long arg1
)
1445 abi_ulong domain
, type
, protocol
, tab
;
1447 get_user_ualx(domain
, arg1
, 0);
1448 get_user_ualx(type
, arg1
, 1);
1449 get_user_ualx(protocol
, arg1
, 2);
1450 get_user_ualx(tab
, arg1
, 3);
1452 gemu_log("%s(", name
);
1453 print_socket_domain(domain
);
1455 print_socket_type(type
);
1457 print_socket_protocol(domain
, type
, protocol
);
1459 print_raw_param(TARGET_ABI_FMT_lx
, tab
, 1);
1463 static void do_print_sendrecv(const char *name
, abi_long arg1
)
1465 abi_ulong sockfd
, msg
, len
, flags
;
1467 get_user_ualx(sockfd
, arg1
, 0);
1468 get_user_ualx(msg
, arg1
, 1);
1469 get_user_ualx(len
, arg1
, 2);
1470 get_user_ualx(flags
, arg1
, 3);
1472 gemu_log("%s(", name
);
1473 print_raw_param(TARGET_ABI_FMT_ld
, sockfd
, 0);
1474 print_buf(msg
, len
, 0);
1475 print_raw_param(TARGET_ABI_FMT_ld
, len
, 0);
1476 print_flags(msg_flags
, flags
, 1);
1480 static void do_print_msgaddr(const char *name
, abi_long arg1
)
1482 abi_ulong sockfd
, msg
, len
, flags
, addr
, addrlen
;
1484 get_user_ualx(sockfd
, arg1
, 0);
1485 get_user_ualx(msg
, arg1
, 1);
1486 get_user_ualx(len
, arg1
, 2);
1487 get_user_ualx(flags
, arg1
, 3);
1488 get_user_ualx(addr
, arg1
, 4);
1489 get_user_ualx(addrlen
, arg1
, 5);
1491 gemu_log("%s(", name
);
1492 print_raw_param(TARGET_ABI_FMT_ld
, sockfd
, 0);
1493 print_buf(msg
, len
, 0);
1494 print_raw_param(TARGET_ABI_FMT_ld
, len
, 0);
1495 print_flags(msg_flags
, flags
, 0);
1496 print_sockaddr(addr
, addrlen
);
1500 static void do_print_shutdown(const char *name
, abi_long arg1
)
1502 abi_ulong sockfd
, how
;
1504 get_user_ualx(sockfd
, arg1
, 0);
1505 get_user_ualx(how
, arg1
, 1);
1507 gemu_log("shutdown(");
1508 print_raw_param(TARGET_ABI_FMT_ld
, sockfd
, 0);
1511 gemu_log("SHUT_RD");
1514 gemu_log("SHUT_WR");
1517 gemu_log("SHUT_RDWR");
1520 print_raw_param(TARGET_ABI_FMT_ld
, how
, 1);
1526 static void do_print_msg(const char *name
, abi_long arg1
)
1528 abi_ulong sockfd
, msg
, flags
;
1530 get_user_ualx(sockfd
, arg1
, 0);
1531 get_user_ualx(msg
, arg1
, 1);
1532 get_user_ualx(flags
, arg1
, 2);
1534 gemu_log("%s(", name
);
1535 print_raw_param(TARGET_ABI_FMT_ld
, sockfd
, 0);
1536 print_pointer(msg
, 0);
1537 print_flags(msg_flags
, flags
, 1);
1541 static void do_print_sockopt(const char *name
, abi_long arg1
)
1543 abi_ulong sockfd
, level
, optname
, optval
, optlen
;
1545 get_user_ualx(sockfd
, arg1
, 0);
1546 get_user_ualx(level
, arg1
, 1);
1547 get_user_ualx(optname
, arg1
, 2);
1548 get_user_ualx(optval
, arg1
, 3);
1549 get_user_ualx(optlen
, arg1
, 4);
1551 gemu_log("%s(", name
);
1552 print_raw_param(TARGET_ABI_FMT_ld
, sockfd
, 0);
1555 gemu_log("SOL_TCP,");
1556 print_raw_param(TARGET_ABI_FMT_ld
, optname
, 0);
1557 print_pointer(optval
, 0);
1560 gemu_log("SOL_IP,");
1561 print_raw_param(TARGET_ABI_FMT_ld
, optname
, 0);
1562 print_pointer(optval
, 0);
1565 gemu_log("SOL_RAW,");
1566 print_raw_param(TARGET_ABI_FMT_ld
, optname
, 0);
1567 print_pointer(optval
, 0);
1569 case TARGET_SOL_SOCKET
:
1570 gemu_log("SOL_SOCKET,");
1572 case TARGET_SO_DEBUG
:
1573 gemu_log("SO_DEBUG,");
1575 print_number(optval
, 0);
1577 case TARGET_SO_REUSEADDR
:
1578 gemu_log("SO_REUSEADDR,");
1580 case TARGET_SO_TYPE
:
1581 gemu_log("SO_TYPE,");
1583 case TARGET_SO_ERROR
:
1584 gemu_log("SO_ERROR,");
1586 case TARGET_SO_DONTROUTE
:
1587 gemu_log("SO_DONTROUTE,");
1589 case TARGET_SO_BROADCAST
:
1590 gemu_log("SO_BROADCAST,");
1592 case TARGET_SO_SNDBUF
:
1593 gemu_log("SO_SNDBUF,");
1595 case TARGET_SO_RCVBUF
:
1596 gemu_log("SO_RCVBUF,");
1598 case TARGET_SO_KEEPALIVE
:
1599 gemu_log("SO_KEEPALIVE,");
1601 case TARGET_SO_OOBINLINE
:
1602 gemu_log("SO_OOBINLINE,");
1604 case TARGET_SO_NO_CHECK
:
1605 gemu_log("SO_NO_CHECK,");
1607 case TARGET_SO_PRIORITY
:
1608 gemu_log("SO_PRIORITY,");
1610 case TARGET_SO_BSDCOMPAT
:
1611 gemu_log("SO_BSDCOMPAT,");
1613 case TARGET_SO_PASSCRED
:
1614 gemu_log("SO_PASSCRED,");
1616 case TARGET_SO_TIMESTAMP
:
1617 gemu_log("SO_TIMESTAMP,");
1619 case TARGET_SO_RCVLOWAT
:
1620 gemu_log("SO_RCVLOWAT,");
1622 case TARGET_SO_RCVTIMEO
:
1623 gemu_log("SO_RCVTIMEO,");
1624 print_timeval(optval
, 0);
1626 case TARGET_SO_SNDTIMEO
:
1627 gemu_log("SO_SNDTIMEO,");
1628 print_timeval(optval
, 0);
1630 case TARGET_SO_ATTACH_FILTER
: {
1631 struct target_sock_fprog
*fprog
;
1633 gemu_log("SO_ATTACH_FILTER,");
1635 if (lock_user_struct(VERIFY_READ
, fprog
, optval
, 0)) {
1636 struct target_sock_filter
*filter
;
1638 if (lock_user_struct(VERIFY_READ
, filter
,
1639 tswapal(fprog
->filter
), 0)) {
1641 for (i
= 0; i
< tswap16(fprog
->len
) - 1; i
++) {
1642 gemu_log("[%d]{0x%x,%d,%d,0x%x},",
1643 i
, tswap16(filter
[i
].code
),
1644 filter
[i
].jt
, filter
[i
].jf
,
1645 tswap32(filter
[i
].k
));
1647 gemu_log("[%d]{0x%x,%d,%d,0x%x}",
1648 i
, tswap16(filter
[i
].code
),
1649 filter
[i
].jt
, filter
[i
].jf
,
1650 tswap32(filter
[i
].k
));
1652 gemu_log(TARGET_ABI_FMT_lx
, tswapal(fprog
->filter
));
1654 gemu_log(",%d},", tswap16(fprog
->len
));
1655 unlock_user(fprog
, optval
, 0);
1657 print_pointer(optval
, 0);
1662 print_raw_param(TARGET_ABI_FMT_ld
, optname
, 0);
1663 print_pointer(optval
, 0);
1668 print_raw_param(TARGET_ABI_FMT_ld
, level
, 0);
1669 print_raw_param(TARGET_ABI_FMT_ld
, optname
, 0);
1670 print_pointer(optval
, 0);
1673 print_raw_param(TARGET_ABI_FMT_ld
, optlen
, 1);
1677 #define PRINT_SOCKOP(name, func) \
1678 [TARGET_SYS_##name] = { #name, func }
1682 void (*print
)(const char *, abi_long
);
1684 PRINT_SOCKOP(SOCKET
, do_print_socket
),
1685 PRINT_SOCKOP(BIND
, do_print_sockaddr
),
1686 PRINT_SOCKOP(CONNECT
, do_print_sockaddr
),
1687 PRINT_SOCKOP(LISTEN
, do_print_listen
),
1688 PRINT_SOCKOP(ACCEPT
, do_print_sockaddr
),
1689 PRINT_SOCKOP(GETSOCKNAME
, do_print_sockaddr
),
1690 PRINT_SOCKOP(GETPEERNAME
, do_print_sockaddr
),
1691 PRINT_SOCKOP(SOCKETPAIR
, do_print_socketpair
),
1692 PRINT_SOCKOP(SEND
, do_print_sendrecv
),
1693 PRINT_SOCKOP(RECV
, do_print_sendrecv
),
1694 PRINT_SOCKOP(SENDTO
, do_print_msgaddr
),
1695 PRINT_SOCKOP(RECVFROM
, do_print_msgaddr
),
1696 PRINT_SOCKOP(SHUTDOWN
, do_print_shutdown
),
1697 PRINT_SOCKOP(SETSOCKOPT
, do_print_sockopt
),
1698 PRINT_SOCKOP(GETSOCKOPT
, do_print_sockopt
),
1699 PRINT_SOCKOP(SENDMSG
, do_print_msg
),
1700 PRINT_SOCKOP(RECVMSG
, do_print_msg
),
1701 PRINT_SOCKOP(ACCEPT4
, NULL
),
1702 PRINT_SOCKOP(RECVMMSG
, NULL
),
1703 PRINT_SOCKOP(SENDMMSG
, NULL
),
1707 print_socketcall(const struct syscallname
*name
,
1708 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1709 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1711 if (arg0
>= 0 && arg0
< ARRAY_SIZE(scall
) && scall
[arg0
].print
) {
1712 scall
[arg0
].print(scall
[arg0
].name
, arg1
);
1715 print_syscall_prologue(name
);
1716 print_raw_param(TARGET_ABI_FMT_ld
, arg0
, 0);
1717 print_raw_param(TARGET_ABI_FMT_ld
, arg1
, 0);
1718 print_raw_param(TARGET_ABI_FMT_ld
, arg2
, 0);
1719 print_raw_param(TARGET_ABI_FMT_ld
, arg3
, 0);
1720 print_raw_param(TARGET_ABI_FMT_ld
, arg4
, 0);
1721 print_raw_param(TARGET_ABI_FMT_ld
, arg5
, 0);
1722 print_syscall_epilogue(name
);
1726 #if defined(TARGET_NR_stat) || defined(TARGET_NR_stat64) || \
1727 defined(TARGET_NR_lstat) || defined(TARGET_NR_lstat64)
1729 print_stat(const struct syscallname
*name
,
1730 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1731 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1733 print_syscall_prologue(name
);
1734 print_string(arg0
, 0);
1735 print_pointer(arg1
, 1);
1736 print_syscall_epilogue(name
);
1738 #define print_lstat print_stat
1739 #define print_stat64 print_stat
1740 #define print_lstat64 print_stat
1743 #if defined(TARGET_NR_fstat) || defined(TARGET_NR_fstat64)
1745 print_fstat(const struct syscallname
*name
,
1746 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1747 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1749 print_syscall_prologue(name
);
1750 print_raw_param("%d", arg0
, 0);
1751 print_pointer(arg1
, 1);
1752 print_syscall_epilogue(name
);
1754 #define print_fstat64 print_fstat
1757 #ifdef TARGET_NR_mkdir
1759 print_mkdir(const struct syscallname
*name
,
1760 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1761 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1763 print_syscall_prologue(name
);
1764 print_string(arg0
, 0);
1765 print_file_mode(arg1
, 1);
1766 print_syscall_epilogue(name
);
1770 #ifdef TARGET_NR_mkdirat
1772 print_mkdirat(const struct syscallname
*name
,
1773 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1774 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1776 print_syscall_prologue(name
);
1777 print_at_dirfd(arg0
, 0);
1778 print_string(arg1
, 0);
1779 print_file_mode(arg2
, 1);
1780 print_syscall_epilogue(name
);
1784 #ifdef TARGET_NR_rmdir
1786 print_rmdir(const struct syscallname
*name
,
1787 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1788 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1790 print_syscall_prologue(name
);
1791 print_string(arg0
, 0);
1792 print_syscall_epilogue(name
);
1796 #ifdef TARGET_NR_rt_sigaction
1798 print_rt_sigaction(const struct syscallname
*name
,
1799 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1800 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1802 print_syscall_prologue(name
);
1803 print_signal(arg0
, 0);
1804 print_pointer(arg1
, 0);
1805 print_pointer(arg2
, 1);
1806 print_syscall_epilogue(name
);
1810 #ifdef TARGET_NR_rt_sigprocmask
1812 print_rt_sigprocmask(const struct syscallname
*name
,
1813 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1814 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1816 const char *how
= "UNKNOWN";
1817 print_syscall_prologue(name
);
1819 case TARGET_SIG_BLOCK
: how
= "SIG_BLOCK"; break;
1820 case TARGET_SIG_UNBLOCK
: how
= "SIG_UNBLOCK"; break;
1821 case TARGET_SIG_SETMASK
: how
= "SIG_SETMASK"; break;
1823 gemu_log("%s,",how
);
1824 print_pointer(arg1
, 0);
1825 print_pointer(arg2
, 1);
1826 print_syscall_epilogue(name
);
1830 #ifdef TARGET_NR_mknod
1832 print_mknod(const struct syscallname
*name
,
1833 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1834 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1836 int hasdev
= (arg1
& (S_IFCHR
|S_IFBLK
));
1838 print_syscall_prologue(name
);
1839 print_string(arg0
, 0);
1840 print_file_mode(arg1
, (hasdev
== 0));
1842 print_raw_param("makedev(%d", major(arg2
), 0);
1843 print_raw_param("%d)", minor(arg2
), 1);
1845 print_syscall_epilogue(name
);
1849 #ifdef TARGET_NR_mknodat
1851 print_mknodat(const struct syscallname
*name
,
1852 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1853 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1855 int hasdev
= (arg2
& (S_IFCHR
|S_IFBLK
));
1857 print_syscall_prologue(name
);
1858 print_at_dirfd(arg0
, 0);
1859 print_string(arg1
, 0);
1860 print_file_mode(arg2
, (hasdev
== 0));
1862 print_raw_param("makedev(%d", major(arg3
), 0);
1863 print_raw_param("%d)", minor(arg3
), 1);
1865 print_syscall_epilogue(name
);
1869 #ifdef TARGET_NR_mq_open
1871 print_mq_open(const struct syscallname
*name
,
1872 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1873 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1875 int is_creat
= (arg1
& TARGET_O_CREAT
);
1877 print_syscall_prologue(name
);
1878 print_string(arg0
, 0);
1879 print_open_flags(arg1
, (is_creat
== 0));
1881 print_file_mode(arg2
, 0);
1882 print_pointer(arg3
, 1);
1884 print_syscall_epilogue(name
);
1888 #ifdef TARGET_NR_open
1890 print_open(const struct syscallname
*name
,
1891 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1892 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1894 int is_creat
= (arg1
& TARGET_O_CREAT
);
1896 print_syscall_prologue(name
);
1897 print_string(arg0
, 0);
1898 print_open_flags(arg1
, (is_creat
== 0));
1900 print_file_mode(arg2
, 1);
1901 print_syscall_epilogue(name
);
1905 #ifdef TARGET_NR_openat
1907 print_openat(const struct syscallname
*name
,
1908 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1909 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1911 int is_creat
= (arg2
& TARGET_O_CREAT
);
1913 print_syscall_prologue(name
);
1914 print_at_dirfd(arg0
, 0);
1915 print_string(arg1
, 0);
1916 print_open_flags(arg2
, (is_creat
== 0));
1918 print_file_mode(arg3
, 1);
1919 print_syscall_epilogue(name
);
1923 #ifdef TARGET_NR_mq_unlink
1925 print_mq_unlink(const struct syscallname
*name
,
1926 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1927 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1929 print_syscall_prologue(name
);
1930 print_string(arg0
, 1);
1931 print_syscall_epilogue(name
);
1935 #if defined(TARGET_NR_fstatat64) || defined(TARGET_NR_newfstatat)
1937 print_fstatat64(const struct syscallname
*name
,
1938 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1939 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1941 print_syscall_prologue(name
);
1942 print_at_dirfd(arg0
, 0);
1943 print_string(arg1
, 0);
1944 print_pointer(arg2
, 0);
1945 print_flags(at_file_flags
, arg3
, 1);
1946 print_syscall_epilogue(name
);
1948 #define print_newfstatat print_fstatat64
1951 #ifdef TARGET_NR_readlink
1953 print_readlink(const struct syscallname
*name
,
1954 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1955 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1957 print_syscall_prologue(name
);
1958 print_string(arg0
, 0);
1959 print_pointer(arg1
, 0);
1960 print_raw_param("%u", arg2
, 1);
1961 print_syscall_epilogue(name
);
1965 #ifdef TARGET_NR_readlinkat
1967 print_readlinkat(const struct syscallname
*name
,
1968 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1969 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1971 print_syscall_prologue(name
);
1972 print_at_dirfd(arg0
, 0);
1973 print_string(arg1
, 0);
1974 print_pointer(arg2
, 0);
1975 print_raw_param("%u", arg3
, 1);
1976 print_syscall_epilogue(name
);
1980 #ifdef TARGET_NR_rename
1982 print_rename(const struct syscallname
*name
,
1983 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1984 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1986 print_syscall_prologue(name
);
1987 print_string(arg0
, 0);
1988 print_string(arg1
, 1);
1989 print_syscall_epilogue(name
);
1993 #ifdef TARGET_NR_renameat
1995 print_renameat(const struct syscallname
*name
,
1996 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1997 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1999 print_syscall_prologue(name
);
2000 print_at_dirfd(arg0
, 0);
2001 print_string(arg1
, 0);
2002 print_at_dirfd(arg2
, 0);
2003 print_string(arg3
, 1);
2004 print_syscall_epilogue(name
);
2008 #ifdef TARGET_NR_statfs
2010 print_statfs(const struct syscallname
*name
,
2011 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2012 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2014 print_syscall_prologue(name
);
2015 print_string(arg0
, 0);
2016 print_pointer(arg1
, 1);
2017 print_syscall_epilogue(name
);
2019 #define print_statfs64 print_statfs
2022 #ifdef TARGET_NR_symlink
2024 print_symlink(const struct syscallname
*name
,
2025 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2026 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2028 print_syscall_prologue(name
);
2029 print_string(arg0
, 0);
2030 print_string(arg1
, 1);
2031 print_syscall_epilogue(name
);
2035 #ifdef TARGET_NR_symlinkat
2037 print_symlinkat(const struct syscallname
*name
,
2038 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2039 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2041 print_syscall_prologue(name
);
2042 print_string(arg0
, 0);
2043 print_at_dirfd(arg1
, 0);
2044 print_string(arg2
, 1);
2045 print_syscall_epilogue(name
);
2049 #ifdef TARGET_NR_mount
2051 print_mount(const struct syscallname
*name
,
2052 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2053 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2055 print_syscall_prologue(name
);
2056 print_string(arg0
, 0);
2057 print_string(arg1
, 0);
2058 print_string(arg2
, 0);
2059 print_flags(mount_flags
, arg3
, 0);
2060 print_pointer(arg4
, 1);
2061 print_syscall_epilogue(name
);
2065 #ifdef TARGET_NR_umount
2067 print_umount(const struct syscallname
*name
,
2068 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2069 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2071 print_syscall_prologue(name
);
2072 print_string(arg0
, 1);
2073 print_syscall_epilogue(name
);
2077 #ifdef TARGET_NR_umount2
2079 print_umount2(const struct syscallname
*name
,
2080 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2081 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2083 print_syscall_prologue(name
);
2084 print_string(arg0
, 0);
2085 print_flags(umount2_flags
, arg1
, 1);
2086 print_syscall_epilogue(name
);
2090 #ifdef TARGET_NR_unlink
2092 print_unlink(const struct syscallname
*name
,
2093 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2094 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2096 print_syscall_prologue(name
);
2097 print_string(arg0
, 1);
2098 print_syscall_epilogue(name
);
2102 #ifdef TARGET_NR_unlinkat
2104 print_unlinkat(const struct syscallname
*name
,
2105 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2106 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2108 print_syscall_prologue(name
);
2109 print_at_dirfd(arg0
, 0);
2110 print_string(arg1
, 0);
2111 print_flags(unlinkat_flags
, arg2
, 1);
2112 print_syscall_epilogue(name
);
2116 #ifdef TARGET_NR_utime
2118 print_utime(const struct syscallname
*name
,
2119 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2120 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2122 print_syscall_prologue(name
);
2123 print_string(arg0
, 0);
2124 print_pointer(arg1
, 1);
2125 print_syscall_epilogue(name
);
2129 #ifdef TARGET_NR_utimes
2131 print_utimes(const struct syscallname
*name
,
2132 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2133 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2135 print_syscall_prologue(name
);
2136 print_string(arg0
, 0);
2137 print_pointer(arg1
, 1);
2138 print_syscall_epilogue(name
);
2142 #ifdef TARGET_NR_utimensat
2144 print_utimensat(const struct syscallname
*name
,
2145 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2146 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2148 print_syscall_prologue(name
);
2149 print_at_dirfd(arg0
, 0);
2150 print_string(arg1
, 0);
2151 print_pointer(arg2
, 0);
2152 print_flags(at_file_flags
, arg3
, 1);
2153 print_syscall_epilogue(name
);
2157 #if defined(TARGET_NR_mmap) || defined(TARGET_NR_mmap2)
2159 print_mmap(const struct syscallname
*name
,
2160 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2161 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2163 print_syscall_prologue(name
);
2164 print_pointer(arg0
, 0);
2165 print_raw_param("%d", arg1
, 0);
2166 print_flags(mmap_prot_flags
, arg2
, 0);
2167 print_flags(mmap_flags
, arg3
, 0);
2168 print_raw_param("%d", arg4
, 0);
2169 print_raw_param("%#x", arg5
, 1);
2170 print_syscall_epilogue(name
);
2172 #define print_mmap2 print_mmap
2175 #ifdef TARGET_NR_mprotect
2177 print_mprotect(const struct syscallname
*name
,
2178 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2179 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2181 print_syscall_prologue(name
);
2182 print_pointer(arg0
, 0);
2183 print_raw_param("%d", arg1
, 0);
2184 print_flags(mmap_prot_flags
, arg2
, 1);
2185 print_syscall_epilogue(name
);
2189 #ifdef TARGET_NR_munmap
2191 print_munmap(const struct syscallname
*name
,
2192 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2193 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2195 print_syscall_prologue(name
);
2196 print_pointer(arg0
, 0);
2197 print_raw_param("%d", arg1
, 1);
2198 print_syscall_epilogue(name
);
2202 #ifdef TARGET_NR_futex
2203 static void print_futex_op(abi_long tflag
, int last
)
2205 #define print_op(val) \
2206 if( cmd == val ) { \
2211 int cmd
= (int)tflag
;
2212 #ifdef FUTEX_PRIVATE_FLAG
2213 if (cmd
& FUTEX_PRIVATE_FLAG
) {
2214 gemu_log("FUTEX_PRIVATE_FLAG|");
2215 cmd
&= ~FUTEX_PRIVATE_FLAG
;
2218 #ifdef FUTEX_CLOCK_REALTIME
2219 if (cmd
& FUTEX_CLOCK_REALTIME
) {
2220 gemu_log("FUTEX_CLOCK_REALTIME|");
2221 cmd
&= ~FUTEX_CLOCK_REALTIME
;
2224 print_op(FUTEX_WAIT
)
2225 print_op(FUTEX_WAKE
)
2227 print_op(FUTEX_REQUEUE
)
2228 print_op(FUTEX_CMP_REQUEUE
)
2229 print_op(FUTEX_WAKE_OP
)
2230 print_op(FUTEX_LOCK_PI
)
2231 print_op(FUTEX_UNLOCK_PI
)
2232 print_op(FUTEX_TRYLOCK_PI
)
2233 #ifdef FUTEX_WAIT_BITSET
2234 print_op(FUTEX_WAIT_BITSET
)
2236 #ifdef FUTEX_WAKE_BITSET
2237 print_op(FUTEX_WAKE_BITSET
)
2239 /* unknown values */
2244 print_futex(const struct syscallname
*name
,
2245 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2246 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2248 print_syscall_prologue(name
);
2249 print_pointer(arg0
, 0);
2250 print_futex_op(arg1
, 0);
2251 print_raw_param(",%d", arg2
, 0);
2252 print_pointer(arg3
, 0); /* struct timespec */
2253 print_pointer(arg4
, 0);
2254 print_raw_param("%d", arg4
, 1);
2255 print_syscall_epilogue(name
);
2259 #ifdef TARGET_NR_kill
2261 print_kill(const struct syscallname
*name
,
2262 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2263 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2265 print_syscall_prologue(name
);
2266 print_raw_param("%d", arg0
, 0);
2267 print_signal(arg1
, 1);
2268 print_syscall_epilogue(name
);
2273 * An array of all of the syscalls we know about
2276 static const struct syscallname scnames
[] = {
2277 #include "strace.list"
2280 static int nsyscalls
= ARRAY_SIZE(scnames
);
2283 * The public interface to this module.
2286 print_syscall(int num
,
2287 abi_long arg1
, abi_long arg2
, abi_long arg3
,
2288 abi_long arg4
, abi_long arg5
, abi_long arg6
)
2291 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
")";
2293 gemu_log("%d ", getpid() );
2295 for(i
=0;i
<nsyscalls
;i
++)
2296 if( scnames
[i
].nr
== num
) {
2297 if( scnames
[i
].call
!= NULL
) {
2298 scnames
[i
].call(&scnames
[i
],arg1
,arg2
,arg3
,arg4
,arg5
,arg6
);
2300 /* XXX: this format system is broken because it uses
2301 host types and host pointers for strings */
2302 if( scnames
[i
].format
!= NULL
)
2303 format
= scnames
[i
].format
;
2304 gemu_log(format
,scnames
[i
].name
, arg1
,arg2
,arg3
,arg4
,arg5
,arg6
);
2308 gemu_log("Unknown syscall %d\n", num
);
2313 print_syscall_ret(int num
, abi_long ret
)
2316 const char *errstr
= NULL
;
2318 for(i
=0;i
<nsyscalls
;i
++)
2319 if( scnames
[i
].nr
== num
) {
2320 if( scnames
[i
].result
!= NULL
) {
2321 scnames
[i
].result(&scnames
[i
],ret
);
2324 errstr
= target_strerror(-ret
);
2327 gemu_log(" = -1 errno=" TARGET_ABI_FMT_ld
" (%s)\n",
2330 gemu_log(" = " TARGET_ABI_FMT_ld
"\n", ret
);
2337 void print_taken_signal(int target_signum
, const target_siginfo_t
*tinfo
)
2339 /* Print the strace output for a signal being taken:
2340 * --- SIGSEGV {si_signo=SIGSEGV, si_code=SI_KERNEL, si_addr=0} ---
2343 print_signal(target_signum
, 1);
2345 print_siginfo(tinfo
);