1 #include "qemu/osdep.h"
7 #include <sys/select.h>
10 #include <netinet/in.h>
11 #include <netinet/tcp.h>
12 #include <netinet/udp.h>
13 #include <linux/if_packet.h>
14 #include <linux/in6.h>
15 #include <linux/netlink.h>
18 #include "user-internals.h"
20 #include "signal-common.h"
21 #include "target_mman.h"
27 void (*call
)(CPUArchState
*, const struct syscallname
*,
28 abi_long
, abi_long
, abi_long
,
29 abi_long
, abi_long
, abi_long
);
30 void (*result
)(CPUArchState
*, const struct syscallname
*, abi_long
,
31 abi_long
, abi_long
, abi_long
,
32 abi_long
, abi_long
, abi_long
);
36 * It is possible that target doesn't have syscall that uses
37 * following flags but we don't want the compiler to warn
38 * us about them being unused. Same applies to utility print
39 * functions. It is ok to keep them while not used.
41 #define UNUSED __attribute__ ((unused))
44 * Structure used to translate flag values into strings. This is
45 * similar that is in the actual strace tool.
48 abi_long f_value
; /* flag */
49 const char *f_string
; /* stringified flag */
52 /* common flags for all architectures */
53 #define FLAG_GENERIC(name) { name, #name }
54 /* target specific flags (syscall_defs.h has TARGET_<flag>) */
55 #define FLAG_TARGET(name) { TARGET_ ## name, #name }
56 /* end of flags array */
57 #define FLAG_END { 0, NULL }
59 /* Structure used to translate enumerated values into strings */
61 abi_long e_value
; /* enum value */
62 const char *e_string
; /* stringified enum */
65 /* common enums for all architectures */
66 #define ENUM_GENERIC(name) { name, #name }
67 /* target specific enums */
68 #define ENUM_TARGET(name) { TARGET_ ## name, #name }
69 /* end of enums array */
70 #define ENUM_END { 0, NULL }
72 UNUSED
static const char *get_comma(int);
73 UNUSED
static void print_pointer(abi_long
, int);
74 UNUSED
static void print_flags(const struct flags
*, abi_long
, int);
75 UNUSED
static void print_enums(const struct enums
*, abi_long
, int);
76 UNUSED
static void print_at_dirfd(abi_long
, int);
77 UNUSED
static void print_file_mode(abi_long
, int);
78 UNUSED
static void print_open_flags(abi_long
, int);
79 UNUSED
static void print_syscall_prologue(const struct syscallname
*);
80 UNUSED
static void print_syscall_epilogue(const struct syscallname
*);
81 UNUSED
static void print_string(abi_long
, int);
82 UNUSED
static void print_buf(abi_long addr
, abi_long len
, int last
);
83 UNUSED
static void print_raw_param(const char *, abi_long
, int);
84 UNUSED
static void print_timeval(abi_ulong
, int);
85 UNUSED
static void print_timespec(abi_ulong
, int);
86 UNUSED
static void print_timespec64(abi_ulong
, int);
87 UNUSED
static void print_timezone(abi_ulong
, int);
88 UNUSED
static void print_itimerval(abi_ulong
, int);
89 UNUSED
static void print_number(abi_long
, int);
90 UNUSED
static void print_signal(abi_ulong
, int);
91 UNUSED
static void print_sockaddr(abi_ulong
, abi_long
, int);
92 UNUSED
static void print_socket_domain(int domain
);
93 UNUSED
static void print_socket_type(int type
);
94 UNUSED
static void print_socket_protocol(int domain
, int type
, int protocol
);
100 print_ipc_cmd(int cmd
)
102 #define output_cmd(val) \
110 /* General IPC commands */
111 output_cmd( IPC_RMID
);
112 output_cmd( IPC_SET
);
113 output_cmd( IPC_STAT
);
114 output_cmd( IPC_INFO
);
115 /* msgctl() commands */
116 output_cmd( MSG_STAT
);
117 output_cmd( MSG_INFO
);
118 /* shmctl() commands */
119 output_cmd( SHM_LOCK
);
120 output_cmd( SHM_UNLOCK
);
121 output_cmd( SHM_STAT
);
122 output_cmd( SHM_INFO
);
123 /* semctl() commands */
124 output_cmd( GETPID
);
125 output_cmd( GETVAL
);
126 output_cmd( GETALL
);
127 output_cmd( GETNCNT
);
128 output_cmd( GETZCNT
);
129 output_cmd( SETVAL
);
130 output_cmd( SETALL
);
131 output_cmd( SEM_STAT
);
132 output_cmd( SEM_INFO
);
133 output_cmd( IPC_RMID
);
134 output_cmd( IPC_RMID
);
135 output_cmd( IPC_RMID
);
136 output_cmd( IPC_RMID
);
137 output_cmd( IPC_RMID
);
138 output_cmd( IPC_RMID
);
139 output_cmd( IPC_RMID
);
140 output_cmd( IPC_RMID
);
141 output_cmd( IPC_RMID
);
143 /* Some value we don't recognize */
147 static const char * const target_signal_name
[] = {
148 #define MAKE_SIG_ENTRY(sig) [TARGET_##sig] = #sig,
150 #undef MAKE_SIG_ENTRY
154 print_signal(abi_ulong arg
, int last
)
156 const char *signal_name
= NULL
;
158 if (arg
< ARRAY_SIZE(target_signal_name
)) {
159 signal_name
= target_signal_name
[arg
];
162 if (signal_name
== NULL
) {
163 print_raw_param("%ld", arg
, last
);
166 qemu_log("%s%s", signal_name
, get_comma(last
));
169 static void print_si_code(int arg
)
171 const char *codename
= NULL
;
175 codename
= "SI_USER";
178 codename
= "SI_KERNEL";
181 codename
= "SI_QUEUE";
184 codename
= "SI_TIMER";
187 codename
= "SI_MESGQ";
190 codename
= "SI_ASYNCIO";
193 codename
= "SI_SIGIO";
196 codename
= "SI_TKILL";
202 qemu_log("%s", codename
);
205 static void get_target_siginfo(target_siginfo_t
*tinfo
,
206 const target_siginfo_t
*info
)
215 __get_user(sig
, &info
->si_signo
);
216 __get_user(si_errno
, &tinfo
->si_errno
);
217 __get_user(si_code
, &info
->si_code
);
219 tinfo
->si_signo
= sig
;
220 tinfo
->si_errno
= si_errno
;
221 tinfo
->si_code
= si_code
;
223 /* Ensure we don't leak random junk to the guest later */
224 memset(tinfo
->_sifields
._pad
, 0, sizeof(tinfo
->_sifields
._pad
));
226 /* This is awkward, because we have to use a combination of
227 * the si_code and si_signo to figure out which of the union's
228 * members are valid. (Within the host kernel it is always possible
229 * to tell, but the kernel carefully avoids giving userspace the
230 * high 16 bits of si_code, so we don't have the information to
231 * do this the easy way...) We therefore make our best guess,
232 * bearing in mind that a guest can spoof most of the si_codes
233 * via rt_sigqueueinfo() if it likes.
235 * Once we have made our guess, we record it in the top 16 bits of
236 * the si_code, so that print_siginfo() later can use it.
237 * print_siginfo() will strip these top bits out before printing
245 /* Sent via kill(), tkill() or tgkill(), or direct from the kernel.
246 * These are the only unspoofable si_code values.
248 __get_user(tinfo
->_sifields
._kill
._pid
, &info
->_sifields
._kill
._pid
);
249 __get_user(tinfo
->_sifields
._kill
._uid
, &info
->_sifields
._kill
._uid
);
250 si_type
= QEMU_SI_KILL
;
253 /* Everything else is spoofable. Make best guess based on signal */
256 __get_user(tinfo
->_sifields
._sigchld
._pid
,
257 &info
->_sifields
._sigchld
._pid
);
258 __get_user(tinfo
->_sifields
._sigchld
._uid
,
259 &info
->_sifields
._sigchld
._uid
);
260 __get_user(tinfo
->_sifields
._sigchld
._status
,
261 &info
->_sifields
._sigchld
._status
);
262 __get_user(tinfo
->_sifields
._sigchld
._utime
,
263 &info
->_sifields
._sigchld
._utime
);
264 __get_user(tinfo
->_sifields
._sigchld
._stime
,
265 &info
->_sifields
._sigchld
._stime
);
266 si_type
= QEMU_SI_CHLD
;
269 __get_user(tinfo
->_sifields
._sigpoll
._band
,
270 &info
->_sifields
._sigpoll
._band
);
271 __get_user(tinfo
->_sifields
._sigpoll
._fd
,
272 &info
->_sifields
._sigpoll
._fd
);
273 si_type
= QEMU_SI_POLL
;
276 /* Assume a sigqueue()/mq_notify()/rt_sigqueueinfo() source. */
277 __get_user(tinfo
->_sifields
._rt
._pid
, &info
->_sifields
._rt
._pid
);
278 __get_user(tinfo
->_sifields
._rt
._uid
, &info
->_sifields
._rt
._uid
);
279 /* XXX: potential problem if 64 bit */
280 __get_user(sival_ptr
, &info
->_sifields
._rt
._sigval
.sival_ptr
);
281 tinfo
->_sifields
._rt
._sigval
.sival_ptr
= sival_ptr
;
283 si_type
= QEMU_SI_RT
;
289 tinfo
->si_code
= deposit32(si_code
, 16, 16, si_type
);
292 static void print_siginfo(const target_siginfo_t
*tinfo
)
294 /* Print a target_siginfo_t in the format desired for printing
295 * signals being taken. We assume the target_siginfo_t is in the
296 * internal form where the top 16 bits of si_code indicate which
297 * part of the union is valid, rather than in the guest-visible
298 * form where the bottom 16 bits are sign-extended into the top 16.
300 int si_type
= extract32(tinfo
->si_code
, 16, 16);
301 int si_code
= sextract32(tinfo
->si_code
, 0, 16);
303 qemu_log("{si_signo=");
304 print_signal(tinfo
->si_signo
, 1);
305 qemu_log(", si_code=");
306 print_si_code(si_code
);
310 qemu_log(", si_pid=%u, si_uid=%u",
311 (unsigned int)tinfo
->_sifields
._kill
._pid
,
312 (unsigned int)tinfo
->_sifields
._kill
._uid
);
315 qemu_log(", si_timer1=%u, si_timer2=%u",
316 tinfo
->_sifields
._timer
._timer1
,
317 tinfo
->_sifields
._timer
._timer2
);
320 qemu_log(", si_band=%d, si_fd=%d",
321 tinfo
->_sifields
._sigpoll
._band
,
322 tinfo
->_sifields
._sigpoll
._fd
);
325 qemu_log(", si_addr=");
326 print_pointer(tinfo
->_sifields
._sigfault
._addr
, 1);
329 qemu_log(", si_pid=%u, si_uid=%u, si_status=%d"
330 ", si_utime=" TARGET_ABI_FMT_ld
331 ", si_stime=" TARGET_ABI_FMT_ld
,
332 (unsigned int)(tinfo
->_sifields
._sigchld
._pid
),
333 (unsigned int)(tinfo
->_sifields
._sigchld
._uid
),
334 tinfo
->_sifields
._sigchld
._status
,
335 tinfo
->_sifields
._sigchld
._utime
,
336 tinfo
->_sifields
._sigchld
._stime
);
339 qemu_log(", si_pid=%u, si_uid=%u, si_sigval=" TARGET_ABI_FMT_ld
,
340 (unsigned int)tinfo
->_sifields
._rt
._pid
,
341 (unsigned int)tinfo
->_sifields
._rt
._uid
,
342 tinfo
->_sifields
._rt
._sigval
.sival_ptr
);
345 g_assert_not_reached();
351 print_sockaddr(abi_ulong addr
, abi_long addrlen
, int last
)
353 struct target_sockaddr
*sa
;
357 sa
= lock_user(VERIFY_READ
, addr
, addrlen
, 1);
359 sa_family
= tswap16(sa
->sa_family
);
362 struct target_sockaddr_un
*un
= (struct target_sockaddr_un
*)sa
;
364 qemu_log("{sun_family=AF_UNIX,sun_path=\"");
365 for (i
= 0; i
< addrlen
-
366 offsetof(struct target_sockaddr_un
, sun_path
) &&
367 un
->sun_path
[i
]; i
++) {
368 qemu_log("%c", un
->sun_path
[i
]);
374 struct target_sockaddr_in
*in
= (struct target_sockaddr_in
*)sa
;
375 uint8_t *c
= (uint8_t *)&in
->sin_addr
.s_addr
;
376 qemu_log("{sin_family=AF_INET,sin_port=htons(%d),",
377 ntohs(in
->sin_port
));
378 qemu_log("sin_addr=inet_addr(\"%d.%d.%d.%d\")",
379 c
[0], c
[1], c
[2], c
[3]);
384 struct target_sockaddr_ll
*ll
= (struct target_sockaddr_ll
*)sa
;
385 uint8_t *c
= (uint8_t *)&ll
->sll_addr
;
386 qemu_log("{sll_family=AF_PACKET,"
387 "sll_protocol=htons(0x%04x),if%d,pkttype=",
388 ntohs(ll
->sll_protocol
), ll
->sll_ifindex
);
389 switch (ll
->sll_pkttype
) {
391 qemu_log("PACKET_HOST");
393 case PACKET_BROADCAST
:
394 qemu_log("PACKET_BROADCAST");
396 case PACKET_MULTICAST
:
397 qemu_log("PACKET_MULTICAST");
399 case PACKET_OTHERHOST
:
400 qemu_log("PACKET_OTHERHOST");
402 case PACKET_OUTGOING
:
403 qemu_log("PACKET_OUTGOING");
406 qemu_log("%d", ll
->sll_pkttype
);
409 qemu_log(",sll_addr=%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x",
410 c
[0], c
[1], c
[2], c
[3], c
[4], c
[5], c
[6], c
[7]);
415 struct target_sockaddr_nl
*nl
= (struct target_sockaddr_nl
*)sa
;
416 qemu_log("{nl_family=AF_NETLINK,nl_pid=%u,nl_groups=%u}",
417 tswap32(nl
->nl_pid
), tswap32(nl
->nl_groups
));
421 qemu_log("{sa_family=%d, sa_data={", sa
->sa_family
);
422 for (i
= 0; i
< 13; i
++) {
423 qemu_log("%02x, ", sa
->sa_data
[i
]);
425 qemu_log("%02x}", sa
->sa_data
[i
]);
429 unlock_user(sa
, addr
, 0);
431 print_raw_param("0x"TARGET_ABI_FMT_lx
, addr
, 0);
433 qemu_log(", "TARGET_ABI_FMT_ld
"%s", addrlen
, get_comma(last
));
437 print_socket_domain(int domain
)
447 qemu_log("PF_NETLINK");
450 qemu_log("PF_PACKET");
453 qemu_log("%d", domain
);
459 print_socket_type(int type
)
461 switch (type
& TARGET_SOCK_TYPE_MASK
) {
462 case TARGET_SOCK_DGRAM
:
463 qemu_log("SOCK_DGRAM");
465 case TARGET_SOCK_STREAM
:
466 qemu_log("SOCK_STREAM");
468 case TARGET_SOCK_RAW
:
469 qemu_log("SOCK_RAW");
471 case TARGET_SOCK_RDM
:
472 qemu_log("SOCK_RDM");
474 case TARGET_SOCK_SEQPACKET
:
475 qemu_log("SOCK_SEQPACKET");
477 case TARGET_SOCK_PACKET
:
478 qemu_log("SOCK_PACKET");
481 if (type
& TARGET_SOCK_CLOEXEC
) {
482 qemu_log("|SOCK_CLOEXEC");
484 if (type
& TARGET_SOCK_NONBLOCK
) {
485 qemu_log("|SOCK_NONBLOCK");
490 print_socket_protocol(int domain
, int type
, int protocol
)
492 if (domain
== AF_PACKET
||
493 (domain
== AF_INET
&& type
== TARGET_SOCK_PACKET
)) {
496 qemu_log("ETH_P_ALL");
499 qemu_log("%d", protocol
);
504 if (domain
== PF_NETLINK
) {
507 qemu_log("NETLINK_ROUTE");
510 qemu_log("NETLINK_UNUSED");
512 case NETLINK_USERSOCK
:
513 qemu_log("NETLINK_USERSOCK");
515 case NETLINK_FIREWALL
:
516 qemu_log("NETLINK_FIREWALL");
518 case NETLINK_SOCK_DIAG
:
519 qemu_log("NETLINK_SOCK_DIAG");
522 qemu_log("NETLINK_NFLOG");
525 qemu_log("NETLINK_XFRM");
527 case NETLINK_SELINUX
:
528 qemu_log("NETLINK_SELINUX");
531 qemu_log("NETLINK_ISCSI");
534 qemu_log("NETLINK_AUDIT");
536 case NETLINK_FIB_LOOKUP
:
537 qemu_log("NETLINK_FIB_LOOKUP");
539 case NETLINK_CONNECTOR
:
540 qemu_log("NETLINK_CONNECTOR");
542 case NETLINK_NETFILTER
:
543 qemu_log("NETLINK_NETFILTER");
546 qemu_log("NETLINK_IP6_FW");
548 case NETLINK_DNRTMSG
:
549 qemu_log("NETLINK_DNRTMSG");
551 case NETLINK_KOBJECT_UEVENT
:
552 qemu_log("NETLINK_KOBJECT_UEVENT");
554 case NETLINK_GENERIC
:
555 qemu_log("NETLINK_GENERIC");
557 case NETLINK_SCSITRANSPORT
:
558 qemu_log("NETLINK_SCSITRANSPORT");
560 case NETLINK_ECRYPTFS
:
561 qemu_log("NETLINK_ECRYPTFS");
564 qemu_log("NETLINK_RDMA");
567 qemu_log("NETLINK_CRYPTO");
570 qemu_log("NETLINK_SMC");
573 qemu_log("%d", protocol
);
581 qemu_log("IPPROTO_IP");
584 qemu_log("IPPROTO_TCP");
587 qemu_log("IPPROTO_UDP");
590 qemu_log("IPPROTO_RAW");
593 qemu_log("%d", protocol
);
599 #ifdef TARGET_NR__newselect
601 print_fdset(int n
, abi_ulong target_fds_addr
)
607 if( target_fds_addr
) {
608 abi_long
*target_fds
;
610 target_fds
= lock_user(VERIFY_READ
,
612 sizeof(*target_fds
)*(n
/ TARGET_ABI_BITS
+ 1),
618 for (i
=n
; i
>=0; i
--) {
619 if ((tswapal(target_fds
[i
/ TARGET_ABI_BITS
]) >>
620 (i
& (TARGET_ABI_BITS
- 1))) & 1) {
621 qemu_log("%s%d", get_comma(first
), i
);
625 unlock_user(target_fds
, target_fds_addr
, 0);
632 * Sysycall specific output functions
636 #ifdef TARGET_NR__newselect
638 print_newselect(CPUArchState
*cpu_env
, const struct syscallname
*name
,
639 abi_long arg1
, abi_long arg2
, abi_long arg3
,
640 abi_long arg4
, abi_long arg5
, abi_long arg6
)
642 print_syscall_prologue(name
);
643 print_fdset(arg1
, arg2
);
645 print_fdset(arg1
, arg3
);
647 print_fdset(arg1
, arg4
);
649 print_timeval(arg5
, 1);
650 print_syscall_epilogue(name
);
654 #ifdef TARGET_NR_semctl
656 print_semctl(CPUArchState
*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
)
660 qemu_log("%s(" TARGET_ABI_FMT_ld
"," TARGET_ABI_FMT_ld
",",
661 name
->name
, arg1
, arg2
);
663 qemu_log(",0x" TARGET_ABI_FMT_lx
")", arg4
);
669 print_ipc(CPUArchState
*cpu_env
, const struct syscallname
*name
,
670 abi_long arg1
, abi_long arg2
, abi_long arg3
,
671 abi_long arg4
, abi_long arg5
, abi_long arg6
)
675 qemu_log("semctl(" TARGET_ABI_FMT_ld
"," TARGET_ABI_FMT_ld
",",
678 qemu_log(",0x" TARGET_ABI_FMT_lx
")", arg4
);
682 TARGET_ABI_FMT_ld
","
683 TARGET_ABI_FMT_ld
","
684 TARGET_ABI_FMT_ld
","
687 name
->name
, arg1
, arg2
, arg3
, arg4
);
693 * Variants for the return value output function
697 print_syscall_err(abi_long ret
)
703 errstr
= target_strerror(-ret
);
705 qemu_log("-1 errno=%d (%s)", (int)-ret
, errstr
);
713 print_syscall_ret_addr(CPUArchState
*cpu_env
, const struct syscallname
*name
,
714 abi_long ret
, abi_long arg0
, abi_long arg1
,
715 abi_long arg2
, abi_long arg3
, abi_long arg4
,
718 if (!print_syscall_err(ret
)) {
719 qemu_log("0x" TARGET_ABI_FMT_lx
, ret
);
724 #if 0 /* currently unused */
726 print_syscall_ret_raw(struct syscallname
*name
, abi_long ret
)
728 qemu_log(" = 0x" TARGET_ABI_FMT_lx
"\n", ret
);
732 #ifdef TARGET_NR__newselect
734 print_syscall_ret_newselect(CPUArchState
*cpu_env
, const struct syscallname
*name
,
735 abi_long ret
, abi_long arg0
, abi_long arg1
,
736 abi_long arg2
, abi_long arg3
, abi_long arg4
,
739 if (!print_syscall_err(ret
)) {
740 qemu_log(" = 0x" TARGET_ABI_FMT_lx
" (", ret
);
741 print_fdset(arg0
, arg1
);
743 print_fdset(arg0
, arg2
);
745 print_fdset(arg0
, arg3
);
747 print_timeval(arg4
, 1);
755 /* special meanings of adjtimex()' non-negative return values */
756 #define TARGET_TIME_OK 0 /* clock synchronized, no leap second */
757 #define TARGET_TIME_INS 1 /* insert leap second */
758 #define TARGET_TIME_DEL 2 /* delete leap second */
759 #define TARGET_TIME_OOP 3 /* leap second in progress */
760 #define TARGET_TIME_WAIT 4 /* leap second has occurred */
761 #define TARGET_TIME_ERROR 5 /* clock not synchronized */
762 #ifdef TARGET_NR_adjtimex
764 print_syscall_ret_adjtimex(CPUArchState
*cpu_env
, const struct syscallname
*name
,
765 abi_long ret
, abi_long arg0
, abi_long arg1
,
766 abi_long arg2
, abi_long arg3
, abi_long arg4
,
769 if (!print_syscall_err(ret
)) {
770 qemu_log(TARGET_ABI_FMT_ld
, ret
);
773 qemu_log(" TIME_OK (clock synchronized, no leap second)");
775 case TARGET_TIME_INS
:
776 qemu_log(" TIME_INS (insert leap second)");
778 case TARGET_TIME_DEL
:
779 qemu_log(" TIME_DEL (delete leap second)");
781 case TARGET_TIME_OOP
:
782 qemu_log(" TIME_OOP (leap second in progress)");
784 case TARGET_TIME_WAIT
:
785 qemu_log(" TIME_WAIT (leap second has occurred)");
787 case TARGET_TIME_ERROR
:
788 qemu_log(" TIME_ERROR (clock not synchronized)");
797 #if defined(TARGET_NR_clock_gettime) || defined(TARGET_NR_clock_getres)
799 print_syscall_ret_clock_gettime(CPUArchState
*cpu_env
, const struct syscallname
*name
,
800 abi_long ret
, abi_long arg0
, abi_long arg1
,
801 abi_long arg2
, abi_long arg3
, abi_long arg4
,
804 if (!print_syscall_err(ret
)) {
805 qemu_log(TARGET_ABI_FMT_ld
, ret
);
807 print_timespec(arg1
, 1);
813 #define print_syscall_ret_clock_getres print_syscall_ret_clock_gettime
816 #if defined(TARGET_NR_clock_gettime64)
818 print_syscall_ret_clock_gettime64(CPUArchState
*cpu_env
, const struct syscallname
*name
,
819 abi_long ret
, abi_long arg0
, abi_long arg1
,
820 abi_long arg2
, abi_long arg3
, abi_long arg4
,
823 if (!print_syscall_err(ret
)) {
824 qemu_log(TARGET_ABI_FMT_ld
, ret
);
826 print_timespec64(arg1
, 1);
834 #ifdef TARGET_NR_gettimeofday
836 print_syscall_ret_gettimeofday(CPUArchState
*cpu_env
, const struct syscallname
*name
,
837 abi_long ret
, abi_long arg0
, abi_long arg1
,
838 abi_long arg2
, abi_long arg3
, abi_long arg4
,
841 if (!print_syscall_err(ret
)) {
842 qemu_log(TARGET_ABI_FMT_ld
, ret
);
844 print_timeval(arg0
, 0);
845 print_timezone(arg1
, 1);
853 #ifdef TARGET_NR_getitimer
855 print_syscall_ret_getitimer(CPUArchState
*cpu_env
, const struct syscallname
*name
,
856 abi_long ret
, abi_long arg0
, abi_long arg1
,
857 abi_long arg2
, abi_long arg3
, abi_long arg4
,
860 if (!print_syscall_err(ret
)) {
861 qemu_log(TARGET_ABI_FMT_ld
, ret
);
863 print_itimerval(arg1
, 1);
872 #ifdef TARGET_NR_getitimer
874 print_syscall_ret_setitimer(CPUArchState
*cpu_env
, const struct syscallname
*name
,
875 abi_long ret
, abi_long arg0
, abi_long arg1
,
876 abi_long arg2
, abi_long arg3
, abi_long arg4
,
879 if (!print_syscall_err(ret
)) {
880 qemu_log(TARGET_ABI_FMT_ld
, ret
);
881 qemu_log(" (old_value = ");
882 print_itimerval(arg2
, 1);
890 #if defined(TARGET_NR_listxattr) || defined(TARGET_NR_llistxattr) \
891 || defined(TARGGET_NR_flistxattr)
893 print_syscall_ret_listxattr(CPUArchState
*cpu_env
, const struct syscallname
*name
,
894 abi_long ret
, abi_long arg0
, abi_long arg1
,
895 abi_long arg2
, abi_long arg3
, abi_long arg4
,
898 if (!print_syscall_err(ret
)) {
899 qemu_log(TARGET_ABI_FMT_ld
, ret
);
900 qemu_log(" (list = ");
902 abi_long attr
= arg1
;
907 print_string(attr
, 1);
908 ret
-= target_strlen(attr
) + 1;
909 attr
+= target_strlen(attr
) + 1;
919 #define print_syscall_ret_llistxattr print_syscall_ret_listxattr
920 #define print_syscall_ret_flistxattr print_syscall_ret_listxattr
923 #ifdef TARGET_NR_ioctl
925 print_syscall_ret_ioctl(CPUArchState
*cpu_env
, const struct syscallname
*name
,
926 abi_long ret
, abi_long arg0
, abi_long arg1
,
927 abi_long arg2
, abi_long arg3
, abi_long arg4
,
930 if (!print_syscall_err(ret
)) {
931 qemu_log(TARGET_ABI_FMT_ld
, ret
);
933 const IOCTLEntry
*ie
;
934 const argtype
*arg_type
;
938 for (ie
= ioctl_entries
; ie
->target_cmd
!= 0; ie
++) {
939 if (ie
->target_cmd
== arg1
) {
944 if (ie
->target_cmd
== arg1
&&
945 (ie
->access
== IOC_R
|| ie
->access
== IOC_RW
)) {
946 arg_type
= ie
->arg_type
;
949 target_size
= thunk_type_size(arg_type
, 0);
950 argptr
= lock_user(VERIFY_READ
, arg2
, target_size
, 1);
952 thunk_print(argptr
, arg_type
);
953 unlock_user(argptr
, arg2
, target_size
);
955 print_pointer(arg2
, 1);
964 UNUSED
static const struct flags access_flags
[] = {
972 UNUSED
static const struct flags at_file_flags
[] = {
974 FLAG_GENERIC(AT_EACCESS
),
976 #ifdef AT_SYMLINK_NOFOLLOW
977 FLAG_GENERIC(AT_SYMLINK_NOFOLLOW
),
982 UNUSED
static const struct flags unlinkat_flags
[] = {
984 FLAG_GENERIC(AT_REMOVEDIR
),
989 UNUSED
static const struct flags mode_flags
[] = {
990 FLAG_GENERIC(S_IFSOCK
),
991 FLAG_GENERIC(S_IFLNK
),
992 FLAG_GENERIC(S_IFREG
),
993 FLAG_GENERIC(S_IFBLK
),
994 FLAG_GENERIC(S_IFDIR
),
995 FLAG_GENERIC(S_IFCHR
),
996 FLAG_GENERIC(S_IFIFO
),
1000 UNUSED
static const struct flags open_access_flags
[] = {
1001 FLAG_TARGET(O_RDONLY
),
1002 FLAG_TARGET(O_WRONLY
),
1003 FLAG_TARGET(O_RDWR
),
1007 UNUSED
static const struct flags open_flags
[] = {
1008 FLAG_TARGET(O_APPEND
),
1009 FLAG_TARGET(O_CREAT
),
1010 FLAG_TARGET(O_DIRECTORY
),
1011 FLAG_TARGET(O_EXCL
),
1012 FLAG_TARGET(O_LARGEFILE
),
1013 FLAG_TARGET(O_NOCTTY
),
1014 FLAG_TARGET(O_NOFOLLOW
),
1015 FLAG_TARGET(O_NONBLOCK
), /* also O_NDELAY */
1016 FLAG_TARGET(O_DSYNC
),
1017 FLAG_TARGET(__O_SYNC
),
1018 FLAG_TARGET(O_TRUNC
),
1020 FLAG_TARGET(O_DIRECT
),
1023 FLAG_TARGET(O_NOATIME
),
1026 FLAG_TARGET(O_CLOEXEC
),
1029 FLAG_TARGET(O_PATH
),
1032 FLAG_TARGET(O_TMPFILE
),
1033 FLAG_TARGET(__O_TMPFILE
),
1038 UNUSED
static const struct flags mount_flags
[] = {
1040 FLAG_GENERIC(MS_BIND
),
1043 FLAG_GENERIC(MS_DIRSYNC
),
1045 FLAG_GENERIC(MS_MANDLOCK
),
1047 FLAG_GENERIC(MS_MOVE
),
1049 FLAG_GENERIC(MS_NOATIME
),
1050 FLAG_GENERIC(MS_NODEV
),
1051 FLAG_GENERIC(MS_NODIRATIME
),
1052 FLAG_GENERIC(MS_NOEXEC
),
1053 FLAG_GENERIC(MS_NOSUID
),
1054 FLAG_GENERIC(MS_RDONLY
),
1056 FLAG_GENERIC(MS_RELATIME
),
1058 FLAG_GENERIC(MS_REMOUNT
),
1059 FLAG_GENERIC(MS_SYNCHRONOUS
),
1063 UNUSED
static const struct flags umount2_flags
[] = {
1065 FLAG_GENERIC(MNT_FORCE
),
1068 FLAG_GENERIC(MNT_DETACH
),
1071 FLAG_GENERIC(MNT_EXPIRE
),
1076 UNUSED
static const struct flags mmap_prot_flags
[] = {
1077 FLAG_GENERIC(PROT_NONE
),
1078 FLAG_GENERIC(PROT_EXEC
),
1079 FLAG_GENERIC(PROT_READ
),
1080 FLAG_GENERIC(PROT_WRITE
),
1081 FLAG_TARGET(PROT_SEM
),
1082 FLAG_GENERIC(PROT_GROWSDOWN
),
1083 FLAG_GENERIC(PROT_GROWSUP
),
1087 UNUSED
static const struct flags mmap_flags
[] = {
1088 FLAG_TARGET(MAP_SHARED
),
1089 FLAG_TARGET(MAP_PRIVATE
),
1090 FLAG_TARGET(MAP_ANONYMOUS
),
1091 FLAG_TARGET(MAP_DENYWRITE
),
1092 FLAG_TARGET(MAP_FIXED
),
1093 FLAG_TARGET(MAP_GROWSDOWN
),
1094 FLAG_TARGET(MAP_EXECUTABLE
),
1096 FLAG_TARGET(MAP_LOCKED
),
1099 FLAG_TARGET(MAP_NONBLOCK
),
1101 FLAG_TARGET(MAP_NORESERVE
),
1103 FLAG_TARGET(MAP_POPULATE
),
1105 #ifdef TARGET_MAP_UNINITIALIZED
1106 FLAG_TARGET(MAP_UNINITIALIZED
),
1108 FLAG_TARGET(MAP_HUGETLB
),
1109 FLAG_TARGET(MAP_STACK
),
1113 UNUSED
static const struct flags clone_flags
[] = {
1114 FLAG_GENERIC(CLONE_VM
),
1115 FLAG_GENERIC(CLONE_FS
),
1116 FLAG_GENERIC(CLONE_FILES
),
1117 FLAG_GENERIC(CLONE_SIGHAND
),
1118 FLAG_GENERIC(CLONE_PTRACE
),
1119 FLAG_GENERIC(CLONE_VFORK
),
1120 FLAG_GENERIC(CLONE_PARENT
),
1121 FLAG_GENERIC(CLONE_THREAD
),
1122 FLAG_GENERIC(CLONE_NEWNS
),
1123 FLAG_GENERIC(CLONE_SYSVSEM
),
1124 FLAG_GENERIC(CLONE_SETTLS
),
1125 FLAG_GENERIC(CLONE_PARENT_SETTID
),
1126 FLAG_GENERIC(CLONE_CHILD_CLEARTID
),
1127 FLAG_GENERIC(CLONE_DETACHED
),
1128 FLAG_GENERIC(CLONE_UNTRACED
),
1129 FLAG_GENERIC(CLONE_CHILD_SETTID
),
1130 #if defined(CLONE_NEWUTS)
1131 FLAG_GENERIC(CLONE_NEWUTS
),
1133 #if defined(CLONE_NEWIPC)
1134 FLAG_GENERIC(CLONE_NEWIPC
),
1136 #if defined(CLONE_NEWUSER)
1137 FLAG_GENERIC(CLONE_NEWUSER
),
1139 #if defined(CLONE_NEWPID)
1140 FLAG_GENERIC(CLONE_NEWPID
),
1142 #if defined(CLONE_NEWNET)
1143 FLAG_GENERIC(CLONE_NEWNET
),
1145 #if defined(CLONE_NEWCGROUP)
1146 FLAG_GENERIC(CLONE_NEWCGROUP
),
1148 #if defined(CLONE_NEWTIME)
1149 FLAG_GENERIC(CLONE_NEWTIME
),
1151 #if defined(CLONE_IO)
1152 FLAG_GENERIC(CLONE_IO
),
1157 UNUSED
static const struct flags execveat_flags
[] = {
1158 #ifdef AT_EMPTY_PATH
1159 FLAG_GENERIC(AT_EMPTY_PATH
),
1161 #ifdef AT_SYMLINK_NOFOLLOW
1162 FLAG_GENERIC(AT_SYMLINK_NOFOLLOW
),
1167 UNUSED
static const struct flags msg_flags
[] = {
1169 FLAG_GENERIC(MSG_CONFIRM
),
1170 FLAG_GENERIC(MSG_DONTROUTE
),
1171 FLAG_GENERIC(MSG_DONTWAIT
),
1172 FLAG_GENERIC(MSG_EOR
),
1173 FLAG_GENERIC(MSG_MORE
),
1174 FLAG_GENERIC(MSG_NOSIGNAL
),
1175 FLAG_GENERIC(MSG_OOB
),
1177 FLAG_GENERIC(MSG_CMSG_CLOEXEC
),
1178 FLAG_GENERIC(MSG_ERRQUEUE
),
1179 FLAG_GENERIC(MSG_PEEK
),
1180 FLAG_GENERIC(MSG_TRUNC
),
1181 FLAG_GENERIC(MSG_WAITALL
),
1183 FLAG_GENERIC(MSG_CTRUNC
),
1187 UNUSED
static const struct flags statx_flags
[] = {
1188 #ifdef AT_EMPTY_PATH
1189 FLAG_GENERIC(AT_EMPTY_PATH
),
1191 #ifdef AT_NO_AUTOMOUNT
1192 FLAG_GENERIC(AT_NO_AUTOMOUNT
),
1194 #ifdef AT_SYMLINK_NOFOLLOW
1195 FLAG_GENERIC(AT_SYMLINK_NOFOLLOW
),
1197 #ifdef AT_STATX_SYNC_AS_STAT
1198 FLAG_GENERIC(AT_STATX_SYNC_AS_STAT
),
1200 #ifdef AT_STATX_FORCE_SYNC
1201 FLAG_GENERIC(AT_STATX_FORCE_SYNC
),
1203 #ifdef AT_STATX_DONT_SYNC
1204 FLAG_GENERIC(AT_STATX_DONT_SYNC
),
1209 UNUSED
static const struct flags statx_mask
[] = {
1210 /* This must come first, because it includes everything. */
1212 FLAG_GENERIC(STATX_ALL
),
1214 /* This must come second; it includes everything except STATX_BTIME. */
1215 #ifdef STATX_BASIC_STATS
1216 FLAG_GENERIC(STATX_BASIC_STATS
),
1219 FLAG_GENERIC(STATX_TYPE
),
1222 FLAG_GENERIC(STATX_MODE
),
1225 FLAG_GENERIC(STATX_NLINK
),
1228 FLAG_GENERIC(STATX_UID
),
1231 FLAG_GENERIC(STATX_GID
),
1234 FLAG_GENERIC(STATX_ATIME
),
1237 FLAG_GENERIC(STATX_MTIME
),
1240 FLAG_GENERIC(STATX_CTIME
),
1243 FLAG_GENERIC(STATX_INO
),
1246 FLAG_GENERIC(STATX_SIZE
),
1249 FLAG_GENERIC(STATX_BLOCKS
),
1252 FLAG_GENERIC(STATX_BTIME
),
1257 UNUSED
static const struct flags falloc_flags
[] = {
1258 FLAG_GENERIC(FALLOC_FL_KEEP_SIZE
),
1259 FLAG_GENERIC(FALLOC_FL_PUNCH_HOLE
),
1260 #ifdef FALLOC_FL_NO_HIDE_STALE
1261 FLAG_GENERIC(FALLOC_FL_NO_HIDE_STALE
),
1263 #ifdef FALLOC_FL_COLLAPSE_RANGE
1264 FLAG_GENERIC(FALLOC_FL_COLLAPSE_RANGE
),
1266 #ifdef FALLOC_FL_ZERO_RANGE
1267 FLAG_GENERIC(FALLOC_FL_ZERO_RANGE
),
1269 #ifdef FALLOC_FL_INSERT_RANGE
1270 FLAG_GENERIC(FALLOC_FL_INSERT_RANGE
),
1272 #ifdef FALLOC_FL_UNSHARE_RANGE
1273 FLAG_GENERIC(FALLOC_FL_UNSHARE_RANGE
),
1277 UNUSED
static const struct flags termios_iflags
[] = {
1278 FLAG_TARGET(IGNBRK
),
1279 FLAG_TARGET(BRKINT
),
1280 FLAG_TARGET(IGNPAR
),
1281 FLAG_TARGET(PARMRK
),
1283 FLAG_TARGET(ISTRIP
),
1291 FLAG_TARGET(IMAXBEL
),
1296 UNUSED
static const struct flags termios_oflags
[] = {
1302 FLAG_TARGET(ONLRET
),
1308 UNUSED
static struct enums termios_oflags_NLDLY
[] = {
1314 UNUSED
static struct enums termios_oflags_CRDLY
[] = {
1322 UNUSED
static struct enums termios_oflags_TABDLY
[] = {
1330 UNUSED
static struct enums termios_oflags_VTDLY
[] = {
1336 UNUSED
static struct enums termios_oflags_FFDLY
[] = {
1342 UNUSED
static struct enums termios_oflags_BSDLY
[] = {
1348 UNUSED
static struct enums termios_cflags_CBAUD
[] = {
1363 ENUM_TARGET(B19200
),
1364 ENUM_TARGET(B38400
),
1365 ENUM_TARGET(B57600
),
1366 ENUM_TARGET(B115200
),
1367 ENUM_TARGET(B230400
),
1368 ENUM_TARGET(B460800
),
1372 UNUSED
static struct enums termios_cflags_CSIZE
[] = {
1380 UNUSED
static const struct flags termios_cflags
[] = {
1381 FLAG_TARGET(CSTOPB
),
1383 FLAG_TARGET(PARENB
),
1384 FLAG_TARGET(PARODD
),
1386 FLAG_TARGET(CLOCAL
),
1387 FLAG_TARGET(CRTSCTS
),
1391 UNUSED
static const struct flags termios_lflags
[] = {
1393 FLAG_TARGET(ICANON
),
1398 FLAG_TARGET(ECHONL
),
1399 FLAG_TARGET(NOFLSH
),
1400 FLAG_TARGET(TOSTOP
),
1401 FLAG_TARGET(ECHOCTL
),
1402 FLAG_TARGET(ECHOPRT
),
1403 FLAG_TARGET(ECHOKE
),
1404 FLAG_TARGET(FLUSHO
),
1405 FLAG_TARGET(PENDIN
),
1406 FLAG_TARGET(IEXTEN
),
1407 FLAG_TARGET(EXTPROC
),
1411 #ifdef TARGET_NR_mlockall
1412 static const struct flags mlockall_flags
[] = {
1413 FLAG_TARGET(MCL_CURRENT
),
1414 FLAG_TARGET(MCL_FUTURE
),
1416 FLAG_TARGET(MCL_ONFAULT
),
1422 /* IDs of the various system clocks */
1423 #define TARGET_CLOCK_REALTIME 0
1424 #define TARGET_CLOCK_MONOTONIC 1
1425 #define TARGET_CLOCK_PROCESS_CPUTIME_ID 2
1426 #define TARGET_CLOCK_THREAD_CPUTIME_ID 3
1427 #define TARGET_CLOCK_MONOTONIC_RAW 4
1428 #define TARGET_CLOCK_REALTIME_COARSE 5
1429 #define TARGET_CLOCK_MONOTONIC_COARSE 6
1430 #define TARGET_CLOCK_BOOTTIME 7
1431 #define TARGET_CLOCK_REALTIME_ALARM 8
1432 #define TARGET_CLOCK_BOOTTIME_ALARM 9
1433 #define TARGET_CLOCK_SGI_CYCLE 10
1434 #define TARGET_CLOCK_TAI 11
1436 UNUSED
static struct enums clockids
[] = {
1437 ENUM_TARGET(CLOCK_REALTIME
),
1438 ENUM_TARGET(CLOCK_MONOTONIC
),
1439 ENUM_TARGET(CLOCK_PROCESS_CPUTIME_ID
),
1440 ENUM_TARGET(CLOCK_THREAD_CPUTIME_ID
),
1441 ENUM_TARGET(CLOCK_MONOTONIC_RAW
),
1442 ENUM_TARGET(CLOCK_REALTIME_COARSE
),
1443 ENUM_TARGET(CLOCK_MONOTONIC_COARSE
),
1444 ENUM_TARGET(CLOCK_BOOTTIME
),
1445 ENUM_TARGET(CLOCK_REALTIME_ALARM
),
1446 ENUM_TARGET(CLOCK_BOOTTIME_ALARM
),
1447 ENUM_TARGET(CLOCK_SGI_CYCLE
),
1448 ENUM_TARGET(CLOCK_TAI
),
1452 UNUSED
static struct enums itimer_types
[] = {
1453 ENUM_GENERIC(ITIMER_REAL
),
1454 ENUM_GENERIC(ITIMER_VIRTUAL
),
1455 ENUM_GENERIC(ITIMER_PROF
),
1460 * print_xxx utility functions. These are used to print syscall
1461 * parameters in certain format. All of these have parameter
1462 * named 'last'. This parameter is used to add comma to output
1469 return ((last
) ? "" : ",");
1473 print_flags(const struct flags
*f
, abi_long flags
, int last
)
1475 const char *sep
= "";
1478 if ((flags
== 0) && (f
->f_value
== 0)) {
1479 qemu_log("%s%s", f
->f_string
, get_comma(last
));
1482 for (n
= 0; f
->f_string
!= NULL
; f
++) {
1483 if ((f
->f_value
!= 0) && ((flags
& f
->f_value
) == f
->f_value
)) {
1484 qemu_log("%s%s", sep
, f
->f_string
);
1485 flags
&= ~f
->f_value
;
1492 /* print rest of the flags as numeric */
1494 qemu_log("%s%#x%s", sep
, (unsigned int)flags
, get_comma(last
));
1496 qemu_log("%s", get_comma(last
));
1499 /* no string version of flags found, print them in hex then */
1500 qemu_log("%#x%s", (unsigned int)flags
, get_comma(last
));
1505 print_enums(const struct enums
*e
, abi_long enum_arg
, int last
)
1507 for (; e
->e_string
!= NULL
; e
++) {
1508 if (e
->e_value
== enum_arg
) {
1509 qemu_log("%s", e
->e_string
);
1514 if (e
->e_string
== NULL
) {
1515 qemu_log("%#x", (unsigned int)enum_arg
);
1518 qemu_log("%s", get_comma(last
));
1522 print_at_dirfd(abi_long dirfd
, int last
)
1525 if (dirfd
== AT_FDCWD
) {
1526 qemu_log("AT_FDCWD%s", get_comma(last
));
1530 qemu_log("%d%s", (int)dirfd
, get_comma(last
));
1534 print_file_mode(abi_long mode
, int last
)
1536 const char *sep
= "";
1537 const struct flags
*m
;
1540 qemu_log("000%s", get_comma(last
));
1544 for (m
= &mode_flags
[0]; m
->f_string
!= NULL
; m
++) {
1545 if ((m
->f_value
& mode
) == m
->f_value
) {
1546 qemu_log("%s%s", m
->f_string
, sep
);
1548 mode
&= ~m
->f_value
;
1554 /* print rest of the mode as octal */
1556 qemu_log("%s%#o", sep
, (unsigned int)mode
);
1558 qemu_log("%s", get_comma(last
));
1562 print_open_flags(abi_long flags
, int last
)
1564 print_flags(open_access_flags
, flags
& TARGET_O_ACCMODE
, 1);
1565 flags
&= ~TARGET_O_ACCMODE
;
1567 qemu_log("%s", get_comma(last
));
1571 print_flags(open_flags
, flags
, last
);
1575 print_syscall_prologue(const struct syscallname
*sc
)
1577 qemu_log("%s(", sc
->name
);
1582 print_syscall_epilogue(const struct syscallname
*sc
)
1589 print_string(abi_long addr
, int last
)
1593 if ((s
= lock_user_string(addr
)) != NULL
) {
1594 qemu_log("\"%s\"%s", s
, get_comma(last
));
1595 unlock_user(s
, addr
, 0);
1597 /* can't get string out of it, so print it as pointer */
1598 print_pointer(addr
, last
);
1602 #define MAX_PRINT_BUF 40
1604 print_buf(abi_long addr
, abi_long len
, int last
)
1609 s
= lock_user(VERIFY_READ
, addr
, len
, 1);
1612 for (i
= 0; i
< MAX_PRINT_BUF
&& i
< len
; i
++) {
1613 if (isprint(s
[i
])) {
1614 qemu_log("%c", s
[i
]);
1616 qemu_log("\\%o", s
[i
]);
1626 unlock_user(s
, addr
, 0);
1628 print_pointer(addr
, last
);
1633 * Prints out raw parameter using given format. Caller needs
1634 * to do byte swapping if needed.
1637 print_raw_param(const char *fmt
, abi_long param
, int last
)
1641 (void) snprintf(format
, sizeof (format
), "%s%s", fmt
, get_comma(last
));
1642 qemu_log(format
, param
);
1646 print_pointer(abi_long p
, int last
)
1649 qemu_log("NULL%s", get_comma(last
));
1651 qemu_log("0x" TARGET_ABI_FMT_lx
"%s", p
, get_comma(last
));
1655 * Reads 32-bit (int) number from guest address space from
1656 * address 'addr' and prints it.
1659 print_number(abi_long addr
, int last
)
1662 qemu_log("NULL%s", get_comma(last
));
1666 get_user_s32(num
, addr
);
1667 qemu_log("[%d]%s", num
, get_comma(last
));
1672 print_timeval(abi_ulong tv_addr
, int last
)
1675 struct target_timeval
*tv
;
1677 tv
= lock_user(VERIFY_READ
, tv_addr
, sizeof(*tv
), 1);
1679 print_pointer(tv_addr
, last
);
1682 qemu_log("{tv_sec = " TARGET_ABI_FMT_ld
1683 ",tv_usec = " TARGET_ABI_FMT_ld
"}%s",
1684 tswapal(tv
->tv_sec
), tswapal(tv
->tv_usec
), get_comma(last
));
1685 unlock_user(tv
, tv_addr
, 0);
1687 qemu_log("NULL%s", get_comma(last
));
1691 print_timespec(abi_ulong ts_addr
, int last
)
1694 struct target_timespec
*ts
;
1696 ts
= lock_user(VERIFY_READ
, ts_addr
, sizeof(*ts
), 1);
1698 print_pointer(ts_addr
, last
);
1701 qemu_log("{tv_sec = " TARGET_ABI_FMT_ld
1702 ",tv_nsec = " TARGET_ABI_FMT_ld
"}%s",
1703 tswapal(ts
->tv_sec
), tswapal(ts
->tv_nsec
), get_comma(last
));
1704 unlock_user(ts
, ts_addr
, 0);
1706 qemu_log("NULL%s", get_comma(last
));
1711 print_timespec64(abi_ulong ts_addr
, int last
)
1714 struct target__kernel_timespec
*ts
;
1716 ts
= lock_user(VERIFY_READ
, ts_addr
, sizeof(*ts
), 1);
1718 print_pointer(ts_addr
, last
);
1721 qemu_log("{tv_sec = %lld"
1722 ",tv_nsec = %lld}%s",
1723 (long long)tswap64(ts
->tv_sec
), (long long)tswap64(ts
->tv_nsec
),
1725 unlock_user(ts
, ts_addr
, 0);
1727 qemu_log("NULL%s", get_comma(last
));
1732 print_timezone(abi_ulong tz_addr
, int last
)
1735 struct target_timezone
*tz
;
1737 tz
= lock_user(VERIFY_READ
, tz_addr
, sizeof(*tz
), 1);
1739 print_pointer(tz_addr
, last
);
1742 qemu_log("{%d,%d}%s", tswap32(tz
->tz_minuteswest
),
1743 tswap32(tz
->tz_dsttime
), get_comma(last
));
1744 unlock_user(tz
, tz_addr
, 0);
1746 qemu_log("NULL%s", get_comma(last
));
1751 print_itimerval(abi_ulong it_addr
, int last
)
1754 qemu_log("{it_interval=");
1755 print_timeval(it_addr
+
1756 offsetof(struct target_itimerval
, it_interval
), 0);
1757 qemu_log("it_value=");
1758 print_timeval(it_addr
+
1759 offsetof(struct target_itimerval
, it_value
), 0);
1760 qemu_log("}%s", get_comma(last
));
1762 qemu_log("NULL%s", get_comma(last
));
1767 print_termios(void *arg
)
1769 const struct target_termios
*target
= arg
;
1771 target_tcflag_t iflags
= tswap32(target
->c_iflag
);
1772 target_tcflag_t oflags
= tswap32(target
->c_oflag
);
1773 target_tcflag_t cflags
= tswap32(target
->c_cflag
);
1774 target_tcflag_t lflags
= tswap32(target
->c_lflag
);
1778 qemu_log("c_iflag = ");
1779 print_flags(termios_iflags
, iflags
, 0);
1781 qemu_log("c_oflag = ");
1782 target_tcflag_t oflags_clean
= oflags
& ~(TARGET_NLDLY
| TARGET_CRDLY
|
1783 TARGET_TABDLY
| TARGET_BSDLY
|
1784 TARGET_VTDLY
| TARGET_FFDLY
);
1785 print_flags(termios_oflags
, oflags_clean
, 0);
1786 if (oflags
& TARGET_NLDLY
) {
1787 print_enums(termios_oflags_NLDLY
, oflags
& TARGET_NLDLY
, 0);
1789 if (oflags
& TARGET_CRDLY
) {
1790 print_enums(termios_oflags_CRDLY
, oflags
& TARGET_CRDLY
, 0);
1792 if (oflags
& TARGET_TABDLY
) {
1793 print_enums(termios_oflags_TABDLY
, oflags
& TARGET_TABDLY
, 0);
1795 if (oflags
& TARGET_BSDLY
) {
1796 print_enums(termios_oflags_BSDLY
, oflags
& TARGET_BSDLY
, 0);
1798 if (oflags
& TARGET_VTDLY
) {
1799 print_enums(termios_oflags_VTDLY
, oflags
& TARGET_VTDLY
, 0);
1801 if (oflags
& TARGET_FFDLY
) {
1802 print_enums(termios_oflags_FFDLY
, oflags
& TARGET_FFDLY
, 0);
1805 qemu_log("c_cflag = ");
1806 if (cflags
& TARGET_CBAUD
) {
1807 print_enums(termios_cflags_CBAUD
, cflags
& TARGET_CBAUD
, 0);
1809 if (cflags
& TARGET_CSIZE
) {
1810 print_enums(termios_cflags_CSIZE
, cflags
& TARGET_CSIZE
, 0);
1812 target_tcflag_t cflags_clean
= cflags
& ~(TARGET_CBAUD
| TARGET_CSIZE
);
1813 print_flags(termios_cflags
, cflags_clean
, 0);
1815 qemu_log("c_lflag = ");
1816 print_flags(termios_lflags
, lflags
, 0);
1818 qemu_log("c_cc = ");
1819 qemu_log("\"%s\",", target
->c_cc
);
1821 qemu_log("c_line = ");
1822 print_raw_param("\'%c\'", target
->c_line
, 1);
1829 #ifdef TARGET_NR_accept
1831 print_accept(CPUArchState
*cpu_env
, const struct syscallname
*name
,
1832 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1833 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1835 print_syscall_prologue(name
);
1836 print_raw_param("%d", arg0
, 0);
1837 print_pointer(arg1
, 0);
1838 print_number(arg2
, 1);
1839 print_syscall_epilogue(name
);
1843 #ifdef TARGET_NR_access
1845 print_access(CPUArchState
*cpu_env
, const struct syscallname
*name
,
1846 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1847 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1849 print_syscall_prologue(name
);
1850 print_string(arg0
, 0);
1851 print_flags(access_flags
, arg1
, 1);
1852 print_syscall_epilogue(name
);
1856 #ifdef TARGET_NR_acct
1858 print_acct(CPUArchState
*cpu_env
, const struct syscallname
*name
,
1859 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1860 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1862 print_syscall_prologue(name
);
1863 print_string(arg0
, 1);
1864 print_syscall_epilogue(name
);
1868 #ifdef TARGET_NR_brk
1870 print_brk(CPUArchState
*cpu_env
, const struct syscallname
*name
,
1871 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1872 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1874 print_syscall_prologue(name
);
1875 print_pointer(arg0
, 1);
1876 print_syscall_epilogue(name
);
1880 #ifdef TARGET_NR_chdir
1882 print_chdir(CPUArchState
*cpu_env
, const struct syscallname
*name
,
1883 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1884 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1886 print_syscall_prologue(name
);
1887 print_string(arg0
, 1);
1888 print_syscall_epilogue(name
);
1892 #ifdef TARGET_NR_chroot
1894 print_chroot(CPUArchState
*cpu_env
, const struct syscallname
*name
,
1895 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1896 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1898 print_syscall_prologue(name
);
1899 print_string(arg0
, 1);
1900 print_syscall_epilogue(name
);
1904 #ifdef TARGET_NR_chmod
1906 print_chmod(CPUArchState
*cpu_env
, const struct syscallname
*name
,
1907 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1908 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1910 print_syscall_prologue(name
);
1911 print_string(arg0
, 0);
1912 print_file_mode(arg1
, 1);
1913 print_syscall_epilogue(name
);
1917 #if defined(TARGET_NR_chown) || defined(TARGET_NR_lchown)
1919 print_chown(CPUArchState
*cpu_env
, const struct syscallname
*name
,
1920 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1921 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1923 print_syscall_prologue(name
);
1924 print_string(arg0
, 0);
1925 print_raw_param("%d", arg1
, 0);
1926 print_raw_param("%d", arg2
, 1);
1927 print_syscall_epilogue(name
);
1929 #define print_lchown print_chown
1932 #ifdef TARGET_NR_clock_adjtime
1934 print_clock_adjtime(CPUArchState
*cpu_env
, const struct syscallname
*name
,
1935 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1936 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1938 print_syscall_prologue(name
);
1939 print_enums(clockids
, arg0
, 0);
1940 print_pointer(arg1
, 1);
1941 print_syscall_epilogue(name
);
1945 #ifdef TARGET_NR_clone
1946 static void do_print_clone(unsigned int flags
, abi_ulong newsp
,
1947 abi_ulong parent_tidptr
, target_ulong newtls
,
1948 abi_ulong child_tidptr
)
1950 print_flags(clone_flags
, flags
, 0);
1951 print_raw_param("child_stack=0x" TARGET_ABI_FMT_lx
, newsp
, 0);
1952 print_raw_param("parent_tidptr=0x" TARGET_ABI_FMT_lx
, parent_tidptr
, 0);
1953 print_raw_param("tls=0x" TARGET_ABI_FMT_lx
, newtls
, 0);
1954 print_raw_param("child_tidptr=0x" TARGET_ABI_FMT_lx
, child_tidptr
, 1);
1958 print_clone(CPUArchState
*cpu_env
, const struct syscallname
*name
,
1959 abi_long arg1
, abi_long arg2
, abi_long arg3
,
1960 abi_long arg4
, abi_long arg5
, abi_long arg6
)
1962 print_syscall_prologue(name
);
1963 #if defined(TARGET_MICROBLAZE)
1964 do_print_clone(arg1
, arg2
, arg4
, arg6
, arg5
);
1965 #elif defined(TARGET_CLONE_BACKWARDS)
1966 do_print_clone(arg1
, arg2
, arg3
, arg4
, arg5
);
1967 #elif defined(TARGET_CLONE_BACKWARDS2)
1968 do_print_clone(arg2
, arg1
, arg3
, arg5
, arg4
);
1970 do_print_clone(arg1
, arg2
, arg3
, arg5
, arg4
);
1972 print_syscall_epilogue(name
);
1976 #ifdef TARGET_NR_creat
1978 print_creat(CPUArchState
*cpu_env
, const struct syscallname
*name
,
1979 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1980 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1982 print_syscall_prologue(name
);
1983 print_string(arg0
, 0);
1984 print_file_mode(arg1
, 1);
1985 print_syscall_epilogue(name
);
1989 #ifdef TARGET_NR_execv
1991 print_execv(CPUArchState
*cpu_env
, const struct syscallname
*name
,
1992 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1993 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1995 print_syscall_prologue(name
);
1996 print_string(arg0
, 0);
1997 print_raw_param("0x" TARGET_ABI_FMT_lx
, arg1
, 1);
1998 print_syscall_epilogue(name
);
2003 print_execve_argv(abi_long argv
, int last
)
2005 abi_ulong arg_ptr_addr
;
2009 for (arg_ptr_addr
= argv
; ; arg_ptr_addr
+= sizeof(abi_ulong
)) {
2010 abi_ulong
*arg_ptr
, arg_addr
;
2012 arg_ptr
= lock_user(VERIFY_READ
, arg_ptr_addr
, sizeof(abi_ulong
), 1);
2016 arg_addr
= tswapal(*arg_ptr
);
2017 unlock_user(arg_ptr
, arg_ptr_addr
, 0);
2021 s
= lock_user_string(arg_addr
);
2023 qemu_log("\"%s\",", s
);
2024 unlock_user(s
, arg_addr
, 0);
2027 qemu_log("NULL}%s", get_comma(last
));
2031 print_execve(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2032 abi_long arg1
, abi_long arg2
, abi_long arg3
,
2033 abi_long arg4
, abi_long arg5
, abi_long arg6
)
2035 print_syscall_prologue(name
);
2036 print_string(arg1
, 0);
2037 print_execve_argv(arg2
, 1);
2038 print_syscall_epilogue(name
);
2042 print_execveat(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2043 abi_long arg1
, abi_long arg2
, abi_long arg3
,
2044 abi_long arg4
, abi_long arg5
, abi_long arg6
)
2046 print_syscall_prologue(name
);
2047 print_at_dirfd(arg1
, 0);
2048 print_string(arg2
, 0);
2049 print_execve_argv(arg3
, 0);
2050 print_flags(execveat_flags
, arg5
, 1);
2051 print_syscall_epilogue(name
);
2054 #if defined(TARGET_NR_faccessat) || defined(TARGET_NR_faccessat2)
2056 print_faccessat(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2057 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2058 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2060 print_syscall_prologue(name
);
2061 print_at_dirfd(arg0
, 0);
2062 print_string(arg1
, 0);
2063 print_flags(access_flags
, arg2
, 0);
2064 print_flags(at_file_flags
, arg3
, 1);
2065 print_syscall_epilogue(name
);
2069 #ifdef TARGET_NR_fallocate
2071 print_fallocate(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2072 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2073 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2075 print_syscall_prologue(name
);
2076 print_raw_param("%d", arg0
, 0);
2077 print_flags(falloc_flags
, arg1
, 0);
2078 #if TARGET_ABI_BITS == 32
2079 print_raw_param("%" PRIu64
, target_offset64(arg2
, arg3
), 0);
2080 print_raw_param("%" PRIu64
, target_offset64(arg4
, arg5
), 1);
2082 print_raw_param(TARGET_ABI_FMT_ld
, arg2
, 0);
2083 print_raw_param(TARGET_ABI_FMT_ld
, arg3
, 1);
2085 print_syscall_epilogue(name
);
2089 #ifdef TARGET_NR_fchmodat
2091 print_fchmodat(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2092 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2093 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2095 print_syscall_prologue(name
);
2096 print_at_dirfd(arg0
, 0);
2097 print_string(arg1
, 0);
2098 print_file_mode(arg2
, 0);
2099 print_flags(at_file_flags
, arg3
, 1);
2100 print_syscall_epilogue(name
);
2104 #ifdef TARGET_NR_fchownat
2106 print_fchownat(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2107 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2108 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2110 print_syscall_prologue(name
);
2111 print_at_dirfd(arg0
, 0);
2112 print_string(arg1
, 0);
2113 print_raw_param("%d", arg2
, 0);
2114 print_raw_param("%d", arg3
, 0);
2115 print_flags(at_file_flags
, arg4
, 1);
2116 print_syscall_epilogue(name
);
2120 #if defined(TARGET_NR_fcntl) || defined(TARGET_NR_fcntl64)
2122 print_fcntl(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2123 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2124 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2126 print_syscall_prologue(name
);
2127 print_raw_param("%d", arg0
, 0);
2129 case TARGET_F_DUPFD
:
2130 qemu_log("F_DUPFD,");
2131 print_raw_param(TARGET_ABI_FMT_ld
, arg2
, 1);
2133 case TARGET_F_GETFD
:
2134 qemu_log("F_GETFD");
2136 case TARGET_F_SETFD
:
2137 qemu_log("F_SETFD,");
2138 print_raw_param(TARGET_ABI_FMT_ld
, arg2
, 1);
2140 case TARGET_F_GETFL
:
2141 qemu_log("F_GETFL");
2143 case TARGET_F_SETFL
:
2144 qemu_log("F_SETFL,");
2145 print_open_flags(arg2
, 1);
2147 case TARGET_F_GETLK
:
2148 qemu_log("F_GETLK,");
2149 print_pointer(arg2
, 1);
2151 case TARGET_F_SETLK
:
2152 qemu_log("F_SETLK,");
2153 print_pointer(arg2
, 1);
2155 case TARGET_F_SETLKW
:
2156 qemu_log("F_SETLKW,");
2157 print_pointer(arg2
, 1);
2159 case TARGET_F_GETOWN
:
2160 qemu_log("F_GETOWN");
2162 case TARGET_F_SETOWN
:
2163 qemu_log("F_SETOWN,");
2164 print_raw_param(TARGET_ABI_FMT_ld
, arg2
, 0);
2166 case TARGET_F_GETSIG
:
2167 qemu_log("F_GETSIG");
2169 case TARGET_F_SETSIG
:
2170 qemu_log("F_SETSIG,");
2171 print_raw_param(TARGET_ABI_FMT_ld
, arg2
, 0);
2173 #if TARGET_ABI_BITS == 32
2174 case TARGET_F_GETLK64
:
2175 qemu_log("F_GETLK64,");
2176 print_pointer(arg2
, 1);
2178 case TARGET_F_SETLK64
:
2179 qemu_log("F_SETLK64,");
2180 print_pointer(arg2
, 1);
2182 case TARGET_F_SETLKW64
:
2183 qemu_log("F_SETLKW64,");
2184 print_pointer(arg2
, 1);
2187 case TARGET_F_OFD_GETLK
:
2188 qemu_log("F_OFD_GETLK,");
2189 print_pointer(arg2
, 1);
2191 case TARGET_F_OFD_SETLK
:
2192 qemu_log("F_OFD_SETLK,");
2193 print_pointer(arg2
, 1);
2195 case TARGET_F_OFD_SETLKW
:
2196 qemu_log("F_OFD_SETLKW,");
2197 print_pointer(arg2
, 1);
2199 case TARGET_F_SETLEASE
:
2200 qemu_log("F_SETLEASE,");
2201 print_raw_param(TARGET_ABI_FMT_ld
, arg2
, 1);
2203 case TARGET_F_GETLEASE
:
2204 qemu_log("F_GETLEASE");
2206 #ifdef F_DUPFD_CLOEXEC
2207 case TARGET_F_DUPFD_CLOEXEC
:
2208 qemu_log("F_DUPFD_CLOEXEC,");
2209 print_raw_param(TARGET_ABI_FMT_ld
, arg2
, 1);
2212 case TARGET_F_NOTIFY
:
2213 qemu_log("F_NOTIFY,");
2214 print_raw_param(TARGET_ABI_FMT_ld
, arg2
, 1);
2217 case TARGET_F_GETOWN_EX
:
2218 qemu_log("F_GETOWN_EX,");
2219 print_pointer(arg2
, 1);
2223 case TARGET_F_SETOWN_EX
:
2224 qemu_log("F_SETOWN_EX,");
2225 print_pointer(arg2
, 1);
2229 case TARGET_F_SETPIPE_SZ
:
2230 qemu_log("F_SETPIPE_SZ,");
2231 print_raw_param(TARGET_ABI_FMT_ld
, arg2
, 1);
2233 case TARGET_F_GETPIPE_SZ
:
2234 qemu_log("F_GETPIPE_SZ");
2238 case TARGET_F_ADD_SEALS
:
2239 qemu_log("F_ADD_SEALS,");
2240 print_raw_param("0x"TARGET_ABI_FMT_lx
, arg2
, 1);
2242 case TARGET_F_GET_SEALS
:
2243 qemu_log("F_GET_SEALS");
2247 print_raw_param(TARGET_ABI_FMT_ld
, arg1
, 0);
2248 print_pointer(arg2
, 1);
2251 print_syscall_epilogue(name
);
2253 #define print_fcntl64 print_fcntl
2256 #ifdef TARGET_NR_fgetxattr
2258 print_fgetxattr(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2259 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2260 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2262 print_syscall_prologue(name
);
2263 print_raw_param("%d", arg0
, 0);
2264 print_string(arg1
, 0);
2265 print_pointer(arg2
, 0);
2266 print_raw_param(TARGET_FMT_lu
, arg3
, 1);
2267 print_syscall_epilogue(name
);
2271 #ifdef TARGET_NR_flistxattr
2273 print_flistxattr(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2274 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2275 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2277 print_syscall_prologue(name
);
2278 print_raw_param("%d", arg0
, 0);
2279 print_pointer(arg1
, 0);
2280 print_raw_param(TARGET_FMT_lu
, arg2
, 1);
2281 print_syscall_epilogue(name
);
2285 #if defined(TARGET_NR_getxattr) || defined(TARGET_NR_lgetxattr)
2287 print_getxattr(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2288 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2289 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2291 print_syscall_prologue(name
);
2292 print_string(arg0
, 0);
2293 print_string(arg1
, 0);
2294 print_pointer(arg2
, 0);
2295 print_raw_param(TARGET_FMT_lu
, arg3
, 1);
2296 print_syscall_epilogue(name
);
2298 #define print_lgetxattr print_getxattr
2301 #if defined(TARGET_NR_listxattr) || defined(TARGET_NR_llistxattr)
2303 print_listxattr(CPUArchState
*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_string(arg0
, 0);
2309 print_pointer(arg1
, 0);
2310 print_raw_param(TARGET_FMT_lu
, arg2
, 1);
2311 print_syscall_epilogue(name
);
2313 #define print_llistxattr print_listxattr
2316 #if defined(TARGET_NR_fremovexattr)
2318 print_fremovexattr(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2319 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2320 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2322 print_syscall_prologue(name
);
2323 print_raw_param("%d", arg0
, 0);
2324 print_string(arg1
, 1);
2325 print_syscall_epilogue(name
);
2329 #if defined(TARGET_NR_removexattr) || defined(TARGET_NR_lremovexattr)
2331 print_removexattr(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2332 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2333 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2335 print_syscall_prologue(name
);
2336 print_string(arg0
, 0);
2337 print_string(arg1
, 1);
2338 print_syscall_epilogue(name
);
2340 #define print_lremovexattr print_removexattr
2343 #ifdef TARGET_NR_futimesat
2345 print_futimesat(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2346 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2347 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2349 print_syscall_prologue(name
);
2350 print_at_dirfd(arg0
, 0);
2351 print_string(arg1
, 0);
2352 print_timeval(arg2
, 0);
2353 print_timeval(arg2
+ sizeof (struct target_timeval
), 1);
2354 print_syscall_epilogue(name
);
2358 #ifdef TARGET_NR_gettimeofday
2360 print_gettimeofday(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2361 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2362 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2364 print_syscall_prologue(name
);
2365 print_pointer(arg0
, 0);
2366 print_pointer(arg1
, 1);
2367 print_syscall_epilogue(name
);
2371 #ifdef TARGET_NR_settimeofday
2373 print_settimeofday(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2374 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2375 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2377 print_syscall_prologue(name
);
2378 print_timeval(arg0
, 0);
2379 print_timezone(arg1
, 1);
2380 print_syscall_epilogue(name
);
2384 #if defined(TARGET_NR_clock_gettime) || defined(TARGET_NR_clock_getres)
2386 print_clock_gettime(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2387 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2388 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2390 print_syscall_prologue(name
);
2391 print_enums(clockids
, arg0
, 0);
2392 print_pointer(arg1
, 1);
2393 print_syscall_epilogue(name
);
2395 #define print_clock_getres print_clock_gettime
2398 #if defined(TARGET_NR_clock_gettime64)
2400 print_clock_gettime64(CPUArchState
*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_enums(clockids
, arg0
, 0);
2406 print_pointer(arg1
, 1);
2407 print_syscall_epilogue(name
);
2411 #ifdef TARGET_NR_clock_settime
2413 print_clock_settime(CPUArchState
*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_enums(clockids
, arg0
, 0);
2419 print_timespec(arg1
, 1);
2420 print_syscall_epilogue(name
);
2424 #ifdef TARGET_NR_getitimer
2426 print_getitimer(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2427 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2428 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2430 print_syscall_prologue(name
);
2431 print_enums(itimer_types
, arg0
, 0);
2432 print_pointer(arg1
, 1);
2433 print_syscall_epilogue(name
);
2437 #ifdef TARGET_NR_setitimer
2439 print_setitimer(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2440 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2441 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2443 print_syscall_prologue(name
);
2444 print_enums(itimer_types
, arg0
, 0);
2445 print_itimerval(arg1
, 0);
2446 print_pointer(arg2
, 1);
2447 print_syscall_epilogue(name
);
2451 #ifdef TARGET_NR_link
2453 print_link(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2454 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2455 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2457 print_syscall_prologue(name
);
2458 print_string(arg0
, 0);
2459 print_string(arg1
, 1);
2460 print_syscall_epilogue(name
);
2464 #ifdef TARGET_NR_linkat
2466 print_linkat(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2467 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2468 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2470 print_syscall_prologue(name
);
2471 print_at_dirfd(arg0
, 0);
2472 print_string(arg1
, 0);
2473 print_at_dirfd(arg2
, 0);
2474 print_string(arg3
, 0);
2475 print_flags(at_file_flags
, arg4
, 1);
2476 print_syscall_epilogue(name
);
2480 #if defined(TARGET_NR__llseek) || defined(TARGET_NR_llseek)
2482 print__llseek(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2483 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2484 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2486 const char *whence
= "UNKNOWN";
2487 print_syscall_prologue(name
);
2488 print_raw_param("%d", arg0
, 0);
2489 print_raw_param("%ld", arg1
, 0);
2490 print_raw_param("%ld", arg2
, 0);
2491 print_pointer(arg3
, 0);
2493 case SEEK_SET
: whence
= "SEEK_SET"; break;
2494 case SEEK_CUR
: whence
= "SEEK_CUR"; break;
2495 case SEEK_END
: whence
= "SEEK_END"; break;
2497 qemu_log("%s", whence
);
2498 print_syscall_epilogue(name
);
2500 #define print_llseek print__llseek
2503 #ifdef TARGET_NR_lseek
2505 print_lseek(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2506 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2507 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2509 print_syscall_prologue(name
);
2510 print_raw_param("%d", arg0
, 0);
2511 print_raw_param(TARGET_ABI_FMT_ld
, arg1
, 0);
2514 qemu_log("SEEK_SET"); break;
2516 qemu_log("SEEK_CUR"); break;
2518 qemu_log("SEEK_END"); break;
2521 qemu_log("SEEK_DATA"); break;
2525 qemu_log("SEEK_HOLE"); break;
2528 print_raw_param("%#x", arg2
, 1);
2530 print_syscall_epilogue(name
);
2534 #ifdef TARGET_NR_truncate
2536 print_truncate(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2537 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2538 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2540 print_syscall_prologue(name
);
2541 print_string(arg0
, 0);
2542 print_raw_param(TARGET_ABI_FMT_ld
, arg1
, 1);
2543 print_syscall_epilogue(name
);
2547 #ifdef TARGET_NR_truncate64
2549 print_truncate64(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2550 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2551 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2553 print_syscall_prologue(name
);
2554 print_string(arg0
, 0);
2555 if (regpairs_aligned(cpu_env
, TARGET_NR_truncate64
)) {
2559 print_raw_param("%" PRIu64
, target_offset64(arg1
, arg2
), 1);
2560 print_syscall_epilogue(name
);
2564 #ifdef TARGET_NR_ftruncate64
2566 print_ftruncate64(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2567 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2568 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2570 print_syscall_prologue(name
);
2571 print_raw_param("%d", arg0
, 0);
2572 if (regpairs_aligned(cpu_env
, TARGET_NR_ftruncate64
)) {
2576 print_raw_param("%" PRIu64
, target_offset64(arg1
, arg2
), 1);
2577 print_syscall_epilogue(name
);
2581 #ifdef TARGET_NR_mlockall
2583 print_mlockall(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2584 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2585 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2587 print_syscall_prologue(name
);
2588 print_flags(mlockall_flags
, arg0
, 1);
2589 print_syscall_epilogue(name
);
2593 #if defined(TARGET_NR_socket)
2595 print_socket(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2596 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2597 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2599 abi_ulong domain
= arg0
, type
= arg1
, protocol
= arg2
;
2601 print_syscall_prologue(name
);
2602 print_socket_domain(domain
);
2604 print_socket_type(type
);
2606 if (domain
== AF_PACKET
||
2607 (domain
== AF_INET
&& type
== TARGET_SOCK_PACKET
)) {
2608 protocol
= tswap16(protocol
);
2610 print_socket_protocol(domain
, type
, protocol
);
2611 print_syscall_epilogue(name
);
2616 #if defined(TARGET_NR_socketcall) || defined(TARGET_NR_bind)
2618 static void print_sockfd(abi_long sockfd
, int last
)
2620 print_raw_param(TARGET_ABI_FMT_ld
, sockfd
, last
);
2625 #if defined(TARGET_NR_socketcall)
2627 #define get_user_ualx(x, gaddr, idx) \
2628 get_user_ual(x, (gaddr) + (idx) * sizeof(abi_long))
2630 static void do_print_socket(const char *name
, abi_long arg1
)
2632 abi_ulong domain
, type
, protocol
;
2634 get_user_ualx(domain
, arg1
, 0);
2635 get_user_ualx(type
, arg1
, 1);
2636 get_user_ualx(protocol
, arg1
, 2);
2637 qemu_log("%s(", name
);
2638 print_socket_domain(domain
);
2640 print_socket_type(type
);
2642 if (domain
== AF_PACKET
||
2643 (domain
== AF_INET
&& type
== TARGET_SOCK_PACKET
)) {
2644 protocol
= tswap16(protocol
);
2646 print_socket_protocol(domain
, type
, protocol
);
2650 static void do_print_sockaddr(const char *name
, abi_long arg1
)
2652 abi_ulong sockfd
, addr
, addrlen
;
2654 get_user_ualx(sockfd
, arg1
, 0);
2655 get_user_ualx(addr
, arg1
, 1);
2656 get_user_ualx(addrlen
, arg1
, 2);
2658 qemu_log("%s(", name
);
2659 print_sockfd(sockfd
, 0);
2660 print_sockaddr(addr
, addrlen
, 0);
2664 static void do_print_listen(const char *name
, abi_long arg1
)
2666 abi_ulong sockfd
, backlog
;
2668 get_user_ualx(sockfd
, arg1
, 0);
2669 get_user_ualx(backlog
, arg1
, 1);
2671 qemu_log("%s(", name
);
2672 print_sockfd(sockfd
, 0);
2673 print_raw_param(TARGET_ABI_FMT_ld
, backlog
, 1);
2677 static void do_print_socketpair(const char *name
, abi_long arg1
)
2679 abi_ulong domain
, type
, protocol
, tab
;
2681 get_user_ualx(domain
, arg1
, 0);
2682 get_user_ualx(type
, arg1
, 1);
2683 get_user_ualx(protocol
, arg1
, 2);
2684 get_user_ualx(tab
, arg1
, 3);
2686 qemu_log("%s(", name
);
2687 print_socket_domain(domain
);
2689 print_socket_type(type
);
2691 print_socket_protocol(domain
, type
, protocol
);
2693 print_raw_param(TARGET_ABI_FMT_lx
, tab
, 1);
2697 static void do_print_sendrecv(const char *name
, abi_long arg1
)
2699 abi_ulong sockfd
, msg
, len
, flags
;
2701 get_user_ualx(sockfd
, arg1
, 0);
2702 get_user_ualx(msg
, arg1
, 1);
2703 get_user_ualx(len
, arg1
, 2);
2704 get_user_ualx(flags
, arg1
, 3);
2706 qemu_log("%s(", name
);
2707 print_sockfd(sockfd
, 0);
2708 print_buf(msg
, len
, 0);
2709 print_raw_param(TARGET_ABI_FMT_ld
, len
, 0);
2710 print_flags(msg_flags
, flags
, 1);
2714 static void do_print_msgaddr(const char *name
, abi_long arg1
)
2716 abi_ulong sockfd
, msg
, len
, flags
, addr
, addrlen
;
2718 get_user_ualx(sockfd
, arg1
, 0);
2719 get_user_ualx(msg
, arg1
, 1);
2720 get_user_ualx(len
, arg1
, 2);
2721 get_user_ualx(flags
, arg1
, 3);
2722 get_user_ualx(addr
, arg1
, 4);
2723 get_user_ualx(addrlen
, arg1
, 5);
2725 qemu_log("%s(", name
);
2726 print_sockfd(sockfd
, 0);
2727 print_buf(msg
, len
, 0);
2728 print_raw_param(TARGET_ABI_FMT_ld
, len
, 0);
2729 print_flags(msg_flags
, flags
, 0);
2730 print_sockaddr(addr
, addrlen
, 0);
2734 static void do_print_shutdown(const char *name
, abi_long arg1
)
2736 abi_ulong sockfd
, how
;
2738 get_user_ualx(sockfd
, arg1
, 0);
2739 get_user_ualx(how
, arg1
, 1);
2741 qemu_log("shutdown(");
2742 print_sockfd(sockfd
, 0);
2745 qemu_log("SHUT_RD");
2748 qemu_log("SHUT_WR");
2751 qemu_log("SHUT_RDWR");
2754 print_raw_param(TARGET_ABI_FMT_ld
, how
, 1);
2760 static void do_print_msg(const char *name
, abi_long arg1
)
2762 abi_ulong sockfd
, msg
, flags
;
2764 get_user_ualx(sockfd
, arg1
, 0);
2765 get_user_ualx(msg
, arg1
, 1);
2766 get_user_ualx(flags
, arg1
, 2);
2768 qemu_log("%s(", name
);
2769 print_sockfd(sockfd
, 0);
2770 print_pointer(msg
, 0);
2771 print_flags(msg_flags
, flags
, 1);
2775 static void do_print_sockopt(const char *name
, abi_long arg1
)
2777 abi_ulong sockfd
, level
, optname
, optval
, optlen
;
2779 get_user_ualx(sockfd
, arg1
, 0);
2780 get_user_ualx(level
, arg1
, 1);
2781 get_user_ualx(optname
, arg1
, 2);
2782 get_user_ualx(optval
, arg1
, 3);
2783 get_user_ualx(optlen
, arg1
, 4);
2785 qemu_log("%s(", name
);
2786 print_sockfd(sockfd
, 0);
2789 qemu_log("SOL_TCP,");
2790 print_raw_param(TARGET_ABI_FMT_ld
, optname
, 0);
2791 print_pointer(optval
, 0);
2794 qemu_log("SOL_UDP,");
2795 print_raw_param(TARGET_ABI_FMT_ld
, optname
, 0);
2796 print_pointer(optval
, 0);
2799 qemu_log("SOL_IP,");
2800 print_raw_param(TARGET_ABI_FMT_ld
, optname
, 0);
2801 print_pointer(optval
, 0);
2804 qemu_log("SOL_RAW,");
2805 print_raw_param(TARGET_ABI_FMT_ld
, optname
, 0);
2806 print_pointer(optval
, 0);
2808 case TARGET_SOL_SOCKET
:
2809 qemu_log("SOL_SOCKET,");
2811 case TARGET_SO_DEBUG
:
2812 qemu_log("SO_DEBUG,");
2814 print_number(optval
, 0);
2816 case TARGET_SO_REUSEADDR
:
2817 qemu_log("SO_REUSEADDR,");
2819 case TARGET_SO_REUSEPORT
:
2820 qemu_log("SO_REUSEPORT,");
2822 case TARGET_SO_TYPE
:
2823 qemu_log("SO_TYPE,");
2825 case TARGET_SO_ERROR
:
2826 qemu_log("SO_ERROR,");
2828 case TARGET_SO_DONTROUTE
:
2829 qemu_log("SO_DONTROUTE,");
2831 case TARGET_SO_BROADCAST
:
2832 qemu_log("SO_BROADCAST,");
2834 case TARGET_SO_SNDBUF
:
2835 qemu_log("SO_SNDBUF,");
2837 case TARGET_SO_RCVBUF
:
2838 qemu_log("SO_RCVBUF,");
2840 case TARGET_SO_KEEPALIVE
:
2841 qemu_log("SO_KEEPALIVE,");
2843 case TARGET_SO_OOBINLINE
:
2844 qemu_log("SO_OOBINLINE,");
2846 case TARGET_SO_NO_CHECK
:
2847 qemu_log("SO_NO_CHECK,");
2849 case TARGET_SO_PRIORITY
:
2850 qemu_log("SO_PRIORITY,");
2852 case TARGET_SO_BSDCOMPAT
:
2853 qemu_log("SO_BSDCOMPAT,");
2855 case TARGET_SO_PASSCRED
:
2856 qemu_log("SO_PASSCRED,");
2858 case TARGET_SO_TIMESTAMP
:
2859 qemu_log("SO_TIMESTAMP,");
2861 case TARGET_SO_RCVLOWAT
:
2862 qemu_log("SO_RCVLOWAT,");
2864 case TARGET_SO_RCVTIMEO
:
2865 qemu_log("SO_RCVTIMEO,");
2866 print_timeval(optval
, 0);
2868 case TARGET_SO_SNDTIMEO
:
2869 qemu_log("SO_SNDTIMEO,");
2870 print_timeval(optval
, 0);
2872 case TARGET_SO_ATTACH_FILTER
: {
2873 struct target_sock_fprog
*fprog
;
2875 qemu_log("SO_ATTACH_FILTER,");
2877 if (lock_user_struct(VERIFY_READ
, fprog
, optval
, 0)) {
2878 struct target_sock_filter
*filter
;
2880 if (lock_user_struct(VERIFY_READ
, filter
,
2881 tswapal(fprog
->filter
), 0)) {
2883 for (i
= 0; i
< tswap16(fprog
->len
) - 1; i
++) {
2884 qemu_log("[%d]{0x%x,%d,%d,0x%x},",
2885 i
, tswap16(filter
[i
].code
),
2886 filter
[i
].jt
, filter
[i
].jf
,
2887 tswap32(filter
[i
].k
));
2889 qemu_log("[%d]{0x%x,%d,%d,0x%x}",
2890 i
, tswap16(filter
[i
].code
),
2891 filter
[i
].jt
, filter
[i
].jf
,
2892 tswap32(filter
[i
].k
));
2894 qemu_log(TARGET_ABI_FMT_lx
, tswapal(fprog
->filter
));
2896 qemu_log(",%d},", tswap16(fprog
->len
));
2897 unlock_user(fprog
, optval
, 0);
2899 print_pointer(optval
, 0);
2904 print_raw_param(TARGET_ABI_FMT_ld
, optname
, 0);
2905 print_pointer(optval
, 0);
2910 qemu_log("SOL_IPV6,");
2912 case IPV6_MTU_DISCOVER
:
2913 qemu_log("IPV6_MTU_DISCOVER,");
2916 qemu_log("IPV6_MTU,");
2919 qemu_log("IPV6_V6ONLY,");
2921 case IPV6_RECVPKTINFO
:
2922 qemu_log("IPV6_RECVPKTINFO,");
2924 case IPV6_UNICAST_HOPS
:
2925 qemu_log("IPV6_UNICAST_HOPS,");
2927 case IPV6_MULTICAST_HOPS
:
2928 qemu_log("IPV6_MULTICAST_HOPS,");
2930 case IPV6_MULTICAST_LOOP
:
2931 qemu_log("IPV6_MULTICAST_LOOP,");
2934 qemu_log("IPV6_RECVERR,");
2936 case IPV6_RECVHOPLIMIT
:
2937 qemu_log("IPV6_RECVHOPLIMIT,");
2939 case IPV6_2292HOPLIMIT
:
2940 qemu_log("IPV6_2292HOPLIMIT,");
2943 qemu_log("IPV6_CHECKSUM,");
2946 qemu_log("IPV6_ADDRFORM,");
2948 case IPV6_2292PKTINFO
:
2949 qemu_log("IPV6_2292PKTINFO,");
2951 case IPV6_RECVTCLASS
:
2952 qemu_log("IPV6_RECVTCLASS,");
2954 case IPV6_RECVRTHDR
:
2955 qemu_log("IPV6_RECVRTHDR,");
2957 case IPV6_2292RTHDR
:
2958 qemu_log("IPV6_2292RTHDR,");
2960 case IPV6_RECVHOPOPTS
:
2961 qemu_log("IPV6_RECVHOPOPTS,");
2963 case IPV6_2292HOPOPTS
:
2964 qemu_log("IPV6_2292HOPOPTS,");
2966 case IPV6_RECVDSTOPTS
:
2967 qemu_log("IPV6_RECVDSTOPTS,");
2969 case IPV6_2292DSTOPTS
:
2970 qemu_log("IPV6_2292DSTOPTS,");
2973 qemu_log("IPV6_TCLASS,");
2975 case IPV6_ADDR_PREFERENCES
:
2976 qemu_log("IPV6_ADDR_PREFERENCES,");
2978 #ifdef IPV6_RECVPATHMTU
2979 case IPV6_RECVPATHMTU
:
2980 qemu_log("IPV6_RECVPATHMTU,");
2983 #ifdef IPV6_TRANSPARENT
2984 case IPV6_TRANSPARENT
:
2985 qemu_log("IPV6_TRANSPARENT,");
2988 #ifdef IPV6_FREEBIND
2990 qemu_log("IPV6_FREEBIND,");
2993 #ifdef IPV6_RECVORIGDSTADDR
2994 case IPV6_RECVORIGDSTADDR
:
2995 qemu_log("IPV6_RECVORIGDSTADDR,");
2999 qemu_log("IPV6_PKTINFO,");
3000 print_pointer(optval
, 0);
3002 case IPV6_ADD_MEMBERSHIP
:
3003 qemu_log("IPV6_ADD_MEMBERSHIP,");
3004 print_pointer(optval
, 0);
3006 case IPV6_DROP_MEMBERSHIP
:
3007 qemu_log("IPV6_DROP_MEMBERSHIP,");
3008 print_pointer(optval
, 0);
3011 print_raw_param(TARGET_ABI_FMT_ld
, optname
, 0);
3012 print_pointer(optval
, 0);
3017 print_raw_param(TARGET_ABI_FMT_ld
, level
, 0);
3018 print_raw_param(TARGET_ABI_FMT_ld
, optname
, 0);
3019 print_pointer(optval
, 0);
3022 print_raw_param(TARGET_ABI_FMT_ld
, optlen
, 1);
3026 #define PRINT_SOCKOP(name, func) \
3027 [TARGET_SYS_##name] = { #name, func }
3031 void (*print
)(const char *, abi_long
);
3033 PRINT_SOCKOP(SOCKET
, do_print_socket
),
3034 PRINT_SOCKOP(BIND
, do_print_sockaddr
),
3035 PRINT_SOCKOP(CONNECT
, do_print_sockaddr
),
3036 PRINT_SOCKOP(LISTEN
, do_print_listen
),
3037 PRINT_SOCKOP(ACCEPT
, do_print_sockaddr
),
3038 PRINT_SOCKOP(GETSOCKNAME
, do_print_sockaddr
),
3039 PRINT_SOCKOP(GETPEERNAME
, do_print_sockaddr
),
3040 PRINT_SOCKOP(SOCKETPAIR
, do_print_socketpair
),
3041 PRINT_SOCKOP(SEND
, do_print_sendrecv
),
3042 PRINT_SOCKOP(RECV
, do_print_sendrecv
),
3043 PRINT_SOCKOP(SENDTO
, do_print_msgaddr
),
3044 PRINT_SOCKOP(RECVFROM
, do_print_msgaddr
),
3045 PRINT_SOCKOP(SHUTDOWN
, do_print_shutdown
),
3046 PRINT_SOCKOP(SETSOCKOPT
, do_print_sockopt
),
3047 PRINT_SOCKOP(GETSOCKOPT
, do_print_sockopt
),
3048 PRINT_SOCKOP(SENDMSG
, do_print_msg
),
3049 PRINT_SOCKOP(RECVMSG
, do_print_msg
),
3050 PRINT_SOCKOP(ACCEPT4
, NULL
),
3051 PRINT_SOCKOP(RECVMMSG
, NULL
),
3052 PRINT_SOCKOP(SENDMMSG
, NULL
),
3056 print_socketcall(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3057 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3058 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3060 if (arg0
>= 0 && arg0
< ARRAY_SIZE(scall
) && scall
[arg0
].print
) {
3061 scall
[arg0
].print(scall
[arg0
].name
, arg1
);
3064 print_syscall_prologue(name
);
3065 print_raw_param(TARGET_ABI_FMT_ld
, arg0
, 0);
3066 print_raw_param(TARGET_ABI_FMT_ld
, arg1
, 0);
3067 print_raw_param(TARGET_ABI_FMT_ld
, arg2
, 0);
3068 print_raw_param(TARGET_ABI_FMT_ld
, arg3
, 0);
3069 print_raw_param(TARGET_ABI_FMT_ld
, arg4
, 0);
3070 print_raw_param(TARGET_ABI_FMT_ld
, arg5
, 0);
3071 print_syscall_epilogue(name
);
3075 #if defined(TARGET_NR_bind)
3077 print_bind(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3078 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3079 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3081 print_syscall_prologue(name
);
3082 print_sockfd(arg0
, 0);
3083 print_sockaddr(arg1
, arg2
, 1);
3084 print_syscall_epilogue(name
);
3088 #if defined(TARGET_NR_stat) || defined(TARGET_NR_stat64) || \
3089 defined(TARGET_NR_lstat) || defined(TARGET_NR_lstat64)
3091 print_stat(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3092 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3093 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3095 print_syscall_prologue(name
);
3096 print_string(arg0
, 0);
3097 print_pointer(arg1
, 1);
3098 print_syscall_epilogue(name
);
3100 #define print_lstat print_stat
3101 #define print_stat64 print_stat
3102 #define print_lstat64 print_stat
3105 #if defined(TARGET_NR_madvise)
3106 static struct enums madvise_advice
[] = {
3107 ENUM_TARGET(MADV_NORMAL
),
3108 ENUM_TARGET(MADV_RANDOM
),
3109 ENUM_TARGET(MADV_SEQUENTIAL
),
3110 ENUM_TARGET(MADV_WILLNEED
),
3111 ENUM_TARGET(MADV_DONTNEED
),
3112 ENUM_TARGET(MADV_FREE
),
3113 ENUM_TARGET(MADV_REMOVE
),
3114 ENUM_TARGET(MADV_DONTFORK
),
3115 ENUM_TARGET(MADV_DOFORK
),
3116 ENUM_TARGET(MADV_MERGEABLE
),
3117 ENUM_TARGET(MADV_UNMERGEABLE
),
3118 ENUM_TARGET(MADV_HUGEPAGE
),
3119 ENUM_TARGET(MADV_NOHUGEPAGE
),
3120 ENUM_TARGET(MADV_DONTDUMP
),
3121 ENUM_TARGET(MADV_DODUMP
),
3122 ENUM_TARGET(MADV_WIPEONFORK
),
3123 ENUM_TARGET(MADV_KEEPONFORK
),
3124 ENUM_TARGET(MADV_COLD
),
3125 ENUM_TARGET(MADV_PAGEOUT
),
3126 ENUM_TARGET(MADV_POPULATE_READ
),
3127 ENUM_TARGET(MADV_POPULATE_WRITE
),
3128 ENUM_TARGET(MADV_DONTNEED_LOCKED
),
3133 print_madvise(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3134 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3135 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3137 print_syscall_prologue(name
);
3138 print_pointer(arg0
, 0);
3139 print_raw_param("%d", arg1
, 0);
3140 print_enums(madvise_advice
, arg2
, 1);
3141 print_syscall_epilogue(name
);
3145 #if defined(TARGET_NR_fstat) || defined(TARGET_NR_fstat64)
3147 print_fstat(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3148 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3149 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3151 print_syscall_prologue(name
);
3152 print_raw_param("%d", arg0
, 0);
3153 print_pointer(arg1
, 1);
3154 print_syscall_epilogue(name
);
3156 #define print_fstat64 print_fstat
3159 #ifdef TARGET_NR_mkdir
3161 print_mkdir(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3162 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3163 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3165 print_syscall_prologue(name
);
3166 print_string(arg0
, 0);
3167 print_file_mode(arg1
, 1);
3168 print_syscall_epilogue(name
);
3172 #ifdef TARGET_NR_mkdirat
3174 print_mkdirat(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3175 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3176 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3178 print_syscall_prologue(name
);
3179 print_at_dirfd(arg0
, 0);
3180 print_string(arg1
, 0);
3181 print_file_mode(arg2
, 1);
3182 print_syscall_epilogue(name
);
3186 #ifdef TARGET_NR_rmdir
3188 print_rmdir(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3189 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3190 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3192 print_syscall_prologue(name
);
3193 print_string(arg0
, 0);
3194 print_syscall_epilogue(name
);
3198 #ifdef TARGET_NR_rt_sigaction
3200 print_rt_sigaction(CPUArchState
*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 print_syscall_prologue(name
);
3205 print_signal(arg0
, 0);
3206 print_pointer(arg1
, 0);
3207 print_pointer(arg2
, 1);
3208 print_syscall_epilogue(name
);
3212 #ifdef TARGET_NR_rt_sigprocmask
3214 print_rt_sigprocmask(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3215 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3216 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3218 const char *how
= "UNKNOWN";
3219 print_syscall_prologue(name
);
3221 case TARGET_SIG_BLOCK
: how
= "SIG_BLOCK"; break;
3222 case TARGET_SIG_UNBLOCK
: how
= "SIG_UNBLOCK"; break;
3223 case TARGET_SIG_SETMASK
: how
= "SIG_SETMASK"; break;
3225 qemu_log("%s,", how
);
3226 print_pointer(arg1
, 0);
3227 print_pointer(arg2
, 0);
3228 print_raw_param("%u", arg3
, 1);
3229 print_syscall_epilogue(name
);
3233 #ifdef TARGET_NR_rt_sigqueueinfo
3235 print_rt_sigqueueinfo(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3236 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3237 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3240 target_siginfo_t uinfo
;
3242 print_syscall_prologue(name
);
3243 print_raw_param("%d", arg0
, 0);
3244 print_signal(arg1
, 0);
3245 p
= lock_user(VERIFY_READ
, arg2
, sizeof(target_siginfo_t
), 1);
3247 get_target_siginfo(&uinfo
, p
);
3248 print_siginfo(&uinfo
);
3250 unlock_user(p
, arg2
, 0);
3252 print_pointer(arg2
, 1);
3254 print_syscall_epilogue(name
);
3258 #ifdef TARGET_NR_rt_tgsigqueueinfo
3260 print_rt_tgsigqueueinfo(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3261 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3262 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3265 target_siginfo_t uinfo
;
3267 print_syscall_prologue(name
);
3268 print_raw_param("%d", arg0
, 0);
3269 print_raw_param("%d", arg1
, 0);
3270 print_signal(arg2
, 0);
3271 p
= lock_user(VERIFY_READ
, arg3
, sizeof(target_siginfo_t
), 1);
3273 get_target_siginfo(&uinfo
, p
);
3274 print_siginfo(&uinfo
);
3276 unlock_user(p
, arg3
, 0);
3278 print_pointer(arg3
, 1);
3280 print_syscall_epilogue(name
);
3284 #ifdef TARGET_NR_syslog
3286 print_syslog_action(abi_ulong arg
, int last
)
3291 case TARGET_SYSLOG_ACTION_CLOSE
: {
3292 type
= "SYSLOG_ACTION_CLOSE";
3295 case TARGET_SYSLOG_ACTION_OPEN
: {
3296 type
= "SYSLOG_ACTION_OPEN";
3299 case TARGET_SYSLOG_ACTION_READ
: {
3300 type
= "SYSLOG_ACTION_READ";
3303 case TARGET_SYSLOG_ACTION_READ_ALL
: {
3304 type
= "SYSLOG_ACTION_READ_ALL";
3307 case TARGET_SYSLOG_ACTION_READ_CLEAR
: {
3308 type
= "SYSLOG_ACTION_READ_CLEAR";
3311 case TARGET_SYSLOG_ACTION_CLEAR
: {
3312 type
= "SYSLOG_ACTION_CLEAR";
3315 case TARGET_SYSLOG_ACTION_CONSOLE_OFF
: {
3316 type
= "SYSLOG_ACTION_CONSOLE_OFF";
3319 case TARGET_SYSLOG_ACTION_CONSOLE_ON
: {
3320 type
= "SYSLOG_ACTION_CONSOLE_ON";
3323 case TARGET_SYSLOG_ACTION_CONSOLE_LEVEL
: {
3324 type
= "SYSLOG_ACTION_CONSOLE_LEVEL";
3327 case TARGET_SYSLOG_ACTION_SIZE_UNREAD
: {
3328 type
= "SYSLOG_ACTION_SIZE_UNREAD";
3331 case TARGET_SYSLOG_ACTION_SIZE_BUFFER
: {
3332 type
= "SYSLOG_ACTION_SIZE_BUFFER";
3336 print_raw_param("%ld", arg
, last
);
3340 qemu_log("%s%s", type
, get_comma(last
));
3344 print_syslog(CPUArchState
*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_syslog_action(arg0
, 0);
3350 print_pointer(arg1
, 0);
3351 print_raw_param("%d", arg2
, 1);
3352 print_syscall_epilogue(name
);
3356 #ifdef TARGET_NR_mknod
3358 print_mknod(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3359 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3360 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3362 int hasdev
= (arg1
& (S_IFCHR
|S_IFBLK
));
3364 print_syscall_prologue(name
);
3365 print_string(arg0
, 0);
3366 print_file_mode(arg1
, (hasdev
== 0));
3368 print_raw_param("makedev(%d", major(arg2
), 0);
3369 print_raw_param("%d)", minor(arg2
), 1);
3371 print_syscall_epilogue(name
);
3375 #ifdef TARGET_NR_mknodat
3377 print_mknodat(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3378 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3379 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3381 int hasdev
= (arg2
& (S_IFCHR
|S_IFBLK
));
3383 print_syscall_prologue(name
);
3384 print_at_dirfd(arg0
, 0);
3385 print_string(arg1
, 0);
3386 print_file_mode(arg2
, (hasdev
== 0));
3388 print_raw_param("makedev(%d", major(arg3
), 0);
3389 print_raw_param("%d)", minor(arg3
), 1);
3391 print_syscall_epilogue(name
);
3395 #ifdef TARGET_NR_mq_open
3397 print_mq_open(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3398 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3399 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3401 int is_creat
= (arg1
& TARGET_O_CREAT
);
3403 print_syscall_prologue(name
);
3404 print_string(arg0
, 0);
3405 print_open_flags(arg1
, (is_creat
== 0));
3407 print_file_mode(arg2
, 0);
3408 print_pointer(arg3
, 1);
3410 print_syscall_epilogue(name
);
3414 #ifdef TARGET_NR_open
3416 print_open(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3417 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3418 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3420 int is_creat
= (arg1
& TARGET_O_CREAT
);
3422 print_syscall_prologue(name
);
3423 print_string(arg0
, 0);
3424 print_open_flags(arg1
, (is_creat
== 0));
3426 print_file_mode(arg2
, 1);
3427 print_syscall_epilogue(name
);
3431 #ifdef TARGET_NR_openat
3433 print_openat(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3434 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3435 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3437 int is_creat
= (arg2
& TARGET_O_CREAT
);
3439 print_syscall_prologue(name
);
3440 print_at_dirfd(arg0
, 0);
3441 print_string(arg1
, 0);
3442 print_open_flags(arg2
, (is_creat
== 0));
3444 print_file_mode(arg3
, 1);
3445 print_syscall_epilogue(name
);
3449 #ifdef TARGET_NR_pidfd_send_signal
3451 print_pidfd_send_signal(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3452 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3453 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3456 target_siginfo_t uinfo
;
3458 print_syscall_prologue(name
);
3459 print_raw_param("%d", arg0
, 0);
3460 print_signal(arg1
, 0);
3462 p
= lock_user(VERIFY_READ
, arg2
, sizeof(target_siginfo_t
), 1);
3464 get_target_siginfo(&uinfo
, p
);
3465 print_siginfo(&uinfo
);
3467 unlock_user(p
, arg2
, 0);
3469 print_pointer(arg2
, 0);
3472 print_raw_param("%u", arg3
, 1);
3473 print_syscall_epilogue(name
);
3477 #ifdef TARGET_NR_mq_unlink
3479 print_mq_unlink(CPUArchState
*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_string(arg0
, 1);
3485 print_syscall_epilogue(name
);
3489 #if defined(TARGET_NR_fstatat64) || defined(TARGET_NR_newfstatat)
3491 print_fstatat64(CPUArchState
*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_at_dirfd(arg0
, 0);
3497 print_string(arg1
, 0);
3498 print_pointer(arg2
, 0);
3499 print_flags(at_file_flags
, arg3
, 1);
3500 print_syscall_epilogue(name
);
3502 #define print_newfstatat print_fstatat64
3505 #ifdef TARGET_NR_readlink
3507 print_readlink(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3508 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3509 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3511 print_syscall_prologue(name
);
3512 print_string(arg0
, 0);
3513 print_pointer(arg1
, 0);
3514 print_raw_param("%u", arg2
, 1);
3515 print_syscall_epilogue(name
);
3519 #ifdef TARGET_NR_readlinkat
3521 print_readlinkat(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3522 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3523 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3525 print_syscall_prologue(name
);
3526 print_at_dirfd(arg0
, 0);
3527 print_string(arg1
, 0);
3528 print_pointer(arg2
, 0);
3529 print_raw_param("%u", arg3
, 1);
3530 print_syscall_epilogue(name
);
3534 #ifdef TARGET_NR_rename
3536 print_rename(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3537 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3538 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3540 print_syscall_prologue(name
);
3541 print_string(arg0
, 0);
3542 print_string(arg1
, 1);
3543 print_syscall_epilogue(name
);
3547 #ifdef TARGET_NR_renameat
3549 print_renameat(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3550 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3551 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3553 print_syscall_prologue(name
);
3554 print_at_dirfd(arg0
, 0);
3555 print_string(arg1
, 0);
3556 print_at_dirfd(arg2
, 0);
3557 print_string(arg3
, 1);
3558 print_syscall_epilogue(name
);
3562 #ifdef TARGET_NR_statfs
3564 print_statfs(CPUArchState
*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_string(arg0
, 0);
3570 print_pointer(arg1
, 1);
3571 print_syscall_epilogue(name
);
3575 #ifdef TARGET_NR_statfs64
3577 print_statfs64(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3578 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3579 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3581 print_syscall_prologue(name
);
3582 print_string(arg0
, 0);
3583 print_pointer(arg1
, 1);
3584 print_syscall_epilogue(name
);
3588 #ifdef TARGET_NR_symlink
3590 print_symlink(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3591 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3592 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3594 print_syscall_prologue(name
);
3595 print_string(arg0
, 0);
3596 print_string(arg1
, 1);
3597 print_syscall_epilogue(name
);
3601 #ifdef TARGET_NR_symlinkat
3603 print_symlinkat(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3604 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3605 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3607 print_syscall_prologue(name
);
3608 print_string(arg0
, 0);
3609 print_at_dirfd(arg1
, 0);
3610 print_string(arg2
, 1);
3611 print_syscall_epilogue(name
);
3615 #ifdef TARGET_NR_mount
3617 print_mount(CPUArchState
*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_string(arg0
, 0);
3623 print_string(arg1
, 0);
3624 print_string(arg2
, 0);
3625 print_flags(mount_flags
, arg3
, 0);
3626 print_pointer(arg4
, 1);
3627 print_syscall_epilogue(name
);
3631 #ifdef TARGET_NR_umount
3633 print_umount(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3634 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3635 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3637 print_syscall_prologue(name
);
3638 print_string(arg0
, 1);
3639 print_syscall_epilogue(name
);
3643 #ifdef TARGET_NR_umount2
3645 print_umount2(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3646 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3647 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3649 print_syscall_prologue(name
);
3650 print_string(arg0
, 0);
3651 print_flags(umount2_flags
, arg1
, 1);
3652 print_syscall_epilogue(name
);
3656 #ifdef TARGET_NR_unlink
3658 print_unlink(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3659 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3660 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3662 print_syscall_prologue(name
);
3663 print_string(arg0
, 1);
3664 print_syscall_epilogue(name
);
3668 #ifdef TARGET_NR_unlinkat
3670 print_unlinkat(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3671 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3672 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3674 print_syscall_prologue(name
);
3675 print_at_dirfd(arg0
, 0);
3676 print_string(arg1
, 0);
3677 print_flags(unlinkat_flags
, arg2
, 1);
3678 print_syscall_epilogue(name
);
3682 #ifdef TARGET_NR_unshare
3684 print_unshare(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3685 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3686 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3688 print_syscall_prologue(name
);
3689 print_flags(clone_flags
, arg0
, 1);
3690 print_syscall_epilogue(name
);
3694 #ifdef TARGET_NR_clock_nanosleep
3696 print_clock_nanosleep(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3697 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3698 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3700 print_syscall_prologue(name
);
3701 print_enums(clockids
, arg0
, 0);
3702 print_raw_param("%d", arg1
, 0);
3703 print_timespec(arg2
, 0);
3704 print_timespec(arg3
, 1);
3705 print_syscall_epilogue(name
);
3709 #ifdef TARGET_NR_utime
3711 print_utime(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3712 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3713 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3715 print_syscall_prologue(name
);
3716 print_string(arg0
, 0);
3717 print_pointer(arg1
, 1);
3718 print_syscall_epilogue(name
);
3722 #ifdef TARGET_NR_utimes
3724 print_utimes(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3725 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3726 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3728 print_syscall_prologue(name
);
3729 print_string(arg0
, 0);
3730 print_pointer(arg1
, 1);
3731 print_syscall_epilogue(name
);
3735 #ifdef TARGET_NR_utimensat
3737 print_utimensat(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3738 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3739 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3741 print_syscall_prologue(name
);
3742 print_at_dirfd(arg0
, 0);
3743 print_string(arg1
, 0);
3744 print_pointer(arg2
, 0);
3745 print_flags(at_file_flags
, arg3
, 1);
3746 print_syscall_epilogue(name
);
3750 #if defined(TARGET_NR_mmap) || defined(TARGET_NR_mmap2)
3752 print_mmap(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3753 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3754 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3756 print_syscall_prologue(name
);
3757 print_pointer(arg0
, 0);
3758 print_raw_param("%d", arg1
, 0);
3759 print_flags(mmap_prot_flags
, arg2
, 0);
3760 print_flags(mmap_flags
, arg3
, 0);
3761 print_raw_param("%d", arg4
, 0);
3762 print_raw_param("%#x", arg5
, 1);
3763 print_syscall_epilogue(name
);
3765 #define print_mmap2 print_mmap
3768 #ifdef TARGET_NR_mprotect
3770 print_mprotect(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3771 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3772 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3774 print_syscall_prologue(name
);
3775 print_pointer(arg0
, 0);
3776 print_raw_param("%d", arg1
, 0);
3777 print_flags(mmap_prot_flags
, arg2
, 1);
3778 print_syscall_epilogue(name
);
3782 #ifdef TARGET_NR_munmap
3784 print_munmap(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3785 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3786 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3788 print_syscall_prologue(name
);
3789 print_pointer(arg0
, 0);
3790 print_raw_param("%d", arg1
, 1);
3791 print_syscall_epilogue(name
);
3795 #ifdef TARGET_NR_futex
3796 static void print_futex_op(int cmd
, int last
)
3798 static const char * const futex_names
[] = {
3799 #define NAME(X) [X] = #X
3803 NAME(FUTEX_REQUEUE
),
3804 NAME(FUTEX_CMP_REQUEUE
),
3805 NAME(FUTEX_WAKE_OP
),
3806 NAME(FUTEX_LOCK_PI
),
3807 NAME(FUTEX_UNLOCK_PI
),
3808 NAME(FUTEX_TRYLOCK_PI
),
3809 NAME(FUTEX_WAIT_BITSET
),
3810 NAME(FUTEX_WAKE_BITSET
),
3811 NAME(FUTEX_WAIT_REQUEUE_PI
),
3812 NAME(FUTEX_CMP_REQUEUE_PI
),
3813 NAME(FUTEX_LOCK_PI2
),
3817 unsigned base_cmd
= cmd
& FUTEX_CMD_MASK
;
3819 if (base_cmd
< ARRAY_SIZE(futex_names
)) {
3821 (cmd
& FUTEX_PRIVATE_FLAG
? "FUTEX_PRIVATE_FLAG|" : ""),
3822 (cmd
& FUTEX_CLOCK_REALTIME
? "FUTEX_CLOCK_REALTIME|" : ""),
3823 futex_names
[base_cmd
]);
3825 qemu_log("0x%x", cmd
);
3830 print_futex(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3831 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3832 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3834 abi_long op
= arg1
& FUTEX_CMD_MASK
;
3835 print_syscall_prologue(name
);
3836 print_pointer(arg0
, 0);
3837 print_futex_op(arg1
, 0);
3838 print_raw_param(",%d", arg2
, 0);
3841 case FUTEX_WAIT_BITSET
:
3843 case FUTEX_LOCK_PI2
:
3844 case FUTEX_WAIT_REQUEUE_PI
:
3845 print_timespec(arg3
, 0);
3848 print_pointer(arg3
, 0);
3851 print_pointer(arg4
, 0);
3852 print_raw_param("%d", arg4
, 1);
3853 print_syscall_epilogue(name
);
3857 #ifdef TARGET_NR_kill
3859 print_kill(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3860 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3861 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3863 print_syscall_prologue(name
);
3864 print_raw_param("%d", arg0
, 0);
3865 print_signal(arg1
, 1);
3866 print_syscall_epilogue(name
);
3870 #ifdef TARGET_NR_tkill
3872 print_tkill(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3873 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3874 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3876 print_syscall_prologue(name
);
3877 print_raw_param("%d", arg0
, 0);
3878 print_signal(arg1
, 1);
3879 print_syscall_epilogue(name
);
3883 #ifdef TARGET_NR_tgkill
3885 print_tgkill(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3886 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3887 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3889 print_syscall_prologue(name
);
3890 print_raw_param("%d", arg0
, 0);
3891 print_raw_param("%d", arg1
, 0);
3892 print_signal(arg2
, 1);
3893 print_syscall_epilogue(name
);
3897 #ifdef TARGET_NR_statx
3899 print_statx(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3900 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3901 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3903 print_syscall_prologue(name
);
3904 print_at_dirfd(arg0
, 0);
3905 print_string(arg1
, 0);
3906 print_flags(statx_flags
, arg2
, 0);
3907 print_flags(statx_mask
, arg3
, 0);
3908 print_pointer(arg4
, 1);
3909 print_syscall_epilogue(name
);
3913 #ifdef TARGET_NR_ioctl
3915 print_ioctl(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3916 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3917 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3919 print_syscall_prologue(name
);
3920 print_raw_param("%d", arg0
, 0);
3922 const IOCTLEntry
*ie
;
3923 const argtype
*arg_type
;
3927 for (ie
= ioctl_entries
; ie
->target_cmd
!= 0; ie
++) {
3928 if (ie
->target_cmd
== arg1
) {
3933 if (ie
->target_cmd
== 0) {
3934 print_raw_param("%#x", arg1
, 0);
3935 print_raw_param("%#x", arg2
, 1);
3937 qemu_log("%s", ie
->name
);
3938 arg_type
= ie
->arg_type
;
3940 if (arg_type
[0] != TYPE_NULL
) {
3943 switch (arg_type
[0]) {
3945 print_pointer(arg2
, 1);
3950 print_raw_param("%d", arg2
, 1);
3953 print_raw_param(TARGET_ABI_FMT_ld
, arg2
, 1);
3956 print_raw_param(TARGET_ABI_FMT_lu
, arg2
, 1);
3959 switch (ie
->access
) {
3961 print_pointer(arg2
, 1);
3966 target_size
= thunk_type_size(arg_type
, 0);
3967 argptr
= lock_user(VERIFY_READ
, arg2
, target_size
, 1);
3969 thunk_print(argptr
, arg_type
);
3970 unlock_user(argptr
, arg2
, target_size
);
3972 print_pointer(arg2
, 1);
3978 g_assert_not_reached();
3982 print_syscall_epilogue(name
);
3987 * An array of all of the syscalls we know about
3990 static const struct syscallname scnames
[] = {
3991 #include "strace.list"
3994 static int nsyscalls
= ARRAY_SIZE(scnames
);
3997 * The public interface to this module.
4000 print_syscall(CPUArchState
*cpu_env
, int num
,
4001 abi_long arg1
, abi_long arg2
, abi_long arg3
,
4002 abi_long arg4
, abi_long arg5
, abi_long arg6
)
4006 const char *format
= "%s(" TARGET_ABI_FMT_ld
"," TARGET_ABI_FMT_ld
","
4007 TARGET_ABI_FMT_ld
"," TARGET_ABI_FMT_ld
","
4008 TARGET_ABI_FMT_ld
"," TARGET_ABI_FMT_ld
")";
4010 f
= qemu_log_trylock();
4014 fprintf(f
, "%d ", getpid());
4016 for (i
= 0; i
< nsyscalls
; i
++) {
4017 if (scnames
[i
].nr
== num
) {
4018 if (scnames
[i
].call
!= NULL
) {
4019 scnames
[i
].call(cpu_env
, &scnames
[i
], arg1
, arg2
, arg3
,
4022 /* XXX: this format system is broken because it uses
4023 host types and host pointers for strings */
4024 if (scnames
[i
].format
!= NULL
) {
4025 format
= scnames
[i
].format
;
4027 fprintf(f
, format
, scnames
[i
].name
, arg1
, arg2
,
4028 arg3
, arg4
, arg5
, arg6
);
4034 fprintf(f
, "Unknown syscall %d\n", num
);
4040 print_syscall_ret(CPUArchState
*cpu_env
, int num
, abi_long ret
,
4041 abi_long arg1
, abi_long arg2
, abi_long arg3
,
4042 abi_long arg4
, abi_long arg5
, abi_long arg6
)
4047 f
= qemu_log_trylock();
4052 for (i
= 0; i
< nsyscalls
; i
++) {
4053 if (scnames
[i
].nr
== num
) {
4054 if (scnames
[i
].result
!= NULL
) {
4055 scnames
[i
].result(cpu_env
, &scnames
[i
], ret
,
4059 if (!print_syscall_err(ret
)) {
4060 fprintf(f
, TARGET_ABI_FMT_ld
, ret
);
4070 void print_taken_signal(int target_signum
, const target_siginfo_t
*tinfo
)
4072 /* Print the strace output for a signal being taken:
4073 * --- SIGSEGV {si_signo=SIGSEGV, si_code=SI_KERNEL, si_addr=0} ---
4077 f
= qemu_log_trylock();
4083 print_signal(target_signum
, 1);
4085 print_siginfo(tinfo
);
4086 fprintf(f
, " ---\n");