1 #include "qemu/osdep.h"
6 #include <sys/select.h>
9 #include <netinet/in.h>
10 #include <netinet/tcp.h>
11 #include <netinet/udp.h>
12 #include <linux/if_packet.h>
13 #include <linux/in6.h>
14 #include <linux/netlink.h>
22 void (*call
)(void *, const struct syscallname
*,
23 abi_long
, abi_long
, abi_long
,
24 abi_long
, abi_long
, abi_long
);
25 void (*result
)(void *, const struct syscallname
*, abi_long
,
26 abi_long
, abi_long
, abi_long
,
27 abi_long
, abi_long
, abi_long
);
31 * It is possible that target doesn't have syscall that uses
32 * following flags but we don't want the compiler to warn
33 * us about them being unused. Same applies to utility print
34 * functions. It is ok to keep them while not used.
36 #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 /* Structure used to translate enumerated values into strings */
56 abi_long e_value
; /* enum value */
57 const char *e_string
; /* stringified enum */
60 /* common enums for all architectures */
61 #define ENUM_GENERIC(name) { name, #name }
62 /* target specific enums */
63 #define ENUM_TARGET(name) { TARGET_ ## name, #name }
64 /* end of enums array */
65 #define ENUM_END { 0, NULL }
67 UNUSED
static const char *get_comma(int);
68 UNUSED
static void print_pointer(abi_long
, int);
69 UNUSED
static void print_flags(const struct flags
*, abi_long
, int);
70 UNUSED
static void print_enums(const struct enums
*, abi_long
, int);
71 UNUSED
static void print_at_dirfd(abi_long
, int);
72 UNUSED
static void print_file_mode(abi_long
, int);
73 UNUSED
static void print_open_flags(abi_long
, int);
74 UNUSED
static void print_syscall_prologue(const struct syscallname
*);
75 UNUSED
static void print_syscall_epilogue(const struct syscallname
*);
76 UNUSED
static void print_string(abi_long
, int);
77 UNUSED
static void print_buf(abi_long addr
, abi_long len
, int last
);
78 UNUSED
static void print_raw_param(const char *, abi_long
, int);
79 UNUSED
static void print_timeval(abi_ulong
, int);
80 UNUSED
static void print_timespec(abi_ulong
, int);
81 UNUSED
static void print_timezone(abi_ulong
, int);
82 UNUSED
static void print_itimerval(abi_ulong
, int);
83 UNUSED
static void print_number(abi_long
, int);
84 UNUSED
static void print_signal(abi_ulong
, int);
85 UNUSED
static void print_sockaddr(abi_ulong
, abi_long
, int);
86 UNUSED
static void print_socket_domain(int domain
);
87 UNUSED
static void print_socket_type(int type
);
88 UNUSED
static void print_socket_protocol(int domain
, int type
, int protocol
);
94 print_ipc_cmd(int cmd
)
96 #define output_cmd(val) \
104 /* General IPC commands */
105 output_cmd( IPC_RMID
);
106 output_cmd( IPC_SET
);
107 output_cmd( IPC_STAT
);
108 output_cmd( IPC_INFO
);
109 /* msgctl() commands */
110 output_cmd( MSG_STAT
);
111 output_cmd( MSG_INFO
);
112 /* shmctl() commands */
113 output_cmd( SHM_LOCK
);
114 output_cmd( SHM_UNLOCK
);
115 output_cmd( SHM_STAT
);
116 output_cmd( SHM_INFO
);
117 /* semctl() commands */
118 output_cmd( GETPID
);
119 output_cmd( GETVAL
);
120 output_cmd( GETALL
);
121 output_cmd( GETNCNT
);
122 output_cmd( GETZCNT
);
123 output_cmd( SETVAL
);
124 output_cmd( SETALL
);
125 output_cmd( SEM_STAT
);
126 output_cmd( SEM_INFO
);
127 output_cmd( IPC_RMID
);
128 output_cmd( IPC_RMID
);
129 output_cmd( IPC_RMID
);
130 output_cmd( IPC_RMID
);
131 output_cmd( IPC_RMID
);
132 output_cmd( IPC_RMID
);
133 output_cmd( IPC_RMID
);
134 output_cmd( IPC_RMID
);
135 output_cmd( IPC_RMID
);
137 /* Some value we don't recognize */
142 print_signal(abi_ulong arg
, int last
)
144 const char *signal_name
= NULL
;
146 case TARGET_SIGHUP
: signal_name
= "SIGHUP"; break;
147 case TARGET_SIGINT
: signal_name
= "SIGINT"; break;
148 case TARGET_SIGQUIT
: signal_name
= "SIGQUIT"; break;
149 case TARGET_SIGILL
: signal_name
= "SIGILL"; break;
150 case TARGET_SIGABRT
: signal_name
= "SIGABRT"; break;
151 case TARGET_SIGFPE
: signal_name
= "SIGFPE"; break;
152 case TARGET_SIGKILL
: signal_name
= "SIGKILL"; break;
153 case TARGET_SIGSEGV
: signal_name
= "SIGSEGV"; break;
154 case TARGET_SIGPIPE
: signal_name
= "SIGPIPE"; break;
155 case TARGET_SIGALRM
: signal_name
= "SIGALRM"; break;
156 case TARGET_SIGTERM
: signal_name
= "SIGTERM"; break;
157 case TARGET_SIGUSR1
: signal_name
= "SIGUSR1"; break;
158 case TARGET_SIGUSR2
: signal_name
= "SIGUSR2"; break;
159 case TARGET_SIGCHLD
: signal_name
= "SIGCHLD"; break;
160 case TARGET_SIGCONT
: signal_name
= "SIGCONT"; break;
161 case TARGET_SIGSTOP
: signal_name
= "SIGSTOP"; break;
162 case TARGET_SIGTTIN
: signal_name
= "SIGTTIN"; break;
163 case TARGET_SIGTTOU
: signal_name
= "SIGTTOU"; break;
165 if (signal_name
== NULL
) {
166 print_raw_param("%ld", arg
, last
);
169 qemu_log("%s%s", signal_name
, get_comma(last
));
172 static void print_si_code(int arg
)
174 const char *codename
= NULL
;
178 codename
= "SI_USER";
181 codename
= "SI_KERNEL";
184 codename
= "SI_QUEUE";
187 codename
= "SI_TIMER";
190 codename
= "SI_MESGQ";
193 codename
= "SI_ASYNCIO";
196 codename
= "SI_SIGIO";
199 codename
= "SI_TKILL";
205 qemu_log("%s", codename
);
208 static void get_target_siginfo(target_siginfo_t
*tinfo
,
209 const target_siginfo_t
*info
)
218 __get_user(sig
, &info
->si_signo
);
219 __get_user(si_errno
, &tinfo
->si_errno
);
220 __get_user(si_code
, &info
->si_code
);
222 tinfo
->si_signo
= sig
;
223 tinfo
->si_errno
= si_errno
;
224 tinfo
->si_code
= si_code
;
226 /* Ensure we don't leak random junk to the guest later */
227 memset(tinfo
->_sifields
._pad
, 0, sizeof(tinfo
->_sifields
._pad
));
229 /* This is awkward, because we have to use a combination of
230 * the si_code and si_signo to figure out which of the union's
231 * members are valid. (Within the host kernel it is always possible
232 * to tell, but the kernel carefully avoids giving userspace the
233 * high 16 bits of si_code, so we don't have the information to
234 * do this the easy way...) We therefore make our best guess,
235 * bearing in mind that a guest can spoof most of the si_codes
236 * via rt_sigqueueinfo() if it likes.
238 * Once we have made our guess, we record it in the top 16 bits of
239 * the si_code, so that print_siginfo() later can use it.
240 * print_siginfo() will strip these top bits out before printing
248 /* Sent via kill(), tkill() or tgkill(), or direct from the kernel.
249 * These are the only unspoofable si_code values.
251 __get_user(tinfo
->_sifields
._kill
._pid
, &info
->_sifields
._kill
._pid
);
252 __get_user(tinfo
->_sifields
._kill
._uid
, &info
->_sifields
._kill
._uid
);
253 si_type
= QEMU_SI_KILL
;
256 /* Everything else is spoofable. Make best guess based on signal */
259 __get_user(tinfo
->_sifields
._sigchld
._pid
,
260 &info
->_sifields
._sigchld
._pid
);
261 __get_user(tinfo
->_sifields
._sigchld
._uid
,
262 &info
->_sifields
._sigchld
._uid
);
263 __get_user(tinfo
->_sifields
._sigchld
._status
,
264 &info
->_sifields
._sigchld
._status
);
265 __get_user(tinfo
->_sifields
._sigchld
._utime
,
266 &info
->_sifields
._sigchld
._utime
);
267 __get_user(tinfo
->_sifields
._sigchld
._stime
,
268 &info
->_sifields
._sigchld
._stime
);
269 si_type
= QEMU_SI_CHLD
;
272 __get_user(tinfo
->_sifields
._sigpoll
._band
,
273 &info
->_sifields
._sigpoll
._band
);
274 __get_user(tinfo
->_sifields
._sigpoll
._fd
,
275 &info
->_sifields
._sigpoll
._fd
);
276 si_type
= QEMU_SI_POLL
;
279 /* Assume a sigqueue()/mq_notify()/rt_sigqueueinfo() source. */
280 __get_user(tinfo
->_sifields
._rt
._pid
, &info
->_sifields
._rt
._pid
);
281 __get_user(tinfo
->_sifields
._rt
._uid
, &info
->_sifields
._rt
._uid
);
282 /* XXX: potential problem if 64 bit */
283 __get_user(sival_ptr
, &info
->_sifields
._rt
._sigval
.sival_ptr
);
284 tinfo
->_sifields
._rt
._sigval
.sival_ptr
= sival_ptr
;
286 si_type
= QEMU_SI_RT
;
292 tinfo
->si_code
= deposit32(si_code
, 16, 16, si_type
);
295 static void print_siginfo(const target_siginfo_t
*tinfo
)
297 /* Print a target_siginfo_t in the format desired for printing
298 * signals being taken. We assume the target_siginfo_t is in the
299 * internal form where the top 16 bits of si_code indicate which
300 * part of the union is valid, rather than in the guest-visible
301 * form where the bottom 16 bits are sign-extended into the top 16.
303 int si_type
= extract32(tinfo
->si_code
, 16, 16);
304 int si_code
= sextract32(tinfo
->si_code
, 0, 16);
306 qemu_log("{si_signo=");
307 print_signal(tinfo
->si_signo
, 1);
308 qemu_log(", si_code=");
309 print_si_code(si_code
);
313 qemu_log(", si_pid=%u, si_uid=%u",
314 (unsigned int)tinfo
->_sifields
._kill
._pid
,
315 (unsigned int)tinfo
->_sifields
._kill
._uid
);
318 qemu_log(", si_timer1=%u, si_timer2=%u",
319 tinfo
->_sifields
._timer
._timer1
,
320 tinfo
->_sifields
._timer
._timer2
);
323 qemu_log(", si_band=%d, si_fd=%d",
324 tinfo
->_sifields
._sigpoll
._band
,
325 tinfo
->_sifields
._sigpoll
._fd
);
328 qemu_log(", si_addr=");
329 print_pointer(tinfo
->_sifields
._sigfault
._addr
, 1);
332 qemu_log(", si_pid=%u, si_uid=%u, si_status=%d"
333 ", si_utime=" TARGET_ABI_FMT_ld
334 ", si_stime=" TARGET_ABI_FMT_ld
,
335 (unsigned int)(tinfo
->_sifields
._sigchld
._pid
),
336 (unsigned int)(tinfo
->_sifields
._sigchld
._uid
),
337 tinfo
->_sifields
._sigchld
._status
,
338 tinfo
->_sifields
._sigchld
._utime
,
339 tinfo
->_sifields
._sigchld
._stime
);
342 qemu_log(", si_pid=%u, si_uid=%u, si_sigval=" TARGET_ABI_FMT_ld
,
343 (unsigned int)tinfo
->_sifields
._rt
._pid
,
344 (unsigned int)tinfo
->_sifields
._rt
._uid
,
345 tinfo
->_sifields
._rt
._sigval
.sival_ptr
);
348 g_assert_not_reached();
354 print_sockaddr(abi_ulong addr
, abi_long addrlen
, int last
)
356 struct target_sockaddr
*sa
;
360 sa
= lock_user(VERIFY_READ
, addr
, addrlen
, 1);
362 sa_family
= tswap16(sa
->sa_family
);
365 struct target_sockaddr_un
*un
= (struct target_sockaddr_un
*)sa
;
367 qemu_log("{sun_family=AF_UNIX,sun_path=\"");
368 for (i
= 0; i
< addrlen
-
369 offsetof(struct target_sockaddr_un
, sun_path
) &&
370 un
->sun_path
[i
]; i
++) {
371 qemu_log("%c", un
->sun_path
[i
]);
377 struct target_sockaddr_in
*in
= (struct target_sockaddr_in
*)sa
;
378 uint8_t *c
= (uint8_t *)&in
->sin_addr
.s_addr
;
379 qemu_log("{sin_family=AF_INET,sin_port=htons(%d),",
380 ntohs(in
->sin_port
));
381 qemu_log("sin_addr=inet_addr(\"%d.%d.%d.%d\")",
382 c
[0], c
[1], c
[2], c
[3]);
387 struct target_sockaddr_ll
*ll
= (struct target_sockaddr_ll
*)sa
;
388 uint8_t *c
= (uint8_t *)&ll
->sll_addr
;
389 qemu_log("{sll_family=AF_PACKET,"
390 "sll_protocol=htons(0x%04x),if%d,pkttype=",
391 ntohs(ll
->sll_protocol
), ll
->sll_ifindex
);
392 switch (ll
->sll_pkttype
) {
394 qemu_log("PACKET_HOST");
396 case PACKET_BROADCAST
:
397 qemu_log("PACKET_BROADCAST");
399 case PACKET_MULTICAST
:
400 qemu_log("PACKET_MULTICAST");
402 case PACKET_OTHERHOST
:
403 qemu_log("PACKET_OTHERHOST");
405 case PACKET_OUTGOING
:
406 qemu_log("PACKET_OUTGOING");
409 qemu_log("%d", ll
->sll_pkttype
);
412 qemu_log(",sll_addr=%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x",
413 c
[0], c
[1], c
[2], c
[3], c
[4], c
[5], c
[6], c
[7]);
418 struct target_sockaddr_nl
*nl
= (struct target_sockaddr_nl
*)sa
;
419 qemu_log("{nl_family=AF_NETLINK,nl_pid=%u,nl_groups=%u}",
420 tswap32(nl
->nl_pid
), tswap32(nl
->nl_groups
));
424 qemu_log("{sa_family=%d, sa_data={", sa
->sa_family
);
425 for (i
= 0; i
< 13; i
++) {
426 qemu_log("%02x, ", sa
->sa_data
[i
]);
428 qemu_log("%02x}", sa
->sa_data
[i
]);
432 unlock_user(sa
, addr
, 0);
434 print_raw_param("0x"TARGET_ABI_FMT_lx
, addr
, 0);
436 qemu_log(", "TARGET_ABI_FMT_ld
"%s", addrlen
, get_comma(last
));
440 print_socket_domain(int domain
)
450 qemu_log("PF_NETLINK");
453 qemu_log("PF_PACKET");
456 qemu_log("%d", domain
);
462 print_socket_type(int type
)
464 switch (type
& TARGET_SOCK_TYPE_MASK
) {
465 case TARGET_SOCK_DGRAM
:
466 qemu_log("SOCK_DGRAM");
468 case TARGET_SOCK_STREAM
:
469 qemu_log("SOCK_STREAM");
471 case TARGET_SOCK_RAW
:
472 qemu_log("SOCK_RAW");
474 case TARGET_SOCK_RDM
:
475 qemu_log("SOCK_RDM");
477 case TARGET_SOCK_SEQPACKET
:
478 qemu_log("SOCK_SEQPACKET");
480 case TARGET_SOCK_PACKET
:
481 qemu_log("SOCK_PACKET");
484 if (type
& TARGET_SOCK_CLOEXEC
) {
485 qemu_log("|SOCK_CLOEXEC");
487 if (type
& TARGET_SOCK_NONBLOCK
) {
488 qemu_log("|SOCK_NONBLOCK");
493 print_socket_protocol(int domain
, int type
, int protocol
)
495 if (domain
== AF_PACKET
||
496 (domain
== AF_INET
&& type
== TARGET_SOCK_PACKET
)) {
499 qemu_log("ETH_P_ALL");
502 qemu_log("%d", protocol
);
507 if (domain
== PF_NETLINK
) {
510 qemu_log("NETLINK_ROUTE");
513 qemu_log("NETLINK_AUDIT");
515 case NETLINK_NETFILTER
:
516 qemu_log("NETLINK_NETFILTER");
518 case NETLINK_KOBJECT_UEVENT
:
519 qemu_log("NETLINK_KOBJECT_UEVENT");
522 qemu_log("NETLINK_RDMA");
525 qemu_log("NETLINK_CRYPTO");
528 qemu_log("%d", protocol
);
536 qemu_log("IPPROTO_IP");
539 qemu_log("IPPROTO_TCP");
542 qemu_log("IPPROTO_UDP");
545 qemu_log("IPPROTO_RAW");
548 qemu_log("%d", protocol
);
554 #ifdef TARGET_NR__newselect
556 print_fdset(int n
, abi_ulong target_fds_addr
)
562 if( target_fds_addr
) {
563 abi_long
*target_fds
;
565 target_fds
= lock_user(VERIFY_READ
,
567 sizeof(*target_fds
)*(n
/ TARGET_ABI_BITS
+ 1),
573 for (i
=n
; i
>=0; i
--) {
574 if ((tswapal(target_fds
[i
/ TARGET_ABI_BITS
]) >>
575 (i
& (TARGET_ABI_BITS
- 1))) & 1) {
576 qemu_log("%s%d", get_comma(first
), i
);
580 unlock_user(target_fds
, target_fds_addr
, 0);
587 * Sysycall specific output functions
591 #ifdef TARGET_NR__newselect
593 print_newselect(void *cpu_env
, const struct syscallname
*name
,
594 abi_long arg1
, abi_long arg2
, abi_long arg3
,
595 abi_long arg4
, abi_long arg5
, abi_long arg6
)
597 print_syscall_prologue(name
);
598 print_fdset(arg1
, arg2
);
600 print_fdset(arg1
, arg3
);
602 print_fdset(arg1
, arg4
);
604 print_timeval(arg5
, 1);
605 print_syscall_epilogue(name
);
609 #ifdef TARGET_NR_semctl
611 print_semctl(void *cpu_env
, const struct syscallname
*name
,
612 abi_long arg1
, abi_long arg2
, abi_long arg3
,
613 abi_long arg4
, abi_long arg5
, abi_long arg6
)
615 qemu_log("%s(" TARGET_ABI_FMT_ld
"," TARGET_ABI_FMT_ld
",",
616 name
->name
, arg1
, arg2
);
618 qemu_log(",0x" TARGET_ABI_FMT_lx
")", arg4
);
623 print_execve(void *cpu_env
, const struct syscallname
*name
,
624 abi_long arg1
, abi_long arg2
, abi_long arg3
,
625 abi_long arg4
, abi_long arg5
, abi_long arg6
)
627 abi_ulong arg_ptr_addr
;
630 if (!(s
= lock_user_string(arg1
)))
632 qemu_log("%s(\"%s\",{", name
->name
, s
);
633 unlock_user(s
, arg1
, 0);
635 for (arg_ptr_addr
= arg2
; ; arg_ptr_addr
+= sizeof(abi_ulong
)) {
636 abi_ulong
*arg_ptr
, arg_addr
;
638 arg_ptr
= lock_user(VERIFY_READ
, arg_ptr_addr
, sizeof(abi_ulong
), 1);
641 arg_addr
= tswapal(*arg_ptr
);
642 unlock_user(arg_ptr
, arg_ptr_addr
, 0);
645 if ((s
= lock_user_string(arg_addr
))) {
646 qemu_log("\"%s\",", s
);
647 unlock_user(s
, arg_addr
, 0);
656 print_ipc(void *cpu_env
, const struct syscallname
*name
,
657 abi_long arg1
, abi_long arg2
, abi_long arg3
,
658 abi_long arg4
, abi_long arg5
, abi_long arg6
)
662 qemu_log("semctl(" TARGET_ABI_FMT_ld
"," TARGET_ABI_FMT_ld
",",
665 qemu_log(",0x" TARGET_ABI_FMT_lx
")", arg4
);
669 TARGET_ABI_FMT_ld
","
670 TARGET_ABI_FMT_ld
","
671 TARGET_ABI_FMT_ld
","
674 name
->name
, arg1
, arg2
, arg3
, arg4
);
680 * Variants for the return value output function
684 print_syscall_err(abi_long ret
)
690 errstr
= target_strerror(-ret
);
692 qemu_log("-1 errno=%d (%s)", (int)-ret
, errstr
);
700 print_syscall_ret_addr(void *cpu_env
, const struct syscallname
*name
,
701 abi_long ret
, abi_long arg0
, abi_long arg1
,
702 abi_long arg2
, abi_long arg3
, abi_long arg4
,
705 if (!print_syscall_err(ret
)) {
706 qemu_log("0x" TARGET_ABI_FMT_lx
, ret
);
711 #if 0 /* currently unused */
713 print_syscall_ret_raw(struct syscallname
*name
, abi_long ret
)
715 qemu_log(" = 0x" TARGET_ABI_FMT_lx
"\n", ret
);
719 #ifdef TARGET_NR__newselect
721 print_syscall_ret_newselect(void *cpu_env
, const struct syscallname
*name
,
722 abi_long ret
, abi_long arg0
, abi_long arg1
,
723 abi_long arg2
, abi_long arg3
, abi_long arg4
,
726 if (!print_syscall_err(ret
)) {
727 qemu_log(" = 0x" TARGET_ABI_FMT_lx
" (", ret
);
728 print_fdset(arg0
, arg1
);
730 print_fdset(arg0
, arg2
);
732 print_fdset(arg0
, arg3
);
734 print_timeval(arg4
, 1);
742 /* special meanings of adjtimex()' non-negative return values */
743 #define TARGET_TIME_OK 0 /* clock synchronized, no leap second */
744 #define TARGET_TIME_INS 1 /* insert leap second */
745 #define TARGET_TIME_DEL 2 /* delete leap second */
746 #define TARGET_TIME_OOP 3 /* leap second in progress */
747 #define TARGET_TIME_WAIT 4 /* leap second has occurred */
748 #define TARGET_TIME_ERROR 5 /* clock not synchronized */
749 #ifdef TARGET_NR_adjtimex
751 print_syscall_ret_adjtimex(void *cpu_env
, const struct syscallname
*name
,
752 abi_long ret
, abi_long arg0
, abi_long arg1
,
753 abi_long arg2
, abi_long arg3
, abi_long arg4
,
756 if (!print_syscall_err(ret
)) {
757 qemu_log(TARGET_ABI_FMT_ld
, ret
);
760 qemu_log(" TIME_OK (clock synchronized, no leap second)");
762 case TARGET_TIME_INS
:
763 qemu_log(" TIME_INS (insert leap second)");
765 case TARGET_TIME_DEL
:
766 qemu_log(" TIME_DEL (delete leap second)");
768 case TARGET_TIME_OOP
:
769 qemu_log(" TIME_OOP (leap second in progress)");
771 case TARGET_TIME_WAIT
:
772 qemu_log(" TIME_WAIT (leap second has occurred)");
774 case TARGET_TIME_ERROR
:
775 qemu_log(" TIME_ERROR (clock not synchronized)");
784 #if defined(TARGET_NR_clock_gettime) || defined(TARGET_NR_clock_getres)
786 print_syscall_ret_clock_gettime(void *cpu_env
, const struct syscallname
*name
,
787 abi_long ret
, abi_long arg0
, abi_long arg1
,
788 abi_long arg2
, abi_long arg3
, abi_long arg4
,
791 if (!print_syscall_err(ret
)) {
792 qemu_log(TARGET_ABI_FMT_ld
, ret
);
794 print_timespec(arg1
, 1);
800 #define print_syscall_ret_clock_getres print_syscall_ret_clock_gettime
803 #ifdef TARGET_NR_gettimeofday
805 print_syscall_ret_gettimeofday(void *cpu_env
, const struct syscallname
*name
,
806 abi_long ret
, abi_long arg0
, abi_long arg1
,
807 abi_long arg2
, abi_long arg3
, abi_long arg4
,
810 if (!print_syscall_err(ret
)) {
811 qemu_log(TARGET_ABI_FMT_ld
, ret
);
813 print_timeval(arg0
, 0);
814 print_timezone(arg1
, 1);
822 #ifdef TARGET_NR_getitimer
824 print_syscall_ret_getitimer(void *cpu_env
, const struct syscallname
*name
,
825 abi_long ret
, abi_long arg0
, abi_long arg1
,
826 abi_long arg2
, abi_long arg3
, abi_long arg4
,
829 if (!print_syscall_err(ret
)) {
830 qemu_log(TARGET_ABI_FMT_ld
, ret
);
832 print_itimerval(arg1
, 1);
841 #ifdef TARGET_NR_getitimer
843 print_syscall_ret_setitimer(void *cpu_env
, const struct syscallname
*name
,
844 abi_long ret
, abi_long arg0
, abi_long arg1
,
845 abi_long arg2
, abi_long arg3
, abi_long arg4
,
848 if (!print_syscall_err(ret
)) {
849 qemu_log(TARGET_ABI_FMT_ld
, ret
);
850 qemu_log(" (old_value = ");
851 print_itimerval(arg2
, 1);
859 #if defined(TARGET_NR_listxattr) || defined(TARGET_NR_llistxattr) \
860 || defined(TARGGET_NR_flistxattr)
862 print_syscall_ret_listxattr(void *cpu_env
, const struct syscallname
*name
,
863 abi_long ret
, abi_long arg0
, abi_long arg1
,
864 abi_long arg2
, abi_long arg3
, abi_long arg4
,
867 if (!print_syscall_err(ret
)) {
868 qemu_log(TARGET_ABI_FMT_ld
, ret
);
869 qemu_log(" (list = ");
871 abi_long attr
= arg1
;
876 print_string(attr
, 1);
877 ret
-= target_strlen(attr
) + 1;
878 attr
+= target_strlen(attr
) + 1;
888 #define print_syscall_ret_llistxattr print_syscall_ret_listxattr
889 #define print_syscall_ret_flistxattr print_syscall_ret_listxattr
892 #ifdef TARGET_NR_ioctl
894 print_syscall_ret_ioctl(void *cpu_env
, const struct syscallname
*name
,
895 abi_long ret
, abi_long arg0
, abi_long arg1
,
896 abi_long arg2
, abi_long arg3
, abi_long arg4
,
899 if (!print_syscall_err(ret
)) {
900 qemu_log(TARGET_ABI_FMT_ld
, ret
);
902 const IOCTLEntry
*ie
;
903 const argtype
*arg_type
;
907 for (ie
= ioctl_entries
; ie
->target_cmd
!= 0; ie
++) {
908 if (ie
->target_cmd
== arg1
) {
913 if (ie
->target_cmd
== arg1
&&
914 (ie
->access
== IOC_R
|| ie
->access
== IOC_RW
)) {
915 arg_type
= ie
->arg_type
;
918 target_size
= thunk_type_size(arg_type
, 0);
919 argptr
= lock_user(VERIFY_READ
, arg2
, target_size
, 1);
921 thunk_print(argptr
, arg_type
);
922 unlock_user(argptr
, arg2
, target_size
);
924 print_pointer(arg2
, 1);
933 UNUSED
static struct flags access_flags
[] = {
941 UNUSED
static struct flags at_file_flags
[] = {
943 FLAG_GENERIC(AT_EACCESS
),
945 #ifdef AT_SYMLINK_NOFOLLOW
946 FLAG_GENERIC(AT_SYMLINK_NOFOLLOW
),
951 UNUSED
static struct flags unlinkat_flags
[] = {
953 FLAG_GENERIC(AT_REMOVEDIR
),
958 UNUSED
static struct flags mode_flags
[] = {
959 FLAG_GENERIC(S_IFSOCK
),
960 FLAG_GENERIC(S_IFLNK
),
961 FLAG_GENERIC(S_IFREG
),
962 FLAG_GENERIC(S_IFBLK
),
963 FLAG_GENERIC(S_IFDIR
),
964 FLAG_GENERIC(S_IFCHR
),
965 FLAG_GENERIC(S_IFIFO
),
969 UNUSED
static struct flags open_access_flags
[] = {
970 FLAG_TARGET(O_RDONLY
),
971 FLAG_TARGET(O_WRONLY
),
976 UNUSED
static struct flags open_flags
[] = {
977 FLAG_TARGET(O_APPEND
),
978 FLAG_TARGET(O_CREAT
),
979 FLAG_TARGET(O_DIRECTORY
),
981 FLAG_TARGET(O_LARGEFILE
),
982 FLAG_TARGET(O_NOCTTY
),
983 FLAG_TARGET(O_NOFOLLOW
),
984 FLAG_TARGET(O_NONBLOCK
), /* also O_NDELAY */
985 FLAG_TARGET(O_DSYNC
),
986 FLAG_TARGET(__O_SYNC
),
987 FLAG_TARGET(O_TRUNC
),
989 FLAG_TARGET(O_DIRECT
),
992 FLAG_TARGET(O_NOATIME
),
995 FLAG_TARGET(O_CLOEXEC
),
1001 FLAG_TARGET(O_TMPFILE
),
1002 FLAG_TARGET(__O_TMPFILE
),
1007 UNUSED
static struct flags mount_flags
[] = {
1009 FLAG_GENERIC(MS_BIND
),
1012 FLAG_GENERIC(MS_DIRSYNC
),
1014 FLAG_GENERIC(MS_MANDLOCK
),
1016 FLAG_GENERIC(MS_MOVE
),
1018 FLAG_GENERIC(MS_NOATIME
),
1019 FLAG_GENERIC(MS_NODEV
),
1020 FLAG_GENERIC(MS_NODIRATIME
),
1021 FLAG_GENERIC(MS_NOEXEC
),
1022 FLAG_GENERIC(MS_NOSUID
),
1023 FLAG_GENERIC(MS_RDONLY
),
1025 FLAG_GENERIC(MS_RELATIME
),
1027 FLAG_GENERIC(MS_REMOUNT
),
1028 FLAG_GENERIC(MS_SYNCHRONOUS
),
1032 UNUSED
static struct flags umount2_flags
[] = {
1034 FLAG_GENERIC(MNT_FORCE
),
1037 FLAG_GENERIC(MNT_DETACH
),
1040 FLAG_GENERIC(MNT_EXPIRE
),
1045 UNUSED
static struct flags mmap_prot_flags
[] = {
1046 FLAG_GENERIC(PROT_NONE
),
1047 FLAG_GENERIC(PROT_EXEC
),
1048 FLAG_GENERIC(PROT_READ
),
1049 FLAG_GENERIC(PROT_WRITE
),
1050 FLAG_TARGET(PROT_SEM
),
1051 FLAG_GENERIC(PROT_GROWSDOWN
),
1052 FLAG_GENERIC(PROT_GROWSUP
),
1056 UNUSED
static struct flags mmap_flags
[] = {
1057 FLAG_TARGET(MAP_SHARED
),
1058 FLAG_TARGET(MAP_PRIVATE
),
1059 FLAG_TARGET(MAP_ANONYMOUS
),
1060 FLAG_TARGET(MAP_DENYWRITE
),
1061 FLAG_TARGET(MAP_FIXED
),
1062 FLAG_TARGET(MAP_GROWSDOWN
),
1063 FLAG_TARGET(MAP_EXECUTABLE
),
1065 FLAG_TARGET(MAP_LOCKED
),
1068 FLAG_TARGET(MAP_NONBLOCK
),
1070 FLAG_TARGET(MAP_NORESERVE
),
1072 FLAG_TARGET(MAP_POPULATE
),
1074 #ifdef TARGET_MAP_UNINITIALIZED
1075 FLAG_TARGET(MAP_UNINITIALIZED
),
1080 UNUSED
static struct flags clone_flags
[] = {
1081 FLAG_GENERIC(CLONE_VM
),
1082 FLAG_GENERIC(CLONE_FS
),
1083 FLAG_GENERIC(CLONE_FILES
),
1084 FLAG_GENERIC(CLONE_SIGHAND
),
1085 FLAG_GENERIC(CLONE_PTRACE
),
1086 FLAG_GENERIC(CLONE_VFORK
),
1087 FLAG_GENERIC(CLONE_PARENT
),
1088 FLAG_GENERIC(CLONE_THREAD
),
1089 FLAG_GENERIC(CLONE_NEWNS
),
1090 FLAG_GENERIC(CLONE_SYSVSEM
),
1091 FLAG_GENERIC(CLONE_SETTLS
),
1092 FLAG_GENERIC(CLONE_PARENT_SETTID
),
1093 FLAG_GENERIC(CLONE_CHILD_CLEARTID
),
1094 FLAG_GENERIC(CLONE_DETACHED
),
1095 FLAG_GENERIC(CLONE_UNTRACED
),
1096 FLAG_GENERIC(CLONE_CHILD_SETTID
),
1097 #if defined(CLONE_NEWUTS)
1098 FLAG_GENERIC(CLONE_NEWUTS
),
1100 #if defined(CLONE_NEWIPC)
1101 FLAG_GENERIC(CLONE_NEWIPC
),
1103 #if defined(CLONE_NEWUSER)
1104 FLAG_GENERIC(CLONE_NEWUSER
),
1106 #if defined(CLONE_NEWPID)
1107 FLAG_GENERIC(CLONE_NEWPID
),
1109 #if defined(CLONE_NEWNET)
1110 FLAG_GENERIC(CLONE_NEWNET
),
1112 #if defined(CLONE_NEWCGROUP)
1113 FLAG_GENERIC(CLONE_NEWCGROUP
),
1115 #if defined(CLONE_NEWTIME)
1116 FLAG_GENERIC(CLONE_NEWTIME
),
1118 #if defined(CLONE_IO)
1119 FLAG_GENERIC(CLONE_IO
),
1124 UNUSED
static struct flags msg_flags
[] = {
1126 FLAG_GENERIC(MSG_CONFIRM
),
1127 FLAG_GENERIC(MSG_DONTROUTE
),
1128 FLAG_GENERIC(MSG_DONTWAIT
),
1129 FLAG_GENERIC(MSG_EOR
),
1130 FLAG_GENERIC(MSG_MORE
),
1131 FLAG_GENERIC(MSG_NOSIGNAL
),
1132 FLAG_GENERIC(MSG_OOB
),
1134 FLAG_GENERIC(MSG_CMSG_CLOEXEC
),
1135 FLAG_GENERIC(MSG_ERRQUEUE
),
1136 FLAG_GENERIC(MSG_PEEK
),
1137 FLAG_GENERIC(MSG_TRUNC
),
1138 FLAG_GENERIC(MSG_WAITALL
),
1140 FLAG_GENERIC(MSG_CTRUNC
),
1144 UNUSED
static struct flags statx_flags
[] = {
1145 #ifdef AT_EMPTY_PATH
1146 FLAG_GENERIC(AT_EMPTY_PATH
),
1148 #ifdef AT_NO_AUTOMOUNT
1149 FLAG_GENERIC(AT_NO_AUTOMOUNT
),
1151 #ifdef AT_SYMLINK_NOFOLLOW
1152 FLAG_GENERIC(AT_SYMLINK_NOFOLLOW
),
1154 #ifdef AT_STATX_SYNC_AS_STAT
1155 FLAG_GENERIC(AT_STATX_SYNC_AS_STAT
),
1157 #ifdef AT_STATX_FORCE_SYNC
1158 FLAG_GENERIC(AT_STATX_FORCE_SYNC
),
1160 #ifdef AT_STATX_DONT_SYNC
1161 FLAG_GENERIC(AT_STATX_DONT_SYNC
),
1166 UNUSED
static struct flags statx_mask
[] = {
1167 /* This must come first, because it includes everything. */
1169 FLAG_GENERIC(STATX_ALL
),
1171 /* This must come second; it includes everything except STATX_BTIME. */
1172 #ifdef STATX_BASIC_STATS
1173 FLAG_GENERIC(STATX_BASIC_STATS
),
1176 FLAG_GENERIC(STATX_TYPE
),
1179 FLAG_GENERIC(STATX_MODE
),
1182 FLAG_GENERIC(STATX_NLINK
),
1185 FLAG_GENERIC(STATX_UID
),
1188 FLAG_GENERIC(STATX_GID
),
1191 FLAG_GENERIC(STATX_ATIME
),
1194 FLAG_GENERIC(STATX_MTIME
),
1197 FLAG_GENERIC(STATX_CTIME
),
1200 FLAG_GENERIC(STATX_INO
),
1203 FLAG_GENERIC(STATX_SIZE
),
1206 FLAG_GENERIC(STATX_BLOCKS
),
1209 FLAG_GENERIC(STATX_BTIME
),
1214 UNUSED
static struct flags falloc_flags
[] = {
1215 FLAG_GENERIC(FALLOC_FL_KEEP_SIZE
),
1216 FLAG_GENERIC(FALLOC_FL_PUNCH_HOLE
),
1217 #ifdef FALLOC_FL_NO_HIDE_STALE
1218 FLAG_GENERIC(FALLOC_FL_NO_HIDE_STALE
),
1220 #ifdef FALLOC_FL_COLLAPSE_RANGE
1221 FLAG_GENERIC(FALLOC_FL_COLLAPSE_RANGE
),
1223 #ifdef FALLOC_FL_ZERO_RANGE
1224 FLAG_GENERIC(FALLOC_FL_ZERO_RANGE
),
1226 #ifdef FALLOC_FL_INSERT_RANGE
1227 FLAG_GENERIC(FALLOC_FL_INSERT_RANGE
),
1229 #ifdef FALLOC_FL_UNSHARE_RANGE
1230 FLAG_GENERIC(FALLOC_FL_UNSHARE_RANGE
),
1234 UNUSED
static struct flags termios_iflags
[] = {
1235 FLAG_TARGET(IGNBRK
),
1236 FLAG_TARGET(BRKINT
),
1237 FLAG_TARGET(IGNPAR
),
1238 FLAG_TARGET(PARMRK
),
1240 FLAG_TARGET(ISTRIP
),
1248 FLAG_TARGET(IMAXBEL
),
1253 UNUSED
static struct flags termios_oflags
[] = {
1259 FLAG_TARGET(ONLRET
),
1265 UNUSED
static struct enums termios_oflags_NLDLY
[] = {
1271 UNUSED
static struct enums termios_oflags_CRDLY
[] = {
1279 UNUSED
static struct enums termios_oflags_TABDLY
[] = {
1287 UNUSED
static struct enums termios_oflags_VTDLY
[] = {
1293 UNUSED
static struct enums termios_oflags_FFDLY
[] = {
1299 UNUSED
static struct enums termios_oflags_BSDLY
[] = {
1305 UNUSED
static struct enums termios_cflags_CBAUD
[] = {
1320 ENUM_TARGET(B19200
),
1321 ENUM_TARGET(B38400
),
1322 ENUM_TARGET(B57600
),
1323 ENUM_TARGET(B115200
),
1324 ENUM_TARGET(B230400
),
1325 ENUM_TARGET(B460800
),
1329 UNUSED
static struct enums termios_cflags_CSIZE
[] = {
1337 UNUSED
static struct flags termios_cflags
[] = {
1338 FLAG_TARGET(CSTOPB
),
1340 FLAG_TARGET(PARENB
),
1341 FLAG_TARGET(PARODD
),
1343 FLAG_TARGET(CLOCAL
),
1344 FLAG_TARGET(CRTSCTS
),
1348 UNUSED
static struct flags termios_lflags
[] = {
1350 FLAG_TARGET(ICANON
),
1355 FLAG_TARGET(ECHONL
),
1356 FLAG_TARGET(NOFLSH
),
1357 FLAG_TARGET(TOSTOP
),
1358 FLAG_TARGET(ECHOCTL
),
1359 FLAG_TARGET(ECHOPRT
),
1360 FLAG_TARGET(ECHOKE
),
1361 FLAG_TARGET(FLUSHO
),
1362 FLAG_TARGET(PENDIN
),
1363 FLAG_TARGET(IEXTEN
),
1364 FLAG_TARGET(EXTPROC
),
1368 UNUSED
static struct flags mlockall_flags
[] = {
1369 FLAG_TARGET(MCL_CURRENT
),
1370 FLAG_TARGET(MCL_FUTURE
),
1372 FLAG_TARGET(MCL_ONFAULT
),
1377 /* IDs of the various system clocks */
1378 #define TARGET_CLOCK_REALTIME 0
1379 #define TARGET_CLOCK_MONOTONIC 1
1380 #define TARGET_CLOCK_PROCESS_CPUTIME_ID 2
1381 #define TARGET_CLOCK_THREAD_CPUTIME_ID 3
1382 #define TARGET_CLOCK_MONOTONIC_RAW 4
1383 #define TARGET_CLOCK_REALTIME_COARSE 5
1384 #define TARGET_CLOCK_MONOTONIC_COARSE 6
1385 #define TARGET_CLOCK_BOOTTIME 7
1386 #define TARGET_CLOCK_REALTIME_ALARM 8
1387 #define TARGET_CLOCK_BOOTTIME_ALARM 9
1388 #define TARGET_CLOCK_SGI_CYCLE 10
1389 #define TARGET_CLOCK_TAI 11
1391 UNUSED
static struct enums clockids
[] = {
1392 ENUM_TARGET(CLOCK_REALTIME
),
1393 ENUM_TARGET(CLOCK_MONOTONIC
),
1394 ENUM_TARGET(CLOCK_PROCESS_CPUTIME_ID
),
1395 ENUM_TARGET(CLOCK_THREAD_CPUTIME_ID
),
1396 ENUM_TARGET(CLOCK_MONOTONIC_RAW
),
1397 ENUM_TARGET(CLOCK_REALTIME_COARSE
),
1398 ENUM_TARGET(CLOCK_MONOTONIC_COARSE
),
1399 ENUM_TARGET(CLOCK_BOOTTIME
),
1400 ENUM_TARGET(CLOCK_REALTIME_ALARM
),
1401 ENUM_TARGET(CLOCK_BOOTTIME_ALARM
),
1402 ENUM_TARGET(CLOCK_SGI_CYCLE
),
1403 ENUM_TARGET(CLOCK_TAI
),
1407 UNUSED
static struct enums itimer_types
[] = {
1408 ENUM_GENERIC(ITIMER_REAL
),
1409 ENUM_GENERIC(ITIMER_VIRTUAL
),
1410 ENUM_GENERIC(ITIMER_PROF
),
1415 * print_xxx utility functions. These are used to print syscall
1416 * parameters in certain format. All of these have parameter
1417 * named 'last'. This parameter is used to add comma to output
1424 return ((last
) ? "" : ",");
1428 print_flags(const struct flags
*f
, abi_long flags
, int last
)
1430 const char *sep
= "";
1433 if ((flags
== 0) && (f
->f_value
== 0)) {
1434 qemu_log("%s%s", f
->f_string
, get_comma(last
));
1437 for (n
= 0; f
->f_string
!= NULL
; f
++) {
1438 if ((f
->f_value
!= 0) && ((flags
& f
->f_value
) == f
->f_value
)) {
1439 qemu_log("%s%s", sep
, f
->f_string
);
1440 flags
&= ~f
->f_value
;
1447 /* print rest of the flags as numeric */
1449 qemu_log("%s%#x%s", sep
, (unsigned int)flags
, get_comma(last
));
1451 qemu_log("%s", get_comma(last
));
1454 /* no string version of flags found, print them in hex then */
1455 qemu_log("%#x%s", (unsigned int)flags
, get_comma(last
));
1460 print_enums(const struct enums
*e
, abi_long enum_arg
, int last
)
1462 for (; e
->e_string
!= NULL
; e
++) {
1463 if (e
->e_value
== enum_arg
) {
1464 qemu_log("%s", e
->e_string
);
1469 if (e
->e_string
== NULL
) {
1470 qemu_log("%#x", (unsigned int)enum_arg
);
1473 qemu_log("%s", get_comma(last
));
1477 print_at_dirfd(abi_long dirfd
, int last
)
1480 if (dirfd
== AT_FDCWD
) {
1481 qemu_log("AT_FDCWD%s", get_comma(last
));
1485 qemu_log("%d%s", (int)dirfd
, get_comma(last
));
1489 print_file_mode(abi_long mode
, int last
)
1491 const char *sep
= "";
1492 const struct flags
*m
;
1494 for (m
= &mode_flags
[0]; m
->f_string
!= NULL
; m
++) {
1495 if ((m
->f_value
& mode
) == m
->f_value
) {
1496 qemu_log("%s%s", m
->f_string
, sep
);
1498 mode
&= ~m
->f_value
;
1504 /* print rest of the mode as octal */
1506 qemu_log("%s%#o", sep
, (unsigned int)mode
);
1508 qemu_log("%s", get_comma(last
));
1512 print_open_flags(abi_long flags
, int last
)
1514 print_flags(open_access_flags
, flags
& TARGET_O_ACCMODE
, 1);
1515 flags
&= ~TARGET_O_ACCMODE
;
1517 qemu_log("%s", get_comma(last
));
1521 print_flags(open_flags
, flags
, last
);
1525 print_syscall_prologue(const struct syscallname
*sc
)
1527 qemu_log("%s(", sc
->name
);
1532 print_syscall_epilogue(const struct syscallname
*sc
)
1539 print_string(abi_long addr
, int last
)
1543 if ((s
= lock_user_string(addr
)) != NULL
) {
1544 qemu_log("\"%s\"%s", s
, get_comma(last
));
1545 unlock_user(s
, addr
, 0);
1547 /* can't get string out of it, so print it as pointer */
1548 print_pointer(addr
, last
);
1552 #define MAX_PRINT_BUF 40
1554 print_buf(abi_long addr
, abi_long len
, int last
)
1559 s
= lock_user(VERIFY_READ
, addr
, len
, 1);
1562 for (i
= 0; i
< MAX_PRINT_BUF
&& i
< len
; i
++) {
1563 if (isprint(s
[i
])) {
1564 qemu_log("%c", s
[i
]);
1566 qemu_log("\\%o", s
[i
]);
1576 unlock_user(s
, addr
, 0);
1578 print_pointer(addr
, last
);
1583 * Prints out raw parameter using given format. Caller needs
1584 * to do byte swapping if needed.
1587 print_raw_param(const char *fmt
, abi_long param
, int last
)
1591 (void) snprintf(format
, sizeof (format
), "%s%s", fmt
, get_comma(last
));
1592 qemu_log(format
, param
);
1596 print_pointer(abi_long p
, int last
)
1599 qemu_log("NULL%s", get_comma(last
));
1601 qemu_log("0x" TARGET_ABI_FMT_lx
"%s", p
, get_comma(last
));
1605 * Reads 32-bit (int) number from guest address space from
1606 * address 'addr' and prints it.
1609 print_number(abi_long addr
, int last
)
1612 qemu_log("NULL%s", get_comma(last
));
1616 get_user_s32(num
, addr
);
1617 qemu_log("[%d]%s", num
, get_comma(last
));
1622 print_timeval(abi_ulong tv_addr
, int last
)
1625 struct target_timeval
*tv
;
1627 tv
= lock_user(VERIFY_READ
, tv_addr
, sizeof(*tv
), 1);
1629 print_pointer(tv_addr
, last
);
1632 qemu_log("{tv_sec = " TARGET_ABI_FMT_ld
1633 ",tv_usec = " TARGET_ABI_FMT_ld
"}%s",
1634 tswapal(tv
->tv_sec
), tswapal(tv
->tv_usec
), get_comma(last
));
1635 unlock_user(tv
, tv_addr
, 0);
1637 qemu_log("NULL%s", get_comma(last
));
1641 print_timespec(abi_ulong ts_addr
, int last
)
1644 struct target_timespec
*ts
;
1646 ts
= lock_user(VERIFY_READ
, ts_addr
, sizeof(*ts
), 1);
1648 print_pointer(ts_addr
, last
);
1651 qemu_log("{tv_sec = " TARGET_ABI_FMT_ld
1652 ",tv_nsec = " TARGET_ABI_FMT_ld
"}%s",
1653 tswapal(ts
->tv_sec
), tswapal(ts
->tv_nsec
), get_comma(last
));
1654 unlock_user(ts
, ts_addr
, 0);
1656 qemu_log("NULL%s", get_comma(last
));
1661 print_timezone(abi_ulong tz_addr
, int last
)
1664 struct target_timezone
*tz
;
1666 tz
= lock_user(VERIFY_READ
, tz_addr
, sizeof(*tz
), 1);
1668 print_pointer(tz_addr
, last
);
1671 qemu_log("{%d,%d}%s", tswap32(tz
->tz_minuteswest
),
1672 tswap32(tz
->tz_dsttime
), get_comma(last
));
1673 unlock_user(tz
, tz_addr
, 0);
1675 qemu_log("NULL%s", get_comma(last
));
1680 print_itimerval(abi_ulong it_addr
, int last
)
1683 qemu_log("{it_interval=");
1684 print_timeval(it_addr
+
1685 offsetof(struct target_itimerval
, it_interval
), 0);
1686 qemu_log("it_value=");
1687 print_timeval(it_addr
+
1688 offsetof(struct target_itimerval
, it_value
), 0);
1689 qemu_log("}%s", get_comma(last
));
1691 qemu_log("NULL%s", get_comma(last
));
1696 print_termios(void *arg
)
1698 const struct target_termios
*target
= arg
;
1700 target_tcflag_t iflags
= tswap32(target
->c_iflag
);
1701 target_tcflag_t oflags
= tswap32(target
->c_oflag
);
1702 target_tcflag_t cflags
= tswap32(target
->c_cflag
);
1703 target_tcflag_t lflags
= tswap32(target
->c_lflag
);
1707 qemu_log("c_iflag = ");
1708 print_flags(termios_iflags
, iflags
, 0);
1710 qemu_log("c_oflag = ");
1711 target_tcflag_t oflags_clean
= oflags
& ~(TARGET_NLDLY
| TARGET_CRDLY
|
1712 TARGET_TABDLY
| TARGET_BSDLY
|
1713 TARGET_VTDLY
| TARGET_FFDLY
);
1714 print_flags(termios_oflags
, oflags_clean
, 0);
1715 if (oflags
& TARGET_NLDLY
) {
1716 print_enums(termios_oflags_NLDLY
, oflags
& TARGET_NLDLY
, 0);
1718 if (oflags
& TARGET_CRDLY
) {
1719 print_enums(termios_oflags_CRDLY
, oflags
& TARGET_CRDLY
, 0);
1721 if (oflags
& TARGET_TABDLY
) {
1722 print_enums(termios_oflags_TABDLY
, oflags
& TARGET_TABDLY
, 0);
1724 if (oflags
& TARGET_BSDLY
) {
1725 print_enums(termios_oflags_BSDLY
, oflags
& TARGET_BSDLY
, 0);
1727 if (oflags
& TARGET_VTDLY
) {
1728 print_enums(termios_oflags_VTDLY
, oflags
& TARGET_VTDLY
, 0);
1730 if (oflags
& TARGET_FFDLY
) {
1731 print_enums(termios_oflags_FFDLY
, oflags
& TARGET_FFDLY
, 0);
1734 qemu_log("c_cflag = ");
1735 if (cflags
& TARGET_CBAUD
) {
1736 print_enums(termios_cflags_CBAUD
, cflags
& TARGET_CBAUD
, 0);
1738 if (cflags
& TARGET_CSIZE
) {
1739 print_enums(termios_cflags_CSIZE
, cflags
& TARGET_CSIZE
, 0);
1741 target_tcflag_t cflags_clean
= cflags
& ~(TARGET_CBAUD
| TARGET_CSIZE
);
1742 print_flags(termios_cflags
, cflags_clean
, 0);
1744 qemu_log("c_lflag = ");
1745 print_flags(termios_lflags
, lflags
, 0);
1747 qemu_log("c_cc = ");
1748 qemu_log("\"%s\",", target
->c_cc
);
1750 qemu_log("c_line = ");
1751 print_raw_param("\'%c\'", target
->c_line
, 1);
1758 #ifdef TARGET_NR_accept
1760 print_accept(void *cpu_env
, const struct syscallname
*name
,
1761 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1762 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1764 print_syscall_prologue(name
);
1765 print_raw_param("%d", arg0
, 0);
1766 print_pointer(arg1
, 0);
1767 print_number(arg2
, 1);
1768 print_syscall_epilogue(name
);
1772 #ifdef TARGET_NR_access
1774 print_access(void *cpu_env
, const struct syscallname
*name
,
1775 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1776 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1778 print_syscall_prologue(name
);
1779 print_string(arg0
, 0);
1780 print_flags(access_flags
, arg1
, 1);
1781 print_syscall_epilogue(name
);
1785 #ifdef TARGET_NR_acct
1787 print_acct(void *cpu_env
, const struct syscallname
*name
,
1788 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1789 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1791 print_syscall_prologue(name
);
1792 print_string(arg0
, 1);
1793 print_syscall_epilogue(name
);
1797 #ifdef TARGET_NR_brk
1799 print_brk(void *cpu_env
, const struct syscallname
*name
,
1800 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1801 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1803 print_syscall_prologue(name
);
1804 print_pointer(arg0
, 1);
1805 print_syscall_epilogue(name
);
1809 #ifdef TARGET_NR_chdir
1811 print_chdir(void *cpu_env
, const struct syscallname
*name
,
1812 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1813 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1815 print_syscall_prologue(name
);
1816 print_string(arg0
, 1);
1817 print_syscall_epilogue(name
);
1821 #ifdef TARGET_NR_chroot
1823 print_chroot(void *cpu_env
, const struct syscallname
*name
,
1824 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1825 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1827 print_syscall_prologue(name
);
1828 print_string(arg0
, 1);
1829 print_syscall_epilogue(name
);
1833 #ifdef TARGET_NR_chmod
1835 print_chmod(void *cpu_env
, const struct syscallname
*name
,
1836 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1837 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1839 print_syscall_prologue(name
);
1840 print_string(arg0
, 0);
1841 print_file_mode(arg1
, 1);
1842 print_syscall_epilogue(name
);
1846 #if defined(TARGET_NR_chown) || defined(TARGET_NR_lchown)
1848 print_chown(void *cpu_env
, const struct syscallname
*name
,
1849 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1850 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1852 print_syscall_prologue(name
);
1853 print_string(arg0
, 0);
1854 print_raw_param("%d", arg1
, 0);
1855 print_raw_param("%d", arg2
, 1);
1856 print_syscall_epilogue(name
);
1858 #define print_lchown print_chown
1861 #ifdef TARGET_NR_clock_adjtime
1863 print_clock_adjtime(void *cpu_env
, const struct syscallname
*name
,
1864 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1865 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1867 print_syscall_prologue(name
);
1868 print_enums(clockids
, arg0
, 0);
1869 print_pointer(arg1
, 1);
1870 print_syscall_epilogue(name
);
1874 #ifdef TARGET_NR_clone
1875 static void do_print_clone(unsigned int flags
, abi_ulong newsp
,
1876 abi_ulong parent_tidptr
, target_ulong newtls
,
1877 abi_ulong child_tidptr
)
1879 print_flags(clone_flags
, flags
, 0);
1880 print_raw_param("child_stack=0x" TARGET_ABI_FMT_lx
, newsp
, 0);
1881 print_raw_param("parent_tidptr=0x" TARGET_ABI_FMT_lx
, parent_tidptr
, 0);
1882 print_raw_param("tls=0x" TARGET_ABI_FMT_lx
, newtls
, 0);
1883 print_raw_param("child_tidptr=0x" TARGET_ABI_FMT_lx
, child_tidptr
, 1);
1887 print_clone(void *cpu_env
, const struct syscallname
*name
,
1888 abi_long arg1
, abi_long arg2
, abi_long arg3
,
1889 abi_long arg4
, abi_long arg5
, abi_long arg6
)
1891 print_syscall_prologue(name
);
1892 #if defined(TARGET_MICROBLAZE)
1893 do_print_clone(arg1
, arg2
, arg4
, arg6
, arg5
);
1894 #elif defined(TARGET_CLONE_BACKWARDS)
1895 do_print_clone(arg1
, arg2
, arg3
, arg4
, arg5
);
1896 #elif defined(TARGET_CLONE_BACKWARDS2)
1897 do_print_clone(arg2
, arg1
, arg3
, arg5
, arg4
);
1899 do_print_clone(arg1
, arg2
, arg3
, arg5
, arg4
);
1901 print_syscall_epilogue(name
);
1905 #ifdef TARGET_NR_creat
1907 print_creat(void *cpu_env
, 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 print_syscall_prologue(name
);
1912 print_string(arg0
, 0);
1913 print_file_mode(arg1
, 1);
1914 print_syscall_epilogue(name
);
1918 #ifdef TARGET_NR_execv
1920 print_execv(void *cpu_env
, const struct syscallname
*name
,
1921 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1922 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1924 print_syscall_prologue(name
);
1925 print_string(arg0
, 0);
1926 print_raw_param("0x" TARGET_ABI_FMT_lx
, arg1
, 1);
1927 print_syscall_epilogue(name
);
1931 #ifdef TARGET_NR_faccessat
1933 print_faccessat(void *cpu_env
, const struct syscallname
*name
,
1934 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1935 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1937 print_syscall_prologue(name
);
1938 print_at_dirfd(arg0
, 0);
1939 print_string(arg1
, 0);
1940 print_flags(access_flags
, arg2
, 0);
1941 print_flags(at_file_flags
, arg3
, 1);
1942 print_syscall_epilogue(name
);
1946 #ifdef TARGET_NR_fallocate
1948 print_fallocate(void *cpu_env
, const struct syscallname
*name
,
1949 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1950 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1952 print_syscall_prologue(name
);
1953 print_raw_param("%d", arg0
, 0);
1954 print_flags(falloc_flags
, arg1
, 0);
1955 #if TARGET_ABI_BITS == 32
1956 print_raw_param("%" PRIu64
, target_offset64(arg2
, arg3
), 0);
1957 print_raw_param("%" PRIu64
, target_offset64(arg4
, arg5
), 1);
1959 print_raw_param(TARGET_ABI_FMT_ld
, arg2
, 0);
1960 print_raw_param(TARGET_ABI_FMT_ld
, arg3
, 1);
1962 print_syscall_epilogue(name
);
1966 #ifdef TARGET_NR_fchmodat
1968 print_fchmodat(void *cpu_env
, const struct syscallname
*name
,
1969 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1970 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1972 print_syscall_prologue(name
);
1973 print_at_dirfd(arg0
, 0);
1974 print_string(arg1
, 0);
1975 print_file_mode(arg2
, 0);
1976 print_flags(at_file_flags
, arg3
, 1);
1977 print_syscall_epilogue(name
);
1981 #ifdef TARGET_NR_fchownat
1983 print_fchownat(void *cpu_env
, const struct syscallname
*name
,
1984 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1985 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1987 print_syscall_prologue(name
);
1988 print_at_dirfd(arg0
, 0);
1989 print_string(arg1
, 0);
1990 print_raw_param("%d", arg2
, 0);
1991 print_raw_param("%d", arg3
, 0);
1992 print_flags(at_file_flags
, arg4
, 1);
1993 print_syscall_epilogue(name
);
1997 #if defined(TARGET_NR_fcntl) || defined(TARGET_NR_fcntl64)
1999 print_fcntl(void *cpu_env
, const struct syscallname
*name
,
2000 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2001 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2003 print_syscall_prologue(name
);
2004 print_raw_param("%d", arg0
, 0);
2006 case TARGET_F_DUPFD
:
2007 qemu_log("F_DUPFD,");
2008 print_raw_param(TARGET_ABI_FMT_ld
, arg2
, 1);
2010 case TARGET_F_GETFD
:
2011 qemu_log("F_GETFD");
2013 case TARGET_F_SETFD
:
2014 qemu_log("F_SETFD,");
2015 print_raw_param(TARGET_ABI_FMT_ld
, arg2
, 1);
2017 case TARGET_F_GETFL
:
2018 qemu_log("F_GETFL");
2020 case TARGET_F_SETFL
:
2021 qemu_log("F_SETFL,");
2022 print_open_flags(arg2
, 1);
2024 case TARGET_F_GETLK
:
2025 qemu_log("F_GETLK,");
2026 print_pointer(arg2
, 1);
2028 case TARGET_F_SETLK
:
2029 qemu_log("F_SETLK,");
2030 print_pointer(arg2
, 1);
2032 case TARGET_F_SETLKW
:
2033 qemu_log("F_SETLKW,");
2034 print_pointer(arg2
, 1);
2036 case TARGET_F_GETOWN
:
2037 qemu_log("F_GETOWN");
2039 case TARGET_F_SETOWN
:
2040 qemu_log("F_SETOWN,");
2041 print_raw_param(TARGET_ABI_FMT_ld
, arg2
, 0);
2043 case TARGET_F_GETSIG
:
2044 qemu_log("F_GETSIG");
2046 case TARGET_F_SETSIG
:
2047 qemu_log("F_SETSIG,");
2048 print_raw_param(TARGET_ABI_FMT_ld
, arg2
, 0);
2050 #if TARGET_ABI_BITS == 32
2051 case TARGET_F_GETLK64
:
2052 qemu_log("F_GETLK64,");
2053 print_pointer(arg2
, 1);
2055 case TARGET_F_SETLK64
:
2056 qemu_log("F_SETLK64,");
2057 print_pointer(arg2
, 1);
2059 case TARGET_F_SETLKW64
:
2060 qemu_log("F_SETLKW64,");
2061 print_pointer(arg2
, 1);
2064 case TARGET_F_OFD_GETLK
:
2065 qemu_log("F_OFD_GETLK,");
2066 print_pointer(arg2
, 1);
2068 case TARGET_F_OFD_SETLK
:
2069 qemu_log("F_OFD_SETLK,");
2070 print_pointer(arg2
, 1);
2072 case TARGET_F_OFD_SETLKW
:
2073 qemu_log("F_OFD_SETLKW,");
2074 print_pointer(arg2
, 1);
2076 case TARGET_F_SETLEASE
:
2077 qemu_log("F_SETLEASE,");
2078 print_raw_param(TARGET_ABI_FMT_ld
, arg2
, 1);
2080 case TARGET_F_GETLEASE
:
2081 qemu_log("F_GETLEASE");
2083 #ifdef F_DUPFD_CLOEXEC
2084 case TARGET_F_DUPFD_CLOEXEC
:
2085 qemu_log("F_DUPFD_CLOEXEC,");
2086 print_raw_param(TARGET_ABI_FMT_ld
, arg2
, 1);
2089 case TARGET_F_NOTIFY
:
2090 qemu_log("F_NOTIFY,");
2091 print_raw_param(TARGET_ABI_FMT_ld
, arg2
, 1);
2094 case TARGET_F_GETOWN_EX
:
2095 qemu_log("F_GETOWN_EX,");
2096 print_pointer(arg2
, 1);
2100 case TARGET_F_SETOWN_EX
:
2101 qemu_log("F_SETOWN_EX,");
2102 print_pointer(arg2
, 1);
2106 case TARGET_F_SETPIPE_SZ
:
2107 qemu_log("F_SETPIPE_SZ,");
2108 print_raw_param(TARGET_ABI_FMT_ld
, arg2
, 1);
2110 case TARGET_F_GETPIPE_SZ
:
2111 qemu_log("F_GETPIPE_SZ");
2115 case TARGET_F_ADD_SEALS
:
2116 qemu_log("F_ADD_SEALS,");
2117 print_raw_param("0x"TARGET_ABI_FMT_lx
, arg2
, 1);
2119 case TARGET_F_GET_SEALS
:
2120 qemu_log("F_GET_SEALS");
2124 print_raw_param(TARGET_ABI_FMT_ld
, arg1
, 0);
2125 print_pointer(arg2
, 1);
2128 print_syscall_epilogue(name
);
2130 #define print_fcntl64 print_fcntl
2133 #ifdef TARGET_NR_fgetxattr
2135 print_fgetxattr(void *cpu_env
, const struct syscallname
*name
,
2136 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2137 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2139 print_syscall_prologue(name
);
2140 print_raw_param("%d", arg0
, 0);
2141 print_string(arg1
, 0);
2142 print_pointer(arg2
, 0);
2143 print_raw_param(TARGET_FMT_lu
, arg3
, 1);
2144 print_syscall_epilogue(name
);
2148 #ifdef TARGET_NR_flistxattr
2150 print_flistxattr(void *cpu_env
, const struct syscallname
*name
,
2151 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2152 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2154 print_syscall_prologue(name
);
2155 print_raw_param("%d", arg0
, 0);
2156 print_pointer(arg1
, 0);
2157 print_raw_param(TARGET_FMT_lu
, arg2
, 1);
2158 print_syscall_epilogue(name
);
2162 #if defined(TARGET_NR_getxattr) || defined(TARGET_NR_lgetxattr)
2164 print_getxattr(void *cpu_env
, const struct syscallname
*name
,
2165 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2166 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2168 print_syscall_prologue(name
);
2169 print_string(arg0
, 0);
2170 print_string(arg1
, 0);
2171 print_pointer(arg2
, 0);
2172 print_raw_param(TARGET_FMT_lu
, arg3
, 1);
2173 print_syscall_epilogue(name
);
2175 #define print_lgetxattr print_getxattr
2178 #if defined(TARGET_NR_listxattr) || defined(TARGET_NR_llistxattr)
2180 print_listxattr(void *cpu_env
, const struct syscallname
*name
,
2181 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2182 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2184 print_syscall_prologue(name
);
2185 print_string(arg0
, 0);
2186 print_pointer(arg1
, 0);
2187 print_raw_param(TARGET_FMT_lu
, arg2
, 1);
2188 print_syscall_epilogue(name
);
2190 #define print_llistxattr print_listxattr
2193 #if defined(TARGET_NR_fremovexattr)
2195 print_fremovexattr(void *cpu_env
, const struct syscallname
*name
,
2196 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2197 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2199 print_syscall_prologue(name
);
2200 print_raw_param("%d", arg0
, 0);
2201 print_string(arg1
, 1);
2202 print_syscall_epilogue(name
);
2206 #if defined(TARGET_NR_removexattr) || defined(TARGET_NR_lremovexattr)
2208 print_removexattr(void *cpu_env
, const struct syscallname
*name
,
2209 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2210 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2212 print_syscall_prologue(name
);
2213 print_string(arg0
, 0);
2214 print_string(arg1
, 1);
2215 print_syscall_epilogue(name
);
2217 #define print_lremovexattr print_removexattr
2220 #ifdef TARGET_NR_futimesat
2222 print_futimesat(void *cpu_env
, const struct syscallname
*name
,
2223 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2224 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2226 print_syscall_prologue(name
);
2227 print_at_dirfd(arg0
, 0);
2228 print_string(arg1
, 0);
2229 print_timeval(arg2
, 0);
2230 print_timeval(arg2
+ sizeof (struct target_timeval
), 1);
2231 print_syscall_epilogue(name
);
2235 #ifdef TARGET_NR_gettimeofday
2237 print_gettimeofday(void *cpu_env
, const struct syscallname
*name
,
2238 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2239 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2241 print_syscall_prologue(name
);
2242 print_pointer(arg0
, 0);
2243 print_pointer(arg1
, 1);
2244 print_syscall_epilogue(name
);
2248 #ifdef TARGET_NR_settimeofday
2250 print_settimeofday(void *cpu_env
, const struct syscallname
*name
,
2251 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2252 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2254 print_syscall_prologue(name
);
2255 print_timeval(arg0
, 0);
2256 print_timezone(arg1
, 1);
2257 print_syscall_epilogue(name
);
2261 #if defined(TARGET_NR_clock_gettime) || defined(TARGET_NR_clock_getres)
2263 print_clock_gettime(void *cpu_env
, const struct syscallname
*name
,
2264 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2265 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2267 print_syscall_prologue(name
);
2268 print_enums(clockids
, arg0
, 0);
2269 print_pointer(arg1
, 1);
2270 print_syscall_epilogue(name
);
2272 #define print_clock_getres print_clock_gettime
2275 #ifdef TARGET_NR_clock_settime
2277 print_clock_settime(void *cpu_env
, const struct syscallname
*name
,
2278 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2279 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2281 print_syscall_prologue(name
);
2282 print_enums(clockids
, arg0
, 0);
2283 print_timespec(arg1
, 1);
2284 print_syscall_epilogue(name
);
2288 #ifdef TARGET_NR_getitimer
2290 print_getitimer(void *cpu_env
, const struct syscallname
*name
,
2291 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2292 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2294 print_syscall_prologue(name
);
2295 print_enums(itimer_types
, arg0
, 0);
2296 print_pointer(arg1
, 1);
2297 print_syscall_epilogue(name
);
2301 #ifdef TARGET_NR_setitimer
2303 print_setitimer(void *cpu_env
, const struct syscallname
*name
,
2304 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2305 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2307 print_syscall_prologue(name
);
2308 print_enums(itimer_types
, arg0
, 0);
2309 print_itimerval(arg1
, 0);
2310 print_pointer(arg2
, 1);
2311 print_syscall_epilogue(name
);
2315 #ifdef TARGET_NR_link
2317 print_link(void *cpu_env
, const struct syscallname
*name
,
2318 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2319 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2321 print_syscall_prologue(name
);
2322 print_string(arg0
, 0);
2323 print_string(arg1
, 1);
2324 print_syscall_epilogue(name
);
2328 #ifdef TARGET_NR_linkat
2330 print_linkat(void *cpu_env
, const struct syscallname
*name
,
2331 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2332 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2334 print_syscall_prologue(name
);
2335 print_at_dirfd(arg0
, 0);
2336 print_string(arg1
, 0);
2337 print_at_dirfd(arg2
, 0);
2338 print_string(arg3
, 0);
2339 print_flags(at_file_flags
, arg4
, 1);
2340 print_syscall_epilogue(name
);
2344 #if defined(TARGET_NR__llseek) || defined(TARGET_NR_llseek)
2346 print__llseek(void *cpu_env
, const struct syscallname
*name
,
2347 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2348 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2350 const char *whence
= "UNKNOWN";
2351 print_syscall_prologue(name
);
2352 print_raw_param("%d", arg0
, 0);
2353 print_raw_param("%ld", arg1
, 0);
2354 print_raw_param("%ld", arg2
, 0);
2355 print_pointer(arg3
, 0);
2357 case SEEK_SET
: whence
= "SEEK_SET"; break;
2358 case SEEK_CUR
: whence
= "SEEK_CUR"; break;
2359 case SEEK_END
: whence
= "SEEK_END"; break;
2361 qemu_log("%s", whence
);
2362 print_syscall_epilogue(name
);
2364 #define print_llseek print__llseek
2367 #ifdef TARGET_NR_lseek
2369 print_lseek(void *cpu_env
, const struct syscallname
*name
,
2370 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2371 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2373 print_syscall_prologue(name
);
2374 print_raw_param("%d", arg0
, 0);
2375 print_raw_param(TARGET_ABI_FMT_ld
, arg1
, 0);
2378 qemu_log("SEEK_SET"); break;
2380 qemu_log("SEEK_CUR"); break;
2382 qemu_log("SEEK_END"); break;
2385 qemu_log("SEEK_DATA"); break;
2389 qemu_log("SEEK_HOLE"); break;
2392 print_raw_param("%#x", arg2
, 1);
2394 print_syscall_epilogue(name
);
2398 #ifdef TARGET_NR_truncate
2400 print_truncate(void *cpu_env
, const struct syscallname
*name
,
2401 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2402 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2404 print_syscall_prologue(name
);
2405 print_string(arg0
, 0);
2406 print_raw_param(TARGET_ABI_FMT_ld
, arg1
, 1);
2407 print_syscall_epilogue(name
);
2411 #ifdef TARGET_NR_truncate64
2413 print_truncate64(void *cpu_env
, const struct syscallname
*name
,
2414 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2415 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2417 print_syscall_prologue(name
);
2418 print_string(arg0
, 0);
2419 if (regpairs_aligned(cpu_env
, TARGET_NR_truncate64
)) {
2423 print_raw_param("%" PRIu64
, target_offset64(arg1
, arg2
), 1);
2424 print_syscall_epilogue(name
);
2428 #ifdef TARGET_NR_ftruncate64
2430 print_ftruncate64(void *cpu_env
, const struct syscallname
*name
,
2431 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2432 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2434 print_syscall_prologue(name
);
2435 print_raw_param("%d", arg0
, 0);
2436 if (regpairs_aligned(cpu_env
, TARGET_NR_ftruncate64
)) {
2440 print_raw_param("%" PRIu64
, target_offset64(arg1
, arg2
), 1);
2441 print_syscall_epilogue(name
);
2445 #ifdef TARGET_NR_mlockall
2447 print_mlockall(void *cpu_env
, const struct syscallname
*name
,
2448 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2449 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2451 print_syscall_prologue(name
);
2452 print_flags(mlockall_flags
, arg0
, 1);
2453 print_syscall_epilogue(name
);
2457 #if defined(TARGET_NR_socket)
2459 print_socket(void *cpu_env
, const struct syscallname
*name
,
2460 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2461 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2463 abi_ulong domain
= arg0
, type
= arg1
, protocol
= arg2
;
2465 print_syscall_prologue(name
);
2466 print_socket_domain(domain
);
2468 print_socket_type(type
);
2470 if (domain
== AF_PACKET
||
2471 (domain
== AF_INET
&& type
== TARGET_SOCK_PACKET
)) {
2472 protocol
= tswap16(protocol
);
2474 print_socket_protocol(domain
, type
, protocol
);
2475 print_syscall_epilogue(name
);
2480 #if defined(TARGET_NR_socketcall) || defined(TARGET_NR_bind)
2482 static void print_sockfd(abi_long sockfd
, int last
)
2484 print_raw_param(TARGET_ABI_FMT_ld
, sockfd
, last
);
2489 #if defined(TARGET_NR_socketcall)
2491 #define get_user_ualx(x, gaddr, idx) \
2492 get_user_ual(x, (gaddr) + (idx) * sizeof(abi_long))
2494 static void do_print_socket(const char *name
, abi_long arg1
)
2496 abi_ulong domain
, type
, protocol
;
2498 get_user_ualx(domain
, arg1
, 0);
2499 get_user_ualx(type
, arg1
, 1);
2500 get_user_ualx(protocol
, arg1
, 2);
2501 qemu_log("%s(", name
);
2502 print_socket_domain(domain
);
2504 print_socket_type(type
);
2506 if (domain
== AF_PACKET
||
2507 (domain
== AF_INET
&& type
== TARGET_SOCK_PACKET
)) {
2508 protocol
= tswap16(protocol
);
2510 print_socket_protocol(domain
, type
, protocol
);
2514 static void do_print_sockaddr(const char *name
, abi_long arg1
)
2516 abi_ulong sockfd
, addr
, addrlen
;
2518 get_user_ualx(sockfd
, arg1
, 0);
2519 get_user_ualx(addr
, arg1
, 1);
2520 get_user_ualx(addrlen
, arg1
, 2);
2522 qemu_log("%s(", name
);
2523 print_sockfd(sockfd
, 0);
2524 print_sockaddr(addr
, addrlen
, 0);
2528 static void do_print_listen(const char *name
, abi_long arg1
)
2530 abi_ulong sockfd
, backlog
;
2532 get_user_ualx(sockfd
, arg1
, 0);
2533 get_user_ualx(backlog
, arg1
, 1);
2535 qemu_log("%s(", name
);
2536 print_sockfd(sockfd
, 0);
2537 print_raw_param(TARGET_ABI_FMT_ld
, backlog
, 1);
2541 static void do_print_socketpair(const char *name
, abi_long arg1
)
2543 abi_ulong domain
, type
, protocol
, tab
;
2545 get_user_ualx(domain
, arg1
, 0);
2546 get_user_ualx(type
, arg1
, 1);
2547 get_user_ualx(protocol
, arg1
, 2);
2548 get_user_ualx(tab
, arg1
, 3);
2550 qemu_log("%s(", name
);
2551 print_socket_domain(domain
);
2553 print_socket_type(type
);
2555 print_socket_protocol(domain
, type
, protocol
);
2557 print_raw_param(TARGET_ABI_FMT_lx
, tab
, 1);
2561 static void do_print_sendrecv(const char *name
, abi_long arg1
)
2563 abi_ulong sockfd
, msg
, len
, flags
;
2565 get_user_ualx(sockfd
, arg1
, 0);
2566 get_user_ualx(msg
, arg1
, 1);
2567 get_user_ualx(len
, arg1
, 2);
2568 get_user_ualx(flags
, arg1
, 3);
2570 qemu_log("%s(", name
);
2571 print_sockfd(sockfd
, 0);
2572 print_buf(msg
, len
, 0);
2573 print_raw_param(TARGET_ABI_FMT_ld
, len
, 0);
2574 print_flags(msg_flags
, flags
, 1);
2578 static void do_print_msgaddr(const char *name
, abi_long arg1
)
2580 abi_ulong sockfd
, msg
, len
, flags
, addr
, addrlen
;
2582 get_user_ualx(sockfd
, arg1
, 0);
2583 get_user_ualx(msg
, arg1
, 1);
2584 get_user_ualx(len
, arg1
, 2);
2585 get_user_ualx(flags
, arg1
, 3);
2586 get_user_ualx(addr
, arg1
, 4);
2587 get_user_ualx(addrlen
, arg1
, 5);
2589 qemu_log("%s(", name
);
2590 print_sockfd(sockfd
, 0);
2591 print_buf(msg
, len
, 0);
2592 print_raw_param(TARGET_ABI_FMT_ld
, len
, 0);
2593 print_flags(msg_flags
, flags
, 0);
2594 print_sockaddr(addr
, addrlen
, 0);
2598 static void do_print_shutdown(const char *name
, abi_long arg1
)
2600 abi_ulong sockfd
, how
;
2602 get_user_ualx(sockfd
, arg1
, 0);
2603 get_user_ualx(how
, arg1
, 1);
2605 qemu_log("shutdown(");
2606 print_sockfd(sockfd
, 0);
2609 qemu_log("SHUT_RD");
2612 qemu_log("SHUT_WR");
2615 qemu_log("SHUT_RDWR");
2618 print_raw_param(TARGET_ABI_FMT_ld
, how
, 1);
2624 static void do_print_msg(const char *name
, abi_long arg1
)
2626 abi_ulong sockfd
, msg
, flags
;
2628 get_user_ualx(sockfd
, arg1
, 0);
2629 get_user_ualx(msg
, arg1
, 1);
2630 get_user_ualx(flags
, arg1
, 2);
2632 qemu_log("%s(", name
);
2633 print_sockfd(sockfd
, 0);
2634 print_pointer(msg
, 0);
2635 print_flags(msg_flags
, flags
, 1);
2639 static void do_print_sockopt(const char *name
, abi_long arg1
)
2641 abi_ulong sockfd
, level
, optname
, optval
, optlen
;
2643 get_user_ualx(sockfd
, arg1
, 0);
2644 get_user_ualx(level
, arg1
, 1);
2645 get_user_ualx(optname
, arg1
, 2);
2646 get_user_ualx(optval
, arg1
, 3);
2647 get_user_ualx(optlen
, arg1
, 4);
2649 qemu_log("%s(", name
);
2650 print_sockfd(sockfd
, 0);
2653 qemu_log("SOL_TCP,");
2654 print_raw_param(TARGET_ABI_FMT_ld
, optname
, 0);
2655 print_pointer(optval
, 0);
2658 qemu_log("SOL_UDP,");
2659 print_raw_param(TARGET_ABI_FMT_ld
, optname
, 0);
2660 print_pointer(optval
, 0);
2663 qemu_log("SOL_IP,");
2664 print_raw_param(TARGET_ABI_FMT_ld
, optname
, 0);
2665 print_pointer(optval
, 0);
2668 qemu_log("SOL_RAW,");
2669 print_raw_param(TARGET_ABI_FMT_ld
, optname
, 0);
2670 print_pointer(optval
, 0);
2672 case TARGET_SOL_SOCKET
:
2673 qemu_log("SOL_SOCKET,");
2675 case TARGET_SO_DEBUG
:
2676 qemu_log("SO_DEBUG,");
2678 print_number(optval
, 0);
2680 case TARGET_SO_REUSEADDR
:
2681 qemu_log("SO_REUSEADDR,");
2683 case TARGET_SO_REUSEPORT
:
2684 qemu_log("SO_REUSEPORT,");
2686 case TARGET_SO_TYPE
:
2687 qemu_log("SO_TYPE,");
2689 case TARGET_SO_ERROR
:
2690 qemu_log("SO_ERROR,");
2692 case TARGET_SO_DONTROUTE
:
2693 qemu_log("SO_DONTROUTE,");
2695 case TARGET_SO_BROADCAST
:
2696 qemu_log("SO_BROADCAST,");
2698 case TARGET_SO_SNDBUF
:
2699 qemu_log("SO_SNDBUF,");
2701 case TARGET_SO_RCVBUF
:
2702 qemu_log("SO_RCVBUF,");
2704 case TARGET_SO_KEEPALIVE
:
2705 qemu_log("SO_KEEPALIVE,");
2707 case TARGET_SO_OOBINLINE
:
2708 qemu_log("SO_OOBINLINE,");
2710 case TARGET_SO_NO_CHECK
:
2711 qemu_log("SO_NO_CHECK,");
2713 case TARGET_SO_PRIORITY
:
2714 qemu_log("SO_PRIORITY,");
2716 case TARGET_SO_BSDCOMPAT
:
2717 qemu_log("SO_BSDCOMPAT,");
2719 case TARGET_SO_PASSCRED
:
2720 qemu_log("SO_PASSCRED,");
2722 case TARGET_SO_TIMESTAMP
:
2723 qemu_log("SO_TIMESTAMP,");
2725 case TARGET_SO_RCVLOWAT
:
2726 qemu_log("SO_RCVLOWAT,");
2728 case TARGET_SO_RCVTIMEO
:
2729 qemu_log("SO_RCVTIMEO,");
2730 print_timeval(optval
, 0);
2732 case TARGET_SO_SNDTIMEO
:
2733 qemu_log("SO_SNDTIMEO,");
2734 print_timeval(optval
, 0);
2736 case TARGET_SO_ATTACH_FILTER
: {
2737 struct target_sock_fprog
*fprog
;
2739 qemu_log("SO_ATTACH_FILTER,");
2741 if (lock_user_struct(VERIFY_READ
, fprog
, optval
, 0)) {
2742 struct target_sock_filter
*filter
;
2744 if (lock_user_struct(VERIFY_READ
, filter
,
2745 tswapal(fprog
->filter
), 0)) {
2747 for (i
= 0; i
< tswap16(fprog
->len
) - 1; i
++) {
2748 qemu_log("[%d]{0x%x,%d,%d,0x%x},",
2749 i
, tswap16(filter
[i
].code
),
2750 filter
[i
].jt
, filter
[i
].jf
,
2751 tswap32(filter
[i
].k
));
2753 qemu_log("[%d]{0x%x,%d,%d,0x%x}",
2754 i
, tswap16(filter
[i
].code
),
2755 filter
[i
].jt
, filter
[i
].jf
,
2756 tswap32(filter
[i
].k
));
2758 qemu_log(TARGET_ABI_FMT_lx
, tswapal(fprog
->filter
));
2760 qemu_log(",%d},", tswap16(fprog
->len
));
2761 unlock_user(fprog
, optval
, 0);
2763 print_pointer(optval
, 0);
2768 print_raw_param(TARGET_ABI_FMT_ld
, optname
, 0);
2769 print_pointer(optval
, 0);
2774 qemu_log("SOL_IPV6,");
2776 case IPV6_MTU_DISCOVER
:
2777 qemu_log("IPV6_MTU_DISCOVER,");
2780 qemu_log("IPV6_MTU,");
2783 qemu_log("IPV6_V6ONLY,");
2785 case IPV6_RECVPKTINFO
:
2786 qemu_log("IPV6_RECVPKTINFO,");
2788 case IPV6_UNICAST_HOPS
:
2789 qemu_log("IPV6_UNICAST_HOPS,");
2791 case IPV6_MULTICAST_HOPS
:
2792 qemu_log("IPV6_MULTICAST_HOPS,");
2794 case IPV6_MULTICAST_LOOP
:
2795 qemu_log("IPV6_MULTICAST_LOOP,");
2798 qemu_log("IPV6_RECVERR,");
2800 case IPV6_RECVHOPLIMIT
:
2801 qemu_log("IPV6_RECVHOPLIMIT,");
2803 case IPV6_2292HOPLIMIT
:
2804 qemu_log("IPV6_2292HOPLIMIT,");
2807 qemu_log("IPV6_CHECKSUM,");
2810 qemu_log("IPV6_ADDRFORM,");
2812 case IPV6_2292PKTINFO
:
2813 qemu_log("IPV6_2292PKTINFO,");
2815 case IPV6_RECVTCLASS
:
2816 qemu_log("IPV6_RECVTCLASS,");
2818 case IPV6_RECVRTHDR
:
2819 qemu_log("IPV6_RECVRTHDR,");
2821 case IPV6_2292RTHDR
:
2822 qemu_log("IPV6_2292RTHDR,");
2824 case IPV6_RECVHOPOPTS
:
2825 qemu_log("IPV6_RECVHOPOPTS,");
2827 case IPV6_2292HOPOPTS
:
2828 qemu_log("IPV6_2292HOPOPTS,");
2830 case IPV6_RECVDSTOPTS
:
2831 qemu_log("IPV6_RECVDSTOPTS,");
2833 case IPV6_2292DSTOPTS
:
2834 qemu_log("IPV6_2292DSTOPTS,");
2837 qemu_log("IPV6_TCLASS,");
2839 case IPV6_ADDR_PREFERENCES
:
2840 qemu_log("IPV6_ADDR_PREFERENCES,");
2842 #ifdef IPV6_RECVPATHMTU
2843 case IPV6_RECVPATHMTU
:
2844 qemu_log("IPV6_RECVPATHMTU,");
2847 #ifdef IPV6_TRANSPARENT
2848 case IPV6_TRANSPARENT
:
2849 qemu_log("IPV6_TRANSPARENT,");
2852 #ifdef IPV6_FREEBIND
2854 qemu_log("IPV6_FREEBIND,");
2857 #ifdef IPV6_RECVORIGDSTADDR
2858 case IPV6_RECVORIGDSTADDR
:
2859 qemu_log("IPV6_RECVORIGDSTADDR,");
2863 qemu_log("IPV6_PKTINFO,");
2864 print_pointer(optval
, 0);
2866 case IPV6_ADD_MEMBERSHIP
:
2867 qemu_log("IPV6_ADD_MEMBERSHIP,");
2868 print_pointer(optval
, 0);
2870 case IPV6_DROP_MEMBERSHIP
:
2871 qemu_log("IPV6_DROP_MEMBERSHIP,");
2872 print_pointer(optval
, 0);
2875 print_raw_param(TARGET_ABI_FMT_ld
, optname
, 0);
2876 print_pointer(optval
, 0);
2881 print_raw_param(TARGET_ABI_FMT_ld
, level
, 0);
2882 print_raw_param(TARGET_ABI_FMT_ld
, optname
, 0);
2883 print_pointer(optval
, 0);
2886 print_raw_param(TARGET_ABI_FMT_ld
, optlen
, 1);
2890 #define PRINT_SOCKOP(name, func) \
2891 [TARGET_SYS_##name] = { #name, func }
2895 void (*print
)(const char *, abi_long
);
2897 PRINT_SOCKOP(SOCKET
, do_print_socket
),
2898 PRINT_SOCKOP(BIND
, do_print_sockaddr
),
2899 PRINT_SOCKOP(CONNECT
, do_print_sockaddr
),
2900 PRINT_SOCKOP(LISTEN
, do_print_listen
),
2901 PRINT_SOCKOP(ACCEPT
, do_print_sockaddr
),
2902 PRINT_SOCKOP(GETSOCKNAME
, do_print_sockaddr
),
2903 PRINT_SOCKOP(GETPEERNAME
, do_print_sockaddr
),
2904 PRINT_SOCKOP(SOCKETPAIR
, do_print_socketpair
),
2905 PRINT_SOCKOP(SEND
, do_print_sendrecv
),
2906 PRINT_SOCKOP(RECV
, do_print_sendrecv
),
2907 PRINT_SOCKOP(SENDTO
, do_print_msgaddr
),
2908 PRINT_SOCKOP(RECVFROM
, do_print_msgaddr
),
2909 PRINT_SOCKOP(SHUTDOWN
, do_print_shutdown
),
2910 PRINT_SOCKOP(SETSOCKOPT
, do_print_sockopt
),
2911 PRINT_SOCKOP(GETSOCKOPT
, do_print_sockopt
),
2912 PRINT_SOCKOP(SENDMSG
, do_print_msg
),
2913 PRINT_SOCKOP(RECVMSG
, do_print_msg
),
2914 PRINT_SOCKOP(ACCEPT4
, NULL
),
2915 PRINT_SOCKOP(RECVMMSG
, NULL
),
2916 PRINT_SOCKOP(SENDMMSG
, NULL
),
2920 print_socketcall(void *cpu_env
, const struct syscallname
*name
,
2921 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2922 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2924 if (arg0
>= 0 && arg0
< ARRAY_SIZE(scall
) && scall
[arg0
].print
) {
2925 scall
[arg0
].print(scall
[arg0
].name
, arg1
);
2928 print_syscall_prologue(name
);
2929 print_raw_param(TARGET_ABI_FMT_ld
, arg0
, 0);
2930 print_raw_param(TARGET_ABI_FMT_ld
, arg1
, 0);
2931 print_raw_param(TARGET_ABI_FMT_ld
, arg2
, 0);
2932 print_raw_param(TARGET_ABI_FMT_ld
, arg3
, 0);
2933 print_raw_param(TARGET_ABI_FMT_ld
, arg4
, 0);
2934 print_raw_param(TARGET_ABI_FMT_ld
, arg5
, 0);
2935 print_syscall_epilogue(name
);
2939 #if defined(TARGET_NR_bind)
2941 print_bind(void *cpu_env
, const struct syscallname
*name
,
2942 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2943 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2945 print_syscall_prologue(name
);
2946 print_sockfd(arg0
, 0);
2947 print_sockaddr(arg1
, arg2
, 1);
2948 print_syscall_epilogue(name
);
2952 #if defined(TARGET_NR_stat) || defined(TARGET_NR_stat64) || \
2953 defined(TARGET_NR_lstat) || defined(TARGET_NR_lstat64)
2955 print_stat(void *cpu_env
, const struct syscallname
*name
,
2956 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2957 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2959 print_syscall_prologue(name
);
2960 print_string(arg0
, 0);
2961 print_pointer(arg1
, 1);
2962 print_syscall_epilogue(name
);
2964 #define print_lstat print_stat
2965 #define print_stat64 print_stat
2966 #define print_lstat64 print_stat
2969 #if defined(TARGET_NR_fstat) || defined(TARGET_NR_fstat64)
2971 print_fstat(void *cpu_env
, const struct syscallname
*name
,
2972 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2973 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2975 print_syscall_prologue(name
);
2976 print_raw_param("%d", arg0
, 0);
2977 print_pointer(arg1
, 1);
2978 print_syscall_epilogue(name
);
2980 #define print_fstat64 print_fstat
2983 #ifdef TARGET_NR_mkdir
2985 print_mkdir(void *cpu_env
, const struct syscallname
*name
,
2986 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2987 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2989 print_syscall_prologue(name
);
2990 print_string(arg0
, 0);
2991 print_file_mode(arg1
, 1);
2992 print_syscall_epilogue(name
);
2996 #ifdef TARGET_NR_mkdirat
2998 print_mkdirat(void *cpu_env
, const struct syscallname
*name
,
2999 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3000 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3002 print_syscall_prologue(name
);
3003 print_at_dirfd(arg0
, 0);
3004 print_string(arg1
, 0);
3005 print_file_mode(arg2
, 1);
3006 print_syscall_epilogue(name
);
3010 #ifdef TARGET_NR_rmdir
3012 print_rmdir(void *cpu_env
, const struct syscallname
*name
,
3013 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3014 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3016 print_syscall_prologue(name
);
3017 print_string(arg0
, 0);
3018 print_syscall_epilogue(name
);
3022 #ifdef TARGET_NR_rt_sigaction
3024 print_rt_sigaction(void *cpu_env
, const struct syscallname
*name
,
3025 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3026 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3028 print_syscall_prologue(name
);
3029 print_signal(arg0
, 0);
3030 print_pointer(arg1
, 0);
3031 print_pointer(arg2
, 1);
3032 print_syscall_epilogue(name
);
3036 #ifdef TARGET_NR_rt_sigprocmask
3038 print_rt_sigprocmask(void *cpu_env
, const struct syscallname
*name
,
3039 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3040 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3042 const char *how
= "UNKNOWN";
3043 print_syscall_prologue(name
);
3045 case TARGET_SIG_BLOCK
: how
= "SIG_BLOCK"; break;
3046 case TARGET_SIG_UNBLOCK
: how
= "SIG_UNBLOCK"; break;
3047 case TARGET_SIG_SETMASK
: how
= "SIG_SETMASK"; break;
3049 qemu_log("%s,", how
);
3050 print_pointer(arg1
, 0);
3051 print_pointer(arg2
, 1);
3052 print_syscall_epilogue(name
);
3056 #ifdef TARGET_NR_rt_sigqueueinfo
3058 print_rt_sigqueueinfo(void *cpu_env
, const struct syscallname
*name
,
3059 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3060 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3063 target_siginfo_t uinfo
;
3065 print_syscall_prologue(name
);
3066 print_raw_param("%d", arg0
, 0);
3067 print_signal(arg1
, 0);
3068 p
= lock_user(VERIFY_READ
, arg2
, sizeof(target_siginfo_t
), 1);
3070 get_target_siginfo(&uinfo
, p
);
3071 print_siginfo(&uinfo
);
3073 unlock_user(p
, arg2
, 0);
3075 print_pointer(arg2
, 1);
3077 print_syscall_epilogue(name
);
3081 #ifdef TARGET_NR_rt_tgsigqueueinfo
3083 print_rt_tgsigqueueinfo(void *cpu_env
, const struct syscallname
*name
,
3084 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3085 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3088 target_siginfo_t uinfo
;
3090 print_syscall_prologue(name
);
3091 print_raw_param("%d", arg0
, 0);
3092 print_raw_param("%d", arg1
, 0);
3093 print_signal(arg2
, 0);
3094 p
= lock_user(VERIFY_READ
, arg3
, sizeof(target_siginfo_t
), 1);
3096 get_target_siginfo(&uinfo
, p
);
3097 print_siginfo(&uinfo
);
3099 unlock_user(p
, arg3
, 0);
3101 print_pointer(arg3
, 1);
3103 print_syscall_epilogue(name
);
3107 #ifdef TARGET_NR_syslog
3109 print_syslog_action(abi_ulong arg
, int last
)
3114 case TARGET_SYSLOG_ACTION_CLOSE
: {
3115 type
= "SYSLOG_ACTION_CLOSE";
3118 case TARGET_SYSLOG_ACTION_OPEN
: {
3119 type
= "SYSLOG_ACTION_OPEN";
3122 case TARGET_SYSLOG_ACTION_READ
: {
3123 type
= "SYSLOG_ACTION_READ";
3126 case TARGET_SYSLOG_ACTION_READ_ALL
: {
3127 type
= "SYSLOG_ACTION_READ_ALL";
3130 case TARGET_SYSLOG_ACTION_READ_CLEAR
: {
3131 type
= "SYSLOG_ACTION_READ_CLEAR";
3134 case TARGET_SYSLOG_ACTION_CLEAR
: {
3135 type
= "SYSLOG_ACTION_CLEAR";
3138 case TARGET_SYSLOG_ACTION_CONSOLE_OFF
: {
3139 type
= "SYSLOG_ACTION_CONSOLE_OFF";
3142 case TARGET_SYSLOG_ACTION_CONSOLE_ON
: {
3143 type
= "SYSLOG_ACTION_CONSOLE_ON";
3146 case TARGET_SYSLOG_ACTION_CONSOLE_LEVEL
: {
3147 type
= "SYSLOG_ACTION_CONSOLE_LEVEL";
3150 case TARGET_SYSLOG_ACTION_SIZE_UNREAD
: {
3151 type
= "SYSLOG_ACTION_SIZE_UNREAD";
3154 case TARGET_SYSLOG_ACTION_SIZE_BUFFER
: {
3155 type
= "SYSLOG_ACTION_SIZE_BUFFER";
3159 print_raw_param("%ld", arg
, last
);
3163 qemu_log("%s%s", type
, get_comma(last
));
3167 print_syslog(void *cpu_env
, const struct syscallname
*name
,
3168 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3169 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3171 print_syscall_prologue(name
);
3172 print_syslog_action(arg0
, 0);
3173 print_pointer(arg1
, 0);
3174 print_raw_param("%d", arg2
, 1);
3175 print_syscall_epilogue(name
);
3179 #ifdef TARGET_NR_mknod
3181 print_mknod(void *cpu_env
, const struct syscallname
*name
,
3182 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3183 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3185 int hasdev
= (arg1
& (S_IFCHR
|S_IFBLK
));
3187 print_syscall_prologue(name
);
3188 print_string(arg0
, 0);
3189 print_file_mode(arg1
, (hasdev
== 0));
3191 print_raw_param("makedev(%d", major(arg2
), 0);
3192 print_raw_param("%d)", minor(arg2
), 1);
3194 print_syscall_epilogue(name
);
3198 #ifdef TARGET_NR_mknodat
3200 print_mknodat(void *cpu_env
, const struct syscallname
*name
,
3201 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3202 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3204 int hasdev
= (arg2
& (S_IFCHR
|S_IFBLK
));
3206 print_syscall_prologue(name
);
3207 print_at_dirfd(arg0
, 0);
3208 print_string(arg1
, 0);
3209 print_file_mode(arg2
, (hasdev
== 0));
3211 print_raw_param("makedev(%d", major(arg3
), 0);
3212 print_raw_param("%d)", minor(arg3
), 1);
3214 print_syscall_epilogue(name
);
3218 #ifdef TARGET_NR_mq_open
3220 print_mq_open(void *cpu_env
, const struct syscallname
*name
,
3221 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3222 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3224 int is_creat
= (arg1
& TARGET_O_CREAT
);
3226 print_syscall_prologue(name
);
3227 print_string(arg0
, 0);
3228 print_open_flags(arg1
, (is_creat
== 0));
3230 print_file_mode(arg2
, 0);
3231 print_pointer(arg3
, 1);
3233 print_syscall_epilogue(name
);
3237 #ifdef TARGET_NR_open
3239 print_open(void *cpu_env
, const struct syscallname
*name
,
3240 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3241 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3243 int is_creat
= (arg1
& TARGET_O_CREAT
);
3245 print_syscall_prologue(name
);
3246 print_string(arg0
, 0);
3247 print_open_flags(arg1
, (is_creat
== 0));
3249 print_file_mode(arg2
, 1);
3250 print_syscall_epilogue(name
);
3254 #ifdef TARGET_NR_openat
3256 print_openat(void *cpu_env
, const struct syscallname
*name
,
3257 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3258 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3260 int is_creat
= (arg2
& TARGET_O_CREAT
);
3262 print_syscall_prologue(name
);
3263 print_at_dirfd(arg0
, 0);
3264 print_string(arg1
, 0);
3265 print_open_flags(arg2
, (is_creat
== 0));
3267 print_file_mode(arg3
, 1);
3268 print_syscall_epilogue(name
);
3272 #ifdef TARGET_NR_mq_unlink
3274 print_mq_unlink(void *cpu_env
, const struct syscallname
*name
,
3275 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3276 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3278 print_syscall_prologue(name
);
3279 print_string(arg0
, 1);
3280 print_syscall_epilogue(name
);
3284 #if defined(TARGET_NR_fstatat64) || defined(TARGET_NR_newfstatat)
3286 print_fstatat64(void *cpu_env
, const struct syscallname
*name
,
3287 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3288 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3290 print_syscall_prologue(name
);
3291 print_at_dirfd(arg0
, 0);
3292 print_string(arg1
, 0);
3293 print_pointer(arg2
, 0);
3294 print_flags(at_file_flags
, arg3
, 1);
3295 print_syscall_epilogue(name
);
3297 #define print_newfstatat print_fstatat64
3300 #ifdef TARGET_NR_readlink
3302 print_readlink(void *cpu_env
, const struct syscallname
*name
,
3303 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3304 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3306 print_syscall_prologue(name
);
3307 print_string(arg0
, 0);
3308 print_pointer(arg1
, 0);
3309 print_raw_param("%u", arg2
, 1);
3310 print_syscall_epilogue(name
);
3314 #ifdef TARGET_NR_readlinkat
3316 print_readlinkat(void *cpu_env
, const struct syscallname
*name
,
3317 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3318 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3320 print_syscall_prologue(name
);
3321 print_at_dirfd(arg0
, 0);
3322 print_string(arg1
, 0);
3323 print_pointer(arg2
, 0);
3324 print_raw_param("%u", arg3
, 1);
3325 print_syscall_epilogue(name
);
3329 #ifdef TARGET_NR_rename
3331 print_rename(void *cpu_env
, const struct syscallname
*name
,
3332 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3333 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3335 print_syscall_prologue(name
);
3336 print_string(arg0
, 0);
3337 print_string(arg1
, 1);
3338 print_syscall_epilogue(name
);
3342 #ifdef TARGET_NR_renameat
3344 print_renameat(void *cpu_env
, const struct syscallname
*name
,
3345 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3346 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3348 print_syscall_prologue(name
);
3349 print_at_dirfd(arg0
, 0);
3350 print_string(arg1
, 0);
3351 print_at_dirfd(arg2
, 0);
3352 print_string(arg3
, 1);
3353 print_syscall_epilogue(name
);
3357 #ifdef TARGET_NR_statfs
3359 print_statfs(void *cpu_env
, const struct syscallname
*name
,
3360 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3361 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3363 print_syscall_prologue(name
);
3364 print_string(arg0
, 0);
3365 print_pointer(arg1
, 1);
3366 print_syscall_epilogue(name
);
3370 #ifdef TARGET_NR_statfs64
3372 print_statfs64(void *cpu_env
, const struct syscallname
*name
,
3373 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3374 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3376 print_syscall_prologue(name
);
3377 print_string(arg0
, 0);
3378 print_pointer(arg1
, 1);
3379 print_syscall_epilogue(name
);
3383 #ifdef TARGET_NR_symlink
3385 print_symlink(void *cpu_env
, const struct syscallname
*name
,
3386 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3387 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3389 print_syscall_prologue(name
);
3390 print_string(arg0
, 0);
3391 print_string(arg1
, 1);
3392 print_syscall_epilogue(name
);
3396 #ifdef TARGET_NR_symlinkat
3398 print_symlinkat(void *cpu_env
, const struct syscallname
*name
,
3399 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3400 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3402 print_syscall_prologue(name
);
3403 print_string(arg0
, 0);
3404 print_at_dirfd(arg1
, 0);
3405 print_string(arg2
, 1);
3406 print_syscall_epilogue(name
);
3410 #ifdef TARGET_NR_mount
3412 print_mount(void *cpu_env
, const struct syscallname
*name
,
3413 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3414 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3416 print_syscall_prologue(name
);
3417 print_string(arg0
, 0);
3418 print_string(arg1
, 0);
3419 print_string(arg2
, 0);
3420 print_flags(mount_flags
, arg3
, 0);
3421 print_pointer(arg4
, 1);
3422 print_syscall_epilogue(name
);
3426 #ifdef TARGET_NR_umount
3428 print_umount(void *cpu_env
, const struct syscallname
*name
,
3429 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3430 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3432 print_syscall_prologue(name
);
3433 print_string(arg0
, 1);
3434 print_syscall_epilogue(name
);
3438 #ifdef TARGET_NR_umount2
3440 print_umount2(void *cpu_env
, const struct syscallname
*name
,
3441 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3442 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3444 print_syscall_prologue(name
);
3445 print_string(arg0
, 0);
3446 print_flags(umount2_flags
, arg1
, 1);
3447 print_syscall_epilogue(name
);
3451 #ifdef TARGET_NR_unlink
3453 print_unlink(void *cpu_env
, const struct syscallname
*name
,
3454 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3455 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3457 print_syscall_prologue(name
);
3458 print_string(arg0
, 1);
3459 print_syscall_epilogue(name
);
3463 #ifdef TARGET_NR_unlinkat
3465 print_unlinkat(void *cpu_env
, const struct syscallname
*name
,
3466 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3467 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3469 print_syscall_prologue(name
);
3470 print_at_dirfd(arg0
, 0);
3471 print_string(arg1
, 0);
3472 print_flags(unlinkat_flags
, arg2
, 1);
3473 print_syscall_epilogue(name
);
3477 #ifdef TARGET_NR_unshare
3479 print_unshare(void *cpu_env
, const struct syscallname
*name
,
3480 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3481 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3483 print_syscall_prologue(name
);
3484 print_flags(clone_flags
, arg0
, 1);
3485 print_syscall_epilogue(name
);
3489 #ifdef TARGET_NR_utime
3491 print_utime(void *cpu_env
, const struct syscallname
*name
,
3492 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3493 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3495 print_syscall_prologue(name
);
3496 print_string(arg0
, 0);
3497 print_pointer(arg1
, 1);
3498 print_syscall_epilogue(name
);
3502 #ifdef TARGET_NR_utimes
3504 print_utimes(void *cpu_env
, const struct syscallname
*name
,
3505 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3506 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3508 print_syscall_prologue(name
);
3509 print_string(arg0
, 0);
3510 print_pointer(arg1
, 1);
3511 print_syscall_epilogue(name
);
3515 #ifdef TARGET_NR_utimensat
3517 print_utimensat(void *cpu_env
, const struct syscallname
*name
,
3518 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3519 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3521 print_syscall_prologue(name
);
3522 print_at_dirfd(arg0
, 0);
3523 print_string(arg1
, 0);
3524 print_pointer(arg2
, 0);
3525 print_flags(at_file_flags
, arg3
, 1);
3526 print_syscall_epilogue(name
);
3530 #if defined(TARGET_NR_mmap) || defined(TARGET_NR_mmap2)
3532 print_mmap(void *cpu_env
, const struct syscallname
*name
,
3533 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3534 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3536 print_syscall_prologue(name
);
3537 print_pointer(arg0
, 0);
3538 print_raw_param("%d", arg1
, 0);
3539 print_flags(mmap_prot_flags
, arg2
, 0);
3540 print_flags(mmap_flags
, arg3
, 0);
3541 print_raw_param("%d", arg4
, 0);
3542 print_raw_param("%#x", arg5
, 1);
3543 print_syscall_epilogue(name
);
3545 #define print_mmap2 print_mmap
3548 #ifdef TARGET_NR_mprotect
3550 print_mprotect(void *cpu_env
, const struct syscallname
*name
,
3551 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3552 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3554 print_syscall_prologue(name
);
3555 print_pointer(arg0
, 0);
3556 print_raw_param("%d", arg1
, 0);
3557 print_flags(mmap_prot_flags
, arg2
, 1);
3558 print_syscall_epilogue(name
);
3562 #ifdef TARGET_NR_munmap
3564 print_munmap(void *cpu_env
, const struct syscallname
*name
,
3565 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3566 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3568 print_syscall_prologue(name
);
3569 print_pointer(arg0
, 0);
3570 print_raw_param("%d", arg1
, 1);
3571 print_syscall_epilogue(name
);
3575 #ifdef TARGET_NR_futex
3576 static void print_futex_op(abi_long tflag
, int last
)
3578 #define print_op(val) \
3579 if( cmd == val ) { \
3584 int cmd
= (int)tflag
;
3585 #ifdef FUTEX_PRIVATE_FLAG
3586 if (cmd
& FUTEX_PRIVATE_FLAG
) {
3587 qemu_log("FUTEX_PRIVATE_FLAG|");
3588 cmd
&= ~FUTEX_PRIVATE_FLAG
;
3591 #ifdef FUTEX_CLOCK_REALTIME
3592 if (cmd
& FUTEX_CLOCK_REALTIME
) {
3593 qemu_log("FUTEX_CLOCK_REALTIME|");
3594 cmd
&= ~FUTEX_CLOCK_REALTIME
;
3597 print_op(FUTEX_WAIT
)
3598 print_op(FUTEX_WAKE
)
3600 print_op(FUTEX_REQUEUE
)
3601 print_op(FUTEX_CMP_REQUEUE
)
3602 print_op(FUTEX_WAKE_OP
)
3603 print_op(FUTEX_LOCK_PI
)
3604 print_op(FUTEX_UNLOCK_PI
)
3605 print_op(FUTEX_TRYLOCK_PI
)
3606 #ifdef FUTEX_WAIT_BITSET
3607 print_op(FUTEX_WAIT_BITSET
)
3609 #ifdef FUTEX_WAKE_BITSET
3610 print_op(FUTEX_WAKE_BITSET
)
3612 /* unknown values */
3613 qemu_log("%d", cmd
);
3617 print_futex(void *cpu_env
, const struct syscallname
*name
,
3618 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3619 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3621 print_syscall_prologue(name
);
3622 print_pointer(arg0
, 0);
3623 print_futex_op(arg1
, 0);
3624 print_raw_param(",%d", arg2
, 0);
3625 print_pointer(arg3
, 0); /* struct timespec */
3626 print_pointer(arg4
, 0);
3627 print_raw_param("%d", arg4
, 1);
3628 print_syscall_epilogue(name
);
3632 #ifdef TARGET_NR_kill
3634 print_kill(void *cpu_env
, const struct syscallname
*name
,
3635 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3636 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3638 print_syscall_prologue(name
);
3639 print_raw_param("%d", arg0
, 0);
3640 print_signal(arg1
, 1);
3641 print_syscall_epilogue(name
);
3645 #ifdef TARGET_NR_tkill
3647 print_tkill(void *cpu_env
, const struct syscallname
*name
,
3648 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3649 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3651 print_syscall_prologue(name
);
3652 print_raw_param("%d", arg0
, 0);
3653 print_signal(arg1
, 1);
3654 print_syscall_epilogue(name
);
3658 #ifdef TARGET_NR_tgkill
3660 print_tgkill(void *cpu_env
, const struct syscallname
*name
,
3661 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3662 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3664 print_syscall_prologue(name
);
3665 print_raw_param("%d", arg0
, 0);
3666 print_raw_param("%d", arg1
, 0);
3667 print_signal(arg2
, 1);
3668 print_syscall_epilogue(name
);
3672 #ifdef TARGET_NR_statx
3674 print_statx(void *cpu_env
, const struct syscallname
*name
,
3675 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3676 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3678 print_syscall_prologue(name
);
3679 print_at_dirfd(arg0
, 0);
3680 print_string(arg1
, 0);
3681 print_flags(statx_flags
, arg2
, 0);
3682 print_flags(statx_mask
, arg3
, 0);
3683 print_pointer(arg4
, 1);
3684 print_syscall_epilogue(name
);
3688 #ifdef TARGET_NR_ioctl
3690 print_ioctl(void *cpu_env
, const struct syscallname
*name
,
3691 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3692 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3694 print_syscall_prologue(name
);
3695 print_raw_param("%d", arg0
, 0);
3697 const IOCTLEntry
*ie
;
3698 const argtype
*arg_type
;
3702 for (ie
= ioctl_entries
; ie
->target_cmd
!= 0; ie
++) {
3703 if (ie
->target_cmd
== arg1
) {
3708 if (ie
->target_cmd
== 0) {
3709 print_raw_param("%#x", arg1
, 0);
3710 print_raw_param("%#x", arg2
, 1);
3712 qemu_log("%s", ie
->name
);
3713 arg_type
= ie
->arg_type
;
3715 if (arg_type
[0] != TYPE_NULL
) {
3718 switch (arg_type
[0]) {
3720 print_pointer(arg2
, 1);
3725 print_raw_param("%d", arg2
, 1);
3728 print_raw_param(TARGET_ABI_FMT_ld
, arg2
, 1);
3731 print_raw_param(TARGET_ABI_FMT_lu
, arg2
, 1);
3734 switch (ie
->access
) {
3736 print_pointer(arg2
, 1);
3741 target_size
= thunk_type_size(arg_type
, 0);
3742 argptr
= lock_user(VERIFY_READ
, arg2
, target_size
, 1);
3744 thunk_print(argptr
, arg_type
);
3745 unlock_user(argptr
, arg2
, target_size
);
3747 print_pointer(arg2
, 1);
3753 g_assert_not_reached();
3757 print_syscall_epilogue(name
);
3762 * An array of all of the syscalls we know about
3765 static const struct syscallname scnames
[] = {
3766 #include "strace.list"
3769 static int nsyscalls
= ARRAY_SIZE(scnames
);
3772 * The public interface to this module.
3775 print_syscall(void *cpu_env
, int num
,
3776 abi_long arg1
, abi_long arg2
, abi_long arg3
,
3777 abi_long arg4
, abi_long arg5
, abi_long arg6
)
3780 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
")";
3782 qemu_log("%d ", getpid());
3784 for(i
=0;i
<nsyscalls
;i
++)
3785 if( scnames
[i
].nr
== num
) {
3786 if( scnames
[i
].call
!= NULL
) {
3788 cpu_env
, &scnames
[i
], arg1
, arg2
, arg3
, arg4
, arg5
, arg6
);
3790 /* XXX: this format system is broken because it uses
3791 host types and host pointers for strings */
3792 if( scnames
[i
].format
!= NULL
)
3793 format
= scnames
[i
].format
;
3795 scnames
[i
].name
, arg1
, arg2
, arg3
, arg4
, arg5
, arg6
);
3799 qemu_log("Unknown syscall %d\n", num
);
3804 print_syscall_ret(void *cpu_env
, int num
, abi_long ret
,
3805 abi_long arg1
, abi_long arg2
, abi_long arg3
,
3806 abi_long arg4
, abi_long arg5
, abi_long arg6
)
3810 for(i
=0;i
<nsyscalls
;i
++)
3811 if( scnames
[i
].nr
== num
) {
3812 if( scnames
[i
].result
!= NULL
) {
3813 scnames
[i
].result(cpu_env
, &scnames
[i
], ret
,
3817 if (!print_syscall_err(ret
)) {
3818 qemu_log(TARGET_ABI_FMT_ld
, ret
);
3826 void print_taken_signal(int target_signum
, const target_siginfo_t
*tinfo
)
3828 /* Print the strace output for a signal being taken:
3829 * --- SIGSEGV {si_signo=SIGSEGV, si_code=SI_KERNEL, si_addr=0} ---
3832 print_signal(target_signum
, 1);
3834 print_siginfo(tinfo
);