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 abi_long f_mask
; /* mask */
50 const char *f_string
; /* stringified flag */
53 /* No 'struct flags' element should have a zero mask. */
54 #define FLAG_BASIC(V, M, N) { V, M | QEMU_BUILD_BUG_ON_ZERO(!(M)), N }
56 /* common flags for all architectures */
57 #define FLAG_GENERIC_MASK(V, M) FLAG_BASIC(V, M, #V)
58 #define FLAG_GENERIC(V) FLAG_BASIC(V, V, #V)
59 /* target specific flags (syscall_defs.h has TARGET_<flag>) */
60 #define FLAG_TARGET_MASK(V, M) FLAG_BASIC(TARGET_##V, TARGET_##M, #V)
61 #define FLAG_TARGET(V) FLAG_BASIC(TARGET_##V, TARGET_##V, #V)
62 /* end of flags array */
63 #define FLAG_END { 0, 0, NULL }
65 /* Structure used to translate enumerated values into strings */
67 abi_long e_value
; /* enum value */
68 const char *e_string
; /* stringified enum */
71 /* common enums for all architectures */
72 #define ENUM_GENERIC(name) { name, #name }
73 /* target specific enums */
74 #define ENUM_TARGET(name) { TARGET_ ## name, #name }
75 /* end of enums array */
76 #define ENUM_END { 0, NULL }
78 UNUSED
static const char *get_comma(int);
79 UNUSED
static void print_pointer(abi_long
, int);
80 UNUSED
static void print_flags(const struct flags
*, abi_long
, int);
81 UNUSED
static void print_enums(const struct enums
*, abi_long
, int);
82 UNUSED
static void print_at_dirfd(abi_long
, int);
83 UNUSED
static void print_file_mode(abi_long
, int);
84 UNUSED
static void print_open_flags(abi_long
, int);
85 UNUSED
static void print_syscall_prologue(const struct syscallname
*);
86 UNUSED
static void print_syscall_epilogue(const struct syscallname
*);
87 UNUSED
static void print_string(abi_long
, int);
88 UNUSED
static void print_buf(abi_long addr
, abi_long len
, int last
);
89 UNUSED
static void print_raw_param(const char *, abi_long
, int);
90 UNUSED
static void print_raw_param64(const char *, long long, int last
);
91 UNUSED
static void print_timeval(abi_ulong
, int);
92 UNUSED
static void print_timespec(abi_ulong
, int);
93 UNUSED
static void print_timespec64(abi_ulong
, int);
94 UNUSED
static void print_timezone(abi_ulong
, int);
95 UNUSED
static void print_itimerval(abi_ulong
, int);
96 UNUSED
static void print_number(abi_long
, int);
97 UNUSED
static void print_signal(abi_ulong
, int);
98 UNUSED
static void print_sockaddr(abi_ulong
, abi_long
, int);
99 UNUSED
static void print_socket_domain(int domain
);
100 UNUSED
static void print_socket_type(int type
);
101 UNUSED
static void print_socket_protocol(int domain
, int type
, int protocol
);
107 print_ipc_cmd(int cmd
)
109 #define output_cmd(val) \
117 /* General IPC commands */
118 output_cmd( IPC_RMID
);
119 output_cmd( IPC_SET
);
120 output_cmd( IPC_STAT
);
121 output_cmd( IPC_INFO
);
122 /* msgctl() commands */
123 output_cmd( MSG_STAT
);
124 output_cmd( MSG_INFO
);
125 /* shmctl() commands */
126 output_cmd( SHM_LOCK
);
127 output_cmd( SHM_UNLOCK
);
128 output_cmd( SHM_STAT
);
129 output_cmd( SHM_INFO
);
130 /* semctl() commands */
131 output_cmd( GETPID
);
132 output_cmd( GETVAL
);
133 output_cmd( GETALL
);
134 output_cmd( GETNCNT
);
135 output_cmd( GETZCNT
);
136 output_cmd( SETVAL
);
137 output_cmd( SETALL
);
138 output_cmd( SEM_STAT
);
139 output_cmd( SEM_INFO
);
140 output_cmd( IPC_RMID
);
141 output_cmd( IPC_RMID
);
142 output_cmd( IPC_RMID
);
143 output_cmd( IPC_RMID
);
144 output_cmd( IPC_RMID
);
145 output_cmd( IPC_RMID
);
146 output_cmd( IPC_RMID
);
147 output_cmd( IPC_RMID
);
148 output_cmd( IPC_RMID
);
150 /* Some value we don't recognize */
154 static const char * const target_signal_name
[] = {
155 #define MAKE_SIG_ENTRY(sig) [TARGET_##sig] = #sig,
157 #undef MAKE_SIG_ENTRY
161 print_signal(abi_ulong arg
, int last
)
163 const char *signal_name
= NULL
;
165 if (arg
< ARRAY_SIZE(target_signal_name
)) {
166 signal_name
= target_signal_name
[arg
];
169 if (signal_name
== NULL
) {
170 print_raw_param("%ld", arg
, last
);
173 qemu_log("%s%s", signal_name
, get_comma(last
));
176 static void print_si_code(int arg
)
178 const char *codename
= NULL
;
182 codename
= "SI_USER";
185 codename
= "SI_KERNEL";
188 codename
= "SI_QUEUE";
191 codename
= "SI_TIMER";
194 codename
= "SI_MESGQ";
197 codename
= "SI_ASYNCIO";
200 codename
= "SI_SIGIO";
203 codename
= "SI_TKILL";
209 qemu_log("%s", codename
);
212 static void get_target_siginfo(target_siginfo_t
*tinfo
,
213 const target_siginfo_t
*info
)
222 __get_user(sig
, &info
->si_signo
);
223 __get_user(si_errno
, &tinfo
->si_errno
);
224 __get_user(si_code
, &info
->si_code
);
226 tinfo
->si_signo
= sig
;
227 tinfo
->si_errno
= si_errno
;
228 tinfo
->si_code
= si_code
;
230 /* Ensure we don't leak random junk to the guest later */
231 memset(tinfo
->_sifields
._pad
, 0, sizeof(tinfo
->_sifields
._pad
));
233 /* This is awkward, because we have to use a combination of
234 * the si_code and si_signo to figure out which of the union's
235 * members are valid. (Within the host kernel it is always possible
236 * to tell, but the kernel carefully avoids giving userspace the
237 * high 16 bits of si_code, so we don't have the information to
238 * do this the easy way...) We therefore make our best guess,
239 * bearing in mind that a guest can spoof most of the si_codes
240 * via rt_sigqueueinfo() if it likes.
242 * Once we have made our guess, we record it in the top 16 bits of
243 * the si_code, so that print_siginfo() later can use it.
244 * print_siginfo() will strip these top bits out before printing
252 /* Sent via kill(), tkill() or tgkill(), or direct from the kernel.
253 * These are the only unspoofable si_code values.
255 __get_user(tinfo
->_sifields
._kill
._pid
, &info
->_sifields
._kill
._pid
);
256 __get_user(tinfo
->_sifields
._kill
._uid
, &info
->_sifields
._kill
._uid
);
257 si_type
= QEMU_SI_KILL
;
260 /* Everything else is spoofable. Make best guess based on signal */
263 __get_user(tinfo
->_sifields
._sigchld
._pid
,
264 &info
->_sifields
._sigchld
._pid
);
265 __get_user(tinfo
->_sifields
._sigchld
._uid
,
266 &info
->_sifields
._sigchld
._uid
);
267 __get_user(tinfo
->_sifields
._sigchld
._status
,
268 &info
->_sifields
._sigchld
._status
);
269 __get_user(tinfo
->_sifields
._sigchld
._utime
,
270 &info
->_sifields
._sigchld
._utime
);
271 __get_user(tinfo
->_sifields
._sigchld
._stime
,
272 &info
->_sifields
._sigchld
._stime
);
273 si_type
= QEMU_SI_CHLD
;
276 __get_user(tinfo
->_sifields
._sigpoll
._band
,
277 &info
->_sifields
._sigpoll
._band
);
278 __get_user(tinfo
->_sifields
._sigpoll
._fd
,
279 &info
->_sifields
._sigpoll
._fd
);
280 si_type
= QEMU_SI_POLL
;
283 /* Assume a sigqueue()/mq_notify()/rt_sigqueueinfo() source. */
284 __get_user(tinfo
->_sifields
._rt
._pid
, &info
->_sifields
._rt
._pid
);
285 __get_user(tinfo
->_sifields
._rt
._uid
, &info
->_sifields
._rt
._uid
);
286 /* XXX: potential problem if 64 bit */
287 __get_user(sival_ptr
, &info
->_sifields
._rt
._sigval
.sival_ptr
);
288 tinfo
->_sifields
._rt
._sigval
.sival_ptr
= sival_ptr
;
290 si_type
= QEMU_SI_RT
;
296 tinfo
->si_code
= deposit32(si_code
, 16, 16, si_type
);
299 static void print_siginfo(const target_siginfo_t
*tinfo
)
301 /* Print a target_siginfo_t in the format desired for printing
302 * signals being taken. We assume the target_siginfo_t is in the
303 * internal form where the top 16 bits of si_code indicate which
304 * part of the union is valid, rather than in the guest-visible
305 * form where the bottom 16 bits are sign-extended into the top 16.
307 int si_type
= extract32(tinfo
->si_code
, 16, 16);
308 int si_code
= sextract32(tinfo
->si_code
, 0, 16);
310 qemu_log("{si_signo=");
311 print_signal(tinfo
->si_signo
, 1);
312 qemu_log(", si_code=");
313 print_si_code(si_code
);
317 qemu_log(", si_pid=%u, si_uid=%u",
318 (unsigned int)tinfo
->_sifields
._kill
._pid
,
319 (unsigned int)tinfo
->_sifields
._kill
._uid
);
322 qemu_log(", si_timer1=%u, si_timer2=%u",
323 tinfo
->_sifields
._timer
._timer1
,
324 tinfo
->_sifields
._timer
._timer2
);
327 qemu_log(", si_band=%d, si_fd=%d",
328 tinfo
->_sifields
._sigpoll
._band
,
329 tinfo
->_sifields
._sigpoll
._fd
);
332 qemu_log(", si_addr=");
333 print_pointer(tinfo
->_sifields
._sigfault
._addr
, 1);
336 qemu_log(", si_pid=%u, si_uid=%u, si_status=%d"
337 ", si_utime=" TARGET_ABI_FMT_ld
338 ", si_stime=" TARGET_ABI_FMT_ld
,
339 (unsigned int)(tinfo
->_sifields
._sigchld
._pid
),
340 (unsigned int)(tinfo
->_sifields
._sigchld
._uid
),
341 tinfo
->_sifields
._sigchld
._status
,
342 tinfo
->_sifields
._sigchld
._utime
,
343 tinfo
->_sifields
._sigchld
._stime
);
346 qemu_log(", si_pid=%u, si_uid=%u, si_sigval=" TARGET_ABI_FMT_ld
,
347 (unsigned int)tinfo
->_sifields
._rt
._pid
,
348 (unsigned int)tinfo
->_sifields
._rt
._uid
,
349 tinfo
->_sifields
._rt
._sigval
.sival_ptr
);
352 g_assert_not_reached();
358 print_sockaddr(abi_ulong addr
, abi_long addrlen
, int last
)
360 struct target_sockaddr
*sa
;
364 sa
= lock_user(VERIFY_READ
, addr
, addrlen
, 1);
366 sa_family
= tswap16(sa
->sa_family
);
369 struct target_sockaddr_un
*un
= (struct target_sockaddr_un
*)sa
;
371 qemu_log("{sun_family=AF_UNIX,sun_path=\"");
372 for (i
= 0; i
< addrlen
-
373 offsetof(struct target_sockaddr_un
, sun_path
) &&
374 un
->sun_path
[i
]; i
++) {
375 qemu_log("%c", un
->sun_path
[i
]);
381 struct target_sockaddr_in
*in
= (struct target_sockaddr_in
*)sa
;
382 uint8_t *c
= (uint8_t *)&in
->sin_addr
.s_addr
;
383 qemu_log("{sin_family=AF_INET,sin_port=htons(%d),",
384 ntohs(in
->sin_port
));
385 qemu_log("sin_addr=inet_addr(\"%d.%d.%d.%d\")",
386 c
[0], c
[1], c
[2], c
[3]);
391 struct target_sockaddr_ll
*ll
= (struct target_sockaddr_ll
*)sa
;
392 uint8_t *c
= (uint8_t *)&ll
->sll_addr
;
393 qemu_log("{sll_family=AF_PACKET,"
394 "sll_protocol=htons(0x%04x),if%d,pkttype=",
395 ntohs(ll
->sll_protocol
), ll
->sll_ifindex
);
396 switch (ll
->sll_pkttype
) {
398 qemu_log("PACKET_HOST");
400 case PACKET_BROADCAST
:
401 qemu_log("PACKET_BROADCAST");
403 case PACKET_MULTICAST
:
404 qemu_log("PACKET_MULTICAST");
406 case PACKET_OTHERHOST
:
407 qemu_log("PACKET_OTHERHOST");
409 case PACKET_OUTGOING
:
410 qemu_log("PACKET_OUTGOING");
413 qemu_log("%d", ll
->sll_pkttype
);
416 qemu_log(",sll_addr=%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x",
417 c
[0], c
[1], c
[2], c
[3], c
[4], c
[5], c
[6], c
[7]);
422 struct target_sockaddr_nl
*nl
= (struct target_sockaddr_nl
*)sa
;
423 qemu_log("{nl_family=AF_NETLINK,nl_pid=%u,nl_groups=%u}",
424 tswap32(nl
->nl_pid
), tswap32(nl
->nl_groups
));
428 qemu_log("{sa_family=%d, sa_data={", sa
->sa_family
);
429 for (i
= 0; i
< 13; i
++) {
430 qemu_log("%02x, ", sa
->sa_data
[i
]);
432 qemu_log("%02x}", sa
->sa_data
[i
]);
436 unlock_user(sa
, addr
, 0);
438 print_raw_param("0x"TARGET_ABI_FMT_lx
, addr
, 0);
440 qemu_log(", "TARGET_ABI_FMT_ld
"%s", addrlen
, get_comma(last
));
444 print_socket_domain(int domain
)
454 qemu_log("PF_NETLINK");
457 qemu_log("PF_PACKET");
460 qemu_log("%d", domain
);
466 print_socket_type(int type
)
468 switch (type
& TARGET_SOCK_TYPE_MASK
) {
469 case TARGET_SOCK_DGRAM
:
470 qemu_log("SOCK_DGRAM");
472 case TARGET_SOCK_STREAM
:
473 qemu_log("SOCK_STREAM");
475 case TARGET_SOCK_RAW
:
476 qemu_log("SOCK_RAW");
478 case TARGET_SOCK_RDM
:
479 qemu_log("SOCK_RDM");
481 case TARGET_SOCK_SEQPACKET
:
482 qemu_log("SOCK_SEQPACKET");
484 case TARGET_SOCK_PACKET
:
485 qemu_log("SOCK_PACKET");
488 if (type
& TARGET_SOCK_CLOEXEC
) {
489 qemu_log("|SOCK_CLOEXEC");
491 if (type
& TARGET_SOCK_NONBLOCK
) {
492 qemu_log("|SOCK_NONBLOCK");
497 print_socket_protocol(int domain
, int type
, int protocol
)
499 if (domain
== AF_PACKET
||
500 (domain
== AF_INET
&& type
== TARGET_SOCK_PACKET
)) {
503 qemu_log("ETH_P_ALL");
506 qemu_log("%d", protocol
);
511 if (domain
== PF_NETLINK
) {
514 qemu_log("NETLINK_ROUTE");
517 qemu_log("NETLINK_UNUSED");
519 case NETLINK_USERSOCK
:
520 qemu_log("NETLINK_USERSOCK");
522 case NETLINK_FIREWALL
:
523 qemu_log("NETLINK_FIREWALL");
525 case NETLINK_SOCK_DIAG
:
526 qemu_log("NETLINK_SOCK_DIAG");
529 qemu_log("NETLINK_NFLOG");
532 qemu_log("NETLINK_XFRM");
534 case NETLINK_SELINUX
:
535 qemu_log("NETLINK_SELINUX");
538 qemu_log("NETLINK_ISCSI");
541 qemu_log("NETLINK_AUDIT");
543 case NETLINK_FIB_LOOKUP
:
544 qemu_log("NETLINK_FIB_LOOKUP");
546 case NETLINK_CONNECTOR
:
547 qemu_log("NETLINK_CONNECTOR");
549 case NETLINK_NETFILTER
:
550 qemu_log("NETLINK_NETFILTER");
553 qemu_log("NETLINK_IP6_FW");
555 case NETLINK_DNRTMSG
:
556 qemu_log("NETLINK_DNRTMSG");
558 case NETLINK_KOBJECT_UEVENT
:
559 qemu_log("NETLINK_KOBJECT_UEVENT");
561 case NETLINK_GENERIC
:
562 qemu_log("NETLINK_GENERIC");
564 case NETLINK_SCSITRANSPORT
:
565 qemu_log("NETLINK_SCSITRANSPORT");
567 case NETLINK_ECRYPTFS
:
568 qemu_log("NETLINK_ECRYPTFS");
571 qemu_log("NETLINK_RDMA");
574 qemu_log("NETLINK_CRYPTO");
577 qemu_log("NETLINK_SMC");
580 qemu_log("%d", protocol
);
588 qemu_log("IPPROTO_IP");
591 qemu_log("IPPROTO_TCP");
594 qemu_log("IPPROTO_UDP");
597 qemu_log("IPPROTO_RAW");
600 qemu_log("%d", protocol
);
606 #ifdef TARGET_NR__newselect
608 print_fdset(int n
, abi_ulong target_fds_addr
)
614 if( target_fds_addr
) {
615 abi_long
*target_fds
;
617 target_fds
= lock_user(VERIFY_READ
,
619 sizeof(*target_fds
)*(n
/ TARGET_ABI_BITS
+ 1),
625 for (i
=n
; i
>=0; i
--) {
626 if ((tswapal(target_fds
[i
/ TARGET_ABI_BITS
]) >>
627 (i
& (TARGET_ABI_BITS
- 1))) & 1) {
628 qemu_log("%s%d", get_comma(first
), i
);
632 unlock_user(target_fds
, target_fds_addr
, 0);
639 * Sysycall specific output functions
643 #ifdef TARGET_NR__newselect
645 print_newselect(CPUArchState
*cpu_env
, const struct syscallname
*name
,
646 abi_long arg1
, abi_long arg2
, abi_long arg3
,
647 abi_long arg4
, abi_long arg5
, abi_long arg6
)
649 print_syscall_prologue(name
);
650 print_fdset(arg1
, arg2
);
652 print_fdset(arg1
, arg3
);
654 print_fdset(arg1
, arg4
);
656 print_timeval(arg5
, 1);
657 print_syscall_epilogue(name
);
661 #ifdef TARGET_NR_semctl
663 print_semctl(CPUArchState
*cpu_env
, const struct syscallname
*name
,
664 abi_long arg1
, abi_long arg2
, abi_long arg3
,
665 abi_long arg4
, abi_long arg5
, abi_long arg6
)
667 qemu_log("%s(" TARGET_ABI_FMT_ld
"," TARGET_ABI_FMT_ld
",",
668 name
->name
, arg1
, arg2
);
670 qemu_log(",0x" TARGET_ABI_FMT_lx
")", arg4
);
676 print_ipc(CPUArchState
*cpu_env
, const struct syscallname
*name
,
677 abi_long arg1
, abi_long arg2
, abi_long arg3
,
678 abi_long arg4
, abi_long arg5
, abi_long arg6
)
682 qemu_log("semctl(" TARGET_ABI_FMT_ld
"," TARGET_ABI_FMT_ld
",",
685 qemu_log(",0x" TARGET_ABI_FMT_lx
")", arg4
);
689 TARGET_ABI_FMT_ld
","
690 TARGET_ABI_FMT_ld
","
691 TARGET_ABI_FMT_ld
","
694 name
->name
, arg1
, arg2
, arg3
, arg4
);
700 * Variants for the return value output function
704 print_syscall_err(abi_long ret
)
710 errstr
= target_strerror(-ret
);
712 qemu_log("-1 errno=%d (%s)", (int)-ret
, errstr
);
720 print_syscall_ret_addr(CPUArchState
*cpu_env
, const struct syscallname
*name
,
721 abi_long ret
, abi_long arg0
, abi_long arg1
,
722 abi_long arg2
, abi_long arg3
, abi_long arg4
,
725 if (!print_syscall_err(ret
)) {
726 qemu_log("0x" TARGET_ABI_FMT_lx
, ret
);
731 #if 0 /* currently unused */
733 print_syscall_ret_raw(struct syscallname
*name
, abi_long ret
)
735 qemu_log(" = 0x" TARGET_ABI_FMT_lx
"\n", ret
);
739 #ifdef TARGET_NR__newselect
741 print_syscall_ret_newselect(CPUArchState
*cpu_env
, const struct syscallname
*name
,
742 abi_long ret
, abi_long arg0
, abi_long arg1
,
743 abi_long arg2
, abi_long arg3
, abi_long arg4
,
746 if (!print_syscall_err(ret
)) {
747 qemu_log(" = 0x" TARGET_ABI_FMT_lx
" (", ret
);
748 print_fdset(arg0
, arg1
);
750 print_fdset(arg0
, arg2
);
752 print_fdset(arg0
, arg3
);
754 print_timeval(arg4
, 1);
762 /* special meanings of adjtimex()' non-negative return values */
763 #define TARGET_TIME_OK 0 /* clock synchronized, no leap second */
764 #define TARGET_TIME_INS 1 /* insert leap second */
765 #define TARGET_TIME_DEL 2 /* delete leap second */
766 #define TARGET_TIME_OOP 3 /* leap second in progress */
767 #define TARGET_TIME_WAIT 4 /* leap second has occurred */
768 #define TARGET_TIME_ERROR 5 /* clock not synchronized */
769 #ifdef TARGET_NR_adjtimex
771 print_syscall_ret_adjtimex(CPUArchState
*cpu_env
, const struct syscallname
*name
,
772 abi_long ret
, abi_long arg0
, abi_long arg1
,
773 abi_long arg2
, abi_long arg3
, abi_long arg4
,
776 if (!print_syscall_err(ret
)) {
777 qemu_log(TARGET_ABI_FMT_ld
, ret
);
780 qemu_log(" TIME_OK (clock synchronized, no leap second)");
782 case TARGET_TIME_INS
:
783 qemu_log(" TIME_INS (insert leap second)");
785 case TARGET_TIME_DEL
:
786 qemu_log(" TIME_DEL (delete leap second)");
788 case TARGET_TIME_OOP
:
789 qemu_log(" TIME_OOP (leap second in progress)");
791 case TARGET_TIME_WAIT
:
792 qemu_log(" TIME_WAIT (leap second has occurred)");
794 case TARGET_TIME_ERROR
:
795 qemu_log(" TIME_ERROR (clock not synchronized)");
804 #if defined(TARGET_NR_clock_gettime) || defined(TARGET_NR_clock_getres)
806 print_syscall_ret_clock_gettime(CPUArchState
*cpu_env
, const struct syscallname
*name
,
807 abi_long ret
, abi_long arg0
, abi_long arg1
,
808 abi_long arg2
, abi_long arg3
, abi_long arg4
,
811 if (!print_syscall_err(ret
)) {
812 qemu_log(TARGET_ABI_FMT_ld
, ret
);
814 print_timespec(arg1
, 1);
820 #define print_syscall_ret_clock_getres print_syscall_ret_clock_gettime
823 #if defined(TARGET_NR_clock_gettime64)
825 print_syscall_ret_clock_gettime64(CPUArchState
*cpu_env
, const struct syscallname
*name
,
826 abi_long ret
, abi_long arg0
, abi_long arg1
,
827 abi_long arg2
, abi_long arg3
, abi_long arg4
,
830 if (!print_syscall_err(ret
)) {
831 qemu_log(TARGET_ABI_FMT_ld
, ret
);
833 print_timespec64(arg1
, 1);
841 #ifdef TARGET_NR_gettimeofday
843 print_syscall_ret_gettimeofday(CPUArchState
*cpu_env
, const struct syscallname
*name
,
844 abi_long ret
, abi_long arg0
, abi_long arg1
,
845 abi_long arg2
, abi_long arg3
, abi_long arg4
,
848 if (!print_syscall_err(ret
)) {
849 qemu_log(TARGET_ABI_FMT_ld
, ret
);
851 print_timeval(arg0
, 0);
852 print_timezone(arg1
, 1);
860 #ifdef TARGET_NR_getitimer
862 print_syscall_ret_getitimer(CPUArchState
*cpu_env
, const struct syscallname
*name
,
863 abi_long ret
, abi_long arg0
, abi_long arg1
,
864 abi_long arg2
, abi_long arg3
, abi_long arg4
,
867 if (!print_syscall_err(ret
)) {
868 qemu_log(TARGET_ABI_FMT_ld
, ret
);
870 print_itimerval(arg1
, 1);
879 #ifdef TARGET_NR_getitimer
881 print_syscall_ret_setitimer(CPUArchState
*cpu_env
, const struct syscallname
*name
,
882 abi_long ret
, abi_long arg0
, abi_long arg1
,
883 abi_long arg2
, abi_long arg3
, abi_long arg4
,
886 if (!print_syscall_err(ret
)) {
887 qemu_log(TARGET_ABI_FMT_ld
, ret
);
888 qemu_log(" (old_value = ");
889 print_itimerval(arg2
, 1);
897 #if defined(TARGET_NR_listxattr) || defined(TARGET_NR_llistxattr) \
898 || defined(TARGGET_NR_flistxattr)
900 print_syscall_ret_listxattr(CPUArchState
*cpu_env
, const struct syscallname
*name
,
901 abi_long ret
, abi_long arg0
, abi_long arg1
,
902 abi_long arg2
, abi_long arg3
, abi_long arg4
,
905 if (!print_syscall_err(ret
)) {
906 qemu_log(TARGET_ABI_FMT_ld
, ret
);
907 qemu_log(" (list = ");
909 abi_long attr
= arg1
;
914 print_string(attr
, 1);
915 ret
-= target_strlen(attr
) + 1;
916 attr
+= target_strlen(attr
) + 1;
926 #define print_syscall_ret_llistxattr print_syscall_ret_listxattr
927 #define print_syscall_ret_flistxattr print_syscall_ret_listxattr
930 #ifdef TARGET_NR_ioctl
932 print_syscall_ret_ioctl(CPUArchState
*cpu_env
, const struct syscallname
*name
,
933 abi_long ret
, abi_long arg0
, abi_long arg1
,
934 abi_long arg2
, abi_long arg3
, abi_long arg4
,
937 if (!print_syscall_err(ret
)) {
938 qemu_log(TARGET_ABI_FMT_ld
, ret
);
940 const IOCTLEntry
*ie
;
941 const argtype
*arg_type
;
945 for (ie
= ioctl_entries
; ie
->target_cmd
!= 0; ie
++) {
946 if (ie
->target_cmd
== arg1
) {
951 if (ie
->target_cmd
== arg1
&&
952 (ie
->access
== IOC_R
|| ie
->access
== IOC_RW
)) {
953 arg_type
= ie
->arg_type
;
956 target_size
= thunk_type_size(arg_type
, 0);
957 argptr
= lock_user(VERIFY_READ
, arg2
, target_size
, 1);
959 thunk_print(argptr
, arg_type
);
960 unlock_user(argptr
, arg2
, target_size
);
962 print_pointer(arg2
, 1);
971 UNUSED
static const struct flags access_flags
[] = {
972 FLAG_GENERIC_MASK(F_OK
, R_OK
| W_OK
| X_OK
),
979 UNUSED
static const struct flags at_file_flags
[] = {
981 FLAG_GENERIC(AT_EACCESS
),
983 #ifdef AT_SYMLINK_NOFOLLOW
984 FLAG_GENERIC(AT_SYMLINK_NOFOLLOW
),
989 UNUSED
static const struct flags unlinkat_flags
[] = {
991 FLAG_GENERIC(AT_REMOVEDIR
),
996 UNUSED
static const struct flags mode_flags
[] = {
997 FLAG_GENERIC(S_IFSOCK
),
998 FLAG_GENERIC(S_IFLNK
),
999 FLAG_GENERIC(S_IFREG
),
1000 FLAG_GENERIC(S_IFBLK
),
1001 FLAG_GENERIC(S_IFDIR
),
1002 FLAG_GENERIC(S_IFCHR
),
1003 FLAG_GENERIC(S_IFIFO
),
1007 UNUSED
static const struct flags open_access_flags
[] = {
1008 FLAG_TARGET_MASK(O_RDONLY
, O_ACCMODE
),
1009 FLAG_TARGET_MASK(O_WRONLY
, O_ACCMODE
),
1010 FLAG_TARGET_MASK(O_RDWR
, O_ACCMODE
),
1014 UNUSED
static const struct flags open_flags
[] = {
1015 FLAG_TARGET(O_APPEND
),
1016 FLAG_TARGET(O_CREAT
),
1017 FLAG_TARGET(O_DIRECTORY
),
1018 FLAG_TARGET(O_EXCL
),
1019 #if TARGET_O_LARGEFILE != 0
1020 FLAG_TARGET(O_LARGEFILE
),
1022 FLAG_TARGET(O_NOCTTY
),
1023 FLAG_TARGET(O_NOFOLLOW
),
1024 FLAG_TARGET(O_NONBLOCK
), /* also O_NDELAY */
1025 FLAG_TARGET(O_DSYNC
),
1026 FLAG_TARGET(__O_SYNC
),
1027 FLAG_TARGET(O_TRUNC
),
1029 FLAG_TARGET(O_DIRECT
),
1032 FLAG_TARGET(O_NOATIME
),
1035 FLAG_TARGET(O_CLOEXEC
),
1038 FLAG_TARGET(O_PATH
),
1041 FLAG_TARGET(O_TMPFILE
),
1042 FLAG_TARGET(__O_TMPFILE
),
1047 UNUSED
static const struct flags mount_flags
[] = {
1049 FLAG_GENERIC(MS_BIND
),
1052 FLAG_GENERIC(MS_DIRSYNC
),
1054 FLAG_GENERIC(MS_MANDLOCK
),
1056 FLAG_GENERIC(MS_MOVE
),
1058 FLAG_GENERIC(MS_NOATIME
),
1059 FLAG_GENERIC(MS_NODEV
),
1060 FLAG_GENERIC(MS_NODIRATIME
),
1061 FLAG_GENERIC(MS_NOEXEC
),
1062 FLAG_GENERIC(MS_NOSUID
),
1063 FLAG_GENERIC(MS_RDONLY
),
1065 FLAG_GENERIC(MS_RELATIME
),
1067 FLAG_GENERIC(MS_REMOUNT
),
1068 FLAG_GENERIC(MS_SYNCHRONOUS
),
1072 UNUSED
static const struct flags umount2_flags
[] = {
1074 FLAG_GENERIC(MNT_FORCE
),
1077 FLAG_GENERIC(MNT_DETACH
),
1080 FLAG_GENERIC(MNT_EXPIRE
),
1085 UNUSED
static const struct flags mmap_prot_flags
[] = {
1086 FLAG_GENERIC_MASK(PROT_NONE
, PROT_READ
| PROT_WRITE
| PROT_EXEC
),
1087 FLAG_GENERIC(PROT_EXEC
),
1088 FLAG_GENERIC(PROT_READ
),
1089 FLAG_GENERIC(PROT_WRITE
),
1090 FLAG_TARGET(PROT_SEM
),
1091 FLAG_GENERIC(PROT_GROWSDOWN
),
1092 FLAG_GENERIC(PROT_GROWSUP
),
1096 UNUSED
static const struct flags mmap_flags
[] = {
1097 FLAG_TARGET_MASK(MAP_SHARED
, MAP_TYPE
),
1098 FLAG_TARGET_MASK(MAP_PRIVATE
, MAP_TYPE
),
1099 FLAG_TARGET_MASK(MAP_SHARED_VALIDATE
, MAP_TYPE
),
1100 FLAG_TARGET(MAP_ANONYMOUS
),
1101 FLAG_TARGET(MAP_DENYWRITE
),
1102 FLAG_TARGET(MAP_EXECUTABLE
),
1103 FLAG_TARGET(MAP_FIXED
),
1104 FLAG_TARGET(MAP_FIXED_NOREPLACE
),
1105 FLAG_TARGET(MAP_GROWSDOWN
),
1106 FLAG_TARGET(MAP_HUGETLB
),
1107 FLAG_TARGET(MAP_LOCKED
),
1108 FLAG_TARGET(MAP_NONBLOCK
),
1109 FLAG_TARGET(MAP_NORESERVE
),
1110 FLAG_TARGET(MAP_POPULATE
),
1111 FLAG_TARGET(MAP_STACK
),
1112 FLAG_TARGET(MAP_SYNC
),
1113 #if TARGET_MAP_UNINITIALIZED != 0
1114 FLAG_TARGET(MAP_UNINITIALIZED
),
1120 # define CLONE_PIDFD 0x00001000
1123 UNUSED
static const struct flags clone_flags
[] = {
1124 FLAG_GENERIC(CLONE_VM
),
1125 FLAG_GENERIC(CLONE_FS
),
1126 FLAG_GENERIC(CLONE_FILES
),
1127 FLAG_GENERIC(CLONE_SIGHAND
),
1128 FLAG_GENERIC(CLONE_PIDFD
),
1129 FLAG_GENERIC(CLONE_PTRACE
),
1130 FLAG_GENERIC(CLONE_VFORK
),
1131 FLAG_GENERIC(CLONE_PARENT
),
1132 FLAG_GENERIC(CLONE_THREAD
),
1133 FLAG_GENERIC(CLONE_NEWNS
),
1134 FLAG_GENERIC(CLONE_SYSVSEM
),
1135 FLAG_GENERIC(CLONE_SETTLS
),
1136 FLAG_GENERIC(CLONE_PARENT_SETTID
),
1137 FLAG_GENERIC(CLONE_CHILD_CLEARTID
),
1138 FLAG_GENERIC(CLONE_DETACHED
),
1139 FLAG_GENERIC(CLONE_UNTRACED
),
1140 FLAG_GENERIC(CLONE_CHILD_SETTID
),
1141 #if defined(CLONE_NEWUTS)
1142 FLAG_GENERIC(CLONE_NEWUTS
),
1144 #if defined(CLONE_NEWIPC)
1145 FLAG_GENERIC(CLONE_NEWIPC
),
1147 #if defined(CLONE_NEWUSER)
1148 FLAG_GENERIC(CLONE_NEWUSER
),
1150 #if defined(CLONE_NEWPID)
1151 FLAG_GENERIC(CLONE_NEWPID
),
1153 #if defined(CLONE_NEWNET)
1154 FLAG_GENERIC(CLONE_NEWNET
),
1156 #if defined(CLONE_NEWCGROUP)
1157 FLAG_GENERIC(CLONE_NEWCGROUP
),
1159 #if defined(CLONE_NEWTIME)
1160 FLAG_GENERIC(CLONE_NEWTIME
),
1162 #if defined(CLONE_IO)
1163 FLAG_GENERIC(CLONE_IO
),
1168 UNUSED
static const struct flags execveat_flags
[] = {
1169 #ifdef AT_EMPTY_PATH
1170 FLAG_GENERIC(AT_EMPTY_PATH
),
1172 #ifdef AT_SYMLINK_NOFOLLOW
1173 FLAG_GENERIC(AT_SYMLINK_NOFOLLOW
),
1178 UNUSED
static const struct flags msg_flags
[] = {
1180 FLAG_GENERIC(MSG_CONFIRM
),
1181 FLAG_GENERIC(MSG_DONTROUTE
),
1182 FLAG_GENERIC(MSG_DONTWAIT
),
1183 FLAG_GENERIC(MSG_EOR
),
1184 FLAG_GENERIC(MSG_MORE
),
1185 FLAG_GENERIC(MSG_NOSIGNAL
),
1186 FLAG_GENERIC(MSG_OOB
),
1188 FLAG_GENERIC(MSG_CMSG_CLOEXEC
),
1189 FLAG_GENERIC(MSG_ERRQUEUE
),
1190 FLAG_GENERIC(MSG_PEEK
),
1191 FLAG_GENERIC(MSG_TRUNC
),
1192 FLAG_GENERIC(MSG_WAITALL
),
1194 FLAG_GENERIC(MSG_CTRUNC
),
1198 UNUSED
static const struct flags statx_flags
[] = {
1199 #ifdef AT_EMPTY_PATH
1200 FLAG_GENERIC(AT_EMPTY_PATH
),
1202 #ifdef AT_NO_AUTOMOUNT
1203 FLAG_GENERIC(AT_NO_AUTOMOUNT
),
1205 #ifdef AT_SYMLINK_NOFOLLOW
1206 FLAG_GENERIC(AT_SYMLINK_NOFOLLOW
),
1208 #ifdef AT_STATX_SYNC_AS_STAT
1209 FLAG_GENERIC_MASK(AT_STATX_SYNC_AS_STAT
, AT_STATX_SYNC_TYPE
),
1211 #ifdef AT_STATX_FORCE_SYNC
1212 FLAG_GENERIC_MASK(AT_STATX_FORCE_SYNC
, AT_STATX_SYNC_TYPE
),
1214 #ifdef AT_STATX_DONT_SYNC
1215 FLAG_GENERIC_MASK(AT_STATX_DONT_SYNC
, AT_STATX_SYNC_TYPE
),
1220 UNUSED
static const struct flags statx_mask
[] = {
1221 /* This must come first, because it includes everything. */
1223 FLAG_GENERIC(STATX_ALL
),
1225 /* This must come second; it includes everything except STATX_BTIME. */
1226 #ifdef STATX_BASIC_STATS
1227 FLAG_GENERIC(STATX_BASIC_STATS
),
1230 FLAG_GENERIC(STATX_TYPE
),
1233 FLAG_GENERIC(STATX_MODE
),
1236 FLAG_GENERIC(STATX_NLINK
),
1239 FLAG_GENERIC(STATX_UID
),
1242 FLAG_GENERIC(STATX_GID
),
1245 FLAG_GENERIC(STATX_ATIME
),
1248 FLAG_GENERIC(STATX_MTIME
),
1251 FLAG_GENERIC(STATX_CTIME
),
1254 FLAG_GENERIC(STATX_INO
),
1257 FLAG_GENERIC(STATX_SIZE
),
1260 FLAG_GENERIC(STATX_BLOCKS
),
1263 FLAG_GENERIC(STATX_BTIME
),
1268 UNUSED
static const struct flags falloc_flags
[] = {
1269 FLAG_GENERIC(FALLOC_FL_KEEP_SIZE
),
1270 FLAG_GENERIC(FALLOC_FL_PUNCH_HOLE
),
1271 #ifdef FALLOC_FL_NO_HIDE_STALE
1272 FLAG_GENERIC(FALLOC_FL_NO_HIDE_STALE
),
1274 #ifdef FALLOC_FL_COLLAPSE_RANGE
1275 FLAG_GENERIC(FALLOC_FL_COLLAPSE_RANGE
),
1277 #ifdef FALLOC_FL_ZERO_RANGE
1278 FLAG_GENERIC(FALLOC_FL_ZERO_RANGE
),
1280 #ifdef FALLOC_FL_INSERT_RANGE
1281 FLAG_GENERIC(FALLOC_FL_INSERT_RANGE
),
1283 #ifdef FALLOC_FL_UNSHARE_RANGE
1284 FLAG_GENERIC(FALLOC_FL_UNSHARE_RANGE
),
1288 UNUSED
static const struct flags termios_iflags
[] = {
1289 FLAG_TARGET(IGNBRK
),
1290 FLAG_TARGET(BRKINT
),
1291 FLAG_TARGET(IGNPAR
),
1292 FLAG_TARGET(PARMRK
),
1294 FLAG_TARGET(ISTRIP
),
1302 FLAG_TARGET(IMAXBEL
),
1307 UNUSED
static const struct flags termios_oflags
[] = {
1313 FLAG_TARGET(ONLRET
),
1319 UNUSED
static struct enums termios_oflags_NLDLY
[] = {
1325 UNUSED
static struct enums termios_oflags_CRDLY
[] = {
1333 UNUSED
static struct enums termios_oflags_TABDLY
[] = {
1341 UNUSED
static struct enums termios_oflags_VTDLY
[] = {
1347 UNUSED
static struct enums termios_oflags_FFDLY
[] = {
1353 UNUSED
static struct enums termios_oflags_BSDLY
[] = {
1359 UNUSED
static struct enums termios_cflags_CBAUD
[] = {
1374 ENUM_TARGET(B19200
),
1375 ENUM_TARGET(B38400
),
1376 ENUM_TARGET(B57600
),
1377 ENUM_TARGET(B115200
),
1378 ENUM_TARGET(B230400
),
1379 ENUM_TARGET(B460800
),
1383 UNUSED
static struct enums termios_cflags_CSIZE
[] = {
1391 UNUSED
static const struct flags termios_cflags
[] = {
1392 FLAG_TARGET(CSTOPB
),
1394 FLAG_TARGET(PARENB
),
1395 FLAG_TARGET(PARODD
),
1397 FLAG_TARGET(CLOCAL
),
1398 FLAG_TARGET(CRTSCTS
),
1402 UNUSED
static const struct flags termios_lflags
[] = {
1404 FLAG_TARGET(ICANON
),
1409 FLAG_TARGET(ECHONL
),
1410 FLAG_TARGET(NOFLSH
),
1411 FLAG_TARGET(TOSTOP
),
1412 FLAG_TARGET(ECHOCTL
),
1413 FLAG_TARGET(ECHOPRT
),
1414 FLAG_TARGET(ECHOKE
),
1415 FLAG_TARGET(FLUSHO
),
1416 FLAG_TARGET(PENDIN
),
1417 FLAG_TARGET(IEXTEN
),
1418 FLAG_TARGET(EXTPROC
),
1422 #ifdef TARGET_NR_mlockall
1423 static const struct flags mlockall_flags
[] = {
1424 FLAG_TARGET(MCL_CURRENT
),
1425 FLAG_TARGET(MCL_FUTURE
),
1427 FLAG_TARGET(MCL_ONFAULT
),
1433 /* IDs of the various system clocks */
1434 #define TARGET_CLOCK_REALTIME 0
1435 #define TARGET_CLOCK_MONOTONIC 1
1436 #define TARGET_CLOCK_PROCESS_CPUTIME_ID 2
1437 #define TARGET_CLOCK_THREAD_CPUTIME_ID 3
1438 #define TARGET_CLOCK_MONOTONIC_RAW 4
1439 #define TARGET_CLOCK_REALTIME_COARSE 5
1440 #define TARGET_CLOCK_MONOTONIC_COARSE 6
1441 #define TARGET_CLOCK_BOOTTIME 7
1442 #define TARGET_CLOCK_REALTIME_ALARM 8
1443 #define TARGET_CLOCK_BOOTTIME_ALARM 9
1444 #define TARGET_CLOCK_SGI_CYCLE 10
1445 #define TARGET_CLOCK_TAI 11
1447 UNUSED
static struct enums clockids
[] = {
1448 ENUM_TARGET(CLOCK_REALTIME
),
1449 ENUM_TARGET(CLOCK_MONOTONIC
),
1450 ENUM_TARGET(CLOCK_PROCESS_CPUTIME_ID
),
1451 ENUM_TARGET(CLOCK_THREAD_CPUTIME_ID
),
1452 ENUM_TARGET(CLOCK_MONOTONIC_RAW
),
1453 ENUM_TARGET(CLOCK_REALTIME_COARSE
),
1454 ENUM_TARGET(CLOCK_MONOTONIC_COARSE
),
1455 ENUM_TARGET(CLOCK_BOOTTIME
),
1456 ENUM_TARGET(CLOCK_REALTIME_ALARM
),
1457 ENUM_TARGET(CLOCK_BOOTTIME_ALARM
),
1458 ENUM_TARGET(CLOCK_SGI_CYCLE
),
1459 ENUM_TARGET(CLOCK_TAI
),
1463 UNUSED
static struct enums itimer_types
[] = {
1464 ENUM_GENERIC(ITIMER_REAL
),
1465 ENUM_GENERIC(ITIMER_VIRTUAL
),
1466 ENUM_GENERIC(ITIMER_PROF
),
1471 * print_xxx utility functions. These are used to print syscall
1472 * parameters in certain format. All of these have parameter
1473 * named 'last'. This parameter is used to add comma to output
1480 return ((last
) ? "" : ",");
1484 print_flags(const struct flags
*f
, abi_long flags
, int last
)
1486 const char *sep
= "";
1489 for (n
= 0; f
->f_string
!= NULL
; f
++) {
1490 if ((flags
& f
->f_mask
) == f
->f_value
) {
1491 qemu_log("%s%s", sep
, f
->f_string
);
1492 flags
&= ~f
->f_mask
;
1499 /* print rest of the flags as numeric */
1501 qemu_log("%s%#x%s", sep
, (unsigned int)flags
, get_comma(last
));
1503 qemu_log("%s", get_comma(last
));
1506 /* no string version of flags found, print them in hex then */
1507 qemu_log("%#x%s", (unsigned int)flags
, get_comma(last
));
1512 print_enums(const struct enums
*e
, abi_long enum_arg
, int last
)
1514 for (; e
->e_string
!= NULL
; e
++) {
1515 if (e
->e_value
== enum_arg
) {
1516 qemu_log("%s", e
->e_string
);
1521 if (e
->e_string
== NULL
) {
1522 qemu_log("%#x", (unsigned int)enum_arg
);
1525 qemu_log("%s", get_comma(last
));
1529 print_at_dirfd(abi_long dirfd
, int last
)
1532 if (dirfd
== AT_FDCWD
) {
1533 qemu_log("AT_FDCWD%s", get_comma(last
));
1537 qemu_log("%d%s", (int)dirfd
, get_comma(last
));
1541 print_file_mode(abi_long mode
, int last
)
1543 const char *sep
= "";
1544 const struct flags
*m
;
1547 qemu_log("000%s", get_comma(last
));
1551 for (m
= &mode_flags
[0]; m
->f_string
!= NULL
; m
++) {
1552 if ((m
->f_value
& mode
) == m
->f_value
) {
1553 qemu_log("%s%s", m
->f_string
, sep
);
1555 mode
&= ~m
->f_value
;
1561 /* print rest of the mode as octal */
1563 qemu_log("%s%#o", sep
, (unsigned int)mode
);
1565 qemu_log("%s", get_comma(last
));
1569 print_open_flags(abi_long flags
, int last
)
1571 print_flags(open_access_flags
, flags
& TARGET_O_ACCMODE
, 1);
1572 flags
&= ~TARGET_O_ACCMODE
;
1574 qemu_log("%s", get_comma(last
));
1578 print_flags(open_flags
, flags
, last
);
1582 print_syscall_prologue(const struct syscallname
*sc
)
1584 qemu_log("%s(", sc
->name
);
1589 print_syscall_epilogue(const struct syscallname
*sc
)
1596 print_string(abi_long addr
, int last
)
1600 if ((s
= lock_user_string(addr
)) != NULL
) {
1601 qemu_log("\"%s\"%s", s
, get_comma(last
));
1602 unlock_user(s
, addr
, 0);
1604 /* can't get string out of it, so print it as pointer */
1605 print_pointer(addr
, last
);
1609 #define MAX_PRINT_BUF 40
1611 print_buf(abi_long addr
, abi_long len
, int last
)
1616 s
= lock_user(VERIFY_READ
, addr
, len
, 1);
1619 for (i
= 0; i
< MAX_PRINT_BUF
&& i
< len
; i
++) {
1620 if (isprint(s
[i
])) {
1621 qemu_log("%c", s
[i
]);
1623 qemu_log("\\%o", s
[i
]);
1633 unlock_user(s
, addr
, 0);
1635 print_pointer(addr
, last
);
1640 * Prints out raw parameter using given format. Caller needs
1641 * to do byte swapping if needed.
1644 print_raw_param(const char *fmt
, abi_long param
, int last
)
1648 (void) snprintf(format
, sizeof (format
), "%s%s", fmt
, get_comma(last
));
1649 qemu_log(format
, param
);
1653 * Same as print_raw_param() but prints out raw 64-bit parameter.
1656 print_raw_param64(const char *fmt
, long long param
, int last
)
1660 (void)snprintf(format
, sizeof(format
), "%s%s", fmt
, get_comma(last
));
1661 qemu_log(format
, param
);
1666 print_pointer(abi_long p
, int last
)
1669 qemu_log("NULL%s", get_comma(last
));
1671 qemu_log("0x" TARGET_ABI_FMT_lx
"%s", p
, get_comma(last
));
1675 * Reads 32-bit (int) number from guest address space from
1676 * address 'addr' and prints it.
1679 print_number(abi_long addr
, int last
)
1682 qemu_log("NULL%s", get_comma(last
));
1686 get_user_s32(num
, addr
);
1687 qemu_log("[%d]%s", num
, get_comma(last
));
1692 print_timeval(abi_ulong tv_addr
, int last
)
1695 struct target_timeval
*tv
;
1697 tv
= lock_user(VERIFY_READ
, tv_addr
, sizeof(*tv
), 1);
1699 print_pointer(tv_addr
, last
);
1702 qemu_log("{tv_sec = " TARGET_ABI_FMT_ld
1703 ",tv_usec = " TARGET_ABI_FMT_ld
"}%s",
1704 tswapal(tv
->tv_sec
), tswapal(tv
->tv_usec
), get_comma(last
));
1705 unlock_user(tv
, tv_addr
, 0);
1707 qemu_log("NULL%s", get_comma(last
));
1711 print_timespec(abi_ulong ts_addr
, int last
)
1714 struct target_timespec
*ts
;
1716 ts
= lock_user(VERIFY_READ
, ts_addr
, sizeof(*ts
), 1);
1718 print_pointer(ts_addr
, last
);
1721 qemu_log("{tv_sec = " TARGET_ABI_FMT_ld
1722 ",tv_nsec = " TARGET_ABI_FMT_ld
"}%s",
1723 tswapal(ts
->tv_sec
), tswapal(ts
->tv_nsec
), get_comma(last
));
1724 unlock_user(ts
, ts_addr
, 0);
1726 qemu_log("NULL%s", get_comma(last
));
1731 print_timespec64(abi_ulong ts_addr
, int last
)
1734 struct target__kernel_timespec
*ts
;
1736 ts
= lock_user(VERIFY_READ
, ts_addr
, sizeof(*ts
), 1);
1738 print_pointer(ts_addr
, last
);
1741 print_raw_param64("{tv_sec=%" PRId64
, tswap64(ts
->tv_sec
), 0);
1742 print_raw_param64("tv_nsec=%" PRId64
"}", tswap64(ts
->tv_nsec
), last
);
1743 unlock_user(ts
, ts_addr
, 0);
1745 qemu_log("NULL%s", get_comma(last
));
1750 print_timezone(abi_ulong tz_addr
, int last
)
1753 struct target_timezone
*tz
;
1755 tz
= lock_user(VERIFY_READ
, tz_addr
, sizeof(*tz
), 1);
1757 print_pointer(tz_addr
, last
);
1760 qemu_log("{%d,%d}%s", tswap32(tz
->tz_minuteswest
),
1761 tswap32(tz
->tz_dsttime
), get_comma(last
));
1762 unlock_user(tz
, tz_addr
, 0);
1764 qemu_log("NULL%s", get_comma(last
));
1769 print_itimerval(abi_ulong it_addr
, int last
)
1772 qemu_log("{it_interval=");
1773 print_timeval(it_addr
+
1774 offsetof(struct target_itimerval
, it_interval
), 0);
1775 qemu_log("it_value=");
1776 print_timeval(it_addr
+
1777 offsetof(struct target_itimerval
, it_value
), 0);
1778 qemu_log("}%s", get_comma(last
));
1780 qemu_log("NULL%s", get_comma(last
));
1785 print_termios(void *arg
)
1787 const struct target_termios
*target
= arg
;
1789 target_tcflag_t iflags
= tswap32(target
->c_iflag
);
1790 target_tcflag_t oflags
= tswap32(target
->c_oflag
);
1791 target_tcflag_t cflags
= tswap32(target
->c_cflag
);
1792 target_tcflag_t lflags
= tswap32(target
->c_lflag
);
1796 qemu_log("c_iflag = ");
1797 print_flags(termios_iflags
, iflags
, 0);
1799 qemu_log("c_oflag = ");
1800 target_tcflag_t oflags_clean
= oflags
& ~(TARGET_NLDLY
| TARGET_CRDLY
|
1801 TARGET_TABDLY
| TARGET_BSDLY
|
1802 TARGET_VTDLY
| TARGET_FFDLY
);
1803 print_flags(termios_oflags
, oflags_clean
, 0);
1804 if (oflags
& TARGET_NLDLY
) {
1805 print_enums(termios_oflags_NLDLY
, oflags
& TARGET_NLDLY
, 0);
1807 if (oflags
& TARGET_CRDLY
) {
1808 print_enums(termios_oflags_CRDLY
, oflags
& TARGET_CRDLY
, 0);
1810 if (oflags
& TARGET_TABDLY
) {
1811 print_enums(termios_oflags_TABDLY
, oflags
& TARGET_TABDLY
, 0);
1813 if (oflags
& TARGET_BSDLY
) {
1814 print_enums(termios_oflags_BSDLY
, oflags
& TARGET_BSDLY
, 0);
1816 if (oflags
& TARGET_VTDLY
) {
1817 print_enums(termios_oflags_VTDLY
, oflags
& TARGET_VTDLY
, 0);
1819 if (oflags
& TARGET_FFDLY
) {
1820 print_enums(termios_oflags_FFDLY
, oflags
& TARGET_FFDLY
, 0);
1823 qemu_log("c_cflag = ");
1824 if (cflags
& TARGET_CBAUD
) {
1825 print_enums(termios_cflags_CBAUD
, cflags
& TARGET_CBAUD
, 0);
1827 if (cflags
& TARGET_CSIZE
) {
1828 print_enums(termios_cflags_CSIZE
, cflags
& TARGET_CSIZE
, 0);
1830 target_tcflag_t cflags_clean
= cflags
& ~(TARGET_CBAUD
| TARGET_CSIZE
);
1831 print_flags(termios_cflags
, cflags_clean
, 0);
1833 qemu_log("c_lflag = ");
1834 print_flags(termios_lflags
, lflags
, 0);
1836 qemu_log("c_cc = ");
1837 qemu_log("\"%s\",", target
->c_cc
);
1839 qemu_log("c_line = ");
1840 print_raw_param("\'%c\'", target
->c_line
, 1);
1847 #ifdef TARGET_NR_accept
1849 print_accept(CPUArchState
*cpu_env
, const struct syscallname
*name
,
1850 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1851 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1853 print_syscall_prologue(name
);
1854 print_raw_param("%d", arg0
, 0);
1855 print_pointer(arg1
, 0);
1856 print_number(arg2
, 1);
1857 print_syscall_epilogue(name
);
1861 #ifdef TARGET_NR_access
1863 print_access(CPUArchState
*cpu_env
, const struct syscallname
*name
,
1864 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1865 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1867 print_syscall_prologue(name
);
1868 print_string(arg0
, 0);
1869 print_flags(access_flags
, arg1
, 1);
1870 print_syscall_epilogue(name
);
1874 #ifdef TARGET_NR_acct
1876 print_acct(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
, 1);
1882 print_syscall_epilogue(name
);
1886 #ifdef TARGET_NR_brk
1888 print_brk(CPUArchState
*cpu_env
, const struct syscallname
*name
,
1889 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1890 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1892 print_syscall_prologue(name
);
1893 print_pointer(arg0
, 1);
1894 print_syscall_epilogue(name
);
1898 #ifdef TARGET_NR_chdir
1900 print_chdir(CPUArchState
*cpu_env
, const struct syscallname
*name
,
1901 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1902 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1904 print_syscall_prologue(name
);
1905 print_string(arg0
, 1);
1906 print_syscall_epilogue(name
);
1910 #ifdef TARGET_NR_chroot
1912 print_chroot(CPUArchState
*cpu_env
, const struct syscallname
*name
,
1913 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1914 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1916 print_syscall_prologue(name
);
1917 print_string(arg0
, 1);
1918 print_syscall_epilogue(name
);
1922 #ifdef TARGET_NR_chmod
1924 print_chmod(CPUArchState
*cpu_env
, const struct syscallname
*name
,
1925 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1926 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1928 print_syscall_prologue(name
);
1929 print_string(arg0
, 0);
1930 print_file_mode(arg1
, 1);
1931 print_syscall_epilogue(name
);
1935 #if defined(TARGET_NR_chown) || defined(TARGET_NR_lchown)
1937 print_chown(CPUArchState
*cpu_env
, const struct syscallname
*name
,
1938 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1939 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1941 print_syscall_prologue(name
);
1942 print_string(arg0
, 0);
1943 print_raw_param("%d", arg1
, 0);
1944 print_raw_param("%d", arg2
, 1);
1945 print_syscall_epilogue(name
);
1947 #define print_lchown print_chown
1950 #ifdef TARGET_NR_clock_adjtime
1952 print_clock_adjtime(CPUArchState
*cpu_env
, const struct syscallname
*name
,
1953 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1954 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1956 print_syscall_prologue(name
);
1957 print_enums(clockids
, arg0
, 0);
1958 print_pointer(arg1
, 1);
1959 print_syscall_epilogue(name
);
1963 #ifdef TARGET_NR_clone
1964 static void do_print_clone(unsigned int flags
, abi_ulong newsp
,
1965 abi_ulong parent_tidptr
, target_ulong newtls
,
1966 abi_ulong child_tidptr
)
1968 print_flags(clone_flags
, flags
, 0);
1969 print_raw_param("child_stack=0x" TARGET_ABI_FMT_lx
, newsp
, 0);
1970 print_raw_param("parent_tidptr=0x" TARGET_ABI_FMT_lx
, parent_tidptr
, 0);
1971 print_raw_param("tls=0x" TARGET_ABI_FMT_lx
, newtls
, 0);
1972 print_raw_param("child_tidptr=0x" TARGET_ABI_FMT_lx
, child_tidptr
, 1);
1976 print_clone(CPUArchState
*cpu_env
, const struct syscallname
*name
,
1977 abi_long arg1
, abi_long arg2
, abi_long arg3
,
1978 abi_long arg4
, abi_long arg5
, abi_long arg6
)
1980 print_syscall_prologue(name
);
1981 #if defined(TARGET_MICROBLAZE)
1982 do_print_clone(arg1
, arg2
, arg4
, arg6
, arg5
);
1983 #elif defined(TARGET_CLONE_BACKWARDS)
1984 do_print_clone(arg1
, arg2
, arg3
, arg4
, arg5
);
1985 #elif defined(TARGET_CLONE_BACKWARDS2)
1986 do_print_clone(arg2
, arg1
, arg3
, arg5
, arg4
);
1988 do_print_clone(arg1
, arg2
, arg3
, arg5
, arg4
);
1990 print_syscall_epilogue(name
);
1994 #ifdef TARGET_NR_creat
1996 print_creat(CPUArchState
*cpu_env
, const struct syscallname
*name
,
1997 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1998 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2000 print_syscall_prologue(name
);
2001 print_string(arg0
, 0);
2002 print_file_mode(arg1
, 1);
2003 print_syscall_epilogue(name
);
2007 #ifdef TARGET_NR_execv
2009 print_execv(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_string(arg0
, 0);
2015 print_raw_param("0x" TARGET_ABI_FMT_lx
, arg1
, 1);
2016 print_syscall_epilogue(name
);
2021 print_execve_argv(abi_long argv
, int last
)
2023 abi_ulong arg_ptr_addr
;
2027 for (arg_ptr_addr
= argv
; ; arg_ptr_addr
+= sizeof(abi_ulong
)) {
2028 abi_ulong
*arg_ptr
, arg_addr
;
2030 arg_ptr
= lock_user(VERIFY_READ
, arg_ptr_addr
, sizeof(abi_ulong
), 1);
2034 arg_addr
= tswapal(*arg_ptr
);
2035 unlock_user(arg_ptr
, arg_ptr_addr
, 0);
2039 s
= lock_user_string(arg_addr
);
2041 qemu_log("\"%s\",", s
);
2042 unlock_user(s
, arg_addr
, 0);
2045 qemu_log("NULL}%s", get_comma(last
));
2049 print_execve(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2050 abi_long arg1
, abi_long arg2
, abi_long arg3
,
2051 abi_long arg4
, abi_long arg5
, abi_long arg6
)
2053 print_syscall_prologue(name
);
2054 print_string(arg1
, 0);
2055 print_execve_argv(arg2
, 1);
2056 print_syscall_epilogue(name
);
2060 print_execveat(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2061 abi_long arg1
, abi_long arg2
, abi_long arg3
,
2062 abi_long arg4
, abi_long arg5
, abi_long arg6
)
2064 print_syscall_prologue(name
);
2065 print_at_dirfd(arg1
, 0);
2066 print_string(arg2
, 0);
2067 print_execve_argv(arg3
, 0);
2068 print_flags(execveat_flags
, arg5
, 1);
2069 print_syscall_epilogue(name
);
2072 #if defined(TARGET_NR_faccessat) || defined(TARGET_NR_faccessat2)
2074 print_faccessat(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2075 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2076 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2078 print_syscall_prologue(name
);
2079 print_at_dirfd(arg0
, 0);
2080 print_string(arg1
, 0);
2081 print_flags(access_flags
, arg2
, 0);
2082 print_flags(at_file_flags
, arg3
, 1);
2083 print_syscall_epilogue(name
);
2087 #ifdef TARGET_NR_fallocate
2089 print_fallocate(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2090 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2091 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2093 print_syscall_prologue(name
);
2094 print_raw_param("%d", arg0
, 0);
2095 print_flags(falloc_flags
, arg1
, 0);
2096 #if TARGET_ABI_BITS == 32
2097 print_raw_param("%" PRIu64
, target_offset64(arg2
, arg3
), 0);
2098 print_raw_param("%" PRIu64
, target_offset64(arg4
, arg5
), 1);
2100 print_raw_param(TARGET_ABI_FMT_ld
, arg2
, 0);
2101 print_raw_param(TARGET_ABI_FMT_ld
, arg3
, 1);
2103 print_syscall_epilogue(name
);
2107 #ifdef TARGET_NR_fchmodat
2109 print_fchmodat(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2110 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2111 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2113 print_syscall_prologue(name
);
2114 print_at_dirfd(arg0
, 0);
2115 print_string(arg1
, 0);
2116 print_file_mode(arg2
, 0);
2117 print_flags(at_file_flags
, arg3
, 1);
2118 print_syscall_epilogue(name
);
2122 #ifdef TARGET_NR_fchownat
2124 print_fchownat(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2125 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2126 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2128 print_syscall_prologue(name
);
2129 print_at_dirfd(arg0
, 0);
2130 print_string(arg1
, 0);
2131 print_raw_param("%d", arg2
, 0);
2132 print_raw_param("%d", arg3
, 0);
2133 print_flags(at_file_flags
, arg4
, 1);
2134 print_syscall_epilogue(name
);
2138 #if defined(TARGET_NR_fcntl) || defined(TARGET_NR_fcntl64)
2140 print_fcntl(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2141 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2142 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2144 print_syscall_prologue(name
);
2145 print_raw_param("%d", arg0
, 0);
2147 case TARGET_F_DUPFD
:
2148 qemu_log("F_DUPFD,");
2149 print_raw_param(TARGET_ABI_FMT_ld
, arg2
, 1);
2151 case TARGET_F_GETFD
:
2152 qemu_log("F_GETFD");
2154 case TARGET_F_SETFD
:
2155 qemu_log("F_SETFD,");
2156 print_raw_param(TARGET_ABI_FMT_ld
, arg2
, 1);
2158 case TARGET_F_GETFL
:
2159 qemu_log("F_GETFL");
2161 case TARGET_F_SETFL
:
2162 qemu_log("F_SETFL,");
2163 print_open_flags(arg2
, 1);
2165 case TARGET_F_GETLK
:
2166 qemu_log("F_GETLK,");
2167 print_pointer(arg2
, 1);
2169 case TARGET_F_SETLK
:
2170 qemu_log("F_SETLK,");
2171 print_pointer(arg2
, 1);
2173 case TARGET_F_SETLKW
:
2174 qemu_log("F_SETLKW,");
2175 print_pointer(arg2
, 1);
2177 case TARGET_F_GETOWN
:
2178 qemu_log("F_GETOWN");
2180 case TARGET_F_SETOWN
:
2181 qemu_log("F_SETOWN,");
2182 print_raw_param(TARGET_ABI_FMT_ld
, arg2
, 0);
2184 case TARGET_F_GETSIG
:
2185 qemu_log("F_GETSIG");
2187 case TARGET_F_SETSIG
:
2188 qemu_log("F_SETSIG,");
2189 print_raw_param(TARGET_ABI_FMT_ld
, arg2
, 0);
2191 #if TARGET_ABI_BITS == 32
2192 case TARGET_F_GETLK64
:
2193 qemu_log("F_GETLK64,");
2194 print_pointer(arg2
, 1);
2196 case TARGET_F_SETLK64
:
2197 qemu_log("F_SETLK64,");
2198 print_pointer(arg2
, 1);
2200 case TARGET_F_SETLKW64
:
2201 qemu_log("F_SETLKW64,");
2202 print_pointer(arg2
, 1);
2205 case TARGET_F_OFD_GETLK
:
2206 qemu_log("F_OFD_GETLK,");
2207 print_pointer(arg2
, 1);
2209 case TARGET_F_OFD_SETLK
:
2210 qemu_log("F_OFD_SETLK,");
2211 print_pointer(arg2
, 1);
2213 case TARGET_F_OFD_SETLKW
:
2214 qemu_log("F_OFD_SETLKW,");
2215 print_pointer(arg2
, 1);
2217 case TARGET_F_SETLEASE
:
2218 qemu_log("F_SETLEASE,");
2219 print_raw_param(TARGET_ABI_FMT_ld
, arg2
, 1);
2221 case TARGET_F_GETLEASE
:
2222 qemu_log("F_GETLEASE");
2224 #ifdef F_DUPFD_CLOEXEC
2225 case TARGET_F_DUPFD_CLOEXEC
:
2226 qemu_log("F_DUPFD_CLOEXEC,");
2227 print_raw_param(TARGET_ABI_FMT_ld
, arg2
, 1);
2230 case TARGET_F_NOTIFY
:
2231 qemu_log("F_NOTIFY,");
2232 print_raw_param(TARGET_ABI_FMT_ld
, arg2
, 1);
2235 case TARGET_F_GETOWN_EX
:
2236 qemu_log("F_GETOWN_EX,");
2237 print_pointer(arg2
, 1);
2241 case TARGET_F_SETOWN_EX
:
2242 qemu_log("F_SETOWN_EX,");
2243 print_pointer(arg2
, 1);
2247 case TARGET_F_SETPIPE_SZ
:
2248 qemu_log("F_SETPIPE_SZ,");
2249 print_raw_param(TARGET_ABI_FMT_ld
, arg2
, 1);
2251 case TARGET_F_GETPIPE_SZ
:
2252 qemu_log("F_GETPIPE_SZ");
2256 case TARGET_F_ADD_SEALS
:
2257 qemu_log("F_ADD_SEALS,");
2258 print_raw_param("0x"TARGET_ABI_FMT_lx
, arg2
, 1);
2260 case TARGET_F_GET_SEALS
:
2261 qemu_log("F_GET_SEALS");
2265 print_raw_param(TARGET_ABI_FMT_ld
, arg1
, 0);
2266 print_pointer(arg2
, 1);
2269 print_syscall_epilogue(name
);
2271 #define print_fcntl64 print_fcntl
2274 #ifdef TARGET_NR_fgetxattr
2276 print_fgetxattr(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2277 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2278 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2280 print_syscall_prologue(name
);
2281 print_raw_param("%d", arg0
, 0);
2282 print_string(arg1
, 0);
2283 print_pointer(arg2
, 0);
2284 print_raw_param(TARGET_FMT_lu
, arg3
, 1);
2285 print_syscall_epilogue(name
);
2289 #ifdef TARGET_NR_flistxattr
2291 print_flistxattr(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_raw_param("%d", arg0
, 0);
2297 print_pointer(arg1
, 0);
2298 print_raw_param(TARGET_FMT_lu
, arg2
, 1);
2299 print_syscall_epilogue(name
);
2303 #if defined(TARGET_NR_getxattr) || defined(TARGET_NR_lgetxattr)
2305 print_getxattr(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2306 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2307 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2309 print_syscall_prologue(name
);
2310 print_string(arg0
, 0);
2311 print_string(arg1
, 0);
2312 print_pointer(arg2
, 0);
2313 print_raw_param(TARGET_FMT_lu
, arg3
, 1);
2314 print_syscall_epilogue(name
);
2316 #define print_lgetxattr print_getxattr
2319 #if defined(TARGET_NR_listxattr) || defined(TARGET_NR_llistxattr)
2321 print_listxattr(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2322 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2323 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2325 print_syscall_prologue(name
);
2326 print_string(arg0
, 0);
2327 print_pointer(arg1
, 0);
2328 print_raw_param(TARGET_FMT_lu
, arg2
, 1);
2329 print_syscall_epilogue(name
);
2331 #define print_llistxattr print_listxattr
2334 #if defined(TARGET_NR_fremovexattr)
2336 print_fremovexattr(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2337 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2338 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2340 print_syscall_prologue(name
);
2341 print_raw_param("%d", arg0
, 0);
2342 print_string(arg1
, 1);
2343 print_syscall_epilogue(name
);
2347 #if defined(TARGET_NR_removexattr) || defined(TARGET_NR_lremovexattr)
2349 print_removexattr(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2350 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2351 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2353 print_syscall_prologue(name
);
2354 print_string(arg0
, 0);
2355 print_string(arg1
, 1);
2356 print_syscall_epilogue(name
);
2358 #define print_lremovexattr print_removexattr
2361 #ifdef TARGET_NR_futimesat
2363 print_futimesat(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2364 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2365 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2367 print_syscall_prologue(name
);
2368 print_at_dirfd(arg0
, 0);
2369 print_string(arg1
, 0);
2370 print_timeval(arg2
, 0);
2371 print_timeval(arg2
+ sizeof (struct target_timeval
), 1);
2372 print_syscall_epilogue(name
);
2376 #ifdef TARGET_NR_gettimeofday
2378 print_gettimeofday(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2379 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2380 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2382 print_syscall_prologue(name
);
2383 print_pointer(arg0
, 0);
2384 print_pointer(arg1
, 1);
2385 print_syscall_epilogue(name
);
2389 #ifdef TARGET_NR_settimeofday
2391 print_settimeofday(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2392 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2393 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2395 print_syscall_prologue(name
);
2396 print_timeval(arg0
, 0);
2397 print_timezone(arg1
, 1);
2398 print_syscall_epilogue(name
);
2402 #if defined(TARGET_NR_clock_gettime) || defined(TARGET_NR_clock_getres)
2404 print_clock_gettime(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2405 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2406 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2408 print_syscall_prologue(name
);
2409 print_enums(clockids
, arg0
, 0);
2410 print_pointer(arg1
, 1);
2411 print_syscall_epilogue(name
);
2413 #define print_clock_getres print_clock_gettime
2416 #if defined(TARGET_NR_clock_gettime64)
2418 print_clock_gettime64(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2419 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2420 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2422 print_syscall_prologue(name
);
2423 print_enums(clockids
, arg0
, 0);
2424 print_pointer(arg1
, 1);
2425 print_syscall_epilogue(name
);
2429 #ifdef TARGET_NR_clock_settime
2431 print_clock_settime(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2432 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2433 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2435 print_syscall_prologue(name
);
2436 print_enums(clockids
, arg0
, 0);
2437 print_timespec(arg1
, 1);
2438 print_syscall_epilogue(name
);
2442 #ifdef TARGET_NR_getitimer
2444 print_getitimer(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2445 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2446 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2448 print_syscall_prologue(name
);
2449 print_enums(itimer_types
, arg0
, 0);
2450 print_pointer(arg1
, 1);
2451 print_syscall_epilogue(name
);
2455 #ifdef TARGET_NR_setitimer
2457 print_setitimer(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2458 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2459 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2461 print_syscall_prologue(name
);
2462 print_enums(itimer_types
, arg0
, 0);
2463 print_itimerval(arg1
, 0);
2464 print_pointer(arg2
, 1);
2465 print_syscall_epilogue(name
);
2469 #ifdef TARGET_NR_link
2471 print_link(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2472 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2473 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2475 print_syscall_prologue(name
);
2476 print_string(arg0
, 0);
2477 print_string(arg1
, 1);
2478 print_syscall_epilogue(name
);
2482 #ifdef TARGET_NR_linkat
2484 print_linkat(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_at_dirfd(arg0
, 0);
2490 print_string(arg1
, 0);
2491 print_at_dirfd(arg2
, 0);
2492 print_string(arg3
, 0);
2493 print_flags(at_file_flags
, arg4
, 1);
2494 print_syscall_epilogue(name
);
2498 #if defined(TARGET_NR__llseek) || defined(TARGET_NR_llseek)
2500 print__llseek(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2501 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2502 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2504 const char *whence
= "UNKNOWN";
2505 print_syscall_prologue(name
);
2506 print_raw_param("%d", arg0
, 0);
2507 print_raw_param("%ld", arg1
, 0);
2508 print_raw_param("%ld", arg2
, 0);
2509 print_pointer(arg3
, 0);
2511 case SEEK_SET
: whence
= "SEEK_SET"; break;
2512 case SEEK_CUR
: whence
= "SEEK_CUR"; break;
2513 case SEEK_END
: whence
= "SEEK_END"; break;
2515 qemu_log("%s", whence
);
2516 print_syscall_epilogue(name
);
2518 #define print_llseek print__llseek
2521 #ifdef TARGET_NR_lseek
2523 print_lseek(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2524 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2525 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2527 print_syscall_prologue(name
);
2528 print_raw_param("%d", arg0
, 0);
2529 print_raw_param(TARGET_ABI_FMT_ld
, arg1
, 0);
2532 qemu_log("SEEK_SET"); break;
2534 qemu_log("SEEK_CUR"); break;
2536 qemu_log("SEEK_END"); break;
2539 qemu_log("SEEK_DATA"); break;
2543 qemu_log("SEEK_HOLE"); break;
2546 print_raw_param("%#x", arg2
, 1);
2548 print_syscall_epilogue(name
);
2552 #ifdef TARGET_NR_truncate
2554 print_truncate(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2555 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2556 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2558 print_syscall_prologue(name
);
2559 print_string(arg0
, 0);
2560 print_raw_param(TARGET_ABI_FMT_ld
, arg1
, 1);
2561 print_syscall_epilogue(name
);
2565 #ifdef TARGET_NR_truncate64
2567 print_truncate64(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2568 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2569 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2571 print_syscall_prologue(name
);
2572 print_string(arg0
, 0);
2573 if (regpairs_aligned(cpu_env
, TARGET_NR_truncate64
)) {
2577 print_raw_param("%" PRIu64
, target_offset64(arg1
, arg2
), 1);
2578 print_syscall_epilogue(name
);
2582 #ifdef TARGET_NR_ftruncate64
2584 print_ftruncate64(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2585 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2586 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2588 print_syscall_prologue(name
);
2589 print_raw_param("%d", arg0
, 0);
2590 if (regpairs_aligned(cpu_env
, TARGET_NR_ftruncate64
)) {
2594 print_raw_param("%" PRIu64
, target_offset64(arg1
, arg2
), 1);
2595 print_syscall_epilogue(name
);
2599 #ifdef TARGET_NR_mlockall
2601 print_mlockall(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2602 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2603 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2605 print_syscall_prologue(name
);
2606 print_flags(mlockall_flags
, arg0
, 1);
2607 print_syscall_epilogue(name
);
2611 #if defined(TARGET_NR_socket)
2613 print_socket(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2614 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2615 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2617 abi_ulong domain
= arg0
, type
= arg1
, protocol
= arg2
;
2619 print_syscall_prologue(name
);
2620 print_socket_domain(domain
);
2622 print_socket_type(type
);
2624 if (domain
== AF_PACKET
||
2625 (domain
== AF_INET
&& type
== TARGET_SOCK_PACKET
)) {
2626 protocol
= tswap16(protocol
);
2628 print_socket_protocol(domain
, type
, protocol
);
2629 print_syscall_epilogue(name
);
2634 #if defined(TARGET_NR_socketcall) || defined(TARGET_NR_bind)
2636 static void print_sockfd(abi_long sockfd
, int last
)
2638 print_raw_param(TARGET_ABI_FMT_ld
, sockfd
, last
);
2643 #if defined(TARGET_NR_socketcall)
2645 #define get_user_ualx(x, gaddr, idx) \
2646 get_user_ual(x, (gaddr) + (idx) * sizeof(abi_long))
2648 static void do_print_socket(const char *name
, abi_long arg1
)
2650 abi_ulong domain
, type
, protocol
;
2652 get_user_ualx(domain
, arg1
, 0);
2653 get_user_ualx(type
, arg1
, 1);
2654 get_user_ualx(protocol
, arg1
, 2);
2655 qemu_log("%s(", name
);
2656 print_socket_domain(domain
);
2658 print_socket_type(type
);
2660 if (domain
== AF_PACKET
||
2661 (domain
== AF_INET
&& type
== TARGET_SOCK_PACKET
)) {
2662 protocol
= tswap16(protocol
);
2664 print_socket_protocol(domain
, type
, protocol
);
2668 static void do_print_sockaddr(const char *name
, abi_long arg1
)
2670 abi_ulong sockfd
, addr
, addrlen
;
2672 get_user_ualx(sockfd
, arg1
, 0);
2673 get_user_ualx(addr
, arg1
, 1);
2674 get_user_ualx(addrlen
, arg1
, 2);
2676 qemu_log("%s(", name
);
2677 print_sockfd(sockfd
, 0);
2678 print_sockaddr(addr
, addrlen
, 0);
2682 static void do_print_listen(const char *name
, abi_long arg1
)
2684 abi_ulong sockfd
, backlog
;
2686 get_user_ualx(sockfd
, arg1
, 0);
2687 get_user_ualx(backlog
, arg1
, 1);
2689 qemu_log("%s(", name
);
2690 print_sockfd(sockfd
, 0);
2691 print_raw_param(TARGET_ABI_FMT_ld
, backlog
, 1);
2695 static void do_print_socketpair(const char *name
, abi_long arg1
)
2697 abi_ulong domain
, type
, protocol
, tab
;
2699 get_user_ualx(domain
, arg1
, 0);
2700 get_user_ualx(type
, arg1
, 1);
2701 get_user_ualx(protocol
, arg1
, 2);
2702 get_user_ualx(tab
, arg1
, 3);
2704 qemu_log("%s(", name
);
2705 print_socket_domain(domain
);
2707 print_socket_type(type
);
2709 print_socket_protocol(domain
, type
, protocol
);
2711 print_raw_param(TARGET_ABI_FMT_lx
, tab
, 1);
2715 static void do_print_sendrecv(const char *name
, abi_long arg1
)
2717 abi_ulong sockfd
, msg
, len
, flags
;
2719 get_user_ualx(sockfd
, arg1
, 0);
2720 get_user_ualx(msg
, arg1
, 1);
2721 get_user_ualx(len
, arg1
, 2);
2722 get_user_ualx(flags
, arg1
, 3);
2724 qemu_log("%s(", name
);
2725 print_sockfd(sockfd
, 0);
2726 print_buf(msg
, len
, 0);
2727 print_raw_param(TARGET_ABI_FMT_ld
, len
, 0);
2728 print_flags(msg_flags
, flags
, 1);
2732 static void do_print_msgaddr(const char *name
, abi_long arg1
)
2734 abi_ulong sockfd
, msg
, len
, flags
, addr
, addrlen
;
2736 get_user_ualx(sockfd
, arg1
, 0);
2737 get_user_ualx(msg
, arg1
, 1);
2738 get_user_ualx(len
, arg1
, 2);
2739 get_user_ualx(flags
, arg1
, 3);
2740 get_user_ualx(addr
, arg1
, 4);
2741 get_user_ualx(addrlen
, arg1
, 5);
2743 qemu_log("%s(", name
);
2744 print_sockfd(sockfd
, 0);
2745 print_buf(msg
, len
, 0);
2746 print_raw_param(TARGET_ABI_FMT_ld
, len
, 0);
2747 print_flags(msg_flags
, flags
, 0);
2748 print_sockaddr(addr
, addrlen
, 0);
2752 static void do_print_shutdown(const char *name
, abi_long arg1
)
2754 abi_ulong sockfd
, how
;
2756 get_user_ualx(sockfd
, arg1
, 0);
2757 get_user_ualx(how
, arg1
, 1);
2759 qemu_log("shutdown(");
2760 print_sockfd(sockfd
, 0);
2763 qemu_log("SHUT_RD");
2766 qemu_log("SHUT_WR");
2769 qemu_log("SHUT_RDWR");
2772 print_raw_param(TARGET_ABI_FMT_ld
, how
, 1);
2778 static void do_print_msg(const char *name
, abi_long arg1
)
2780 abi_ulong sockfd
, msg
, flags
;
2782 get_user_ualx(sockfd
, arg1
, 0);
2783 get_user_ualx(msg
, arg1
, 1);
2784 get_user_ualx(flags
, arg1
, 2);
2786 qemu_log("%s(", name
);
2787 print_sockfd(sockfd
, 0);
2788 print_pointer(msg
, 0);
2789 print_flags(msg_flags
, flags
, 1);
2793 static void do_print_sockopt(const char *name
, abi_long arg1
)
2795 abi_ulong sockfd
, level
, optname
, optval
, optlen
;
2797 get_user_ualx(sockfd
, arg1
, 0);
2798 get_user_ualx(level
, arg1
, 1);
2799 get_user_ualx(optname
, arg1
, 2);
2800 get_user_ualx(optval
, arg1
, 3);
2801 get_user_ualx(optlen
, arg1
, 4);
2803 qemu_log("%s(", name
);
2804 print_sockfd(sockfd
, 0);
2807 qemu_log("SOL_TCP,");
2808 print_raw_param(TARGET_ABI_FMT_ld
, optname
, 0);
2809 print_pointer(optval
, 0);
2812 qemu_log("SOL_UDP,");
2813 print_raw_param(TARGET_ABI_FMT_ld
, optname
, 0);
2814 print_pointer(optval
, 0);
2817 qemu_log("SOL_IP,");
2818 print_raw_param(TARGET_ABI_FMT_ld
, optname
, 0);
2819 print_pointer(optval
, 0);
2822 qemu_log("SOL_RAW,");
2823 print_raw_param(TARGET_ABI_FMT_ld
, optname
, 0);
2824 print_pointer(optval
, 0);
2826 case TARGET_SOL_SOCKET
:
2827 qemu_log("SOL_SOCKET,");
2829 case TARGET_SO_DEBUG
:
2830 qemu_log("SO_DEBUG,");
2832 print_number(optval
, 0);
2834 case TARGET_SO_REUSEADDR
:
2835 qemu_log("SO_REUSEADDR,");
2837 case TARGET_SO_REUSEPORT
:
2838 qemu_log("SO_REUSEPORT,");
2840 case TARGET_SO_TYPE
:
2841 qemu_log("SO_TYPE,");
2843 case TARGET_SO_ERROR
:
2844 qemu_log("SO_ERROR,");
2846 case TARGET_SO_DONTROUTE
:
2847 qemu_log("SO_DONTROUTE,");
2849 case TARGET_SO_BROADCAST
:
2850 qemu_log("SO_BROADCAST,");
2852 case TARGET_SO_SNDBUF
:
2853 qemu_log("SO_SNDBUF,");
2855 case TARGET_SO_RCVBUF
:
2856 qemu_log("SO_RCVBUF,");
2858 case TARGET_SO_KEEPALIVE
:
2859 qemu_log("SO_KEEPALIVE,");
2861 case TARGET_SO_OOBINLINE
:
2862 qemu_log("SO_OOBINLINE,");
2864 case TARGET_SO_NO_CHECK
:
2865 qemu_log("SO_NO_CHECK,");
2867 case TARGET_SO_PRIORITY
:
2868 qemu_log("SO_PRIORITY,");
2870 case TARGET_SO_BSDCOMPAT
:
2871 qemu_log("SO_BSDCOMPAT,");
2873 case TARGET_SO_PASSCRED
:
2874 qemu_log("SO_PASSCRED,");
2876 case TARGET_SO_TIMESTAMP
:
2877 qemu_log("SO_TIMESTAMP,");
2879 case TARGET_SO_RCVLOWAT
:
2880 qemu_log("SO_RCVLOWAT,");
2882 case TARGET_SO_RCVTIMEO
:
2883 qemu_log("SO_RCVTIMEO,");
2884 print_timeval(optval
, 0);
2886 case TARGET_SO_SNDTIMEO
:
2887 qemu_log("SO_SNDTIMEO,");
2888 print_timeval(optval
, 0);
2890 case TARGET_SO_ATTACH_FILTER
: {
2891 struct target_sock_fprog
*fprog
;
2893 qemu_log("SO_ATTACH_FILTER,");
2895 if (lock_user_struct(VERIFY_READ
, fprog
, optval
, 0)) {
2896 struct target_sock_filter
*filter
;
2898 if (lock_user_struct(VERIFY_READ
, filter
,
2899 tswapal(fprog
->filter
), 0)) {
2901 for (i
= 0; i
< tswap16(fprog
->len
) - 1; i
++) {
2902 qemu_log("[%d]{0x%x,%d,%d,0x%x},",
2903 i
, tswap16(filter
[i
].code
),
2904 filter
[i
].jt
, filter
[i
].jf
,
2905 tswap32(filter
[i
].k
));
2907 qemu_log("[%d]{0x%x,%d,%d,0x%x}",
2908 i
, tswap16(filter
[i
].code
),
2909 filter
[i
].jt
, filter
[i
].jf
,
2910 tswap32(filter
[i
].k
));
2912 qemu_log(TARGET_ABI_FMT_lx
, tswapal(fprog
->filter
));
2914 qemu_log(",%d},", tswap16(fprog
->len
));
2915 unlock_user(fprog
, optval
, 0);
2917 print_pointer(optval
, 0);
2922 print_raw_param(TARGET_ABI_FMT_ld
, optname
, 0);
2923 print_pointer(optval
, 0);
2928 qemu_log("SOL_IPV6,");
2930 case IPV6_MTU_DISCOVER
:
2931 qemu_log("IPV6_MTU_DISCOVER,");
2934 qemu_log("IPV6_MTU,");
2937 qemu_log("IPV6_V6ONLY,");
2939 case IPV6_RECVPKTINFO
:
2940 qemu_log("IPV6_RECVPKTINFO,");
2942 case IPV6_UNICAST_HOPS
:
2943 qemu_log("IPV6_UNICAST_HOPS,");
2945 case IPV6_MULTICAST_HOPS
:
2946 qemu_log("IPV6_MULTICAST_HOPS,");
2948 case IPV6_MULTICAST_LOOP
:
2949 qemu_log("IPV6_MULTICAST_LOOP,");
2952 qemu_log("IPV6_RECVERR,");
2954 case IPV6_RECVHOPLIMIT
:
2955 qemu_log("IPV6_RECVHOPLIMIT,");
2957 case IPV6_2292HOPLIMIT
:
2958 qemu_log("IPV6_2292HOPLIMIT,");
2961 qemu_log("IPV6_CHECKSUM,");
2964 qemu_log("IPV6_ADDRFORM,");
2966 case IPV6_2292PKTINFO
:
2967 qemu_log("IPV6_2292PKTINFO,");
2969 case IPV6_RECVTCLASS
:
2970 qemu_log("IPV6_RECVTCLASS,");
2972 case IPV6_RECVRTHDR
:
2973 qemu_log("IPV6_RECVRTHDR,");
2975 case IPV6_2292RTHDR
:
2976 qemu_log("IPV6_2292RTHDR,");
2978 case IPV6_RECVHOPOPTS
:
2979 qemu_log("IPV6_RECVHOPOPTS,");
2981 case IPV6_2292HOPOPTS
:
2982 qemu_log("IPV6_2292HOPOPTS,");
2984 case IPV6_RECVDSTOPTS
:
2985 qemu_log("IPV6_RECVDSTOPTS,");
2987 case IPV6_2292DSTOPTS
:
2988 qemu_log("IPV6_2292DSTOPTS,");
2991 qemu_log("IPV6_TCLASS,");
2993 case IPV6_ADDR_PREFERENCES
:
2994 qemu_log("IPV6_ADDR_PREFERENCES,");
2996 #ifdef IPV6_RECVPATHMTU
2997 case IPV6_RECVPATHMTU
:
2998 qemu_log("IPV6_RECVPATHMTU,");
3001 #ifdef IPV6_TRANSPARENT
3002 case IPV6_TRANSPARENT
:
3003 qemu_log("IPV6_TRANSPARENT,");
3006 #ifdef IPV6_FREEBIND
3008 qemu_log("IPV6_FREEBIND,");
3011 #ifdef IPV6_RECVORIGDSTADDR
3012 case IPV6_RECVORIGDSTADDR
:
3013 qemu_log("IPV6_RECVORIGDSTADDR,");
3017 qemu_log("IPV6_PKTINFO,");
3018 print_pointer(optval
, 0);
3020 case IPV6_ADD_MEMBERSHIP
:
3021 qemu_log("IPV6_ADD_MEMBERSHIP,");
3022 print_pointer(optval
, 0);
3024 case IPV6_DROP_MEMBERSHIP
:
3025 qemu_log("IPV6_DROP_MEMBERSHIP,");
3026 print_pointer(optval
, 0);
3029 print_raw_param(TARGET_ABI_FMT_ld
, optname
, 0);
3030 print_pointer(optval
, 0);
3035 print_raw_param(TARGET_ABI_FMT_ld
, level
, 0);
3036 print_raw_param(TARGET_ABI_FMT_ld
, optname
, 0);
3037 print_pointer(optval
, 0);
3040 print_raw_param(TARGET_ABI_FMT_ld
, optlen
, 1);
3044 #define PRINT_SOCKOP(name, func) \
3045 [TARGET_SYS_##name] = { #name, func }
3049 void (*print
)(const char *, abi_long
);
3051 PRINT_SOCKOP(SOCKET
, do_print_socket
),
3052 PRINT_SOCKOP(BIND
, do_print_sockaddr
),
3053 PRINT_SOCKOP(CONNECT
, do_print_sockaddr
),
3054 PRINT_SOCKOP(LISTEN
, do_print_listen
),
3055 PRINT_SOCKOP(ACCEPT
, do_print_sockaddr
),
3056 PRINT_SOCKOP(GETSOCKNAME
, do_print_sockaddr
),
3057 PRINT_SOCKOP(GETPEERNAME
, do_print_sockaddr
),
3058 PRINT_SOCKOP(SOCKETPAIR
, do_print_socketpair
),
3059 PRINT_SOCKOP(SEND
, do_print_sendrecv
),
3060 PRINT_SOCKOP(RECV
, do_print_sendrecv
),
3061 PRINT_SOCKOP(SENDTO
, do_print_msgaddr
),
3062 PRINT_SOCKOP(RECVFROM
, do_print_msgaddr
),
3063 PRINT_SOCKOP(SHUTDOWN
, do_print_shutdown
),
3064 PRINT_SOCKOP(SETSOCKOPT
, do_print_sockopt
),
3065 PRINT_SOCKOP(GETSOCKOPT
, do_print_sockopt
),
3066 PRINT_SOCKOP(SENDMSG
, do_print_msg
),
3067 PRINT_SOCKOP(RECVMSG
, do_print_msg
),
3068 PRINT_SOCKOP(ACCEPT4
, NULL
),
3069 PRINT_SOCKOP(RECVMMSG
, NULL
),
3070 PRINT_SOCKOP(SENDMMSG
, NULL
),
3074 print_socketcall(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3075 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3076 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3078 if (arg0
>= 0 && arg0
< ARRAY_SIZE(scall
) && scall
[arg0
].print
) {
3079 scall
[arg0
].print(scall
[arg0
].name
, arg1
);
3082 print_syscall_prologue(name
);
3083 print_raw_param(TARGET_ABI_FMT_ld
, arg0
, 0);
3084 print_raw_param(TARGET_ABI_FMT_ld
, arg1
, 0);
3085 print_raw_param(TARGET_ABI_FMT_ld
, arg2
, 0);
3086 print_raw_param(TARGET_ABI_FMT_ld
, arg3
, 0);
3087 print_raw_param(TARGET_ABI_FMT_ld
, arg4
, 0);
3088 print_raw_param(TARGET_ABI_FMT_ld
, arg5
, 0);
3089 print_syscall_epilogue(name
);
3093 #if defined(TARGET_NR_bind)
3095 print_bind(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3096 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3097 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3099 print_syscall_prologue(name
);
3100 print_sockfd(arg0
, 0);
3101 print_sockaddr(arg1
, arg2
, 1);
3102 print_syscall_epilogue(name
);
3106 #if defined(TARGET_NR_stat) || defined(TARGET_NR_stat64) || \
3107 defined(TARGET_NR_lstat) || defined(TARGET_NR_lstat64)
3109 print_stat(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3110 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3111 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3113 print_syscall_prologue(name
);
3114 print_string(arg0
, 0);
3115 print_pointer(arg1
, 1);
3116 print_syscall_epilogue(name
);
3118 #define print_lstat print_stat
3119 #define print_stat64 print_stat
3120 #define print_lstat64 print_stat
3123 #if defined(TARGET_NR_madvise)
3124 static struct enums madvise_advice
[] = {
3125 ENUM_TARGET(MADV_NORMAL
),
3126 ENUM_TARGET(MADV_RANDOM
),
3127 ENUM_TARGET(MADV_SEQUENTIAL
),
3128 ENUM_TARGET(MADV_WILLNEED
),
3129 ENUM_TARGET(MADV_DONTNEED
),
3130 ENUM_TARGET(MADV_FREE
),
3131 ENUM_TARGET(MADV_REMOVE
),
3132 ENUM_TARGET(MADV_DONTFORK
),
3133 ENUM_TARGET(MADV_DOFORK
),
3134 ENUM_TARGET(MADV_MERGEABLE
),
3135 ENUM_TARGET(MADV_UNMERGEABLE
),
3136 ENUM_TARGET(MADV_HUGEPAGE
),
3137 ENUM_TARGET(MADV_NOHUGEPAGE
),
3138 ENUM_TARGET(MADV_DONTDUMP
),
3139 ENUM_TARGET(MADV_DODUMP
),
3140 ENUM_TARGET(MADV_WIPEONFORK
),
3141 ENUM_TARGET(MADV_KEEPONFORK
),
3142 ENUM_TARGET(MADV_COLD
),
3143 ENUM_TARGET(MADV_PAGEOUT
),
3144 ENUM_TARGET(MADV_POPULATE_READ
),
3145 ENUM_TARGET(MADV_POPULATE_WRITE
),
3146 ENUM_TARGET(MADV_DONTNEED_LOCKED
),
3151 print_madvise(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3152 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3153 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3155 print_syscall_prologue(name
);
3156 print_pointer(arg0
, 0);
3157 print_raw_param("%d", arg1
, 0);
3158 print_enums(madvise_advice
, arg2
, 1);
3159 print_syscall_epilogue(name
);
3163 #if defined(TARGET_NR_fstat) || defined(TARGET_NR_fstat64)
3165 print_fstat(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3166 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3167 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3169 print_syscall_prologue(name
);
3170 print_raw_param("%d", arg0
, 0);
3171 print_pointer(arg1
, 1);
3172 print_syscall_epilogue(name
);
3174 #define print_fstat64 print_fstat
3177 #ifdef TARGET_NR_mkdir
3179 print_mkdir(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3180 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3181 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3183 print_syscall_prologue(name
);
3184 print_string(arg0
, 0);
3185 print_file_mode(arg1
, 1);
3186 print_syscall_epilogue(name
);
3190 #ifdef TARGET_NR_mkdirat
3192 print_mkdirat(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3193 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3194 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3196 print_syscall_prologue(name
);
3197 print_at_dirfd(arg0
, 0);
3198 print_string(arg1
, 0);
3199 print_file_mode(arg2
, 1);
3200 print_syscall_epilogue(name
);
3204 #ifdef TARGET_NR_rmdir
3206 print_rmdir(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3207 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3208 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3210 print_syscall_prologue(name
);
3211 print_string(arg0
, 0);
3212 print_syscall_epilogue(name
);
3216 #ifdef TARGET_NR_rt_sigaction
3218 print_rt_sigaction(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3219 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3220 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3222 print_syscall_prologue(name
);
3223 print_signal(arg0
, 0);
3224 print_pointer(arg1
, 0);
3225 print_pointer(arg2
, 1);
3226 print_syscall_epilogue(name
);
3230 #ifdef TARGET_NR_rt_sigprocmask
3232 print_rt_sigprocmask(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3233 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3234 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3236 const char *how
= "UNKNOWN";
3237 print_syscall_prologue(name
);
3239 case TARGET_SIG_BLOCK
: how
= "SIG_BLOCK"; break;
3240 case TARGET_SIG_UNBLOCK
: how
= "SIG_UNBLOCK"; break;
3241 case TARGET_SIG_SETMASK
: how
= "SIG_SETMASK"; break;
3243 qemu_log("%s,", how
);
3244 print_pointer(arg1
, 0);
3245 print_pointer(arg2
, 0);
3246 print_raw_param("%u", arg3
, 1);
3247 print_syscall_epilogue(name
);
3251 #ifdef TARGET_NR_rt_sigqueueinfo
3253 print_rt_sigqueueinfo(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3254 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3255 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3258 target_siginfo_t uinfo
;
3260 print_syscall_prologue(name
);
3261 print_raw_param("%d", arg0
, 0);
3262 print_signal(arg1
, 0);
3263 p
= lock_user(VERIFY_READ
, arg2
, sizeof(target_siginfo_t
), 1);
3265 get_target_siginfo(&uinfo
, p
);
3266 print_siginfo(&uinfo
);
3268 unlock_user(p
, arg2
, 0);
3270 print_pointer(arg2
, 1);
3272 print_syscall_epilogue(name
);
3276 #ifdef TARGET_NR_rt_tgsigqueueinfo
3278 print_rt_tgsigqueueinfo(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3279 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3280 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3283 target_siginfo_t uinfo
;
3285 print_syscall_prologue(name
);
3286 print_raw_param("%d", arg0
, 0);
3287 print_raw_param("%d", arg1
, 0);
3288 print_signal(arg2
, 0);
3289 p
= lock_user(VERIFY_READ
, arg3
, sizeof(target_siginfo_t
), 1);
3291 get_target_siginfo(&uinfo
, p
);
3292 print_siginfo(&uinfo
);
3294 unlock_user(p
, arg3
, 0);
3296 print_pointer(arg3
, 1);
3298 print_syscall_epilogue(name
);
3302 #ifdef TARGET_NR_syslog
3304 print_syslog_action(abi_ulong arg
, int last
)
3309 case TARGET_SYSLOG_ACTION_CLOSE
: {
3310 type
= "SYSLOG_ACTION_CLOSE";
3313 case TARGET_SYSLOG_ACTION_OPEN
: {
3314 type
= "SYSLOG_ACTION_OPEN";
3317 case TARGET_SYSLOG_ACTION_READ
: {
3318 type
= "SYSLOG_ACTION_READ";
3321 case TARGET_SYSLOG_ACTION_READ_ALL
: {
3322 type
= "SYSLOG_ACTION_READ_ALL";
3325 case TARGET_SYSLOG_ACTION_READ_CLEAR
: {
3326 type
= "SYSLOG_ACTION_READ_CLEAR";
3329 case TARGET_SYSLOG_ACTION_CLEAR
: {
3330 type
= "SYSLOG_ACTION_CLEAR";
3333 case TARGET_SYSLOG_ACTION_CONSOLE_OFF
: {
3334 type
= "SYSLOG_ACTION_CONSOLE_OFF";
3337 case TARGET_SYSLOG_ACTION_CONSOLE_ON
: {
3338 type
= "SYSLOG_ACTION_CONSOLE_ON";
3341 case TARGET_SYSLOG_ACTION_CONSOLE_LEVEL
: {
3342 type
= "SYSLOG_ACTION_CONSOLE_LEVEL";
3345 case TARGET_SYSLOG_ACTION_SIZE_UNREAD
: {
3346 type
= "SYSLOG_ACTION_SIZE_UNREAD";
3349 case TARGET_SYSLOG_ACTION_SIZE_BUFFER
: {
3350 type
= "SYSLOG_ACTION_SIZE_BUFFER";
3354 print_raw_param("%ld", arg
, last
);
3358 qemu_log("%s%s", type
, get_comma(last
));
3362 print_syslog(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3363 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3364 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3366 print_syscall_prologue(name
);
3367 print_syslog_action(arg0
, 0);
3368 print_pointer(arg1
, 0);
3369 print_raw_param("%d", arg2
, 1);
3370 print_syscall_epilogue(name
);
3374 #ifdef TARGET_NR_mknod
3376 print_mknod(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3377 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3378 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3380 int hasdev
= (arg1
& (S_IFCHR
|S_IFBLK
));
3382 print_syscall_prologue(name
);
3383 print_string(arg0
, 0);
3384 print_file_mode(arg1
, (hasdev
== 0));
3386 print_raw_param("makedev(%d", major(arg2
), 0);
3387 print_raw_param("%d)", minor(arg2
), 1);
3389 print_syscall_epilogue(name
);
3393 #ifdef TARGET_NR_mknodat
3395 print_mknodat(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3396 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3397 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3399 int hasdev
= (arg2
& (S_IFCHR
|S_IFBLK
));
3401 print_syscall_prologue(name
);
3402 print_at_dirfd(arg0
, 0);
3403 print_string(arg1
, 0);
3404 print_file_mode(arg2
, (hasdev
== 0));
3406 print_raw_param("makedev(%d", major(arg3
), 0);
3407 print_raw_param("%d)", minor(arg3
), 1);
3409 print_syscall_epilogue(name
);
3413 #ifdef TARGET_NR_mq_open
3415 print_mq_open(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3416 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3417 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3419 int is_creat
= (arg1
& TARGET_O_CREAT
);
3421 print_syscall_prologue(name
);
3422 print_string(arg0
, 0);
3423 print_open_flags(arg1
, (is_creat
== 0));
3425 print_file_mode(arg2
, 0);
3426 print_pointer(arg3
, 1);
3428 print_syscall_epilogue(name
);
3432 #ifdef TARGET_NR_open
3434 print_open(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3435 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3436 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3438 int is_creat
= (arg1
& TARGET_O_CREAT
);
3440 print_syscall_prologue(name
);
3441 print_string(arg0
, 0);
3442 print_open_flags(arg1
, (is_creat
== 0));
3444 print_file_mode(arg2
, 1);
3445 print_syscall_epilogue(name
);
3449 #ifdef TARGET_NR_openat
3451 print_openat(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3452 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3453 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3455 int is_creat
= (arg2
& TARGET_O_CREAT
);
3457 print_syscall_prologue(name
);
3458 print_at_dirfd(arg0
, 0);
3459 print_string(arg1
, 0);
3460 print_open_flags(arg2
, (is_creat
== 0));
3462 print_file_mode(arg3
, 1);
3463 print_syscall_epilogue(name
);
3467 #ifdef TARGET_NR_pidfd_send_signal
3469 print_pidfd_send_signal(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3470 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3471 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3474 target_siginfo_t uinfo
;
3476 print_syscall_prologue(name
);
3477 print_raw_param("%d", arg0
, 0);
3478 print_signal(arg1
, 0);
3480 p
= lock_user(VERIFY_READ
, arg2
, sizeof(target_siginfo_t
), 1);
3482 get_target_siginfo(&uinfo
, p
);
3483 print_siginfo(&uinfo
);
3485 unlock_user(p
, arg2
, 0);
3487 print_pointer(arg2
, 0);
3490 print_raw_param("%u", arg3
, 1);
3491 print_syscall_epilogue(name
);
3495 #ifdef TARGET_NR_mq_unlink
3497 print_mq_unlink(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3498 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3499 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3501 print_syscall_prologue(name
);
3502 print_string(arg0
, 1);
3503 print_syscall_epilogue(name
);
3507 #if defined(TARGET_NR_fstatat64) || defined(TARGET_NR_newfstatat)
3509 print_fstatat64(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3510 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3511 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3513 print_syscall_prologue(name
);
3514 print_at_dirfd(arg0
, 0);
3515 print_string(arg1
, 0);
3516 print_pointer(arg2
, 0);
3517 print_flags(at_file_flags
, arg3
, 1);
3518 print_syscall_epilogue(name
);
3520 #define print_newfstatat print_fstatat64
3523 #ifdef TARGET_NR_readlink
3525 print_readlink(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3526 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3527 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3529 print_syscall_prologue(name
);
3530 print_string(arg0
, 0);
3531 print_pointer(arg1
, 0);
3532 print_raw_param("%u", arg2
, 1);
3533 print_syscall_epilogue(name
);
3537 #ifdef TARGET_NR_readlinkat
3539 print_readlinkat(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3540 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3541 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3543 print_syscall_prologue(name
);
3544 print_at_dirfd(arg0
, 0);
3545 print_string(arg1
, 0);
3546 print_pointer(arg2
, 0);
3547 print_raw_param("%u", arg3
, 1);
3548 print_syscall_epilogue(name
);
3552 #ifdef TARGET_NR_rename
3554 print_rename(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3555 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3556 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3558 print_syscall_prologue(name
);
3559 print_string(arg0
, 0);
3560 print_string(arg1
, 1);
3561 print_syscall_epilogue(name
);
3565 #ifdef TARGET_NR_renameat
3567 print_renameat(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3568 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3569 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3571 print_syscall_prologue(name
);
3572 print_at_dirfd(arg0
, 0);
3573 print_string(arg1
, 0);
3574 print_at_dirfd(arg2
, 0);
3575 print_string(arg3
, 1);
3576 print_syscall_epilogue(name
);
3580 #ifdef TARGET_NR_statfs
3582 print_statfs(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3583 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3584 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3586 print_syscall_prologue(name
);
3587 print_string(arg0
, 0);
3588 print_pointer(arg1
, 1);
3589 print_syscall_epilogue(name
);
3593 #ifdef TARGET_NR_statfs64
3595 print_statfs64(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3596 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3597 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3599 print_syscall_prologue(name
);
3600 print_string(arg0
, 0);
3601 print_pointer(arg1
, 1);
3602 print_syscall_epilogue(name
);
3606 #ifdef TARGET_NR_symlink
3608 print_symlink(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3609 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3610 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3612 print_syscall_prologue(name
);
3613 print_string(arg0
, 0);
3614 print_string(arg1
, 1);
3615 print_syscall_epilogue(name
);
3619 #ifdef TARGET_NR_symlinkat
3621 print_symlinkat(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3622 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3623 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3625 print_syscall_prologue(name
);
3626 print_string(arg0
, 0);
3627 print_at_dirfd(arg1
, 0);
3628 print_string(arg2
, 1);
3629 print_syscall_epilogue(name
);
3633 #ifdef TARGET_NR_mount
3635 print_mount(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3636 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3637 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3639 print_syscall_prologue(name
);
3640 print_string(arg0
, 0);
3641 print_string(arg1
, 0);
3642 print_string(arg2
, 0);
3643 print_flags(mount_flags
, arg3
, 0);
3644 print_pointer(arg4
, 1);
3645 print_syscall_epilogue(name
);
3649 #ifdef TARGET_NR_umount
3651 print_umount(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3652 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3653 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3655 print_syscall_prologue(name
);
3656 print_string(arg0
, 1);
3657 print_syscall_epilogue(name
);
3661 #ifdef TARGET_NR_umount2
3663 print_umount2(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3664 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3665 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3667 print_syscall_prologue(name
);
3668 print_string(arg0
, 0);
3669 print_flags(umount2_flags
, arg1
, 1);
3670 print_syscall_epilogue(name
);
3674 #ifdef TARGET_NR_unlink
3676 print_unlink(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3677 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3678 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3680 print_syscall_prologue(name
);
3681 print_string(arg0
, 1);
3682 print_syscall_epilogue(name
);
3686 #ifdef TARGET_NR_unlinkat
3688 print_unlinkat(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3689 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3690 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3692 print_syscall_prologue(name
);
3693 print_at_dirfd(arg0
, 0);
3694 print_string(arg1
, 0);
3695 print_flags(unlinkat_flags
, arg2
, 1);
3696 print_syscall_epilogue(name
);
3700 #ifdef TARGET_NR_unshare
3702 print_unshare(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3703 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3704 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3706 print_syscall_prologue(name
);
3707 print_flags(clone_flags
, arg0
, 1);
3708 print_syscall_epilogue(name
);
3712 #ifdef TARGET_NR_clock_nanosleep
3714 print_clock_nanosleep(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3715 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3716 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3718 print_syscall_prologue(name
);
3719 print_enums(clockids
, arg0
, 0);
3720 print_raw_param("%d", arg1
, 0);
3721 print_timespec(arg2
, 0);
3722 print_timespec(arg3
, 1);
3723 print_syscall_epilogue(name
);
3727 #ifdef TARGET_NR_utime
3729 print_utime(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3730 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3731 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3733 print_syscall_prologue(name
);
3734 print_string(arg0
, 0);
3735 print_pointer(arg1
, 1);
3736 print_syscall_epilogue(name
);
3740 #ifdef TARGET_NR_utimes
3742 print_utimes(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3743 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3744 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3746 print_syscall_prologue(name
);
3747 print_string(arg0
, 0);
3748 print_pointer(arg1
, 1);
3749 print_syscall_epilogue(name
);
3753 #ifdef TARGET_NR_utimensat
3755 print_utimensat(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3756 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3757 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3759 print_syscall_prologue(name
);
3760 print_at_dirfd(arg0
, 0);
3761 print_string(arg1
, 0);
3762 print_pointer(arg2
, 0);
3763 print_flags(at_file_flags
, arg3
, 1);
3764 print_syscall_epilogue(name
);
3768 #if defined(TARGET_NR_mmap) || defined(TARGET_NR_mmap2)
3770 print_mmap_both(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3771 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3772 abi_long arg3
, abi_long arg4
, abi_long arg5
,
3777 abi_ulong argp
= arg0
;
3778 if (!(v
= lock_user(VERIFY_READ
, argp
, 6 * sizeof(abi_ulong
), 1)))
3780 arg0
= tswapal(v
[0]);
3781 arg1
= tswapal(v
[1]);
3782 arg2
= tswapal(v
[2]);
3783 arg3
= tswapal(v
[3]);
3784 arg4
= tswapal(v
[4]);
3785 arg5
= tswapal(v
[5]);
3786 unlock_user(v
, argp
, 0);
3788 print_syscall_prologue(name
);
3789 print_pointer(arg0
, 0);
3790 print_raw_param("%d", arg1
, 0);
3791 print_flags(mmap_prot_flags
, arg2
, 0);
3792 print_flags(mmap_flags
, arg3
, 0);
3793 print_raw_param("%d", arg4
, 0);
3794 print_raw_param("%#x", arg5
, 1);
3795 print_syscall_epilogue(name
);
3799 #if defined(TARGET_NR_mmap)
3801 print_mmap(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3802 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3803 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3805 return print_mmap_both(cpu_env
, name
, arg0
, arg1
, arg2
, arg3
,
3807 #if defined(TARGET_NR_mmap2)
3816 #if defined(TARGET_NR_mmap2)
3818 print_mmap2(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3819 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3820 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3822 return print_mmap_both(cpu_env
, name
, arg0
, arg1
, arg2
, arg3
,
3827 #ifdef TARGET_NR_mprotect
3829 print_mprotect(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3830 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3831 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3833 print_syscall_prologue(name
);
3834 print_pointer(arg0
, 0);
3835 print_raw_param("%d", arg1
, 0);
3836 print_flags(mmap_prot_flags
, arg2
, 1);
3837 print_syscall_epilogue(name
);
3841 #ifdef TARGET_NR_munmap
3843 print_munmap(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3844 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3845 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3847 print_syscall_prologue(name
);
3848 print_pointer(arg0
, 0);
3849 print_raw_param("%d", arg1
, 1);
3850 print_syscall_epilogue(name
);
3854 #ifdef TARGET_NR_futex
3855 static void print_futex_op(int cmd
, int last
)
3857 static const char * const futex_names
[] = {
3858 #define NAME(X) [X] = #X
3862 NAME(FUTEX_REQUEUE
),
3863 NAME(FUTEX_CMP_REQUEUE
),
3864 NAME(FUTEX_WAKE_OP
),
3865 NAME(FUTEX_LOCK_PI
),
3866 NAME(FUTEX_UNLOCK_PI
),
3867 NAME(FUTEX_TRYLOCK_PI
),
3868 NAME(FUTEX_WAIT_BITSET
),
3869 NAME(FUTEX_WAKE_BITSET
),
3870 NAME(FUTEX_WAIT_REQUEUE_PI
),
3871 NAME(FUTEX_CMP_REQUEUE_PI
),
3872 NAME(FUTEX_LOCK_PI2
),
3876 unsigned base_cmd
= cmd
& FUTEX_CMD_MASK
;
3878 if (base_cmd
< ARRAY_SIZE(futex_names
)) {
3880 (cmd
& FUTEX_PRIVATE_FLAG
? "FUTEX_PRIVATE_FLAG|" : ""),
3881 (cmd
& FUTEX_CLOCK_REALTIME
? "FUTEX_CLOCK_REALTIME|" : ""),
3882 futex_names
[base_cmd
]);
3884 qemu_log("0x%x", cmd
);
3889 print_futex(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3890 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3891 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3893 abi_long op
= arg1
& FUTEX_CMD_MASK
;
3894 print_syscall_prologue(name
);
3895 print_pointer(arg0
, 0);
3896 print_futex_op(arg1
, 0);
3897 print_raw_param(",%d", arg2
, 0);
3900 case FUTEX_WAIT_BITSET
:
3902 case FUTEX_LOCK_PI2
:
3903 case FUTEX_WAIT_REQUEUE_PI
:
3904 print_timespec(arg3
, 0);
3907 print_pointer(arg3
, 0);
3910 print_pointer(arg4
, 0);
3911 print_raw_param("%d", arg4
, 1);
3912 print_syscall_epilogue(name
);
3916 #ifdef TARGET_NR_prlimit64
3917 static const char *target_ressource_string(abi_ulong r
)
3919 #define RET_RES_ENTRY(res) case TARGET_##res: return #res;
3921 RET_RES_ENTRY(RLIMIT_AS
);
3922 RET_RES_ENTRY(RLIMIT_CORE
);
3923 RET_RES_ENTRY(RLIMIT_CPU
);
3924 RET_RES_ENTRY(RLIMIT_DATA
);
3925 RET_RES_ENTRY(RLIMIT_FSIZE
);
3926 RET_RES_ENTRY(RLIMIT_LOCKS
);
3927 RET_RES_ENTRY(RLIMIT_MEMLOCK
);
3928 RET_RES_ENTRY(RLIMIT_MSGQUEUE
);
3929 RET_RES_ENTRY(RLIMIT_NICE
);
3930 RET_RES_ENTRY(RLIMIT_NOFILE
);
3931 RET_RES_ENTRY(RLIMIT_NPROC
);
3932 RET_RES_ENTRY(RLIMIT_RSS
);
3933 RET_RES_ENTRY(RLIMIT_RTPRIO
);
3934 #ifdef RLIMIT_RTTIME
3935 RET_RES_ENTRY(RLIMIT_RTTIME
);
3937 RET_RES_ENTRY(RLIMIT_SIGPENDING
);
3938 RET_RES_ENTRY(RLIMIT_STACK
);
3942 #undef RET_RES_ENTRY
3946 print_rlimit64(abi_ulong rlim_addr
, int last
)
3949 struct target_rlimit64
*rl
;
3951 rl
= lock_user(VERIFY_READ
, rlim_addr
, sizeof(*rl
), 1);
3953 print_pointer(rlim_addr
, last
);
3956 print_raw_param64("{rlim_cur=%" PRId64
, tswap64(rl
->rlim_cur
), 0);
3957 print_raw_param64("rlim_max=%" PRId64
"}", tswap64(rl
->rlim_max
),
3959 unlock_user(rl
, rlim_addr
, 0);
3961 qemu_log("NULL%s", get_comma(last
));
3966 print_prlimit64(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3967 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3968 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3970 const char *rlim_name
;
3972 print_syscall_prologue(name
);
3973 print_raw_param("%d", arg0
, 0);
3974 rlim_name
= target_ressource_string(arg1
);
3976 qemu_log("%s,", rlim_name
);
3978 print_raw_param("%d", arg1
, 0);
3980 print_rlimit64(arg2
, 0);
3981 print_pointer(arg3
, 1);
3982 print_syscall_epilogue(name
);
3986 print_syscall_ret_prlimit64(CPUArchState
*cpu_env
,
3987 const struct syscallname
*name
,
3988 abi_long ret
, abi_long arg0
, abi_long arg1
,
3989 abi_long arg2
, abi_long arg3
, abi_long arg4
,
3992 if (!print_syscall_err(ret
)) {
3993 qemu_log(TARGET_ABI_FMT_ld
, ret
);
3996 print_rlimit64(arg3
, 1);
4004 #ifdef TARGET_NR_kill
4006 print_kill(CPUArchState
*cpu_env
, const struct syscallname
*name
,
4007 abi_long arg0
, abi_long arg1
, abi_long arg2
,
4008 abi_long arg3
, abi_long arg4
, abi_long arg5
)
4010 print_syscall_prologue(name
);
4011 print_raw_param("%d", arg0
, 0);
4012 print_signal(arg1
, 1);
4013 print_syscall_epilogue(name
);
4017 #ifdef TARGET_NR_tkill
4019 print_tkill(CPUArchState
*cpu_env
, const struct syscallname
*name
,
4020 abi_long arg0
, abi_long arg1
, abi_long arg2
,
4021 abi_long arg3
, abi_long arg4
, abi_long arg5
)
4023 print_syscall_prologue(name
);
4024 print_raw_param("%d", arg0
, 0);
4025 print_signal(arg1
, 1);
4026 print_syscall_epilogue(name
);
4030 #ifdef TARGET_NR_tgkill
4032 print_tgkill(CPUArchState
*cpu_env
, const struct syscallname
*name
,
4033 abi_long arg0
, abi_long arg1
, abi_long arg2
,
4034 abi_long arg3
, abi_long arg4
, abi_long arg5
)
4036 print_syscall_prologue(name
);
4037 print_raw_param("%d", arg0
, 0);
4038 print_raw_param("%d", arg1
, 0);
4039 print_signal(arg2
, 1);
4040 print_syscall_epilogue(name
);
4044 #if defined(TARGET_NR_pread64) || defined(TARGET_NR_pwrite64)
4046 print_pread64(CPUArchState
*cpu_env
, const struct syscallname
*name
,
4047 abi_long arg0
, abi_long arg1
, abi_long arg2
,
4048 abi_long arg3
, abi_long arg4
, abi_long arg5
)
4050 if (regpairs_aligned(cpu_env
, TARGET_NR_pread64
)) {
4054 print_syscall_prologue(name
);
4055 print_raw_param("%d", arg0
, 0);
4056 print_pointer(arg1
, 0);
4057 print_raw_param("%d", arg2
, 0);
4058 print_raw_param("%" PRIu64
, target_offset64(arg3
, arg4
), 1);
4059 print_syscall_epilogue(name
);
4063 #ifdef TARGET_NR_statx
4065 print_statx(CPUArchState
*cpu_env
, const struct syscallname
*name
,
4066 abi_long arg0
, abi_long arg1
, abi_long arg2
,
4067 abi_long arg3
, abi_long arg4
, abi_long arg5
)
4069 print_syscall_prologue(name
);
4070 print_at_dirfd(arg0
, 0);
4071 print_string(arg1
, 0);
4072 print_flags(statx_flags
, arg2
, 0);
4073 print_flags(statx_mask
, arg3
, 0);
4074 print_pointer(arg4
, 1);
4075 print_syscall_epilogue(name
);
4079 #ifdef TARGET_NR_ioctl
4081 print_ioctl(CPUArchState
*cpu_env
, const struct syscallname
*name
,
4082 abi_long arg0
, abi_long arg1
, abi_long arg2
,
4083 abi_long arg3
, abi_long arg4
, abi_long arg5
)
4085 print_syscall_prologue(name
);
4086 print_raw_param("%d", arg0
, 0);
4088 const IOCTLEntry
*ie
;
4089 const argtype
*arg_type
;
4093 for (ie
= ioctl_entries
; ie
->target_cmd
!= 0; ie
++) {
4094 if (ie
->target_cmd
== arg1
) {
4099 if (ie
->target_cmd
== 0) {
4100 print_raw_param("%#x", arg1
, 0);
4101 print_raw_param("%#x", arg2
, 1);
4103 qemu_log("%s", ie
->name
);
4104 arg_type
= ie
->arg_type
;
4106 if (arg_type
[0] != TYPE_NULL
) {
4109 switch (arg_type
[0]) {
4111 print_pointer(arg2
, 1);
4116 print_raw_param("%d", arg2
, 1);
4119 print_raw_param(TARGET_ABI_FMT_ld
, arg2
, 1);
4122 print_raw_param(TARGET_ABI_FMT_lu
, arg2
, 1);
4125 switch (ie
->access
) {
4127 print_pointer(arg2
, 1);
4132 target_size
= thunk_type_size(arg_type
, 0);
4133 argptr
= lock_user(VERIFY_READ
, arg2
, target_size
, 1);
4135 thunk_print(argptr
, arg_type
);
4136 unlock_user(argptr
, arg2
, target_size
);
4138 print_pointer(arg2
, 1);
4144 g_assert_not_reached();
4148 print_syscall_epilogue(name
);
4153 * An array of all of the syscalls we know about
4156 static const struct syscallname scnames
[] = {
4157 #include "strace.list"
4160 static int nsyscalls
= ARRAY_SIZE(scnames
);
4163 * The public interface to this module.
4166 print_syscall(CPUArchState
*cpu_env
, int num
,
4167 abi_long arg1
, abi_long arg2
, abi_long arg3
,
4168 abi_long arg4
, abi_long arg5
, abi_long arg6
)
4172 const char *format
= "%s(" TARGET_ABI_FMT_ld
"," TARGET_ABI_FMT_ld
","
4173 TARGET_ABI_FMT_ld
"," TARGET_ABI_FMT_ld
","
4174 TARGET_ABI_FMT_ld
"," TARGET_ABI_FMT_ld
")";
4176 f
= qemu_log_trylock();
4180 fprintf(f
, "%d ", getpid());
4182 for (i
= 0; i
< nsyscalls
; i
++) {
4183 if (scnames
[i
].nr
== num
) {
4184 if (scnames
[i
].call
!= NULL
) {
4185 scnames
[i
].call(cpu_env
, &scnames
[i
], arg1
, arg2
, arg3
,
4188 /* XXX: this format system is broken because it uses
4189 host types and host pointers for strings */
4190 if (scnames
[i
].format
!= NULL
) {
4191 format
= scnames
[i
].format
;
4193 fprintf(f
, format
, scnames
[i
].name
, arg1
, arg2
,
4194 arg3
, arg4
, arg5
, arg6
);
4200 fprintf(f
, "Unknown syscall %d\n", num
);
4206 print_syscall_ret(CPUArchState
*cpu_env
, int num
, abi_long ret
,
4207 abi_long arg1
, abi_long arg2
, abi_long arg3
,
4208 abi_long arg4
, abi_long arg5
, abi_long arg6
)
4213 f
= qemu_log_trylock();
4218 for (i
= 0; i
< nsyscalls
; i
++) {
4219 if (scnames
[i
].nr
== num
) {
4220 if (scnames
[i
].result
!= NULL
) {
4221 scnames
[i
].result(cpu_env
, &scnames
[i
], ret
,
4225 if (!print_syscall_err(ret
)) {
4226 fprintf(f
, TARGET_ABI_FMT_ld
, ret
);
4236 void print_taken_signal(int target_signum
, const target_siginfo_t
*tinfo
)
4238 /* Print the strace output for a signal being taken:
4239 * --- SIGSEGV {si_signo=SIGSEGV, si_code=SI_KERNEL, si_addr=0} ---
4243 f
= qemu_log_trylock();
4249 print_signal(target_signum
, 1);
4251 print_siginfo(tinfo
);
4252 fprintf(f
, " ---\n");