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_AUDIT");
512 case NETLINK_NETFILTER
:
513 qemu_log("NETLINK_NETFILTER");
515 case NETLINK_KOBJECT_UEVENT
:
516 qemu_log("NETLINK_KOBJECT_UEVENT");
519 qemu_log("NETLINK_RDMA");
522 qemu_log("NETLINK_CRYPTO");
525 qemu_log("%d", protocol
);
533 qemu_log("IPPROTO_IP");
536 qemu_log("IPPROTO_TCP");
539 qemu_log("IPPROTO_UDP");
542 qemu_log("IPPROTO_RAW");
545 qemu_log("%d", protocol
);
551 #ifdef TARGET_NR__newselect
553 print_fdset(int n
, abi_ulong target_fds_addr
)
559 if( target_fds_addr
) {
560 abi_long
*target_fds
;
562 target_fds
= lock_user(VERIFY_READ
,
564 sizeof(*target_fds
)*(n
/ TARGET_ABI_BITS
+ 1),
570 for (i
=n
; i
>=0; i
--) {
571 if ((tswapal(target_fds
[i
/ TARGET_ABI_BITS
]) >>
572 (i
& (TARGET_ABI_BITS
- 1))) & 1) {
573 qemu_log("%s%d", get_comma(first
), i
);
577 unlock_user(target_fds
, target_fds_addr
, 0);
584 * Sysycall specific output functions
588 #ifdef TARGET_NR__newselect
590 print_newselect(CPUArchState
*cpu_env
, const struct syscallname
*name
,
591 abi_long arg1
, abi_long arg2
, abi_long arg3
,
592 abi_long arg4
, abi_long arg5
, abi_long arg6
)
594 print_syscall_prologue(name
);
595 print_fdset(arg1
, arg2
);
597 print_fdset(arg1
, arg3
);
599 print_fdset(arg1
, arg4
);
601 print_timeval(arg5
, 1);
602 print_syscall_epilogue(name
);
606 #ifdef TARGET_NR_semctl
608 print_semctl(CPUArchState
*cpu_env
, const struct syscallname
*name
,
609 abi_long arg1
, abi_long arg2
, abi_long arg3
,
610 abi_long arg4
, abi_long arg5
, abi_long arg6
)
612 qemu_log("%s(" TARGET_ABI_FMT_ld
"," TARGET_ABI_FMT_ld
",",
613 name
->name
, arg1
, arg2
);
615 qemu_log(",0x" TARGET_ABI_FMT_lx
")", arg4
);
620 print_execve(CPUArchState
*cpu_env
, const struct syscallname
*name
,
621 abi_long arg1
, abi_long arg2
, abi_long arg3
,
622 abi_long arg4
, abi_long arg5
, abi_long arg6
)
624 abi_ulong arg_ptr_addr
;
627 if (!(s
= lock_user_string(arg1
)))
629 qemu_log("%s(\"%s\",{", name
->name
, s
);
630 unlock_user(s
, arg1
, 0);
632 for (arg_ptr_addr
= arg2
; ; arg_ptr_addr
+= sizeof(abi_ulong
)) {
633 abi_ulong
*arg_ptr
, arg_addr
;
635 arg_ptr
= lock_user(VERIFY_READ
, arg_ptr_addr
, sizeof(abi_ulong
), 1);
638 arg_addr
= tswapal(*arg_ptr
);
639 unlock_user(arg_ptr
, arg_ptr_addr
, 0);
642 if ((s
= lock_user_string(arg_addr
))) {
643 qemu_log("\"%s\",", s
);
644 unlock_user(s
, arg_addr
, 0);
653 print_ipc(CPUArchState
*cpu_env
, const struct syscallname
*name
,
654 abi_long arg1
, abi_long arg2
, abi_long arg3
,
655 abi_long arg4
, abi_long arg5
, abi_long arg6
)
659 qemu_log("semctl(" TARGET_ABI_FMT_ld
"," TARGET_ABI_FMT_ld
",",
662 qemu_log(",0x" TARGET_ABI_FMT_lx
")", arg4
);
666 TARGET_ABI_FMT_ld
","
667 TARGET_ABI_FMT_ld
","
668 TARGET_ABI_FMT_ld
","
671 name
->name
, arg1
, arg2
, arg3
, arg4
);
677 * Variants for the return value output function
681 print_syscall_err(abi_long ret
)
687 errstr
= target_strerror(-ret
);
689 qemu_log("-1 errno=%d (%s)", (int)-ret
, errstr
);
697 print_syscall_ret_addr(CPUArchState
*cpu_env
, const struct syscallname
*name
,
698 abi_long ret
, abi_long arg0
, abi_long arg1
,
699 abi_long arg2
, abi_long arg3
, abi_long arg4
,
702 if (!print_syscall_err(ret
)) {
703 qemu_log("0x" TARGET_ABI_FMT_lx
, ret
);
708 #if 0 /* currently unused */
710 print_syscall_ret_raw(struct syscallname
*name
, abi_long ret
)
712 qemu_log(" = 0x" TARGET_ABI_FMT_lx
"\n", ret
);
716 #ifdef TARGET_NR__newselect
718 print_syscall_ret_newselect(CPUArchState
*cpu_env
, const struct syscallname
*name
,
719 abi_long ret
, abi_long arg0
, abi_long arg1
,
720 abi_long arg2
, abi_long arg3
, abi_long arg4
,
723 if (!print_syscall_err(ret
)) {
724 qemu_log(" = 0x" TARGET_ABI_FMT_lx
" (", ret
);
725 print_fdset(arg0
, arg1
);
727 print_fdset(arg0
, arg2
);
729 print_fdset(arg0
, arg3
);
731 print_timeval(arg4
, 1);
739 /* special meanings of adjtimex()' non-negative return values */
740 #define TARGET_TIME_OK 0 /* clock synchronized, no leap second */
741 #define TARGET_TIME_INS 1 /* insert leap second */
742 #define TARGET_TIME_DEL 2 /* delete leap second */
743 #define TARGET_TIME_OOP 3 /* leap second in progress */
744 #define TARGET_TIME_WAIT 4 /* leap second has occurred */
745 #define TARGET_TIME_ERROR 5 /* clock not synchronized */
746 #ifdef TARGET_NR_adjtimex
748 print_syscall_ret_adjtimex(CPUArchState
*cpu_env
, const struct syscallname
*name
,
749 abi_long ret
, abi_long arg0
, abi_long arg1
,
750 abi_long arg2
, abi_long arg3
, abi_long arg4
,
753 if (!print_syscall_err(ret
)) {
754 qemu_log(TARGET_ABI_FMT_ld
, ret
);
757 qemu_log(" TIME_OK (clock synchronized, no leap second)");
759 case TARGET_TIME_INS
:
760 qemu_log(" TIME_INS (insert leap second)");
762 case TARGET_TIME_DEL
:
763 qemu_log(" TIME_DEL (delete leap second)");
765 case TARGET_TIME_OOP
:
766 qemu_log(" TIME_OOP (leap second in progress)");
768 case TARGET_TIME_WAIT
:
769 qemu_log(" TIME_WAIT (leap second has occurred)");
771 case TARGET_TIME_ERROR
:
772 qemu_log(" TIME_ERROR (clock not synchronized)");
781 #if defined(TARGET_NR_clock_gettime) || defined(TARGET_NR_clock_getres)
783 print_syscall_ret_clock_gettime(CPUArchState
*cpu_env
, const struct syscallname
*name
,
784 abi_long ret
, abi_long arg0
, abi_long arg1
,
785 abi_long arg2
, abi_long arg3
, abi_long arg4
,
788 if (!print_syscall_err(ret
)) {
789 qemu_log(TARGET_ABI_FMT_ld
, ret
);
791 print_timespec(arg1
, 1);
797 #define print_syscall_ret_clock_getres print_syscall_ret_clock_gettime
800 #if defined(TARGET_NR_clock_gettime64)
802 print_syscall_ret_clock_gettime64(CPUArchState
*cpu_env
, const struct syscallname
*name
,
803 abi_long ret
, abi_long arg0
, abi_long arg1
,
804 abi_long arg2
, abi_long arg3
, abi_long arg4
,
807 if (!print_syscall_err(ret
)) {
808 qemu_log(TARGET_ABI_FMT_ld
, ret
);
810 print_timespec64(arg1
, 1);
818 #ifdef TARGET_NR_gettimeofday
820 print_syscall_ret_gettimeofday(CPUArchState
*cpu_env
, const struct syscallname
*name
,
821 abi_long ret
, abi_long arg0
, abi_long arg1
,
822 abi_long arg2
, abi_long arg3
, abi_long arg4
,
825 if (!print_syscall_err(ret
)) {
826 qemu_log(TARGET_ABI_FMT_ld
, ret
);
828 print_timeval(arg0
, 0);
829 print_timezone(arg1
, 1);
837 #ifdef TARGET_NR_getitimer
839 print_syscall_ret_getitimer(CPUArchState
*cpu_env
, const struct syscallname
*name
,
840 abi_long ret
, abi_long arg0
, abi_long arg1
,
841 abi_long arg2
, abi_long arg3
, abi_long arg4
,
844 if (!print_syscall_err(ret
)) {
845 qemu_log(TARGET_ABI_FMT_ld
, ret
);
847 print_itimerval(arg1
, 1);
856 #ifdef TARGET_NR_getitimer
858 print_syscall_ret_setitimer(CPUArchState
*cpu_env
, const struct syscallname
*name
,
859 abi_long ret
, abi_long arg0
, abi_long arg1
,
860 abi_long arg2
, abi_long arg3
, abi_long arg4
,
863 if (!print_syscall_err(ret
)) {
864 qemu_log(TARGET_ABI_FMT_ld
, ret
);
865 qemu_log(" (old_value = ");
866 print_itimerval(arg2
, 1);
874 #if defined(TARGET_NR_listxattr) || defined(TARGET_NR_llistxattr) \
875 || defined(TARGGET_NR_flistxattr)
877 print_syscall_ret_listxattr(CPUArchState
*cpu_env
, const struct syscallname
*name
,
878 abi_long ret
, abi_long arg0
, abi_long arg1
,
879 abi_long arg2
, abi_long arg3
, abi_long arg4
,
882 if (!print_syscall_err(ret
)) {
883 qemu_log(TARGET_ABI_FMT_ld
, ret
);
884 qemu_log(" (list = ");
886 abi_long attr
= arg1
;
891 print_string(attr
, 1);
892 ret
-= target_strlen(attr
) + 1;
893 attr
+= target_strlen(attr
) + 1;
903 #define print_syscall_ret_llistxattr print_syscall_ret_listxattr
904 #define print_syscall_ret_flistxattr print_syscall_ret_listxattr
907 #ifdef TARGET_NR_ioctl
909 print_syscall_ret_ioctl(CPUArchState
*cpu_env
, const struct syscallname
*name
,
910 abi_long ret
, abi_long arg0
, abi_long arg1
,
911 abi_long arg2
, abi_long arg3
, abi_long arg4
,
914 if (!print_syscall_err(ret
)) {
915 qemu_log(TARGET_ABI_FMT_ld
, ret
);
917 const IOCTLEntry
*ie
;
918 const argtype
*arg_type
;
922 for (ie
= ioctl_entries
; ie
->target_cmd
!= 0; ie
++) {
923 if (ie
->target_cmd
== arg1
) {
928 if (ie
->target_cmd
== arg1
&&
929 (ie
->access
== IOC_R
|| ie
->access
== IOC_RW
)) {
930 arg_type
= ie
->arg_type
;
933 target_size
= thunk_type_size(arg_type
, 0);
934 argptr
= lock_user(VERIFY_READ
, arg2
, target_size
, 1);
936 thunk_print(argptr
, arg_type
);
937 unlock_user(argptr
, arg2
, target_size
);
939 print_pointer(arg2
, 1);
948 UNUSED
static struct flags access_flags
[] = {
956 UNUSED
static struct flags at_file_flags
[] = {
958 FLAG_GENERIC(AT_EACCESS
),
960 #ifdef AT_SYMLINK_NOFOLLOW
961 FLAG_GENERIC(AT_SYMLINK_NOFOLLOW
),
966 UNUSED
static struct flags unlinkat_flags
[] = {
968 FLAG_GENERIC(AT_REMOVEDIR
),
973 UNUSED
static struct flags mode_flags
[] = {
974 FLAG_GENERIC(S_IFSOCK
),
975 FLAG_GENERIC(S_IFLNK
),
976 FLAG_GENERIC(S_IFREG
),
977 FLAG_GENERIC(S_IFBLK
),
978 FLAG_GENERIC(S_IFDIR
),
979 FLAG_GENERIC(S_IFCHR
),
980 FLAG_GENERIC(S_IFIFO
),
984 UNUSED
static struct flags open_access_flags
[] = {
985 FLAG_TARGET(O_RDONLY
),
986 FLAG_TARGET(O_WRONLY
),
991 UNUSED
static struct flags open_flags
[] = {
992 FLAG_TARGET(O_APPEND
),
993 FLAG_TARGET(O_CREAT
),
994 FLAG_TARGET(O_DIRECTORY
),
996 FLAG_TARGET(O_LARGEFILE
),
997 FLAG_TARGET(O_NOCTTY
),
998 FLAG_TARGET(O_NOFOLLOW
),
999 FLAG_TARGET(O_NONBLOCK
), /* also O_NDELAY */
1000 FLAG_TARGET(O_DSYNC
),
1001 FLAG_TARGET(__O_SYNC
),
1002 FLAG_TARGET(O_TRUNC
),
1004 FLAG_TARGET(O_DIRECT
),
1007 FLAG_TARGET(O_NOATIME
),
1010 FLAG_TARGET(O_CLOEXEC
),
1013 FLAG_TARGET(O_PATH
),
1016 FLAG_TARGET(O_TMPFILE
),
1017 FLAG_TARGET(__O_TMPFILE
),
1022 UNUSED
static struct flags mount_flags
[] = {
1024 FLAG_GENERIC(MS_BIND
),
1027 FLAG_GENERIC(MS_DIRSYNC
),
1029 FLAG_GENERIC(MS_MANDLOCK
),
1031 FLAG_GENERIC(MS_MOVE
),
1033 FLAG_GENERIC(MS_NOATIME
),
1034 FLAG_GENERIC(MS_NODEV
),
1035 FLAG_GENERIC(MS_NODIRATIME
),
1036 FLAG_GENERIC(MS_NOEXEC
),
1037 FLAG_GENERIC(MS_NOSUID
),
1038 FLAG_GENERIC(MS_RDONLY
),
1040 FLAG_GENERIC(MS_RELATIME
),
1042 FLAG_GENERIC(MS_REMOUNT
),
1043 FLAG_GENERIC(MS_SYNCHRONOUS
),
1047 UNUSED
static struct flags umount2_flags
[] = {
1049 FLAG_GENERIC(MNT_FORCE
),
1052 FLAG_GENERIC(MNT_DETACH
),
1055 FLAG_GENERIC(MNT_EXPIRE
),
1060 UNUSED
static struct flags mmap_prot_flags
[] = {
1061 FLAG_GENERIC(PROT_NONE
),
1062 FLAG_GENERIC(PROT_EXEC
),
1063 FLAG_GENERIC(PROT_READ
),
1064 FLAG_GENERIC(PROT_WRITE
),
1065 FLAG_TARGET(PROT_SEM
),
1066 FLAG_GENERIC(PROT_GROWSDOWN
),
1067 FLAG_GENERIC(PROT_GROWSUP
),
1071 UNUSED
static struct flags mmap_flags
[] = {
1072 FLAG_TARGET(MAP_SHARED
),
1073 FLAG_TARGET(MAP_PRIVATE
),
1074 FLAG_TARGET(MAP_ANONYMOUS
),
1075 FLAG_TARGET(MAP_DENYWRITE
),
1076 FLAG_TARGET(MAP_FIXED
),
1077 FLAG_TARGET(MAP_GROWSDOWN
),
1078 FLAG_TARGET(MAP_EXECUTABLE
),
1080 FLAG_TARGET(MAP_LOCKED
),
1083 FLAG_TARGET(MAP_NONBLOCK
),
1085 FLAG_TARGET(MAP_NORESERVE
),
1087 FLAG_TARGET(MAP_POPULATE
),
1089 #ifdef TARGET_MAP_UNINITIALIZED
1090 FLAG_TARGET(MAP_UNINITIALIZED
),
1095 UNUSED
static struct flags clone_flags
[] = {
1096 FLAG_GENERIC(CLONE_VM
),
1097 FLAG_GENERIC(CLONE_FS
),
1098 FLAG_GENERIC(CLONE_FILES
),
1099 FLAG_GENERIC(CLONE_SIGHAND
),
1100 FLAG_GENERIC(CLONE_PTRACE
),
1101 FLAG_GENERIC(CLONE_VFORK
),
1102 FLAG_GENERIC(CLONE_PARENT
),
1103 FLAG_GENERIC(CLONE_THREAD
),
1104 FLAG_GENERIC(CLONE_NEWNS
),
1105 FLAG_GENERIC(CLONE_SYSVSEM
),
1106 FLAG_GENERIC(CLONE_SETTLS
),
1107 FLAG_GENERIC(CLONE_PARENT_SETTID
),
1108 FLAG_GENERIC(CLONE_CHILD_CLEARTID
),
1109 FLAG_GENERIC(CLONE_DETACHED
),
1110 FLAG_GENERIC(CLONE_UNTRACED
),
1111 FLAG_GENERIC(CLONE_CHILD_SETTID
),
1112 #if defined(CLONE_NEWUTS)
1113 FLAG_GENERIC(CLONE_NEWUTS
),
1115 #if defined(CLONE_NEWIPC)
1116 FLAG_GENERIC(CLONE_NEWIPC
),
1118 #if defined(CLONE_NEWUSER)
1119 FLAG_GENERIC(CLONE_NEWUSER
),
1121 #if defined(CLONE_NEWPID)
1122 FLAG_GENERIC(CLONE_NEWPID
),
1124 #if defined(CLONE_NEWNET)
1125 FLAG_GENERIC(CLONE_NEWNET
),
1127 #if defined(CLONE_NEWCGROUP)
1128 FLAG_GENERIC(CLONE_NEWCGROUP
),
1130 #if defined(CLONE_NEWTIME)
1131 FLAG_GENERIC(CLONE_NEWTIME
),
1133 #if defined(CLONE_IO)
1134 FLAG_GENERIC(CLONE_IO
),
1139 UNUSED
static struct flags msg_flags
[] = {
1141 FLAG_GENERIC(MSG_CONFIRM
),
1142 FLAG_GENERIC(MSG_DONTROUTE
),
1143 FLAG_GENERIC(MSG_DONTWAIT
),
1144 FLAG_GENERIC(MSG_EOR
),
1145 FLAG_GENERIC(MSG_MORE
),
1146 FLAG_GENERIC(MSG_NOSIGNAL
),
1147 FLAG_GENERIC(MSG_OOB
),
1149 FLAG_GENERIC(MSG_CMSG_CLOEXEC
),
1150 FLAG_GENERIC(MSG_ERRQUEUE
),
1151 FLAG_GENERIC(MSG_PEEK
),
1152 FLAG_GENERIC(MSG_TRUNC
),
1153 FLAG_GENERIC(MSG_WAITALL
),
1155 FLAG_GENERIC(MSG_CTRUNC
),
1159 UNUSED
static struct flags statx_flags
[] = {
1160 #ifdef AT_EMPTY_PATH
1161 FLAG_GENERIC(AT_EMPTY_PATH
),
1163 #ifdef AT_NO_AUTOMOUNT
1164 FLAG_GENERIC(AT_NO_AUTOMOUNT
),
1166 #ifdef AT_SYMLINK_NOFOLLOW
1167 FLAG_GENERIC(AT_SYMLINK_NOFOLLOW
),
1169 #ifdef AT_STATX_SYNC_AS_STAT
1170 FLAG_GENERIC(AT_STATX_SYNC_AS_STAT
),
1172 #ifdef AT_STATX_FORCE_SYNC
1173 FLAG_GENERIC(AT_STATX_FORCE_SYNC
),
1175 #ifdef AT_STATX_DONT_SYNC
1176 FLAG_GENERIC(AT_STATX_DONT_SYNC
),
1181 UNUSED
static struct flags statx_mask
[] = {
1182 /* This must come first, because it includes everything. */
1184 FLAG_GENERIC(STATX_ALL
),
1186 /* This must come second; it includes everything except STATX_BTIME. */
1187 #ifdef STATX_BASIC_STATS
1188 FLAG_GENERIC(STATX_BASIC_STATS
),
1191 FLAG_GENERIC(STATX_TYPE
),
1194 FLAG_GENERIC(STATX_MODE
),
1197 FLAG_GENERIC(STATX_NLINK
),
1200 FLAG_GENERIC(STATX_UID
),
1203 FLAG_GENERIC(STATX_GID
),
1206 FLAG_GENERIC(STATX_ATIME
),
1209 FLAG_GENERIC(STATX_MTIME
),
1212 FLAG_GENERIC(STATX_CTIME
),
1215 FLAG_GENERIC(STATX_INO
),
1218 FLAG_GENERIC(STATX_SIZE
),
1221 FLAG_GENERIC(STATX_BLOCKS
),
1224 FLAG_GENERIC(STATX_BTIME
),
1229 UNUSED
static struct flags falloc_flags
[] = {
1230 FLAG_GENERIC(FALLOC_FL_KEEP_SIZE
),
1231 FLAG_GENERIC(FALLOC_FL_PUNCH_HOLE
),
1232 #ifdef FALLOC_FL_NO_HIDE_STALE
1233 FLAG_GENERIC(FALLOC_FL_NO_HIDE_STALE
),
1235 #ifdef FALLOC_FL_COLLAPSE_RANGE
1236 FLAG_GENERIC(FALLOC_FL_COLLAPSE_RANGE
),
1238 #ifdef FALLOC_FL_ZERO_RANGE
1239 FLAG_GENERIC(FALLOC_FL_ZERO_RANGE
),
1241 #ifdef FALLOC_FL_INSERT_RANGE
1242 FLAG_GENERIC(FALLOC_FL_INSERT_RANGE
),
1244 #ifdef FALLOC_FL_UNSHARE_RANGE
1245 FLAG_GENERIC(FALLOC_FL_UNSHARE_RANGE
),
1249 UNUSED
static struct flags termios_iflags
[] = {
1250 FLAG_TARGET(IGNBRK
),
1251 FLAG_TARGET(BRKINT
),
1252 FLAG_TARGET(IGNPAR
),
1253 FLAG_TARGET(PARMRK
),
1255 FLAG_TARGET(ISTRIP
),
1263 FLAG_TARGET(IMAXBEL
),
1268 UNUSED
static struct flags termios_oflags
[] = {
1274 FLAG_TARGET(ONLRET
),
1280 UNUSED
static struct enums termios_oflags_NLDLY
[] = {
1286 UNUSED
static struct enums termios_oflags_CRDLY
[] = {
1294 UNUSED
static struct enums termios_oflags_TABDLY
[] = {
1302 UNUSED
static struct enums termios_oflags_VTDLY
[] = {
1308 UNUSED
static struct enums termios_oflags_FFDLY
[] = {
1314 UNUSED
static struct enums termios_oflags_BSDLY
[] = {
1320 UNUSED
static struct enums termios_cflags_CBAUD
[] = {
1335 ENUM_TARGET(B19200
),
1336 ENUM_TARGET(B38400
),
1337 ENUM_TARGET(B57600
),
1338 ENUM_TARGET(B115200
),
1339 ENUM_TARGET(B230400
),
1340 ENUM_TARGET(B460800
),
1344 UNUSED
static struct enums termios_cflags_CSIZE
[] = {
1352 UNUSED
static struct flags termios_cflags
[] = {
1353 FLAG_TARGET(CSTOPB
),
1355 FLAG_TARGET(PARENB
),
1356 FLAG_TARGET(PARODD
),
1358 FLAG_TARGET(CLOCAL
),
1359 FLAG_TARGET(CRTSCTS
),
1363 UNUSED
static struct flags termios_lflags
[] = {
1365 FLAG_TARGET(ICANON
),
1370 FLAG_TARGET(ECHONL
),
1371 FLAG_TARGET(NOFLSH
),
1372 FLAG_TARGET(TOSTOP
),
1373 FLAG_TARGET(ECHOCTL
),
1374 FLAG_TARGET(ECHOPRT
),
1375 FLAG_TARGET(ECHOKE
),
1376 FLAG_TARGET(FLUSHO
),
1377 FLAG_TARGET(PENDIN
),
1378 FLAG_TARGET(IEXTEN
),
1379 FLAG_TARGET(EXTPROC
),
1383 UNUSED
static struct flags mlockall_flags
[] = {
1384 FLAG_TARGET(MCL_CURRENT
),
1385 FLAG_TARGET(MCL_FUTURE
),
1387 FLAG_TARGET(MCL_ONFAULT
),
1392 /* IDs of the various system clocks */
1393 #define TARGET_CLOCK_REALTIME 0
1394 #define TARGET_CLOCK_MONOTONIC 1
1395 #define TARGET_CLOCK_PROCESS_CPUTIME_ID 2
1396 #define TARGET_CLOCK_THREAD_CPUTIME_ID 3
1397 #define TARGET_CLOCK_MONOTONIC_RAW 4
1398 #define TARGET_CLOCK_REALTIME_COARSE 5
1399 #define TARGET_CLOCK_MONOTONIC_COARSE 6
1400 #define TARGET_CLOCK_BOOTTIME 7
1401 #define TARGET_CLOCK_REALTIME_ALARM 8
1402 #define TARGET_CLOCK_BOOTTIME_ALARM 9
1403 #define TARGET_CLOCK_SGI_CYCLE 10
1404 #define TARGET_CLOCK_TAI 11
1406 UNUSED
static struct enums clockids
[] = {
1407 ENUM_TARGET(CLOCK_REALTIME
),
1408 ENUM_TARGET(CLOCK_MONOTONIC
),
1409 ENUM_TARGET(CLOCK_PROCESS_CPUTIME_ID
),
1410 ENUM_TARGET(CLOCK_THREAD_CPUTIME_ID
),
1411 ENUM_TARGET(CLOCK_MONOTONIC_RAW
),
1412 ENUM_TARGET(CLOCK_REALTIME_COARSE
),
1413 ENUM_TARGET(CLOCK_MONOTONIC_COARSE
),
1414 ENUM_TARGET(CLOCK_BOOTTIME
),
1415 ENUM_TARGET(CLOCK_REALTIME_ALARM
),
1416 ENUM_TARGET(CLOCK_BOOTTIME_ALARM
),
1417 ENUM_TARGET(CLOCK_SGI_CYCLE
),
1418 ENUM_TARGET(CLOCK_TAI
),
1422 UNUSED
static struct enums itimer_types
[] = {
1423 ENUM_GENERIC(ITIMER_REAL
),
1424 ENUM_GENERIC(ITIMER_VIRTUAL
),
1425 ENUM_GENERIC(ITIMER_PROF
),
1430 * print_xxx utility functions. These are used to print syscall
1431 * parameters in certain format. All of these have parameter
1432 * named 'last'. This parameter is used to add comma to output
1439 return ((last
) ? "" : ",");
1443 print_flags(const struct flags
*f
, abi_long flags
, int last
)
1445 const char *sep
= "";
1448 if ((flags
== 0) && (f
->f_value
== 0)) {
1449 qemu_log("%s%s", f
->f_string
, get_comma(last
));
1452 for (n
= 0; f
->f_string
!= NULL
; f
++) {
1453 if ((f
->f_value
!= 0) && ((flags
& f
->f_value
) == f
->f_value
)) {
1454 qemu_log("%s%s", sep
, f
->f_string
);
1455 flags
&= ~f
->f_value
;
1462 /* print rest of the flags as numeric */
1464 qemu_log("%s%#x%s", sep
, (unsigned int)flags
, get_comma(last
));
1466 qemu_log("%s", get_comma(last
));
1469 /* no string version of flags found, print them in hex then */
1470 qemu_log("%#x%s", (unsigned int)flags
, get_comma(last
));
1475 print_enums(const struct enums
*e
, abi_long enum_arg
, int last
)
1477 for (; e
->e_string
!= NULL
; e
++) {
1478 if (e
->e_value
== enum_arg
) {
1479 qemu_log("%s", e
->e_string
);
1484 if (e
->e_string
== NULL
) {
1485 qemu_log("%#x", (unsigned int)enum_arg
);
1488 qemu_log("%s", get_comma(last
));
1492 print_at_dirfd(abi_long dirfd
, int last
)
1495 if (dirfd
== AT_FDCWD
) {
1496 qemu_log("AT_FDCWD%s", get_comma(last
));
1500 qemu_log("%d%s", (int)dirfd
, get_comma(last
));
1504 print_file_mode(abi_long mode
, int last
)
1506 const char *sep
= "";
1507 const struct flags
*m
;
1510 qemu_log("000%s", get_comma(last
));
1514 for (m
= &mode_flags
[0]; m
->f_string
!= NULL
; m
++) {
1515 if ((m
->f_value
& mode
) == m
->f_value
) {
1516 qemu_log("%s%s", m
->f_string
, sep
);
1518 mode
&= ~m
->f_value
;
1524 /* print rest of the mode as octal */
1526 qemu_log("%s%#o", sep
, (unsigned int)mode
);
1528 qemu_log("%s", get_comma(last
));
1532 print_open_flags(abi_long flags
, int last
)
1534 print_flags(open_access_flags
, flags
& TARGET_O_ACCMODE
, 1);
1535 flags
&= ~TARGET_O_ACCMODE
;
1537 qemu_log("%s", get_comma(last
));
1541 print_flags(open_flags
, flags
, last
);
1545 print_syscall_prologue(const struct syscallname
*sc
)
1547 qemu_log("%s(", sc
->name
);
1552 print_syscall_epilogue(const struct syscallname
*sc
)
1559 print_string(abi_long addr
, int last
)
1563 if ((s
= lock_user_string(addr
)) != NULL
) {
1564 qemu_log("\"%s\"%s", s
, get_comma(last
));
1565 unlock_user(s
, addr
, 0);
1567 /* can't get string out of it, so print it as pointer */
1568 print_pointer(addr
, last
);
1572 #define MAX_PRINT_BUF 40
1574 print_buf(abi_long addr
, abi_long len
, int last
)
1579 s
= lock_user(VERIFY_READ
, addr
, len
, 1);
1582 for (i
= 0; i
< MAX_PRINT_BUF
&& i
< len
; i
++) {
1583 if (isprint(s
[i
])) {
1584 qemu_log("%c", s
[i
]);
1586 qemu_log("\\%o", s
[i
]);
1596 unlock_user(s
, addr
, 0);
1598 print_pointer(addr
, last
);
1603 * Prints out raw parameter using given format. Caller needs
1604 * to do byte swapping if needed.
1607 print_raw_param(const char *fmt
, abi_long param
, int last
)
1611 (void) snprintf(format
, sizeof (format
), "%s%s", fmt
, get_comma(last
));
1612 qemu_log(format
, param
);
1616 print_pointer(abi_long p
, int last
)
1619 qemu_log("NULL%s", get_comma(last
));
1621 qemu_log("0x" TARGET_ABI_FMT_lx
"%s", p
, get_comma(last
));
1625 * Reads 32-bit (int) number from guest address space from
1626 * address 'addr' and prints it.
1629 print_number(abi_long addr
, int last
)
1632 qemu_log("NULL%s", get_comma(last
));
1636 get_user_s32(num
, addr
);
1637 qemu_log("[%d]%s", num
, get_comma(last
));
1642 print_timeval(abi_ulong tv_addr
, int last
)
1645 struct target_timeval
*tv
;
1647 tv
= lock_user(VERIFY_READ
, tv_addr
, sizeof(*tv
), 1);
1649 print_pointer(tv_addr
, last
);
1652 qemu_log("{tv_sec = " TARGET_ABI_FMT_ld
1653 ",tv_usec = " TARGET_ABI_FMT_ld
"}%s",
1654 tswapal(tv
->tv_sec
), tswapal(tv
->tv_usec
), get_comma(last
));
1655 unlock_user(tv
, tv_addr
, 0);
1657 qemu_log("NULL%s", get_comma(last
));
1661 print_timespec(abi_ulong ts_addr
, int last
)
1664 struct target_timespec
*ts
;
1666 ts
= lock_user(VERIFY_READ
, ts_addr
, sizeof(*ts
), 1);
1668 print_pointer(ts_addr
, last
);
1671 qemu_log("{tv_sec = " TARGET_ABI_FMT_ld
1672 ",tv_nsec = " TARGET_ABI_FMT_ld
"}%s",
1673 tswapal(ts
->tv_sec
), tswapal(ts
->tv_nsec
), get_comma(last
));
1674 unlock_user(ts
, ts_addr
, 0);
1676 qemu_log("NULL%s", get_comma(last
));
1681 print_timespec64(abi_ulong ts_addr
, int last
)
1684 struct target__kernel_timespec
*ts
;
1686 ts
= lock_user(VERIFY_READ
, ts_addr
, sizeof(*ts
), 1);
1688 print_pointer(ts_addr
, last
);
1691 qemu_log("{tv_sec = %lld"
1692 ",tv_nsec = %lld}%s",
1693 (long long)tswap64(ts
->tv_sec
), (long long)tswap64(ts
->tv_nsec
),
1695 unlock_user(ts
, ts_addr
, 0);
1697 qemu_log("NULL%s", get_comma(last
));
1702 print_timezone(abi_ulong tz_addr
, int last
)
1705 struct target_timezone
*tz
;
1707 tz
= lock_user(VERIFY_READ
, tz_addr
, sizeof(*tz
), 1);
1709 print_pointer(tz_addr
, last
);
1712 qemu_log("{%d,%d}%s", tswap32(tz
->tz_minuteswest
),
1713 tswap32(tz
->tz_dsttime
), get_comma(last
));
1714 unlock_user(tz
, tz_addr
, 0);
1716 qemu_log("NULL%s", get_comma(last
));
1721 print_itimerval(abi_ulong it_addr
, int last
)
1724 qemu_log("{it_interval=");
1725 print_timeval(it_addr
+
1726 offsetof(struct target_itimerval
, it_interval
), 0);
1727 qemu_log("it_value=");
1728 print_timeval(it_addr
+
1729 offsetof(struct target_itimerval
, it_value
), 0);
1730 qemu_log("}%s", get_comma(last
));
1732 qemu_log("NULL%s", get_comma(last
));
1737 print_termios(void *arg
)
1739 const struct target_termios
*target
= arg
;
1741 target_tcflag_t iflags
= tswap32(target
->c_iflag
);
1742 target_tcflag_t oflags
= tswap32(target
->c_oflag
);
1743 target_tcflag_t cflags
= tswap32(target
->c_cflag
);
1744 target_tcflag_t lflags
= tswap32(target
->c_lflag
);
1748 qemu_log("c_iflag = ");
1749 print_flags(termios_iflags
, iflags
, 0);
1751 qemu_log("c_oflag = ");
1752 target_tcflag_t oflags_clean
= oflags
& ~(TARGET_NLDLY
| TARGET_CRDLY
|
1753 TARGET_TABDLY
| TARGET_BSDLY
|
1754 TARGET_VTDLY
| TARGET_FFDLY
);
1755 print_flags(termios_oflags
, oflags_clean
, 0);
1756 if (oflags
& TARGET_NLDLY
) {
1757 print_enums(termios_oflags_NLDLY
, oflags
& TARGET_NLDLY
, 0);
1759 if (oflags
& TARGET_CRDLY
) {
1760 print_enums(termios_oflags_CRDLY
, oflags
& TARGET_CRDLY
, 0);
1762 if (oflags
& TARGET_TABDLY
) {
1763 print_enums(termios_oflags_TABDLY
, oflags
& TARGET_TABDLY
, 0);
1765 if (oflags
& TARGET_BSDLY
) {
1766 print_enums(termios_oflags_BSDLY
, oflags
& TARGET_BSDLY
, 0);
1768 if (oflags
& TARGET_VTDLY
) {
1769 print_enums(termios_oflags_VTDLY
, oflags
& TARGET_VTDLY
, 0);
1771 if (oflags
& TARGET_FFDLY
) {
1772 print_enums(termios_oflags_FFDLY
, oflags
& TARGET_FFDLY
, 0);
1775 qemu_log("c_cflag = ");
1776 if (cflags
& TARGET_CBAUD
) {
1777 print_enums(termios_cflags_CBAUD
, cflags
& TARGET_CBAUD
, 0);
1779 if (cflags
& TARGET_CSIZE
) {
1780 print_enums(termios_cflags_CSIZE
, cflags
& TARGET_CSIZE
, 0);
1782 target_tcflag_t cflags_clean
= cflags
& ~(TARGET_CBAUD
| TARGET_CSIZE
);
1783 print_flags(termios_cflags
, cflags_clean
, 0);
1785 qemu_log("c_lflag = ");
1786 print_flags(termios_lflags
, lflags
, 0);
1788 qemu_log("c_cc = ");
1789 qemu_log("\"%s\",", target
->c_cc
);
1791 qemu_log("c_line = ");
1792 print_raw_param("\'%c\'", target
->c_line
, 1);
1799 #ifdef TARGET_NR_accept
1801 print_accept(CPUArchState
*cpu_env
, const struct syscallname
*name
,
1802 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1803 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1805 print_syscall_prologue(name
);
1806 print_raw_param("%d", arg0
, 0);
1807 print_pointer(arg1
, 0);
1808 print_number(arg2
, 1);
1809 print_syscall_epilogue(name
);
1813 #ifdef TARGET_NR_access
1815 print_access(CPUArchState
*cpu_env
, const struct syscallname
*name
,
1816 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1817 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1819 print_syscall_prologue(name
);
1820 print_string(arg0
, 0);
1821 print_flags(access_flags
, arg1
, 1);
1822 print_syscall_epilogue(name
);
1826 #ifdef TARGET_NR_acct
1828 print_acct(CPUArchState
*cpu_env
, const struct syscallname
*name
,
1829 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1830 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1832 print_syscall_prologue(name
);
1833 print_string(arg0
, 1);
1834 print_syscall_epilogue(name
);
1838 #ifdef TARGET_NR_brk
1840 print_brk(CPUArchState
*cpu_env
, const struct syscallname
*name
,
1841 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1842 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1844 print_syscall_prologue(name
);
1845 print_pointer(arg0
, 1);
1846 print_syscall_epilogue(name
);
1850 #ifdef TARGET_NR_chdir
1852 print_chdir(CPUArchState
*cpu_env
, const struct syscallname
*name
,
1853 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1854 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1856 print_syscall_prologue(name
);
1857 print_string(arg0
, 1);
1858 print_syscall_epilogue(name
);
1862 #ifdef TARGET_NR_chroot
1864 print_chroot(CPUArchState
*cpu_env
, const struct syscallname
*name
,
1865 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1866 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1868 print_syscall_prologue(name
);
1869 print_string(arg0
, 1);
1870 print_syscall_epilogue(name
);
1874 #ifdef TARGET_NR_chmod
1876 print_chmod(CPUArchState
*cpu_env
, const struct syscallname
*name
,
1877 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1878 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1880 print_syscall_prologue(name
);
1881 print_string(arg0
, 0);
1882 print_file_mode(arg1
, 1);
1883 print_syscall_epilogue(name
);
1887 #if defined(TARGET_NR_chown) || defined(TARGET_NR_lchown)
1889 print_chown(CPUArchState
*cpu_env
, const struct syscallname
*name
,
1890 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1891 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1893 print_syscall_prologue(name
);
1894 print_string(arg0
, 0);
1895 print_raw_param("%d", arg1
, 0);
1896 print_raw_param("%d", arg2
, 1);
1897 print_syscall_epilogue(name
);
1899 #define print_lchown print_chown
1902 #ifdef TARGET_NR_clock_adjtime
1904 print_clock_adjtime(CPUArchState
*cpu_env
, const struct syscallname
*name
,
1905 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1906 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1908 print_syscall_prologue(name
);
1909 print_enums(clockids
, arg0
, 0);
1910 print_pointer(arg1
, 1);
1911 print_syscall_epilogue(name
);
1915 #ifdef TARGET_NR_clone
1916 static void do_print_clone(unsigned int flags
, abi_ulong newsp
,
1917 abi_ulong parent_tidptr
, target_ulong newtls
,
1918 abi_ulong child_tidptr
)
1920 print_flags(clone_flags
, flags
, 0);
1921 print_raw_param("child_stack=0x" TARGET_ABI_FMT_lx
, newsp
, 0);
1922 print_raw_param("parent_tidptr=0x" TARGET_ABI_FMT_lx
, parent_tidptr
, 0);
1923 print_raw_param("tls=0x" TARGET_ABI_FMT_lx
, newtls
, 0);
1924 print_raw_param("child_tidptr=0x" TARGET_ABI_FMT_lx
, child_tidptr
, 1);
1928 print_clone(CPUArchState
*cpu_env
, const struct syscallname
*name
,
1929 abi_long arg1
, abi_long arg2
, abi_long arg3
,
1930 abi_long arg4
, abi_long arg5
, abi_long arg6
)
1932 print_syscall_prologue(name
);
1933 #if defined(TARGET_MICROBLAZE)
1934 do_print_clone(arg1
, arg2
, arg4
, arg6
, arg5
);
1935 #elif defined(TARGET_CLONE_BACKWARDS)
1936 do_print_clone(arg1
, arg2
, arg3
, arg4
, arg5
);
1937 #elif defined(TARGET_CLONE_BACKWARDS2)
1938 do_print_clone(arg2
, arg1
, arg3
, arg5
, arg4
);
1940 do_print_clone(arg1
, arg2
, arg3
, arg5
, arg4
);
1942 print_syscall_epilogue(name
);
1946 #ifdef TARGET_NR_creat
1948 print_creat(CPUArchState
*cpu_env
, const struct syscallname
*name
,
1949 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1950 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1952 print_syscall_prologue(name
);
1953 print_string(arg0
, 0);
1954 print_file_mode(arg1
, 1);
1955 print_syscall_epilogue(name
);
1959 #ifdef TARGET_NR_execv
1961 print_execv(CPUArchState
*cpu_env
, const struct syscallname
*name
,
1962 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1963 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1965 print_syscall_prologue(name
);
1966 print_string(arg0
, 0);
1967 print_raw_param("0x" TARGET_ABI_FMT_lx
, arg1
, 1);
1968 print_syscall_epilogue(name
);
1972 #if defined(TARGET_NR_faccessat) || defined(TARGET_NR_faccessat2)
1974 print_faccessat(CPUArchState
*cpu_env
, const struct syscallname
*name
,
1975 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1976 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1978 print_syscall_prologue(name
);
1979 print_at_dirfd(arg0
, 0);
1980 print_string(arg1
, 0);
1981 print_flags(access_flags
, arg2
, 0);
1982 print_flags(at_file_flags
, arg3
, 1);
1983 print_syscall_epilogue(name
);
1987 #ifdef TARGET_NR_fallocate
1989 print_fallocate(CPUArchState
*cpu_env
, const struct syscallname
*name
,
1990 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1991 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1993 print_syscall_prologue(name
);
1994 print_raw_param("%d", arg0
, 0);
1995 print_flags(falloc_flags
, arg1
, 0);
1996 #if TARGET_ABI_BITS == 32
1997 print_raw_param("%" PRIu64
, target_offset64(arg2
, arg3
), 0);
1998 print_raw_param("%" PRIu64
, target_offset64(arg4
, arg5
), 1);
2000 print_raw_param(TARGET_ABI_FMT_ld
, arg2
, 0);
2001 print_raw_param(TARGET_ABI_FMT_ld
, arg3
, 1);
2003 print_syscall_epilogue(name
);
2007 #ifdef TARGET_NR_fchmodat
2009 print_fchmodat(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2010 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2011 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2013 print_syscall_prologue(name
);
2014 print_at_dirfd(arg0
, 0);
2015 print_string(arg1
, 0);
2016 print_file_mode(arg2
, 0);
2017 print_flags(at_file_flags
, arg3
, 1);
2018 print_syscall_epilogue(name
);
2022 #ifdef TARGET_NR_fchownat
2024 print_fchownat(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2025 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2026 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2028 print_syscall_prologue(name
);
2029 print_at_dirfd(arg0
, 0);
2030 print_string(arg1
, 0);
2031 print_raw_param("%d", arg2
, 0);
2032 print_raw_param("%d", arg3
, 0);
2033 print_flags(at_file_flags
, arg4
, 1);
2034 print_syscall_epilogue(name
);
2038 #if defined(TARGET_NR_fcntl) || defined(TARGET_NR_fcntl64)
2040 print_fcntl(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2041 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2042 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2044 print_syscall_prologue(name
);
2045 print_raw_param("%d", arg0
, 0);
2047 case TARGET_F_DUPFD
:
2048 qemu_log("F_DUPFD,");
2049 print_raw_param(TARGET_ABI_FMT_ld
, arg2
, 1);
2051 case TARGET_F_GETFD
:
2052 qemu_log("F_GETFD");
2054 case TARGET_F_SETFD
:
2055 qemu_log("F_SETFD,");
2056 print_raw_param(TARGET_ABI_FMT_ld
, arg2
, 1);
2058 case TARGET_F_GETFL
:
2059 qemu_log("F_GETFL");
2061 case TARGET_F_SETFL
:
2062 qemu_log("F_SETFL,");
2063 print_open_flags(arg2
, 1);
2065 case TARGET_F_GETLK
:
2066 qemu_log("F_GETLK,");
2067 print_pointer(arg2
, 1);
2069 case TARGET_F_SETLK
:
2070 qemu_log("F_SETLK,");
2071 print_pointer(arg2
, 1);
2073 case TARGET_F_SETLKW
:
2074 qemu_log("F_SETLKW,");
2075 print_pointer(arg2
, 1);
2077 case TARGET_F_GETOWN
:
2078 qemu_log("F_GETOWN");
2080 case TARGET_F_SETOWN
:
2081 qemu_log("F_SETOWN,");
2082 print_raw_param(TARGET_ABI_FMT_ld
, arg2
, 0);
2084 case TARGET_F_GETSIG
:
2085 qemu_log("F_GETSIG");
2087 case TARGET_F_SETSIG
:
2088 qemu_log("F_SETSIG,");
2089 print_raw_param(TARGET_ABI_FMT_ld
, arg2
, 0);
2091 #if TARGET_ABI_BITS == 32
2092 case TARGET_F_GETLK64
:
2093 qemu_log("F_GETLK64,");
2094 print_pointer(arg2
, 1);
2096 case TARGET_F_SETLK64
:
2097 qemu_log("F_SETLK64,");
2098 print_pointer(arg2
, 1);
2100 case TARGET_F_SETLKW64
:
2101 qemu_log("F_SETLKW64,");
2102 print_pointer(arg2
, 1);
2105 case TARGET_F_OFD_GETLK
:
2106 qemu_log("F_OFD_GETLK,");
2107 print_pointer(arg2
, 1);
2109 case TARGET_F_OFD_SETLK
:
2110 qemu_log("F_OFD_SETLK,");
2111 print_pointer(arg2
, 1);
2113 case TARGET_F_OFD_SETLKW
:
2114 qemu_log("F_OFD_SETLKW,");
2115 print_pointer(arg2
, 1);
2117 case TARGET_F_SETLEASE
:
2118 qemu_log("F_SETLEASE,");
2119 print_raw_param(TARGET_ABI_FMT_ld
, arg2
, 1);
2121 case TARGET_F_GETLEASE
:
2122 qemu_log("F_GETLEASE");
2124 #ifdef F_DUPFD_CLOEXEC
2125 case TARGET_F_DUPFD_CLOEXEC
:
2126 qemu_log("F_DUPFD_CLOEXEC,");
2127 print_raw_param(TARGET_ABI_FMT_ld
, arg2
, 1);
2130 case TARGET_F_NOTIFY
:
2131 qemu_log("F_NOTIFY,");
2132 print_raw_param(TARGET_ABI_FMT_ld
, arg2
, 1);
2135 case TARGET_F_GETOWN_EX
:
2136 qemu_log("F_GETOWN_EX,");
2137 print_pointer(arg2
, 1);
2141 case TARGET_F_SETOWN_EX
:
2142 qemu_log("F_SETOWN_EX,");
2143 print_pointer(arg2
, 1);
2147 case TARGET_F_SETPIPE_SZ
:
2148 qemu_log("F_SETPIPE_SZ,");
2149 print_raw_param(TARGET_ABI_FMT_ld
, arg2
, 1);
2151 case TARGET_F_GETPIPE_SZ
:
2152 qemu_log("F_GETPIPE_SZ");
2156 case TARGET_F_ADD_SEALS
:
2157 qemu_log("F_ADD_SEALS,");
2158 print_raw_param("0x"TARGET_ABI_FMT_lx
, arg2
, 1);
2160 case TARGET_F_GET_SEALS
:
2161 qemu_log("F_GET_SEALS");
2165 print_raw_param(TARGET_ABI_FMT_ld
, arg1
, 0);
2166 print_pointer(arg2
, 1);
2169 print_syscall_epilogue(name
);
2171 #define print_fcntl64 print_fcntl
2174 #ifdef TARGET_NR_fgetxattr
2176 print_fgetxattr(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2177 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2178 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2180 print_syscall_prologue(name
);
2181 print_raw_param("%d", arg0
, 0);
2182 print_string(arg1
, 0);
2183 print_pointer(arg2
, 0);
2184 print_raw_param(TARGET_FMT_lu
, arg3
, 1);
2185 print_syscall_epilogue(name
);
2189 #ifdef TARGET_NR_flistxattr
2191 print_flistxattr(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2192 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2193 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2195 print_syscall_prologue(name
);
2196 print_raw_param("%d", arg0
, 0);
2197 print_pointer(arg1
, 0);
2198 print_raw_param(TARGET_FMT_lu
, arg2
, 1);
2199 print_syscall_epilogue(name
);
2203 #if defined(TARGET_NR_getxattr) || defined(TARGET_NR_lgetxattr)
2205 print_getxattr(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2206 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2207 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2209 print_syscall_prologue(name
);
2210 print_string(arg0
, 0);
2211 print_string(arg1
, 0);
2212 print_pointer(arg2
, 0);
2213 print_raw_param(TARGET_FMT_lu
, arg3
, 1);
2214 print_syscall_epilogue(name
);
2216 #define print_lgetxattr print_getxattr
2219 #if defined(TARGET_NR_listxattr) || defined(TARGET_NR_llistxattr)
2221 print_listxattr(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2222 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2223 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2225 print_syscall_prologue(name
);
2226 print_string(arg0
, 0);
2227 print_pointer(arg1
, 0);
2228 print_raw_param(TARGET_FMT_lu
, arg2
, 1);
2229 print_syscall_epilogue(name
);
2231 #define print_llistxattr print_listxattr
2234 #if defined(TARGET_NR_fremovexattr)
2236 print_fremovexattr(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2237 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2238 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2240 print_syscall_prologue(name
);
2241 print_raw_param("%d", arg0
, 0);
2242 print_string(arg1
, 1);
2243 print_syscall_epilogue(name
);
2247 #if defined(TARGET_NR_removexattr) || defined(TARGET_NR_lremovexattr)
2249 print_removexattr(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2250 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2251 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2253 print_syscall_prologue(name
);
2254 print_string(arg0
, 0);
2255 print_string(arg1
, 1);
2256 print_syscall_epilogue(name
);
2258 #define print_lremovexattr print_removexattr
2261 #ifdef TARGET_NR_futimesat
2263 print_futimesat(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2264 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2265 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2267 print_syscall_prologue(name
);
2268 print_at_dirfd(arg0
, 0);
2269 print_string(arg1
, 0);
2270 print_timeval(arg2
, 0);
2271 print_timeval(arg2
+ sizeof (struct target_timeval
), 1);
2272 print_syscall_epilogue(name
);
2276 #ifdef TARGET_NR_gettimeofday
2278 print_gettimeofday(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2279 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2280 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2282 print_syscall_prologue(name
);
2283 print_pointer(arg0
, 0);
2284 print_pointer(arg1
, 1);
2285 print_syscall_epilogue(name
);
2289 #ifdef TARGET_NR_settimeofday
2291 print_settimeofday(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2292 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2293 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2295 print_syscall_prologue(name
);
2296 print_timeval(arg0
, 0);
2297 print_timezone(arg1
, 1);
2298 print_syscall_epilogue(name
);
2302 #if defined(TARGET_NR_clock_gettime) || defined(TARGET_NR_clock_getres)
2304 print_clock_gettime(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2305 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2306 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2308 print_syscall_prologue(name
);
2309 print_enums(clockids
, arg0
, 0);
2310 print_pointer(arg1
, 1);
2311 print_syscall_epilogue(name
);
2313 #define print_clock_getres print_clock_gettime
2316 #if defined(TARGET_NR_clock_gettime64)
2318 print_clock_gettime64(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_enums(clockids
, arg0
, 0);
2324 print_pointer(arg1
, 1);
2325 print_syscall_epilogue(name
);
2329 #ifdef TARGET_NR_clock_settime
2331 print_clock_settime(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_enums(clockids
, arg0
, 0);
2337 print_timespec(arg1
, 1);
2338 print_syscall_epilogue(name
);
2342 #ifdef TARGET_NR_getitimer
2344 print_getitimer(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2345 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2346 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2348 print_syscall_prologue(name
);
2349 print_enums(itimer_types
, arg0
, 0);
2350 print_pointer(arg1
, 1);
2351 print_syscall_epilogue(name
);
2355 #ifdef TARGET_NR_setitimer
2357 print_setitimer(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2358 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2359 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2361 print_syscall_prologue(name
);
2362 print_enums(itimer_types
, arg0
, 0);
2363 print_itimerval(arg1
, 0);
2364 print_pointer(arg2
, 1);
2365 print_syscall_epilogue(name
);
2369 #ifdef TARGET_NR_link
2371 print_link(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2372 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2373 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2375 print_syscall_prologue(name
);
2376 print_string(arg0
, 0);
2377 print_string(arg1
, 1);
2378 print_syscall_epilogue(name
);
2382 #ifdef TARGET_NR_linkat
2384 print_linkat(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2385 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2386 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2388 print_syscall_prologue(name
);
2389 print_at_dirfd(arg0
, 0);
2390 print_string(arg1
, 0);
2391 print_at_dirfd(arg2
, 0);
2392 print_string(arg3
, 0);
2393 print_flags(at_file_flags
, arg4
, 1);
2394 print_syscall_epilogue(name
);
2398 #if defined(TARGET_NR__llseek) || defined(TARGET_NR_llseek)
2400 print__llseek(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 const char *whence
= "UNKNOWN";
2405 print_syscall_prologue(name
);
2406 print_raw_param("%d", arg0
, 0);
2407 print_raw_param("%ld", arg1
, 0);
2408 print_raw_param("%ld", arg2
, 0);
2409 print_pointer(arg3
, 0);
2411 case SEEK_SET
: whence
= "SEEK_SET"; break;
2412 case SEEK_CUR
: whence
= "SEEK_CUR"; break;
2413 case SEEK_END
: whence
= "SEEK_END"; break;
2415 qemu_log("%s", whence
);
2416 print_syscall_epilogue(name
);
2418 #define print_llseek print__llseek
2421 #ifdef TARGET_NR_lseek
2423 print_lseek(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2424 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2425 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2427 print_syscall_prologue(name
);
2428 print_raw_param("%d", arg0
, 0);
2429 print_raw_param(TARGET_ABI_FMT_ld
, arg1
, 0);
2432 qemu_log("SEEK_SET"); break;
2434 qemu_log("SEEK_CUR"); break;
2436 qemu_log("SEEK_END"); break;
2439 qemu_log("SEEK_DATA"); break;
2443 qemu_log("SEEK_HOLE"); break;
2446 print_raw_param("%#x", arg2
, 1);
2448 print_syscall_epilogue(name
);
2452 #ifdef TARGET_NR_truncate
2454 print_truncate(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2455 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2456 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2458 print_syscall_prologue(name
);
2459 print_string(arg0
, 0);
2460 print_raw_param(TARGET_ABI_FMT_ld
, arg1
, 1);
2461 print_syscall_epilogue(name
);
2465 #ifdef TARGET_NR_truncate64
2467 print_truncate64(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2468 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2469 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2471 print_syscall_prologue(name
);
2472 print_string(arg0
, 0);
2473 if (regpairs_aligned(cpu_env
, TARGET_NR_truncate64
)) {
2477 print_raw_param("%" PRIu64
, target_offset64(arg1
, arg2
), 1);
2478 print_syscall_epilogue(name
);
2482 #ifdef TARGET_NR_ftruncate64
2484 print_ftruncate64(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2485 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2486 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2488 print_syscall_prologue(name
);
2489 print_raw_param("%d", arg0
, 0);
2490 if (regpairs_aligned(cpu_env
, TARGET_NR_ftruncate64
)) {
2494 print_raw_param("%" PRIu64
, target_offset64(arg1
, arg2
), 1);
2495 print_syscall_epilogue(name
);
2499 #ifdef TARGET_NR_mlockall
2501 print_mlockall(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2502 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2503 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2505 print_syscall_prologue(name
);
2506 print_flags(mlockall_flags
, arg0
, 1);
2507 print_syscall_epilogue(name
);
2511 #if defined(TARGET_NR_socket)
2513 print_socket(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2514 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2515 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2517 abi_ulong domain
= arg0
, type
= arg1
, protocol
= arg2
;
2519 print_syscall_prologue(name
);
2520 print_socket_domain(domain
);
2522 print_socket_type(type
);
2524 if (domain
== AF_PACKET
||
2525 (domain
== AF_INET
&& type
== TARGET_SOCK_PACKET
)) {
2526 protocol
= tswap16(protocol
);
2528 print_socket_protocol(domain
, type
, protocol
);
2529 print_syscall_epilogue(name
);
2534 #if defined(TARGET_NR_socketcall) || defined(TARGET_NR_bind)
2536 static void print_sockfd(abi_long sockfd
, int last
)
2538 print_raw_param(TARGET_ABI_FMT_ld
, sockfd
, last
);
2543 #if defined(TARGET_NR_socketcall)
2545 #define get_user_ualx(x, gaddr, idx) \
2546 get_user_ual(x, (gaddr) + (idx) * sizeof(abi_long))
2548 static void do_print_socket(const char *name
, abi_long arg1
)
2550 abi_ulong domain
, type
, protocol
;
2552 get_user_ualx(domain
, arg1
, 0);
2553 get_user_ualx(type
, arg1
, 1);
2554 get_user_ualx(protocol
, arg1
, 2);
2555 qemu_log("%s(", name
);
2556 print_socket_domain(domain
);
2558 print_socket_type(type
);
2560 if (domain
== AF_PACKET
||
2561 (domain
== AF_INET
&& type
== TARGET_SOCK_PACKET
)) {
2562 protocol
= tswap16(protocol
);
2564 print_socket_protocol(domain
, type
, protocol
);
2568 static void do_print_sockaddr(const char *name
, abi_long arg1
)
2570 abi_ulong sockfd
, addr
, addrlen
;
2572 get_user_ualx(sockfd
, arg1
, 0);
2573 get_user_ualx(addr
, arg1
, 1);
2574 get_user_ualx(addrlen
, arg1
, 2);
2576 qemu_log("%s(", name
);
2577 print_sockfd(sockfd
, 0);
2578 print_sockaddr(addr
, addrlen
, 0);
2582 static void do_print_listen(const char *name
, abi_long arg1
)
2584 abi_ulong sockfd
, backlog
;
2586 get_user_ualx(sockfd
, arg1
, 0);
2587 get_user_ualx(backlog
, arg1
, 1);
2589 qemu_log("%s(", name
);
2590 print_sockfd(sockfd
, 0);
2591 print_raw_param(TARGET_ABI_FMT_ld
, backlog
, 1);
2595 static void do_print_socketpair(const char *name
, abi_long arg1
)
2597 abi_ulong domain
, type
, protocol
, tab
;
2599 get_user_ualx(domain
, arg1
, 0);
2600 get_user_ualx(type
, arg1
, 1);
2601 get_user_ualx(protocol
, arg1
, 2);
2602 get_user_ualx(tab
, arg1
, 3);
2604 qemu_log("%s(", name
);
2605 print_socket_domain(domain
);
2607 print_socket_type(type
);
2609 print_socket_protocol(domain
, type
, protocol
);
2611 print_raw_param(TARGET_ABI_FMT_lx
, tab
, 1);
2615 static void do_print_sendrecv(const char *name
, abi_long arg1
)
2617 abi_ulong sockfd
, msg
, len
, flags
;
2619 get_user_ualx(sockfd
, arg1
, 0);
2620 get_user_ualx(msg
, arg1
, 1);
2621 get_user_ualx(len
, arg1
, 2);
2622 get_user_ualx(flags
, arg1
, 3);
2624 qemu_log("%s(", name
);
2625 print_sockfd(sockfd
, 0);
2626 print_buf(msg
, len
, 0);
2627 print_raw_param(TARGET_ABI_FMT_ld
, len
, 0);
2628 print_flags(msg_flags
, flags
, 1);
2632 static void do_print_msgaddr(const char *name
, abi_long arg1
)
2634 abi_ulong sockfd
, msg
, len
, flags
, addr
, addrlen
;
2636 get_user_ualx(sockfd
, arg1
, 0);
2637 get_user_ualx(msg
, arg1
, 1);
2638 get_user_ualx(len
, arg1
, 2);
2639 get_user_ualx(flags
, arg1
, 3);
2640 get_user_ualx(addr
, arg1
, 4);
2641 get_user_ualx(addrlen
, arg1
, 5);
2643 qemu_log("%s(", name
);
2644 print_sockfd(sockfd
, 0);
2645 print_buf(msg
, len
, 0);
2646 print_raw_param(TARGET_ABI_FMT_ld
, len
, 0);
2647 print_flags(msg_flags
, flags
, 0);
2648 print_sockaddr(addr
, addrlen
, 0);
2652 static void do_print_shutdown(const char *name
, abi_long arg1
)
2654 abi_ulong sockfd
, how
;
2656 get_user_ualx(sockfd
, arg1
, 0);
2657 get_user_ualx(how
, arg1
, 1);
2659 qemu_log("shutdown(");
2660 print_sockfd(sockfd
, 0);
2663 qemu_log("SHUT_RD");
2666 qemu_log("SHUT_WR");
2669 qemu_log("SHUT_RDWR");
2672 print_raw_param(TARGET_ABI_FMT_ld
, how
, 1);
2678 static void do_print_msg(const char *name
, abi_long arg1
)
2680 abi_ulong sockfd
, msg
, flags
;
2682 get_user_ualx(sockfd
, arg1
, 0);
2683 get_user_ualx(msg
, arg1
, 1);
2684 get_user_ualx(flags
, arg1
, 2);
2686 qemu_log("%s(", name
);
2687 print_sockfd(sockfd
, 0);
2688 print_pointer(msg
, 0);
2689 print_flags(msg_flags
, flags
, 1);
2693 static void do_print_sockopt(const char *name
, abi_long arg1
)
2695 abi_ulong sockfd
, level
, optname
, optval
, optlen
;
2697 get_user_ualx(sockfd
, arg1
, 0);
2698 get_user_ualx(level
, arg1
, 1);
2699 get_user_ualx(optname
, arg1
, 2);
2700 get_user_ualx(optval
, arg1
, 3);
2701 get_user_ualx(optlen
, arg1
, 4);
2703 qemu_log("%s(", name
);
2704 print_sockfd(sockfd
, 0);
2707 qemu_log("SOL_TCP,");
2708 print_raw_param(TARGET_ABI_FMT_ld
, optname
, 0);
2709 print_pointer(optval
, 0);
2712 qemu_log("SOL_UDP,");
2713 print_raw_param(TARGET_ABI_FMT_ld
, optname
, 0);
2714 print_pointer(optval
, 0);
2717 qemu_log("SOL_IP,");
2718 print_raw_param(TARGET_ABI_FMT_ld
, optname
, 0);
2719 print_pointer(optval
, 0);
2722 qemu_log("SOL_RAW,");
2723 print_raw_param(TARGET_ABI_FMT_ld
, optname
, 0);
2724 print_pointer(optval
, 0);
2726 case TARGET_SOL_SOCKET
:
2727 qemu_log("SOL_SOCKET,");
2729 case TARGET_SO_DEBUG
:
2730 qemu_log("SO_DEBUG,");
2732 print_number(optval
, 0);
2734 case TARGET_SO_REUSEADDR
:
2735 qemu_log("SO_REUSEADDR,");
2737 case TARGET_SO_REUSEPORT
:
2738 qemu_log("SO_REUSEPORT,");
2740 case TARGET_SO_TYPE
:
2741 qemu_log("SO_TYPE,");
2743 case TARGET_SO_ERROR
:
2744 qemu_log("SO_ERROR,");
2746 case TARGET_SO_DONTROUTE
:
2747 qemu_log("SO_DONTROUTE,");
2749 case TARGET_SO_BROADCAST
:
2750 qemu_log("SO_BROADCAST,");
2752 case TARGET_SO_SNDBUF
:
2753 qemu_log("SO_SNDBUF,");
2755 case TARGET_SO_RCVBUF
:
2756 qemu_log("SO_RCVBUF,");
2758 case TARGET_SO_KEEPALIVE
:
2759 qemu_log("SO_KEEPALIVE,");
2761 case TARGET_SO_OOBINLINE
:
2762 qemu_log("SO_OOBINLINE,");
2764 case TARGET_SO_NO_CHECK
:
2765 qemu_log("SO_NO_CHECK,");
2767 case TARGET_SO_PRIORITY
:
2768 qemu_log("SO_PRIORITY,");
2770 case TARGET_SO_BSDCOMPAT
:
2771 qemu_log("SO_BSDCOMPAT,");
2773 case TARGET_SO_PASSCRED
:
2774 qemu_log("SO_PASSCRED,");
2776 case TARGET_SO_TIMESTAMP
:
2777 qemu_log("SO_TIMESTAMP,");
2779 case TARGET_SO_RCVLOWAT
:
2780 qemu_log("SO_RCVLOWAT,");
2782 case TARGET_SO_RCVTIMEO
:
2783 qemu_log("SO_RCVTIMEO,");
2784 print_timeval(optval
, 0);
2786 case TARGET_SO_SNDTIMEO
:
2787 qemu_log("SO_SNDTIMEO,");
2788 print_timeval(optval
, 0);
2790 case TARGET_SO_ATTACH_FILTER
: {
2791 struct target_sock_fprog
*fprog
;
2793 qemu_log("SO_ATTACH_FILTER,");
2795 if (lock_user_struct(VERIFY_READ
, fprog
, optval
, 0)) {
2796 struct target_sock_filter
*filter
;
2798 if (lock_user_struct(VERIFY_READ
, filter
,
2799 tswapal(fprog
->filter
), 0)) {
2801 for (i
= 0; i
< tswap16(fprog
->len
) - 1; i
++) {
2802 qemu_log("[%d]{0x%x,%d,%d,0x%x},",
2803 i
, tswap16(filter
[i
].code
),
2804 filter
[i
].jt
, filter
[i
].jf
,
2805 tswap32(filter
[i
].k
));
2807 qemu_log("[%d]{0x%x,%d,%d,0x%x}",
2808 i
, tswap16(filter
[i
].code
),
2809 filter
[i
].jt
, filter
[i
].jf
,
2810 tswap32(filter
[i
].k
));
2812 qemu_log(TARGET_ABI_FMT_lx
, tswapal(fprog
->filter
));
2814 qemu_log(",%d},", tswap16(fprog
->len
));
2815 unlock_user(fprog
, optval
, 0);
2817 print_pointer(optval
, 0);
2822 print_raw_param(TARGET_ABI_FMT_ld
, optname
, 0);
2823 print_pointer(optval
, 0);
2828 qemu_log("SOL_IPV6,");
2830 case IPV6_MTU_DISCOVER
:
2831 qemu_log("IPV6_MTU_DISCOVER,");
2834 qemu_log("IPV6_MTU,");
2837 qemu_log("IPV6_V6ONLY,");
2839 case IPV6_RECVPKTINFO
:
2840 qemu_log("IPV6_RECVPKTINFO,");
2842 case IPV6_UNICAST_HOPS
:
2843 qemu_log("IPV6_UNICAST_HOPS,");
2845 case IPV6_MULTICAST_HOPS
:
2846 qemu_log("IPV6_MULTICAST_HOPS,");
2848 case IPV6_MULTICAST_LOOP
:
2849 qemu_log("IPV6_MULTICAST_LOOP,");
2852 qemu_log("IPV6_RECVERR,");
2854 case IPV6_RECVHOPLIMIT
:
2855 qemu_log("IPV6_RECVHOPLIMIT,");
2857 case IPV6_2292HOPLIMIT
:
2858 qemu_log("IPV6_2292HOPLIMIT,");
2861 qemu_log("IPV6_CHECKSUM,");
2864 qemu_log("IPV6_ADDRFORM,");
2866 case IPV6_2292PKTINFO
:
2867 qemu_log("IPV6_2292PKTINFO,");
2869 case IPV6_RECVTCLASS
:
2870 qemu_log("IPV6_RECVTCLASS,");
2872 case IPV6_RECVRTHDR
:
2873 qemu_log("IPV6_RECVRTHDR,");
2875 case IPV6_2292RTHDR
:
2876 qemu_log("IPV6_2292RTHDR,");
2878 case IPV6_RECVHOPOPTS
:
2879 qemu_log("IPV6_RECVHOPOPTS,");
2881 case IPV6_2292HOPOPTS
:
2882 qemu_log("IPV6_2292HOPOPTS,");
2884 case IPV6_RECVDSTOPTS
:
2885 qemu_log("IPV6_RECVDSTOPTS,");
2887 case IPV6_2292DSTOPTS
:
2888 qemu_log("IPV6_2292DSTOPTS,");
2891 qemu_log("IPV6_TCLASS,");
2893 case IPV6_ADDR_PREFERENCES
:
2894 qemu_log("IPV6_ADDR_PREFERENCES,");
2896 #ifdef IPV6_RECVPATHMTU
2897 case IPV6_RECVPATHMTU
:
2898 qemu_log("IPV6_RECVPATHMTU,");
2901 #ifdef IPV6_TRANSPARENT
2902 case IPV6_TRANSPARENT
:
2903 qemu_log("IPV6_TRANSPARENT,");
2906 #ifdef IPV6_FREEBIND
2908 qemu_log("IPV6_FREEBIND,");
2911 #ifdef IPV6_RECVORIGDSTADDR
2912 case IPV6_RECVORIGDSTADDR
:
2913 qemu_log("IPV6_RECVORIGDSTADDR,");
2917 qemu_log("IPV6_PKTINFO,");
2918 print_pointer(optval
, 0);
2920 case IPV6_ADD_MEMBERSHIP
:
2921 qemu_log("IPV6_ADD_MEMBERSHIP,");
2922 print_pointer(optval
, 0);
2924 case IPV6_DROP_MEMBERSHIP
:
2925 qemu_log("IPV6_DROP_MEMBERSHIP,");
2926 print_pointer(optval
, 0);
2929 print_raw_param(TARGET_ABI_FMT_ld
, optname
, 0);
2930 print_pointer(optval
, 0);
2935 print_raw_param(TARGET_ABI_FMT_ld
, level
, 0);
2936 print_raw_param(TARGET_ABI_FMT_ld
, optname
, 0);
2937 print_pointer(optval
, 0);
2940 print_raw_param(TARGET_ABI_FMT_ld
, optlen
, 1);
2944 #define PRINT_SOCKOP(name, func) \
2945 [TARGET_SYS_##name] = { #name, func }
2949 void (*print
)(const char *, abi_long
);
2951 PRINT_SOCKOP(SOCKET
, do_print_socket
),
2952 PRINT_SOCKOP(BIND
, do_print_sockaddr
),
2953 PRINT_SOCKOP(CONNECT
, do_print_sockaddr
),
2954 PRINT_SOCKOP(LISTEN
, do_print_listen
),
2955 PRINT_SOCKOP(ACCEPT
, do_print_sockaddr
),
2956 PRINT_SOCKOP(GETSOCKNAME
, do_print_sockaddr
),
2957 PRINT_SOCKOP(GETPEERNAME
, do_print_sockaddr
),
2958 PRINT_SOCKOP(SOCKETPAIR
, do_print_socketpair
),
2959 PRINT_SOCKOP(SEND
, do_print_sendrecv
),
2960 PRINT_SOCKOP(RECV
, do_print_sendrecv
),
2961 PRINT_SOCKOP(SENDTO
, do_print_msgaddr
),
2962 PRINT_SOCKOP(RECVFROM
, do_print_msgaddr
),
2963 PRINT_SOCKOP(SHUTDOWN
, do_print_shutdown
),
2964 PRINT_SOCKOP(SETSOCKOPT
, do_print_sockopt
),
2965 PRINT_SOCKOP(GETSOCKOPT
, do_print_sockopt
),
2966 PRINT_SOCKOP(SENDMSG
, do_print_msg
),
2967 PRINT_SOCKOP(RECVMSG
, do_print_msg
),
2968 PRINT_SOCKOP(ACCEPT4
, NULL
),
2969 PRINT_SOCKOP(RECVMMSG
, NULL
),
2970 PRINT_SOCKOP(SENDMMSG
, NULL
),
2974 print_socketcall(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2975 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2976 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2978 if (arg0
>= 0 && arg0
< ARRAY_SIZE(scall
) && scall
[arg0
].print
) {
2979 scall
[arg0
].print(scall
[arg0
].name
, arg1
);
2982 print_syscall_prologue(name
);
2983 print_raw_param(TARGET_ABI_FMT_ld
, arg0
, 0);
2984 print_raw_param(TARGET_ABI_FMT_ld
, arg1
, 0);
2985 print_raw_param(TARGET_ABI_FMT_ld
, arg2
, 0);
2986 print_raw_param(TARGET_ABI_FMT_ld
, arg3
, 0);
2987 print_raw_param(TARGET_ABI_FMT_ld
, arg4
, 0);
2988 print_raw_param(TARGET_ABI_FMT_ld
, arg5
, 0);
2989 print_syscall_epilogue(name
);
2993 #if defined(TARGET_NR_bind)
2995 print_bind(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2996 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2997 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2999 print_syscall_prologue(name
);
3000 print_sockfd(arg0
, 0);
3001 print_sockaddr(arg1
, arg2
, 1);
3002 print_syscall_epilogue(name
);
3006 #if defined(TARGET_NR_stat) || defined(TARGET_NR_stat64) || \
3007 defined(TARGET_NR_lstat) || defined(TARGET_NR_lstat64)
3009 print_stat(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3010 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3011 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3013 print_syscall_prologue(name
);
3014 print_string(arg0
, 0);
3015 print_pointer(arg1
, 1);
3016 print_syscall_epilogue(name
);
3018 #define print_lstat print_stat
3019 #define print_stat64 print_stat
3020 #define print_lstat64 print_stat
3023 #if defined(TARGET_NR_madvise)
3024 static struct enums madvise_advice
[] = {
3025 ENUM_TARGET(MADV_NORMAL
),
3026 ENUM_TARGET(MADV_RANDOM
),
3027 ENUM_TARGET(MADV_SEQUENTIAL
),
3028 ENUM_TARGET(MADV_WILLNEED
),
3029 ENUM_TARGET(MADV_DONTNEED
),
3030 ENUM_TARGET(MADV_FREE
),
3031 ENUM_TARGET(MADV_REMOVE
),
3032 ENUM_TARGET(MADV_DONTFORK
),
3033 ENUM_TARGET(MADV_DOFORK
),
3034 ENUM_TARGET(MADV_MERGEABLE
),
3035 ENUM_TARGET(MADV_UNMERGEABLE
),
3036 ENUM_TARGET(MADV_HUGEPAGE
),
3037 ENUM_TARGET(MADV_NOHUGEPAGE
),
3038 ENUM_TARGET(MADV_DONTDUMP
),
3039 ENUM_TARGET(MADV_DODUMP
),
3040 ENUM_TARGET(MADV_WIPEONFORK
),
3041 ENUM_TARGET(MADV_KEEPONFORK
),
3042 ENUM_TARGET(MADV_COLD
),
3043 ENUM_TARGET(MADV_PAGEOUT
),
3044 ENUM_TARGET(MADV_POPULATE_READ
),
3045 ENUM_TARGET(MADV_POPULATE_WRITE
),
3046 ENUM_TARGET(MADV_DONTNEED_LOCKED
),
3051 print_madvise(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3052 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3053 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3055 print_syscall_prologue(name
);
3056 print_pointer(arg0
, 0);
3057 print_raw_param("%d", arg1
, 0);
3058 print_enums(madvise_advice
, arg2
, 1);
3059 print_syscall_epilogue(name
);
3063 #if defined(TARGET_NR_fstat) || defined(TARGET_NR_fstat64)
3065 print_fstat(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3066 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3067 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3069 print_syscall_prologue(name
);
3070 print_raw_param("%d", arg0
, 0);
3071 print_pointer(arg1
, 1);
3072 print_syscall_epilogue(name
);
3074 #define print_fstat64 print_fstat
3077 #ifdef TARGET_NR_mkdir
3079 print_mkdir(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3080 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3081 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3083 print_syscall_prologue(name
);
3084 print_string(arg0
, 0);
3085 print_file_mode(arg1
, 1);
3086 print_syscall_epilogue(name
);
3090 #ifdef TARGET_NR_mkdirat
3092 print_mkdirat(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3093 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3094 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3096 print_syscall_prologue(name
);
3097 print_at_dirfd(arg0
, 0);
3098 print_string(arg1
, 0);
3099 print_file_mode(arg2
, 1);
3100 print_syscall_epilogue(name
);
3104 #ifdef TARGET_NR_rmdir
3106 print_rmdir(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3107 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3108 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3110 print_syscall_prologue(name
);
3111 print_string(arg0
, 0);
3112 print_syscall_epilogue(name
);
3116 #ifdef TARGET_NR_rt_sigaction
3118 print_rt_sigaction(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3119 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3120 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3122 print_syscall_prologue(name
);
3123 print_signal(arg0
, 0);
3124 print_pointer(arg1
, 0);
3125 print_pointer(arg2
, 1);
3126 print_syscall_epilogue(name
);
3130 #ifdef TARGET_NR_rt_sigprocmask
3132 print_rt_sigprocmask(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3133 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3134 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3136 const char *how
= "UNKNOWN";
3137 print_syscall_prologue(name
);
3139 case TARGET_SIG_BLOCK
: how
= "SIG_BLOCK"; break;
3140 case TARGET_SIG_UNBLOCK
: how
= "SIG_UNBLOCK"; break;
3141 case TARGET_SIG_SETMASK
: how
= "SIG_SETMASK"; break;
3143 qemu_log("%s,", how
);
3144 print_pointer(arg1
, 0);
3145 print_pointer(arg2
, 1);
3146 print_syscall_epilogue(name
);
3150 #ifdef TARGET_NR_rt_sigqueueinfo
3152 print_rt_sigqueueinfo(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3153 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3154 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3157 target_siginfo_t uinfo
;
3159 print_syscall_prologue(name
);
3160 print_raw_param("%d", arg0
, 0);
3161 print_signal(arg1
, 0);
3162 p
= lock_user(VERIFY_READ
, arg2
, sizeof(target_siginfo_t
), 1);
3164 get_target_siginfo(&uinfo
, p
);
3165 print_siginfo(&uinfo
);
3167 unlock_user(p
, arg2
, 0);
3169 print_pointer(arg2
, 1);
3171 print_syscall_epilogue(name
);
3175 #ifdef TARGET_NR_rt_tgsigqueueinfo
3177 print_rt_tgsigqueueinfo(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3178 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3179 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3182 target_siginfo_t uinfo
;
3184 print_syscall_prologue(name
);
3185 print_raw_param("%d", arg0
, 0);
3186 print_raw_param("%d", arg1
, 0);
3187 print_signal(arg2
, 0);
3188 p
= lock_user(VERIFY_READ
, arg3
, sizeof(target_siginfo_t
), 1);
3190 get_target_siginfo(&uinfo
, p
);
3191 print_siginfo(&uinfo
);
3193 unlock_user(p
, arg3
, 0);
3195 print_pointer(arg3
, 1);
3197 print_syscall_epilogue(name
);
3201 #ifdef TARGET_NR_syslog
3203 print_syslog_action(abi_ulong arg
, int last
)
3208 case TARGET_SYSLOG_ACTION_CLOSE
: {
3209 type
= "SYSLOG_ACTION_CLOSE";
3212 case TARGET_SYSLOG_ACTION_OPEN
: {
3213 type
= "SYSLOG_ACTION_OPEN";
3216 case TARGET_SYSLOG_ACTION_READ
: {
3217 type
= "SYSLOG_ACTION_READ";
3220 case TARGET_SYSLOG_ACTION_READ_ALL
: {
3221 type
= "SYSLOG_ACTION_READ_ALL";
3224 case TARGET_SYSLOG_ACTION_READ_CLEAR
: {
3225 type
= "SYSLOG_ACTION_READ_CLEAR";
3228 case TARGET_SYSLOG_ACTION_CLEAR
: {
3229 type
= "SYSLOG_ACTION_CLEAR";
3232 case TARGET_SYSLOG_ACTION_CONSOLE_OFF
: {
3233 type
= "SYSLOG_ACTION_CONSOLE_OFF";
3236 case TARGET_SYSLOG_ACTION_CONSOLE_ON
: {
3237 type
= "SYSLOG_ACTION_CONSOLE_ON";
3240 case TARGET_SYSLOG_ACTION_CONSOLE_LEVEL
: {
3241 type
= "SYSLOG_ACTION_CONSOLE_LEVEL";
3244 case TARGET_SYSLOG_ACTION_SIZE_UNREAD
: {
3245 type
= "SYSLOG_ACTION_SIZE_UNREAD";
3248 case TARGET_SYSLOG_ACTION_SIZE_BUFFER
: {
3249 type
= "SYSLOG_ACTION_SIZE_BUFFER";
3253 print_raw_param("%ld", arg
, last
);
3257 qemu_log("%s%s", type
, get_comma(last
));
3261 print_syslog(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3262 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3263 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3265 print_syscall_prologue(name
);
3266 print_syslog_action(arg0
, 0);
3267 print_pointer(arg1
, 0);
3268 print_raw_param("%d", arg2
, 1);
3269 print_syscall_epilogue(name
);
3273 #ifdef TARGET_NR_mknod
3275 print_mknod(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3276 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3277 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3279 int hasdev
= (arg1
& (S_IFCHR
|S_IFBLK
));
3281 print_syscall_prologue(name
);
3282 print_string(arg0
, 0);
3283 print_file_mode(arg1
, (hasdev
== 0));
3285 print_raw_param("makedev(%d", major(arg2
), 0);
3286 print_raw_param("%d)", minor(arg2
), 1);
3288 print_syscall_epilogue(name
);
3292 #ifdef TARGET_NR_mknodat
3294 print_mknodat(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3295 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3296 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3298 int hasdev
= (arg2
& (S_IFCHR
|S_IFBLK
));
3300 print_syscall_prologue(name
);
3301 print_at_dirfd(arg0
, 0);
3302 print_string(arg1
, 0);
3303 print_file_mode(arg2
, (hasdev
== 0));
3305 print_raw_param("makedev(%d", major(arg3
), 0);
3306 print_raw_param("%d)", minor(arg3
), 1);
3308 print_syscall_epilogue(name
);
3312 #ifdef TARGET_NR_mq_open
3314 print_mq_open(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3315 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3316 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3318 int is_creat
= (arg1
& TARGET_O_CREAT
);
3320 print_syscall_prologue(name
);
3321 print_string(arg0
, 0);
3322 print_open_flags(arg1
, (is_creat
== 0));
3324 print_file_mode(arg2
, 0);
3325 print_pointer(arg3
, 1);
3327 print_syscall_epilogue(name
);
3331 #ifdef TARGET_NR_open
3333 print_open(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3334 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3335 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3337 int is_creat
= (arg1
& TARGET_O_CREAT
);
3339 print_syscall_prologue(name
);
3340 print_string(arg0
, 0);
3341 print_open_flags(arg1
, (is_creat
== 0));
3343 print_file_mode(arg2
, 1);
3344 print_syscall_epilogue(name
);
3348 #ifdef TARGET_NR_openat
3350 print_openat(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3351 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3352 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3354 int is_creat
= (arg2
& TARGET_O_CREAT
);
3356 print_syscall_prologue(name
);
3357 print_at_dirfd(arg0
, 0);
3358 print_string(arg1
, 0);
3359 print_open_flags(arg2
, (is_creat
== 0));
3361 print_file_mode(arg3
, 1);
3362 print_syscall_epilogue(name
);
3366 #ifdef TARGET_NR_pidfd_send_signal
3368 print_pidfd_send_signal(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3369 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3370 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3373 target_siginfo_t uinfo
;
3375 print_syscall_prologue(name
);
3376 print_raw_param("%d", arg0
, 0);
3377 print_signal(arg1
, 0);
3379 p
= lock_user(VERIFY_READ
, arg2
, sizeof(target_siginfo_t
), 1);
3381 get_target_siginfo(&uinfo
, p
);
3382 print_siginfo(&uinfo
);
3384 unlock_user(p
, arg2
, 0);
3386 print_pointer(arg2
, 0);
3389 print_raw_param("%u", arg3
, 1);
3390 print_syscall_epilogue(name
);
3394 #ifdef TARGET_NR_mq_unlink
3396 print_mq_unlink(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3397 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3398 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3400 print_syscall_prologue(name
);
3401 print_string(arg0
, 1);
3402 print_syscall_epilogue(name
);
3406 #if defined(TARGET_NR_fstatat64) || defined(TARGET_NR_newfstatat)
3408 print_fstatat64(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3409 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3410 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3412 print_syscall_prologue(name
);
3413 print_at_dirfd(arg0
, 0);
3414 print_string(arg1
, 0);
3415 print_pointer(arg2
, 0);
3416 print_flags(at_file_flags
, arg3
, 1);
3417 print_syscall_epilogue(name
);
3419 #define print_newfstatat print_fstatat64
3422 #ifdef TARGET_NR_readlink
3424 print_readlink(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3425 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3426 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3428 print_syscall_prologue(name
);
3429 print_string(arg0
, 0);
3430 print_pointer(arg1
, 0);
3431 print_raw_param("%u", arg2
, 1);
3432 print_syscall_epilogue(name
);
3436 #ifdef TARGET_NR_readlinkat
3438 print_readlinkat(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3439 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3440 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3442 print_syscall_prologue(name
);
3443 print_at_dirfd(arg0
, 0);
3444 print_string(arg1
, 0);
3445 print_pointer(arg2
, 0);
3446 print_raw_param("%u", arg3
, 1);
3447 print_syscall_epilogue(name
);
3451 #ifdef TARGET_NR_rename
3453 print_rename(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3454 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3455 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3457 print_syscall_prologue(name
);
3458 print_string(arg0
, 0);
3459 print_string(arg1
, 1);
3460 print_syscall_epilogue(name
);
3464 #ifdef TARGET_NR_renameat
3466 print_renameat(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3467 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3468 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3470 print_syscall_prologue(name
);
3471 print_at_dirfd(arg0
, 0);
3472 print_string(arg1
, 0);
3473 print_at_dirfd(arg2
, 0);
3474 print_string(arg3
, 1);
3475 print_syscall_epilogue(name
);
3479 #ifdef TARGET_NR_statfs
3481 print_statfs(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3482 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3483 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3485 print_syscall_prologue(name
);
3486 print_string(arg0
, 0);
3487 print_pointer(arg1
, 1);
3488 print_syscall_epilogue(name
);
3492 #ifdef TARGET_NR_statfs64
3494 print_statfs64(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3495 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3496 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3498 print_syscall_prologue(name
);
3499 print_string(arg0
, 0);
3500 print_pointer(arg1
, 1);
3501 print_syscall_epilogue(name
);
3505 #ifdef TARGET_NR_symlink
3507 print_symlink(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_string(arg1
, 1);
3514 print_syscall_epilogue(name
);
3518 #ifdef TARGET_NR_symlinkat
3520 print_symlinkat(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3521 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3522 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3524 print_syscall_prologue(name
);
3525 print_string(arg0
, 0);
3526 print_at_dirfd(arg1
, 0);
3527 print_string(arg2
, 1);
3528 print_syscall_epilogue(name
);
3532 #ifdef TARGET_NR_mount
3534 print_mount(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3535 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3536 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3538 print_syscall_prologue(name
);
3539 print_string(arg0
, 0);
3540 print_string(arg1
, 0);
3541 print_string(arg2
, 0);
3542 print_flags(mount_flags
, arg3
, 0);
3543 print_pointer(arg4
, 1);
3544 print_syscall_epilogue(name
);
3548 #ifdef TARGET_NR_umount
3550 print_umount(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3551 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3552 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3554 print_syscall_prologue(name
);
3555 print_string(arg0
, 1);
3556 print_syscall_epilogue(name
);
3560 #ifdef TARGET_NR_umount2
3562 print_umount2(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3563 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3564 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3566 print_syscall_prologue(name
);
3567 print_string(arg0
, 0);
3568 print_flags(umount2_flags
, arg1
, 1);
3569 print_syscall_epilogue(name
);
3573 #ifdef TARGET_NR_unlink
3575 print_unlink(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3576 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3577 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3579 print_syscall_prologue(name
);
3580 print_string(arg0
, 1);
3581 print_syscall_epilogue(name
);
3585 #ifdef TARGET_NR_unlinkat
3587 print_unlinkat(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3588 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3589 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3591 print_syscall_prologue(name
);
3592 print_at_dirfd(arg0
, 0);
3593 print_string(arg1
, 0);
3594 print_flags(unlinkat_flags
, arg2
, 1);
3595 print_syscall_epilogue(name
);
3599 #ifdef TARGET_NR_unshare
3601 print_unshare(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3602 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3603 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3605 print_syscall_prologue(name
);
3606 print_flags(clone_flags
, arg0
, 1);
3607 print_syscall_epilogue(name
);
3611 #ifdef TARGET_NR_clock_nanosleep
3613 print_clock_nanosleep(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3614 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3615 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3617 print_syscall_prologue(name
);
3618 print_enums(clockids
, arg0
, 0);
3619 print_raw_param("%d", arg1
, 0);
3620 print_timespec(arg2
, 0);
3621 print_timespec(arg3
, 1);
3622 print_syscall_epilogue(name
);
3626 #ifdef TARGET_NR_utime
3628 print_utime(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3629 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3630 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3632 print_syscall_prologue(name
);
3633 print_string(arg0
, 0);
3634 print_pointer(arg1
, 1);
3635 print_syscall_epilogue(name
);
3639 #ifdef TARGET_NR_utimes
3641 print_utimes(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3642 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3643 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3645 print_syscall_prologue(name
);
3646 print_string(arg0
, 0);
3647 print_pointer(arg1
, 1);
3648 print_syscall_epilogue(name
);
3652 #ifdef TARGET_NR_utimensat
3654 print_utimensat(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3655 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3656 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3658 print_syscall_prologue(name
);
3659 print_at_dirfd(arg0
, 0);
3660 print_string(arg1
, 0);
3661 print_pointer(arg2
, 0);
3662 print_flags(at_file_flags
, arg3
, 1);
3663 print_syscall_epilogue(name
);
3667 #if defined(TARGET_NR_mmap) || defined(TARGET_NR_mmap2)
3669 print_mmap(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3670 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3671 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3673 print_syscall_prologue(name
);
3674 print_pointer(arg0
, 0);
3675 print_raw_param("%d", arg1
, 0);
3676 print_flags(mmap_prot_flags
, arg2
, 0);
3677 print_flags(mmap_flags
, arg3
, 0);
3678 print_raw_param("%d", arg4
, 0);
3679 print_raw_param("%#x", arg5
, 1);
3680 print_syscall_epilogue(name
);
3682 #define print_mmap2 print_mmap
3685 #ifdef TARGET_NR_mprotect
3687 print_mprotect(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3688 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3689 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3691 print_syscall_prologue(name
);
3692 print_pointer(arg0
, 0);
3693 print_raw_param("%d", arg1
, 0);
3694 print_flags(mmap_prot_flags
, arg2
, 1);
3695 print_syscall_epilogue(name
);
3699 #ifdef TARGET_NR_munmap
3701 print_munmap(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3702 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3703 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3705 print_syscall_prologue(name
);
3706 print_pointer(arg0
, 0);
3707 print_raw_param("%d", arg1
, 1);
3708 print_syscall_epilogue(name
);
3712 #ifdef TARGET_NR_futex
3713 static void print_futex_op(int cmd
, int last
)
3715 static const char * const futex_names
[] = {
3716 #define NAME(X) [X] = #X
3720 NAME(FUTEX_REQUEUE
),
3721 NAME(FUTEX_CMP_REQUEUE
),
3722 NAME(FUTEX_WAKE_OP
),
3723 NAME(FUTEX_LOCK_PI
),
3724 NAME(FUTEX_UNLOCK_PI
),
3725 NAME(FUTEX_TRYLOCK_PI
),
3726 NAME(FUTEX_WAIT_BITSET
),
3727 NAME(FUTEX_WAKE_BITSET
),
3728 NAME(FUTEX_WAIT_REQUEUE_PI
),
3729 NAME(FUTEX_CMP_REQUEUE_PI
),
3730 NAME(FUTEX_LOCK_PI2
),
3734 unsigned base_cmd
= cmd
& FUTEX_CMD_MASK
;
3736 if (base_cmd
< ARRAY_SIZE(futex_names
)) {
3738 (cmd
& FUTEX_PRIVATE_FLAG
? "FUTEX_PRIVATE_FLAG|" : ""),
3739 (cmd
& FUTEX_CLOCK_REALTIME
? "FUTEX_CLOCK_REALTIME|" : ""),
3740 futex_names
[base_cmd
]);
3742 qemu_log("0x%x", cmd
);
3747 print_futex(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3748 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3749 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3751 abi_long op
= arg1
& FUTEX_CMD_MASK
;
3752 print_syscall_prologue(name
);
3753 print_pointer(arg0
, 0);
3754 print_futex_op(arg1
, 0);
3755 print_raw_param(",%d", arg2
, 0);
3758 case FUTEX_WAIT_BITSET
:
3760 case FUTEX_LOCK_PI2
:
3761 case FUTEX_WAIT_REQUEUE_PI
:
3762 print_timespec(arg3
, 0);
3765 print_pointer(arg3
, 0);
3768 print_pointer(arg4
, 0);
3769 print_raw_param("%d", arg4
, 1);
3770 print_syscall_epilogue(name
);
3774 #ifdef TARGET_NR_kill
3776 print_kill(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3777 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3778 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3780 print_syscall_prologue(name
);
3781 print_raw_param("%d", arg0
, 0);
3782 print_signal(arg1
, 1);
3783 print_syscall_epilogue(name
);
3787 #ifdef TARGET_NR_tkill
3789 print_tkill(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3790 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3791 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3793 print_syscall_prologue(name
);
3794 print_raw_param("%d", arg0
, 0);
3795 print_signal(arg1
, 1);
3796 print_syscall_epilogue(name
);
3800 #ifdef TARGET_NR_tgkill
3802 print_tgkill(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3803 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3804 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3806 print_syscall_prologue(name
);
3807 print_raw_param("%d", arg0
, 0);
3808 print_raw_param("%d", arg1
, 0);
3809 print_signal(arg2
, 1);
3810 print_syscall_epilogue(name
);
3814 #ifdef TARGET_NR_statx
3816 print_statx(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3817 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3818 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3820 print_syscall_prologue(name
);
3821 print_at_dirfd(arg0
, 0);
3822 print_string(arg1
, 0);
3823 print_flags(statx_flags
, arg2
, 0);
3824 print_flags(statx_mask
, arg3
, 0);
3825 print_pointer(arg4
, 1);
3826 print_syscall_epilogue(name
);
3830 #ifdef TARGET_NR_ioctl
3832 print_ioctl(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3833 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3834 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3836 print_syscall_prologue(name
);
3837 print_raw_param("%d", arg0
, 0);
3839 const IOCTLEntry
*ie
;
3840 const argtype
*arg_type
;
3844 for (ie
= ioctl_entries
; ie
->target_cmd
!= 0; ie
++) {
3845 if (ie
->target_cmd
== arg1
) {
3850 if (ie
->target_cmd
== 0) {
3851 print_raw_param("%#x", arg1
, 0);
3852 print_raw_param("%#x", arg2
, 1);
3854 qemu_log("%s", ie
->name
);
3855 arg_type
= ie
->arg_type
;
3857 if (arg_type
[0] != TYPE_NULL
) {
3860 switch (arg_type
[0]) {
3862 print_pointer(arg2
, 1);
3867 print_raw_param("%d", arg2
, 1);
3870 print_raw_param(TARGET_ABI_FMT_ld
, arg2
, 1);
3873 print_raw_param(TARGET_ABI_FMT_lu
, arg2
, 1);
3876 switch (ie
->access
) {
3878 print_pointer(arg2
, 1);
3883 target_size
= thunk_type_size(arg_type
, 0);
3884 argptr
= lock_user(VERIFY_READ
, arg2
, target_size
, 1);
3886 thunk_print(argptr
, arg_type
);
3887 unlock_user(argptr
, arg2
, target_size
);
3889 print_pointer(arg2
, 1);
3895 g_assert_not_reached();
3899 print_syscall_epilogue(name
);
3904 * An array of all of the syscalls we know about
3907 static const struct syscallname scnames
[] = {
3908 #include "strace.list"
3911 static int nsyscalls
= ARRAY_SIZE(scnames
);
3914 * The public interface to this module.
3917 print_syscall(CPUArchState
*cpu_env
, int num
,
3918 abi_long arg1
, abi_long arg2
, abi_long arg3
,
3919 abi_long arg4
, abi_long arg5
, abi_long arg6
)
3923 const char *format
= "%s(" TARGET_ABI_FMT_ld
"," TARGET_ABI_FMT_ld
","
3924 TARGET_ABI_FMT_ld
"," TARGET_ABI_FMT_ld
","
3925 TARGET_ABI_FMT_ld
"," TARGET_ABI_FMT_ld
")";
3927 f
= qemu_log_trylock();
3931 fprintf(f
, "%d ", getpid());
3933 for (i
= 0; i
< nsyscalls
; i
++) {
3934 if (scnames
[i
].nr
== num
) {
3935 if (scnames
[i
].call
!= NULL
) {
3936 scnames
[i
].call(cpu_env
, &scnames
[i
], arg1
, arg2
, arg3
,
3939 /* XXX: this format system is broken because it uses
3940 host types and host pointers for strings */
3941 if (scnames
[i
].format
!= NULL
) {
3942 format
= scnames
[i
].format
;
3944 fprintf(f
, format
, scnames
[i
].name
, arg1
, arg2
,
3945 arg3
, arg4
, arg5
, arg6
);
3951 fprintf(f
, "Unknown syscall %d\n", num
);
3957 print_syscall_ret(CPUArchState
*cpu_env
, int num
, abi_long ret
,
3958 abi_long arg1
, abi_long arg2
, abi_long arg3
,
3959 abi_long arg4
, abi_long arg5
, abi_long arg6
)
3964 f
= qemu_log_trylock();
3969 for (i
= 0; i
< nsyscalls
; i
++) {
3970 if (scnames
[i
].nr
== num
) {
3971 if (scnames
[i
].result
!= NULL
) {
3972 scnames
[i
].result(cpu_env
, &scnames
[i
], ret
,
3976 if (!print_syscall_err(ret
)) {
3977 fprintf(f
, TARGET_ABI_FMT_ld
, ret
);
3987 void print_taken_signal(int target_signum
, const target_siginfo_t
*tinfo
)
3989 /* Print the strace output for a signal being taken:
3990 * --- SIGSEGV {si_signo=SIGSEGV, si_code=SI_KERNEL, si_addr=0} ---
3994 f
= qemu_log_trylock();
4000 print_signal(target_signum
, 1);
4002 print_siginfo(tinfo
);
4003 fprintf(f
, " ---\n");