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"
26 void (*call
)(CPUArchState
*, const struct syscallname
*,
27 abi_long
, abi_long
, abi_long
,
28 abi_long
, abi_long
, abi_long
);
29 void (*result
)(CPUArchState
*, const struct syscallname
*, abi_long
,
30 abi_long
, abi_long
, abi_long
,
31 abi_long
, abi_long
, abi_long
);
35 * It is possible that target doesn't have syscall that uses
36 * following flags but we don't want the compiler to warn
37 * us about them being unused. Same applies to utility print
38 * functions. It is ok to keep them while not used.
40 #define UNUSED __attribute__ ((unused))
43 * Structure used to translate flag values into strings. This is
44 * similar that is in the actual strace tool.
47 abi_long f_value
; /* flag */
48 const char *f_string
; /* stringified flag */
51 /* common flags for all architectures */
52 #define FLAG_GENERIC(name) { name, #name }
53 /* target specific flags (syscall_defs.h has TARGET_<flag>) */
54 #define FLAG_TARGET(name) { TARGET_ ## name, #name }
55 /* end of flags array */
56 #define FLAG_END { 0, NULL }
58 /* Structure used to translate enumerated values into strings */
60 abi_long e_value
; /* enum value */
61 const char *e_string
; /* stringified enum */
64 /* common enums for all architectures */
65 #define ENUM_GENERIC(name) { name, #name }
66 /* target specific enums */
67 #define ENUM_TARGET(name) { TARGET_ ## name, #name }
68 /* end of enums array */
69 #define ENUM_END { 0, NULL }
71 UNUSED
static const char *get_comma(int);
72 UNUSED
static void print_pointer(abi_long
, int);
73 UNUSED
static void print_flags(const struct flags
*, abi_long
, int);
74 UNUSED
static void print_enums(const struct enums
*, abi_long
, int);
75 UNUSED
static void print_at_dirfd(abi_long
, int);
76 UNUSED
static void print_file_mode(abi_long
, int);
77 UNUSED
static void print_open_flags(abi_long
, int);
78 UNUSED
static void print_syscall_prologue(const struct syscallname
*);
79 UNUSED
static void print_syscall_epilogue(const struct syscallname
*);
80 UNUSED
static void print_string(abi_long
, int);
81 UNUSED
static void print_buf(abi_long addr
, abi_long len
, int last
);
82 UNUSED
static void print_raw_param(const char *, abi_long
, int);
83 UNUSED
static void print_timeval(abi_ulong
, int);
84 UNUSED
static void print_timespec(abi_ulong
, int);
85 UNUSED
static void print_timezone(abi_ulong
, int);
86 UNUSED
static void print_itimerval(abi_ulong
, int);
87 UNUSED
static void print_number(abi_long
, int);
88 UNUSED
static void print_signal(abi_ulong
, int);
89 UNUSED
static void print_sockaddr(abi_ulong
, abi_long
, int);
90 UNUSED
static void print_socket_domain(int domain
);
91 UNUSED
static void print_socket_type(int type
);
92 UNUSED
static void print_socket_protocol(int domain
, int type
, int protocol
);
98 print_ipc_cmd(int cmd
)
100 #define output_cmd(val) \
108 /* General IPC commands */
109 output_cmd( IPC_RMID
);
110 output_cmd( IPC_SET
);
111 output_cmd( IPC_STAT
);
112 output_cmd( IPC_INFO
);
113 /* msgctl() commands */
114 output_cmd( MSG_STAT
);
115 output_cmd( MSG_INFO
);
116 /* shmctl() commands */
117 output_cmd( SHM_LOCK
);
118 output_cmd( SHM_UNLOCK
);
119 output_cmd( SHM_STAT
);
120 output_cmd( SHM_INFO
);
121 /* semctl() commands */
122 output_cmd( GETPID
);
123 output_cmd( GETVAL
);
124 output_cmd( GETALL
);
125 output_cmd( GETNCNT
);
126 output_cmd( GETZCNT
);
127 output_cmd( SETVAL
);
128 output_cmd( SETALL
);
129 output_cmd( SEM_STAT
);
130 output_cmd( SEM_INFO
);
131 output_cmd( IPC_RMID
);
132 output_cmd( IPC_RMID
);
133 output_cmd( IPC_RMID
);
134 output_cmd( IPC_RMID
);
135 output_cmd( IPC_RMID
);
136 output_cmd( IPC_RMID
);
137 output_cmd( IPC_RMID
);
138 output_cmd( IPC_RMID
);
139 output_cmd( IPC_RMID
);
141 /* Some value we don't recognize */
145 static const char * const target_signal_name
[] = {
146 #define MAKE_SIG_ENTRY(sig) [TARGET_##sig] = #sig,
148 #undef MAKE_SIG_ENTRY
152 print_signal(abi_ulong arg
, int last
)
154 const char *signal_name
= NULL
;
156 if (arg
< ARRAY_SIZE(target_signal_name
)) {
157 signal_name
= target_signal_name
[arg
];
160 if (signal_name
== NULL
) {
161 print_raw_param("%ld", arg
, last
);
164 qemu_log("%s%s", signal_name
, get_comma(last
));
167 static void print_si_code(int arg
)
169 const char *codename
= NULL
;
173 codename
= "SI_USER";
176 codename
= "SI_KERNEL";
179 codename
= "SI_QUEUE";
182 codename
= "SI_TIMER";
185 codename
= "SI_MESGQ";
188 codename
= "SI_ASYNCIO";
191 codename
= "SI_SIGIO";
194 codename
= "SI_TKILL";
200 qemu_log("%s", codename
);
203 static void get_target_siginfo(target_siginfo_t
*tinfo
,
204 const target_siginfo_t
*info
)
213 __get_user(sig
, &info
->si_signo
);
214 __get_user(si_errno
, &tinfo
->si_errno
);
215 __get_user(si_code
, &info
->si_code
);
217 tinfo
->si_signo
= sig
;
218 tinfo
->si_errno
= si_errno
;
219 tinfo
->si_code
= si_code
;
221 /* Ensure we don't leak random junk to the guest later */
222 memset(tinfo
->_sifields
._pad
, 0, sizeof(tinfo
->_sifields
._pad
));
224 /* This is awkward, because we have to use a combination of
225 * the si_code and si_signo to figure out which of the union's
226 * members are valid. (Within the host kernel it is always possible
227 * to tell, but the kernel carefully avoids giving userspace the
228 * high 16 bits of si_code, so we don't have the information to
229 * do this the easy way...) We therefore make our best guess,
230 * bearing in mind that a guest can spoof most of the si_codes
231 * via rt_sigqueueinfo() if it likes.
233 * Once we have made our guess, we record it in the top 16 bits of
234 * the si_code, so that print_siginfo() later can use it.
235 * print_siginfo() will strip these top bits out before printing
243 /* Sent via kill(), tkill() or tgkill(), or direct from the kernel.
244 * These are the only unspoofable si_code values.
246 __get_user(tinfo
->_sifields
._kill
._pid
, &info
->_sifields
._kill
._pid
);
247 __get_user(tinfo
->_sifields
._kill
._uid
, &info
->_sifields
._kill
._uid
);
248 si_type
= QEMU_SI_KILL
;
251 /* Everything else is spoofable. Make best guess based on signal */
254 __get_user(tinfo
->_sifields
._sigchld
._pid
,
255 &info
->_sifields
._sigchld
._pid
);
256 __get_user(tinfo
->_sifields
._sigchld
._uid
,
257 &info
->_sifields
._sigchld
._uid
);
258 __get_user(tinfo
->_sifields
._sigchld
._status
,
259 &info
->_sifields
._sigchld
._status
);
260 __get_user(tinfo
->_sifields
._sigchld
._utime
,
261 &info
->_sifields
._sigchld
._utime
);
262 __get_user(tinfo
->_sifields
._sigchld
._stime
,
263 &info
->_sifields
._sigchld
._stime
);
264 si_type
= QEMU_SI_CHLD
;
267 __get_user(tinfo
->_sifields
._sigpoll
._band
,
268 &info
->_sifields
._sigpoll
._band
);
269 __get_user(tinfo
->_sifields
._sigpoll
._fd
,
270 &info
->_sifields
._sigpoll
._fd
);
271 si_type
= QEMU_SI_POLL
;
274 /* Assume a sigqueue()/mq_notify()/rt_sigqueueinfo() source. */
275 __get_user(tinfo
->_sifields
._rt
._pid
, &info
->_sifields
._rt
._pid
);
276 __get_user(tinfo
->_sifields
._rt
._uid
, &info
->_sifields
._rt
._uid
);
277 /* XXX: potential problem if 64 bit */
278 __get_user(sival_ptr
, &info
->_sifields
._rt
._sigval
.sival_ptr
);
279 tinfo
->_sifields
._rt
._sigval
.sival_ptr
= sival_ptr
;
281 si_type
= QEMU_SI_RT
;
287 tinfo
->si_code
= deposit32(si_code
, 16, 16, si_type
);
290 static void print_siginfo(const target_siginfo_t
*tinfo
)
292 /* Print a target_siginfo_t in the format desired for printing
293 * signals being taken. We assume the target_siginfo_t is in the
294 * internal form where the top 16 bits of si_code indicate which
295 * part of the union is valid, rather than in the guest-visible
296 * form where the bottom 16 bits are sign-extended into the top 16.
298 int si_type
= extract32(tinfo
->si_code
, 16, 16);
299 int si_code
= sextract32(tinfo
->si_code
, 0, 16);
301 qemu_log("{si_signo=");
302 print_signal(tinfo
->si_signo
, 1);
303 qemu_log(", si_code=");
304 print_si_code(si_code
);
308 qemu_log(", si_pid=%u, si_uid=%u",
309 (unsigned int)tinfo
->_sifields
._kill
._pid
,
310 (unsigned int)tinfo
->_sifields
._kill
._uid
);
313 qemu_log(", si_timer1=%u, si_timer2=%u",
314 tinfo
->_sifields
._timer
._timer1
,
315 tinfo
->_sifields
._timer
._timer2
);
318 qemu_log(", si_band=%d, si_fd=%d",
319 tinfo
->_sifields
._sigpoll
._band
,
320 tinfo
->_sifields
._sigpoll
._fd
);
323 qemu_log(", si_addr=");
324 print_pointer(tinfo
->_sifields
._sigfault
._addr
, 1);
327 qemu_log(", si_pid=%u, si_uid=%u, si_status=%d"
328 ", si_utime=" TARGET_ABI_FMT_ld
329 ", si_stime=" TARGET_ABI_FMT_ld
,
330 (unsigned int)(tinfo
->_sifields
._sigchld
._pid
),
331 (unsigned int)(tinfo
->_sifields
._sigchld
._uid
),
332 tinfo
->_sifields
._sigchld
._status
,
333 tinfo
->_sifields
._sigchld
._utime
,
334 tinfo
->_sifields
._sigchld
._stime
);
337 qemu_log(", si_pid=%u, si_uid=%u, si_sigval=" TARGET_ABI_FMT_ld
,
338 (unsigned int)tinfo
->_sifields
._rt
._pid
,
339 (unsigned int)tinfo
->_sifields
._rt
._uid
,
340 tinfo
->_sifields
._rt
._sigval
.sival_ptr
);
343 g_assert_not_reached();
349 print_sockaddr(abi_ulong addr
, abi_long addrlen
, int last
)
351 struct target_sockaddr
*sa
;
355 sa
= lock_user(VERIFY_READ
, addr
, addrlen
, 1);
357 sa_family
= tswap16(sa
->sa_family
);
360 struct target_sockaddr_un
*un
= (struct target_sockaddr_un
*)sa
;
362 qemu_log("{sun_family=AF_UNIX,sun_path=\"");
363 for (i
= 0; i
< addrlen
-
364 offsetof(struct target_sockaddr_un
, sun_path
) &&
365 un
->sun_path
[i
]; i
++) {
366 qemu_log("%c", un
->sun_path
[i
]);
372 struct target_sockaddr_in
*in
= (struct target_sockaddr_in
*)sa
;
373 uint8_t *c
= (uint8_t *)&in
->sin_addr
.s_addr
;
374 qemu_log("{sin_family=AF_INET,sin_port=htons(%d),",
375 ntohs(in
->sin_port
));
376 qemu_log("sin_addr=inet_addr(\"%d.%d.%d.%d\")",
377 c
[0], c
[1], c
[2], c
[3]);
382 struct target_sockaddr_ll
*ll
= (struct target_sockaddr_ll
*)sa
;
383 uint8_t *c
= (uint8_t *)&ll
->sll_addr
;
384 qemu_log("{sll_family=AF_PACKET,"
385 "sll_protocol=htons(0x%04x),if%d,pkttype=",
386 ntohs(ll
->sll_protocol
), ll
->sll_ifindex
);
387 switch (ll
->sll_pkttype
) {
389 qemu_log("PACKET_HOST");
391 case PACKET_BROADCAST
:
392 qemu_log("PACKET_BROADCAST");
394 case PACKET_MULTICAST
:
395 qemu_log("PACKET_MULTICAST");
397 case PACKET_OTHERHOST
:
398 qemu_log("PACKET_OTHERHOST");
400 case PACKET_OUTGOING
:
401 qemu_log("PACKET_OUTGOING");
404 qemu_log("%d", ll
->sll_pkttype
);
407 qemu_log(",sll_addr=%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x",
408 c
[0], c
[1], c
[2], c
[3], c
[4], c
[5], c
[6], c
[7]);
413 struct target_sockaddr_nl
*nl
= (struct target_sockaddr_nl
*)sa
;
414 qemu_log("{nl_family=AF_NETLINK,nl_pid=%u,nl_groups=%u}",
415 tswap32(nl
->nl_pid
), tswap32(nl
->nl_groups
));
419 qemu_log("{sa_family=%d, sa_data={", sa
->sa_family
);
420 for (i
= 0; i
< 13; i
++) {
421 qemu_log("%02x, ", sa
->sa_data
[i
]);
423 qemu_log("%02x}", sa
->sa_data
[i
]);
427 unlock_user(sa
, addr
, 0);
429 print_raw_param("0x"TARGET_ABI_FMT_lx
, addr
, 0);
431 qemu_log(", "TARGET_ABI_FMT_ld
"%s", addrlen
, get_comma(last
));
435 print_socket_domain(int domain
)
445 qemu_log("PF_NETLINK");
448 qemu_log("PF_PACKET");
451 qemu_log("%d", domain
);
457 print_socket_type(int type
)
459 switch (type
& TARGET_SOCK_TYPE_MASK
) {
460 case TARGET_SOCK_DGRAM
:
461 qemu_log("SOCK_DGRAM");
463 case TARGET_SOCK_STREAM
:
464 qemu_log("SOCK_STREAM");
466 case TARGET_SOCK_RAW
:
467 qemu_log("SOCK_RAW");
469 case TARGET_SOCK_RDM
:
470 qemu_log("SOCK_RDM");
472 case TARGET_SOCK_SEQPACKET
:
473 qemu_log("SOCK_SEQPACKET");
475 case TARGET_SOCK_PACKET
:
476 qemu_log("SOCK_PACKET");
479 if (type
& TARGET_SOCK_CLOEXEC
) {
480 qemu_log("|SOCK_CLOEXEC");
482 if (type
& TARGET_SOCK_NONBLOCK
) {
483 qemu_log("|SOCK_NONBLOCK");
488 print_socket_protocol(int domain
, int type
, int protocol
)
490 if (domain
== AF_PACKET
||
491 (domain
== AF_INET
&& type
== TARGET_SOCK_PACKET
)) {
494 qemu_log("ETH_P_ALL");
497 qemu_log("%d", protocol
);
502 if (domain
== PF_NETLINK
) {
505 qemu_log("NETLINK_ROUTE");
508 qemu_log("NETLINK_AUDIT");
510 case NETLINK_NETFILTER
:
511 qemu_log("NETLINK_NETFILTER");
513 case NETLINK_KOBJECT_UEVENT
:
514 qemu_log("NETLINK_KOBJECT_UEVENT");
517 qemu_log("NETLINK_RDMA");
520 qemu_log("NETLINK_CRYPTO");
523 qemu_log("%d", protocol
);
531 qemu_log("IPPROTO_IP");
534 qemu_log("IPPROTO_TCP");
537 qemu_log("IPPROTO_UDP");
540 qemu_log("IPPROTO_RAW");
543 qemu_log("%d", protocol
);
549 #ifdef TARGET_NR__newselect
551 print_fdset(int n
, abi_ulong target_fds_addr
)
557 if( target_fds_addr
) {
558 abi_long
*target_fds
;
560 target_fds
= lock_user(VERIFY_READ
,
562 sizeof(*target_fds
)*(n
/ TARGET_ABI_BITS
+ 1),
568 for (i
=n
; i
>=0; i
--) {
569 if ((tswapal(target_fds
[i
/ TARGET_ABI_BITS
]) >>
570 (i
& (TARGET_ABI_BITS
- 1))) & 1) {
571 qemu_log("%s%d", get_comma(first
), i
);
575 unlock_user(target_fds
, target_fds_addr
, 0);
582 * Sysycall specific output functions
586 #ifdef TARGET_NR__newselect
588 print_newselect(CPUArchState
*cpu_env
, const struct syscallname
*name
,
589 abi_long arg1
, abi_long arg2
, abi_long arg3
,
590 abi_long arg4
, abi_long arg5
, abi_long arg6
)
592 print_syscall_prologue(name
);
593 print_fdset(arg1
, arg2
);
595 print_fdset(arg1
, arg3
);
597 print_fdset(arg1
, arg4
);
599 print_timeval(arg5
, 1);
600 print_syscall_epilogue(name
);
604 #ifdef TARGET_NR_semctl
606 print_semctl(CPUArchState
*cpu_env
, const struct syscallname
*name
,
607 abi_long arg1
, abi_long arg2
, abi_long arg3
,
608 abi_long arg4
, abi_long arg5
, abi_long arg6
)
610 qemu_log("%s(" TARGET_ABI_FMT_ld
"," TARGET_ABI_FMT_ld
",",
611 name
->name
, arg1
, arg2
);
613 qemu_log(",0x" TARGET_ABI_FMT_lx
")", arg4
);
618 print_execve(CPUArchState
*cpu_env
, const struct syscallname
*name
,
619 abi_long arg1
, abi_long arg2
, abi_long arg3
,
620 abi_long arg4
, abi_long arg5
, abi_long arg6
)
622 abi_ulong arg_ptr_addr
;
625 if (!(s
= lock_user_string(arg1
)))
627 qemu_log("%s(\"%s\",{", name
->name
, s
);
628 unlock_user(s
, arg1
, 0);
630 for (arg_ptr_addr
= arg2
; ; arg_ptr_addr
+= sizeof(abi_ulong
)) {
631 abi_ulong
*arg_ptr
, arg_addr
;
633 arg_ptr
= lock_user(VERIFY_READ
, arg_ptr_addr
, sizeof(abi_ulong
), 1);
636 arg_addr
= tswapal(*arg_ptr
);
637 unlock_user(arg_ptr
, arg_ptr_addr
, 0);
640 if ((s
= lock_user_string(arg_addr
))) {
641 qemu_log("\"%s\",", s
);
642 unlock_user(s
, arg_addr
, 0);
651 print_ipc(CPUArchState
*cpu_env
, const struct syscallname
*name
,
652 abi_long arg1
, abi_long arg2
, abi_long arg3
,
653 abi_long arg4
, abi_long arg5
, abi_long arg6
)
657 qemu_log("semctl(" TARGET_ABI_FMT_ld
"," TARGET_ABI_FMT_ld
",",
660 qemu_log(",0x" TARGET_ABI_FMT_lx
")", arg4
);
664 TARGET_ABI_FMT_ld
","
665 TARGET_ABI_FMT_ld
","
666 TARGET_ABI_FMT_ld
","
669 name
->name
, arg1
, arg2
, arg3
, arg4
);
675 * Variants for the return value output function
679 print_syscall_err(abi_long ret
)
685 errstr
= target_strerror(-ret
);
687 qemu_log("-1 errno=%d (%s)", (int)-ret
, errstr
);
695 print_syscall_ret_addr(CPUArchState
*cpu_env
, const struct syscallname
*name
,
696 abi_long ret
, abi_long arg0
, abi_long arg1
,
697 abi_long arg2
, abi_long arg3
, abi_long arg4
,
700 if (!print_syscall_err(ret
)) {
701 qemu_log("0x" TARGET_ABI_FMT_lx
, ret
);
706 #if 0 /* currently unused */
708 print_syscall_ret_raw(struct syscallname
*name
, abi_long ret
)
710 qemu_log(" = 0x" TARGET_ABI_FMT_lx
"\n", ret
);
714 #ifdef TARGET_NR__newselect
716 print_syscall_ret_newselect(CPUArchState
*cpu_env
, const struct syscallname
*name
,
717 abi_long ret
, abi_long arg0
, abi_long arg1
,
718 abi_long arg2
, abi_long arg3
, abi_long arg4
,
721 if (!print_syscall_err(ret
)) {
722 qemu_log(" = 0x" TARGET_ABI_FMT_lx
" (", ret
);
723 print_fdset(arg0
, arg1
);
725 print_fdset(arg0
, arg2
);
727 print_fdset(arg0
, arg3
);
729 print_timeval(arg4
, 1);
737 /* special meanings of adjtimex()' non-negative return values */
738 #define TARGET_TIME_OK 0 /* clock synchronized, no leap second */
739 #define TARGET_TIME_INS 1 /* insert leap second */
740 #define TARGET_TIME_DEL 2 /* delete leap second */
741 #define TARGET_TIME_OOP 3 /* leap second in progress */
742 #define TARGET_TIME_WAIT 4 /* leap second has occurred */
743 #define TARGET_TIME_ERROR 5 /* clock not synchronized */
744 #ifdef TARGET_NR_adjtimex
746 print_syscall_ret_adjtimex(CPUArchState
*cpu_env
, const struct syscallname
*name
,
747 abi_long ret
, abi_long arg0
, abi_long arg1
,
748 abi_long arg2
, abi_long arg3
, abi_long arg4
,
751 if (!print_syscall_err(ret
)) {
752 qemu_log(TARGET_ABI_FMT_ld
, ret
);
755 qemu_log(" TIME_OK (clock synchronized, no leap second)");
757 case TARGET_TIME_INS
:
758 qemu_log(" TIME_INS (insert leap second)");
760 case TARGET_TIME_DEL
:
761 qemu_log(" TIME_DEL (delete leap second)");
763 case TARGET_TIME_OOP
:
764 qemu_log(" TIME_OOP (leap second in progress)");
766 case TARGET_TIME_WAIT
:
767 qemu_log(" TIME_WAIT (leap second has occurred)");
769 case TARGET_TIME_ERROR
:
770 qemu_log(" TIME_ERROR (clock not synchronized)");
779 #if defined(TARGET_NR_clock_gettime) || defined(TARGET_NR_clock_getres)
781 print_syscall_ret_clock_gettime(CPUArchState
*cpu_env
, const struct syscallname
*name
,
782 abi_long ret
, abi_long arg0
, abi_long arg1
,
783 abi_long arg2
, abi_long arg3
, abi_long arg4
,
786 if (!print_syscall_err(ret
)) {
787 qemu_log(TARGET_ABI_FMT_ld
, ret
);
789 print_timespec(arg1
, 1);
795 #define print_syscall_ret_clock_getres print_syscall_ret_clock_gettime
798 #ifdef TARGET_NR_gettimeofday
800 print_syscall_ret_gettimeofday(CPUArchState
*cpu_env
, const struct syscallname
*name
,
801 abi_long ret
, abi_long arg0
, abi_long arg1
,
802 abi_long arg2
, abi_long arg3
, abi_long arg4
,
805 if (!print_syscall_err(ret
)) {
806 qemu_log(TARGET_ABI_FMT_ld
, ret
);
808 print_timeval(arg0
, 0);
809 print_timezone(arg1
, 1);
817 #ifdef TARGET_NR_getitimer
819 print_syscall_ret_getitimer(CPUArchState
*cpu_env
, const struct syscallname
*name
,
820 abi_long ret
, abi_long arg0
, abi_long arg1
,
821 abi_long arg2
, abi_long arg3
, abi_long arg4
,
824 if (!print_syscall_err(ret
)) {
825 qemu_log(TARGET_ABI_FMT_ld
, ret
);
827 print_itimerval(arg1
, 1);
836 #ifdef TARGET_NR_getitimer
838 print_syscall_ret_setitimer(CPUArchState
*cpu_env
, const struct syscallname
*name
,
839 abi_long ret
, abi_long arg0
, abi_long arg1
,
840 abi_long arg2
, abi_long arg3
, abi_long arg4
,
843 if (!print_syscall_err(ret
)) {
844 qemu_log(TARGET_ABI_FMT_ld
, ret
);
845 qemu_log(" (old_value = ");
846 print_itimerval(arg2
, 1);
854 #if defined(TARGET_NR_listxattr) || defined(TARGET_NR_llistxattr) \
855 || defined(TARGGET_NR_flistxattr)
857 print_syscall_ret_listxattr(CPUArchState
*cpu_env
, const struct syscallname
*name
,
858 abi_long ret
, abi_long arg0
, abi_long arg1
,
859 abi_long arg2
, abi_long arg3
, abi_long arg4
,
862 if (!print_syscall_err(ret
)) {
863 qemu_log(TARGET_ABI_FMT_ld
, ret
);
864 qemu_log(" (list = ");
866 abi_long attr
= arg1
;
871 print_string(attr
, 1);
872 ret
-= target_strlen(attr
) + 1;
873 attr
+= target_strlen(attr
) + 1;
883 #define print_syscall_ret_llistxattr print_syscall_ret_listxattr
884 #define print_syscall_ret_flistxattr print_syscall_ret_listxattr
887 #ifdef TARGET_NR_ioctl
889 print_syscall_ret_ioctl(CPUArchState
*cpu_env
, const struct syscallname
*name
,
890 abi_long ret
, abi_long arg0
, abi_long arg1
,
891 abi_long arg2
, abi_long arg3
, abi_long arg4
,
894 if (!print_syscall_err(ret
)) {
895 qemu_log(TARGET_ABI_FMT_ld
, ret
);
897 const IOCTLEntry
*ie
;
898 const argtype
*arg_type
;
902 for (ie
= ioctl_entries
; ie
->target_cmd
!= 0; ie
++) {
903 if (ie
->target_cmd
== arg1
) {
908 if (ie
->target_cmd
== arg1
&&
909 (ie
->access
== IOC_R
|| ie
->access
== IOC_RW
)) {
910 arg_type
= ie
->arg_type
;
913 target_size
= thunk_type_size(arg_type
, 0);
914 argptr
= lock_user(VERIFY_READ
, arg2
, target_size
, 1);
916 thunk_print(argptr
, arg_type
);
917 unlock_user(argptr
, arg2
, target_size
);
919 print_pointer(arg2
, 1);
928 UNUSED
static struct flags access_flags
[] = {
936 UNUSED
static struct flags at_file_flags
[] = {
938 FLAG_GENERIC(AT_EACCESS
),
940 #ifdef AT_SYMLINK_NOFOLLOW
941 FLAG_GENERIC(AT_SYMLINK_NOFOLLOW
),
946 UNUSED
static struct flags unlinkat_flags
[] = {
948 FLAG_GENERIC(AT_REMOVEDIR
),
953 UNUSED
static struct flags mode_flags
[] = {
954 FLAG_GENERIC(S_IFSOCK
),
955 FLAG_GENERIC(S_IFLNK
),
956 FLAG_GENERIC(S_IFREG
),
957 FLAG_GENERIC(S_IFBLK
),
958 FLAG_GENERIC(S_IFDIR
),
959 FLAG_GENERIC(S_IFCHR
),
960 FLAG_GENERIC(S_IFIFO
),
964 UNUSED
static struct flags open_access_flags
[] = {
965 FLAG_TARGET(O_RDONLY
),
966 FLAG_TARGET(O_WRONLY
),
971 UNUSED
static struct flags open_flags
[] = {
972 FLAG_TARGET(O_APPEND
),
973 FLAG_TARGET(O_CREAT
),
974 FLAG_TARGET(O_DIRECTORY
),
976 FLAG_TARGET(O_LARGEFILE
),
977 FLAG_TARGET(O_NOCTTY
),
978 FLAG_TARGET(O_NOFOLLOW
),
979 FLAG_TARGET(O_NONBLOCK
), /* also O_NDELAY */
980 FLAG_TARGET(O_DSYNC
),
981 FLAG_TARGET(__O_SYNC
),
982 FLAG_TARGET(O_TRUNC
),
984 FLAG_TARGET(O_DIRECT
),
987 FLAG_TARGET(O_NOATIME
),
990 FLAG_TARGET(O_CLOEXEC
),
996 FLAG_TARGET(O_TMPFILE
),
997 FLAG_TARGET(__O_TMPFILE
),
1002 UNUSED
static struct flags mount_flags
[] = {
1004 FLAG_GENERIC(MS_BIND
),
1007 FLAG_GENERIC(MS_DIRSYNC
),
1009 FLAG_GENERIC(MS_MANDLOCK
),
1011 FLAG_GENERIC(MS_MOVE
),
1013 FLAG_GENERIC(MS_NOATIME
),
1014 FLAG_GENERIC(MS_NODEV
),
1015 FLAG_GENERIC(MS_NODIRATIME
),
1016 FLAG_GENERIC(MS_NOEXEC
),
1017 FLAG_GENERIC(MS_NOSUID
),
1018 FLAG_GENERIC(MS_RDONLY
),
1020 FLAG_GENERIC(MS_RELATIME
),
1022 FLAG_GENERIC(MS_REMOUNT
),
1023 FLAG_GENERIC(MS_SYNCHRONOUS
),
1027 UNUSED
static struct flags umount2_flags
[] = {
1029 FLAG_GENERIC(MNT_FORCE
),
1032 FLAG_GENERIC(MNT_DETACH
),
1035 FLAG_GENERIC(MNT_EXPIRE
),
1040 UNUSED
static struct flags mmap_prot_flags
[] = {
1041 FLAG_GENERIC(PROT_NONE
),
1042 FLAG_GENERIC(PROT_EXEC
),
1043 FLAG_GENERIC(PROT_READ
),
1044 FLAG_GENERIC(PROT_WRITE
),
1045 FLAG_TARGET(PROT_SEM
),
1046 FLAG_GENERIC(PROT_GROWSDOWN
),
1047 FLAG_GENERIC(PROT_GROWSUP
),
1051 UNUSED
static struct flags mmap_flags
[] = {
1052 FLAG_TARGET(MAP_SHARED
),
1053 FLAG_TARGET(MAP_PRIVATE
),
1054 FLAG_TARGET(MAP_ANONYMOUS
),
1055 FLAG_TARGET(MAP_DENYWRITE
),
1056 FLAG_TARGET(MAP_FIXED
),
1057 FLAG_TARGET(MAP_GROWSDOWN
),
1058 FLAG_TARGET(MAP_EXECUTABLE
),
1060 FLAG_TARGET(MAP_LOCKED
),
1063 FLAG_TARGET(MAP_NONBLOCK
),
1065 FLAG_TARGET(MAP_NORESERVE
),
1067 FLAG_TARGET(MAP_POPULATE
),
1069 #ifdef TARGET_MAP_UNINITIALIZED
1070 FLAG_TARGET(MAP_UNINITIALIZED
),
1075 UNUSED
static struct flags clone_flags
[] = {
1076 FLAG_GENERIC(CLONE_VM
),
1077 FLAG_GENERIC(CLONE_FS
),
1078 FLAG_GENERIC(CLONE_FILES
),
1079 FLAG_GENERIC(CLONE_SIGHAND
),
1080 FLAG_GENERIC(CLONE_PTRACE
),
1081 FLAG_GENERIC(CLONE_VFORK
),
1082 FLAG_GENERIC(CLONE_PARENT
),
1083 FLAG_GENERIC(CLONE_THREAD
),
1084 FLAG_GENERIC(CLONE_NEWNS
),
1085 FLAG_GENERIC(CLONE_SYSVSEM
),
1086 FLAG_GENERIC(CLONE_SETTLS
),
1087 FLAG_GENERIC(CLONE_PARENT_SETTID
),
1088 FLAG_GENERIC(CLONE_CHILD_CLEARTID
),
1089 FLAG_GENERIC(CLONE_DETACHED
),
1090 FLAG_GENERIC(CLONE_UNTRACED
),
1091 FLAG_GENERIC(CLONE_CHILD_SETTID
),
1092 #if defined(CLONE_NEWUTS)
1093 FLAG_GENERIC(CLONE_NEWUTS
),
1095 #if defined(CLONE_NEWIPC)
1096 FLAG_GENERIC(CLONE_NEWIPC
),
1098 #if defined(CLONE_NEWUSER)
1099 FLAG_GENERIC(CLONE_NEWUSER
),
1101 #if defined(CLONE_NEWPID)
1102 FLAG_GENERIC(CLONE_NEWPID
),
1104 #if defined(CLONE_NEWNET)
1105 FLAG_GENERIC(CLONE_NEWNET
),
1107 #if defined(CLONE_NEWCGROUP)
1108 FLAG_GENERIC(CLONE_NEWCGROUP
),
1110 #if defined(CLONE_NEWTIME)
1111 FLAG_GENERIC(CLONE_NEWTIME
),
1113 #if defined(CLONE_IO)
1114 FLAG_GENERIC(CLONE_IO
),
1119 UNUSED
static struct flags msg_flags
[] = {
1121 FLAG_GENERIC(MSG_CONFIRM
),
1122 FLAG_GENERIC(MSG_DONTROUTE
),
1123 FLAG_GENERIC(MSG_DONTWAIT
),
1124 FLAG_GENERIC(MSG_EOR
),
1125 FLAG_GENERIC(MSG_MORE
),
1126 FLAG_GENERIC(MSG_NOSIGNAL
),
1127 FLAG_GENERIC(MSG_OOB
),
1129 FLAG_GENERIC(MSG_CMSG_CLOEXEC
),
1130 FLAG_GENERIC(MSG_ERRQUEUE
),
1131 FLAG_GENERIC(MSG_PEEK
),
1132 FLAG_GENERIC(MSG_TRUNC
),
1133 FLAG_GENERIC(MSG_WAITALL
),
1135 FLAG_GENERIC(MSG_CTRUNC
),
1139 UNUSED
static struct flags statx_flags
[] = {
1140 #ifdef AT_EMPTY_PATH
1141 FLAG_GENERIC(AT_EMPTY_PATH
),
1143 #ifdef AT_NO_AUTOMOUNT
1144 FLAG_GENERIC(AT_NO_AUTOMOUNT
),
1146 #ifdef AT_SYMLINK_NOFOLLOW
1147 FLAG_GENERIC(AT_SYMLINK_NOFOLLOW
),
1149 #ifdef AT_STATX_SYNC_AS_STAT
1150 FLAG_GENERIC(AT_STATX_SYNC_AS_STAT
),
1152 #ifdef AT_STATX_FORCE_SYNC
1153 FLAG_GENERIC(AT_STATX_FORCE_SYNC
),
1155 #ifdef AT_STATX_DONT_SYNC
1156 FLAG_GENERIC(AT_STATX_DONT_SYNC
),
1161 UNUSED
static struct flags statx_mask
[] = {
1162 /* This must come first, because it includes everything. */
1164 FLAG_GENERIC(STATX_ALL
),
1166 /* This must come second; it includes everything except STATX_BTIME. */
1167 #ifdef STATX_BASIC_STATS
1168 FLAG_GENERIC(STATX_BASIC_STATS
),
1171 FLAG_GENERIC(STATX_TYPE
),
1174 FLAG_GENERIC(STATX_MODE
),
1177 FLAG_GENERIC(STATX_NLINK
),
1180 FLAG_GENERIC(STATX_UID
),
1183 FLAG_GENERIC(STATX_GID
),
1186 FLAG_GENERIC(STATX_ATIME
),
1189 FLAG_GENERIC(STATX_MTIME
),
1192 FLAG_GENERIC(STATX_CTIME
),
1195 FLAG_GENERIC(STATX_INO
),
1198 FLAG_GENERIC(STATX_SIZE
),
1201 FLAG_GENERIC(STATX_BLOCKS
),
1204 FLAG_GENERIC(STATX_BTIME
),
1209 UNUSED
static struct flags falloc_flags
[] = {
1210 FLAG_GENERIC(FALLOC_FL_KEEP_SIZE
),
1211 FLAG_GENERIC(FALLOC_FL_PUNCH_HOLE
),
1212 #ifdef FALLOC_FL_NO_HIDE_STALE
1213 FLAG_GENERIC(FALLOC_FL_NO_HIDE_STALE
),
1215 #ifdef FALLOC_FL_COLLAPSE_RANGE
1216 FLAG_GENERIC(FALLOC_FL_COLLAPSE_RANGE
),
1218 #ifdef FALLOC_FL_ZERO_RANGE
1219 FLAG_GENERIC(FALLOC_FL_ZERO_RANGE
),
1221 #ifdef FALLOC_FL_INSERT_RANGE
1222 FLAG_GENERIC(FALLOC_FL_INSERT_RANGE
),
1224 #ifdef FALLOC_FL_UNSHARE_RANGE
1225 FLAG_GENERIC(FALLOC_FL_UNSHARE_RANGE
),
1229 UNUSED
static struct flags termios_iflags
[] = {
1230 FLAG_TARGET(IGNBRK
),
1231 FLAG_TARGET(BRKINT
),
1232 FLAG_TARGET(IGNPAR
),
1233 FLAG_TARGET(PARMRK
),
1235 FLAG_TARGET(ISTRIP
),
1243 FLAG_TARGET(IMAXBEL
),
1248 UNUSED
static struct flags termios_oflags
[] = {
1254 FLAG_TARGET(ONLRET
),
1260 UNUSED
static struct enums termios_oflags_NLDLY
[] = {
1266 UNUSED
static struct enums termios_oflags_CRDLY
[] = {
1274 UNUSED
static struct enums termios_oflags_TABDLY
[] = {
1282 UNUSED
static struct enums termios_oflags_VTDLY
[] = {
1288 UNUSED
static struct enums termios_oflags_FFDLY
[] = {
1294 UNUSED
static struct enums termios_oflags_BSDLY
[] = {
1300 UNUSED
static struct enums termios_cflags_CBAUD
[] = {
1315 ENUM_TARGET(B19200
),
1316 ENUM_TARGET(B38400
),
1317 ENUM_TARGET(B57600
),
1318 ENUM_TARGET(B115200
),
1319 ENUM_TARGET(B230400
),
1320 ENUM_TARGET(B460800
),
1324 UNUSED
static struct enums termios_cflags_CSIZE
[] = {
1332 UNUSED
static struct flags termios_cflags
[] = {
1333 FLAG_TARGET(CSTOPB
),
1335 FLAG_TARGET(PARENB
),
1336 FLAG_TARGET(PARODD
),
1338 FLAG_TARGET(CLOCAL
),
1339 FLAG_TARGET(CRTSCTS
),
1343 UNUSED
static struct flags termios_lflags
[] = {
1345 FLAG_TARGET(ICANON
),
1350 FLAG_TARGET(ECHONL
),
1351 FLAG_TARGET(NOFLSH
),
1352 FLAG_TARGET(TOSTOP
),
1353 FLAG_TARGET(ECHOCTL
),
1354 FLAG_TARGET(ECHOPRT
),
1355 FLAG_TARGET(ECHOKE
),
1356 FLAG_TARGET(FLUSHO
),
1357 FLAG_TARGET(PENDIN
),
1358 FLAG_TARGET(IEXTEN
),
1359 FLAG_TARGET(EXTPROC
),
1363 UNUSED
static struct flags mlockall_flags
[] = {
1364 FLAG_TARGET(MCL_CURRENT
),
1365 FLAG_TARGET(MCL_FUTURE
),
1367 FLAG_TARGET(MCL_ONFAULT
),
1372 /* IDs of the various system clocks */
1373 #define TARGET_CLOCK_REALTIME 0
1374 #define TARGET_CLOCK_MONOTONIC 1
1375 #define TARGET_CLOCK_PROCESS_CPUTIME_ID 2
1376 #define TARGET_CLOCK_THREAD_CPUTIME_ID 3
1377 #define TARGET_CLOCK_MONOTONIC_RAW 4
1378 #define TARGET_CLOCK_REALTIME_COARSE 5
1379 #define TARGET_CLOCK_MONOTONIC_COARSE 6
1380 #define TARGET_CLOCK_BOOTTIME 7
1381 #define TARGET_CLOCK_REALTIME_ALARM 8
1382 #define TARGET_CLOCK_BOOTTIME_ALARM 9
1383 #define TARGET_CLOCK_SGI_CYCLE 10
1384 #define TARGET_CLOCK_TAI 11
1386 UNUSED
static struct enums clockids
[] = {
1387 ENUM_TARGET(CLOCK_REALTIME
),
1388 ENUM_TARGET(CLOCK_MONOTONIC
),
1389 ENUM_TARGET(CLOCK_PROCESS_CPUTIME_ID
),
1390 ENUM_TARGET(CLOCK_THREAD_CPUTIME_ID
),
1391 ENUM_TARGET(CLOCK_MONOTONIC_RAW
),
1392 ENUM_TARGET(CLOCK_REALTIME_COARSE
),
1393 ENUM_TARGET(CLOCK_MONOTONIC_COARSE
),
1394 ENUM_TARGET(CLOCK_BOOTTIME
),
1395 ENUM_TARGET(CLOCK_REALTIME_ALARM
),
1396 ENUM_TARGET(CLOCK_BOOTTIME_ALARM
),
1397 ENUM_TARGET(CLOCK_SGI_CYCLE
),
1398 ENUM_TARGET(CLOCK_TAI
),
1402 UNUSED
static struct enums itimer_types
[] = {
1403 ENUM_GENERIC(ITIMER_REAL
),
1404 ENUM_GENERIC(ITIMER_VIRTUAL
),
1405 ENUM_GENERIC(ITIMER_PROF
),
1410 * print_xxx utility functions. These are used to print syscall
1411 * parameters in certain format. All of these have parameter
1412 * named 'last'. This parameter is used to add comma to output
1419 return ((last
) ? "" : ",");
1423 print_flags(const struct flags
*f
, abi_long flags
, int last
)
1425 const char *sep
= "";
1428 if ((flags
== 0) && (f
->f_value
== 0)) {
1429 qemu_log("%s%s", f
->f_string
, get_comma(last
));
1432 for (n
= 0; f
->f_string
!= NULL
; f
++) {
1433 if ((f
->f_value
!= 0) && ((flags
& f
->f_value
) == f
->f_value
)) {
1434 qemu_log("%s%s", sep
, f
->f_string
);
1435 flags
&= ~f
->f_value
;
1442 /* print rest of the flags as numeric */
1444 qemu_log("%s%#x%s", sep
, (unsigned int)flags
, get_comma(last
));
1446 qemu_log("%s", get_comma(last
));
1449 /* no string version of flags found, print them in hex then */
1450 qemu_log("%#x%s", (unsigned int)flags
, get_comma(last
));
1455 print_enums(const struct enums
*e
, abi_long enum_arg
, int last
)
1457 for (; e
->e_string
!= NULL
; e
++) {
1458 if (e
->e_value
== enum_arg
) {
1459 qemu_log("%s", e
->e_string
);
1464 if (e
->e_string
== NULL
) {
1465 qemu_log("%#x", (unsigned int)enum_arg
);
1468 qemu_log("%s", get_comma(last
));
1472 print_at_dirfd(abi_long dirfd
, int last
)
1475 if (dirfd
== AT_FDCWD
) {
1476 qemu_log("AT_FDCWD%s", get_comma(last
));
1480 qemu_log("%d%s", (int)dirfd
, get_comma(last
));
1484 print_file_mode(abi_long mode
, int last
)
1486 const char *sep
= "";
1487 const struct flags
*m
;
1489 for (m
= &mode_flags
[0]; m
->f_string
!= NULL
; m
++) {
1490 if ((m
->f_value
& mode
) == m
->f_value
) {
1491 qemu_log("%s%s", m
->f_string
, sep
);
1493 mode
&= ~m
->f_value
;
1499 /* print rest of the mode as octal */
1501 qemu_log("%s%#o", sep
, (unsigned int)mode
);
1503 qemu_log("%s", get_comma(last
));
1507 print_open_flags(abi_long flags
, int last
)
1509 print_flags(open_access_flags
, flags
& TARGET_O_ACCMODE
, 1);
1510 flags
&= ~TARGET_O_ACCMODE
;
1512 qemu_log("%s", get_comma(last
));
1516 print_flags(open_flags
, flags
, last
);
1520 print_syscall_prologue(const struct syscallname
*sc
)
1522 qemu_log("%s(", sc
->name
);
1527 print_syscall_epilogue(const struct syscallname
*sc
)
1534 print_string(abi_long addr
, int last
)
1538 if ((s
= lock_user_string(addr
)) != NULL
) {
1539 qemu_log("\"%s\"%s", s
, get_comma(last
));
1540 unlock_user(s
, addr
, 0);
1542 /* can't get string out of it, so print it as pointer */
1543 print_pointer(addr
, last
);
1547 #define MAX_PRINT_BUF 40
1549 print_buf(abi_long addr
, abi_long len
, int last
)
1554 s
= lock_user(VERIFY_READ
, addr
, len
, 1);
1557 for (i
= 0; i
< MAX_PRINT_BUF
&& i
< len
; i
++) {
1558 if (isprint(s
[i
])) {
1559 qemu_log("%c", s
[i
]);
1561 qemu_log("\\%o", s
[i
]);
1571 unlock_user(s
, addr
, 0);
1573 print_pointer(addr
, last
);
1578 * Prints out raw parameter using given format. Caller needs
1579 * to do byte swapping if needed.
1582 print_raw_param(const char *fmt
, abi_long param
, int last
)
1586 (void) snprintf(format
, sizeof (format
), "%s%s", fmt
, get_comma(last
));
1587 qemu_log(format
, param
);
1591 print_pointer(abi_long p
, int last
)
1594 qemu_log("NULL%s", get_comma(last
));
1596 qemu_log("0x" TARGET_ABI_FMT_lx
"%s", p
, get_comma(last
));
1600 * Reads 32-bit (int) number from guest address space from
1601 * address 'addr' and prints it.
1604 print_number(abi_long addr
, int last
)
1607 qemu_log("NULL%s", get_comma(last
));
1611 get_user_s32(num
, addr
);
1612 qemu_log("[%d]%s", num
, get_comma(last
));
1617 print_timeval(abi_ulong tv_addr
, int last
)
1620 struct target_timeval
*tv
;
1622 tv
= lock_user(VERIFY_READ
, tv_addr
, sizeof(*tv
), 1);
1624 print_pointer(tv_addr
, last
);
1627 qemu_log("{tv_sec = " TARGET_ABI_FMT_ld
1628 ",tv_usec = " TARGET_ABI_FMT_ld
"}%s",
1629 tswapal(tv
->tv_sec
), tswapal(tv
->tv_usec
), get_comma(last
));
1630 unlock_user(tv
, tv_addr
, 0);
1632 qemu_log("NULL%s", get_comma(last
));
1636 print_timespec(abi_ulong ts_addr
, int last
)
1639 struct target_timespec
*ts
;
1641 ts
= lock_user(VERIFY_READ
, ts_addr
, sizeof(*ts
), 1);
1643 print_pointer(ts_addr
, last
);
1646 qemu_log("{tv_sec = " TARGET_ABI_FMT_ld
1647 ",tv_nsec = " TARGET_ABI_FMT_ld
"}%s",
1648 tswapal(ts
->tv_sec
), tswapal(ts
->tv_nsec
), get_comma(last
));
1649 unlock_user(ts
, ts_addr
, 0);
1651 qemu_log("NULL%s", get_comma(last
));
1656 print_timezone(abi_ulong tz_addr
, int last
)
1659 struct target_timezone
*tz
;
1661 tz
= lock_user(VERIFY_READ
, tz_addr
, sizeof(*tz
), 1);
1663 print_pointer(tz_addr
, last
);
1666 qemu_log("{%d,%d}%s", tswap32(tz
->tz_minuteswest
),
1667 tswap32(tz
->tz_dsttime
), get_comma(last
));
1668 unlock_user(tz
, tz_addr
, 0);
1670 qemu_log("NULL%s", get_comma(last
));
1675 print_itimerval(abi_ulong it_addr
, int last
)
1678 qemu_log("{it_interval=");
1679 print_timeval(it_addr
+
1680 offsetof(struct target_itimerval
, it_interval
), 0);
1681 qemu_log("it_value=");
1682 print_timeval(it_addr
+
1683 offsetof(struct target_itimerval
, it_value
), 0);
1684 qemu_log("}%s", get_comma(last
));
1686 qemu_log("NULL%s", get_comma(last
));
1691 print_termios(void *arg
)
1693 const struct target_termios
*target
= arg
;
1695 target_tcflag_t iflags
= tswap32(target
->c_iflag
);
1696 target_tcflag_t oflags
= tswap32(target
->c_oflag
);
1697 target_tcflag_t cflags
= tswap32(target
->c_cflag
);
1698 target_tcflag_t lflags
= tswap32(target
->c_lflag
);
1702 qemu_log("c_iflag = ");
1703 print_flags(termios_iflags
, iflags
, 0);
1705 qemu_log("c_oflag = ");
1706 target_tcflag_t oflags_clean
= oflags
& ~(TARGET_NLDLY
| TARGET_CRDLY
|
1707 TARGET_TABDLY
| TARGET_BSDLY
|
1708 TARGET_VTDLY
| TARGET_FFDLY
);
1709 print_flags(termios_oflags
, oflags_clean
, 0);
1710 if (oflags
& TARGET_NLDLY
) {
1711 print_enums(termios_oflags_NLDLY
, oflags
& TARGET_NLDLY
, 0);
1713 if (oflags
& TARGET_CRDLY
) {
1714 print_enums(termios_oflags_CRDLY
, oflags
& TARGET_CRDLY
, 0);
1716 if (oflags
& TARGET_TABDLY
) {
1717 print_enums(termios_oflags_TABDLY
, oflags
& TARGET_TABDLY
, 0);
1719 if (oflags
& TARGET_BSDLY
) {
1720 print_enums(termios_oflags_BSDLY
, oflags
& TARGET_BSDLY
, 0);
1722 if (oflags
& TARGET_VTDLY
) {
1723 print_enums(termios_oflags_VTDLY
, oflags
& TARGET_VTDLY
, 0);
1725 if (oflags
& TARGET_FFDLY
) {
1726 print_enums(termios_oflags_FFDLY
, oflags
& TARGET_FFDLY
, 0);
1729 qemu_log("c_cflag = ");
1730 if (cflags
& TARGET_CBAUD
) {
1731 print_enums(termios_cflags_CBAUD
, cflags
& TARGET_CBAUD
, 0);
1733 if (cflags
& TARGET_CSIZE
) {
1734 print_enums(termios_cflags_CSIZE
, cflags
& TARGET_CSIZE
, 0);
1736 target_tcflag_t cflags_clean
= cflags
& ~(TARGET_CBAUD
| TARGET_CSIZE
);
1737 print_flags(termios_cflags
, cflags_clean
, 0);
1739 qemu_log("c_lflag = ");
1740 print_flags(termios_lflags
, lflags
, 0);
1742 qemu_log("c_cc = ");
1743 qemu_log("\"%s\",", target
->c_cc
);
1745 qemu_log("c_line = ");
1746 print_raw_param("\'%c\'", target
->c_line
, 1);
1753 #ifdef TARGET_NR_accept
1755 print_accept(CPUArchState
*cpu_env
, const struct syscallname
*name
,
1756 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1757 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1759 print_syscall_prologue(name
);
1760 print_raw_param("%d", arg0
, 0);
1761 print_pointer(arg1
, 0);
1762 print_number(arg2
, 1);
1763 print_syscall_epilogue(name
);
1767 #ifdef TARGET_NR_access
1769 print_access(CPUArchState
*cpu_env
, const struct syscallname
*name
,
1770 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1771 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1773 print_syscall_prologue(name
);
1774 print_string(arg0
, 0);
1775 print_flags(access_flags
, arg1
, 1);
1776 print_syscall_epilogue(name
);
1780 #ifdef TARGET_NR_acct
1782 print_acct(CPUArchState
*cpu_env
, const struct syscallname
*name
,
1783 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1784 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1786 print_syscall_prologue(name
);
1787 print_string(arg0
, 1);
1788 print_syscall_epilogue(name
);
1792 #ifdef TARGET_NR_brk
1794 print_brk(CPUArchState
*cpu_env
, const struct syscallname
*name
,
1795 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1796 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1798 print_syscall_prologue(name
);
1799 print_pointer(arg0
, 1);
1800 print_syscall_epilogue(name
);
1804 #ifdef TARGET_NR_chdir
1806 print_chdir(CPUArchState
*cpu_env
, const struct syscallname
*name
,
1807 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1808 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1810 print_syscall_prologue(name
);
1811 print_string(arg0
, 1);
1812 print_syscall_epilogue(name
);
1816 #ifdef TARGET_NR_chroot
1818 print_chroot(CPUArchState
*cpu_env
, const struct syscallname
*name
,
1819 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1820 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1822 print_syscall_prologue(name
);
1823 print_string(arg0
, 1);
1824 print_syscall_epilogue(name
);
1828 #ifdef TARGET_NR_chmod
1830 print_chmod(CPUArchState
*cpu_env
, const struct syscallname
*name
,
1831 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1832 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1834 print_syscall_prologue(name
);
1835 print_string(arg0
, 0);
1836 print_file_mode(arg1
, 1);
1837 print_syscall_epilogue(name
);
1841 #if defined(TARGET_NR_chown) || defined(TARGET_NR_lchown)
1843 print_chown(CPUArchState
*cpu_env
, const struct syscallname
*name
,
1844 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1845 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1847 print_syscall_prologue(name
);
1848 print_string(arg0
, 0);
1849 print_raw_param("%d", arg1
, 0);
1850 print_raw_param("%d", arg2
, 1);
1851 print_syscall_epilogue(name
);
1853 #define print_lchown print_chown
1856 #ifdef TARGET_NR_clock_adjtime
1858 print_clock_adjtime(CPUArchState
*cpu_env
, const struct syscallname
*name
,
1859 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1860 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1862 print_syscall_prologue(name
);
1863 print_enums(clockids
, arg0
, 0);
1864 print_pointer(arg1
, 1);
1865 print_syscall_epilogue(name
);
1869 #ifdef TARGET_NR_clone
1870 static void do_print_clone(unsigned int flags
, abi_ulong newsp
,
1871 abi_ulong parent_tidptr
, target_ulong newtls
,
1872 abi_ulong child_tidptr
)
1874 print_flags(clone_flags
, flags
, 0);
1875 print_raw_param("child_stack=0x" TARGET_ABI_FMT_lx
, newsp
, 0);
1876 print_raw_param("parent_tidptr=0x" TARGET_ABI_FMT_lx
, parent_tidptr
, 0);
1877 print_raw_param("tls=0x" TARGET_ABI_FMT_lx
, newtls
, 0);
1878 print_raw_param("child_tidptr=0x" TARGET_ABI_FMT_lx
, child_tidptr
, 1);
1882 print_clone(CPUArchState
*cpu_env
, const struct syscallname
*name
,
1883 abi_long arg1
, abi_long arg2
, abi_long arg3
,
1884 abi_long arg4
, abi_long arg5
, abi_long arg6
)
1886 print_syscall_prologue(name
);
1887 #if defined(TARGET_MICROBLAZE)
1888 do_print_clone(arg1
, arg2
, arg4
, arg6
, arg5
);
1889 #elif defined(TARGET_CLONE_BACKWARDS)
1890 do_print_clone(arg1
, arg2
, arg3
, arg4
, arg5
);
1891 #elif defined(TARGET_CLONE_BACKWARDS2)
1892 do_print_clone(arg2
, arg1
, arg3
, arg5
, arg4
);
1894 do_print_clone(arg1
, arg2
, arg3
, arg5
, arg4
);
1896 print_syscall_epilogue(name
);
1900 #ifdef TARGET_NR_creat
1902 print_creat(CPUArchState
*cpu_env
, const struct syscallname
*name
,
1903 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1904 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1906 print_syscall_prologue(name
);
1907 print_string(arg0
, 0);
1908 print_file_mode(arg1
, 1);
1909 print_syscall_epilogue(name
);
1913 #ifdef TARGET_NR_execv
1915 print_execv(CPUArchState
*cpu_env
, const struct syscallname
*name
,
1916 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1917 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1919 print_syscall_prologue(name
);
1920 print_string(arg0
, 0);
1921 print_raw_param("0x" TARGET_ABI_FMT_lx
, arg1
, 1);
1922 print_syscall_epilogue(name
);
1926 #ifdef TARGET_NR_faccessat
1928 print_faccessat(CPUArchState
*cpu_env
, const struct syscallname
*name
,
1929 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1930 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1932 print_syscall_prologue(name
);
1933 print_at_dirfd(arg0
, 0);
1934 print_string(arg1
, 0);
1935 print_flags(access_flags
, arg2
, 0);
1936 print_flags(at_file_flags
, arg3
, 1);
1937 print_syscall_epilogue(name
);
1941 #ifdef TARGET_NR_fallocate
1943 print_fallocate(CPUArchState
*cpu_env
, const struct syscallname
*name
,
1944 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1945 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1947 print_syscall_prologue(name
);
1948 print_raw_param("%d", arg0
, 0);
1949 print_flags(falloc_flags
, arg1
, 0);
1950 #if TARGET_ABI_BITS == 32
1951 print_raw_param("%" PRIu64
, target_offset64(arg2
, arg3
), 0);
1952 print_raw_param("%" PRIu64
, target_offset64(arg4
, arg5
), 1);
1954 print_raw_param(TARGET_ABI_FMT_ld
, arg2
, 0);
1955 print_raw_param(TARGET_ABI_FMT_ld
, arg3
, 1);
1957 print_syscall_epilogue(name
);
1961 #ifdef TARGET_NR_fchmodat
1963 print_fchmodat(CPUArchState
*cpu_env
, const struct syscallname
*name
,
1964 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1965 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1967 print_syscall_prologue(name
);
1968 print_at_dirfd(arg0
, 0);
1969 print_string(arg1
, 0);
1970 print_file_mode(arg2
, 0);
1971 print_flags(at_file_flags
, arg3
, 1);
1972 print_syscall_epilogue(name
);
1976 #ifdef TARGET_NR_fchownat
1978 print_fchownat(CPUArchState
*cpu_env
, const struct syscallname
*name
,
1979 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1980 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1982 print_syscall_prologue(name
);
1983 print_at_dirfd(arg0
, 0);
1984 print_string(arg1
, 0);
1985 print_raw_param("%d", arg2
, 0);
1986 print_raw_param("%d", arg3
, 0);
1987 print_flags(at_file_flags
, arg4
, 1);
1988 print_syscall_epilogue(name
);
1992 #if defined(TARGET_NR_fcntl) || defined(TARGET_NR_fcntl64)
1994 print_fcntl(CPUArchState
*cpu_env
, const struct syscallname
*name
,
1995 abi_long arg0
, abi_long arg1
, abi_long arg2
,
1996 abi_long arg3
, abi_long arg4
, abi_long arg5
)
1998 print_syscall_prologue(name
);
1999 print_raw_param("%d", arg0
, 0);
2001 case TARGET_F_DUPFD
:
2002 qemu_log("F_DUPFD,");
2003 print_raw_param(TARGET_ABI_FMT_ld
, arg2
, 1);
2005 case TARGET_F_GETFD
:
2006 qemu_log("F_GETFD");
2008 case TARGET_F_SETFD
:
2009 qemu_log("F_SETFD,");
2010 print_raw_param(TARGET_ABI_FMT_ld
, arg2
, 1);
2012 case TARGET_F_GETFL
:
2013 qemu_log("F_GETFL");
2015 case TARGET_F_SETFL
:
2016 qemu_log("F_SETFL,");
2017 print_open_flags(arg2
, 1);
2019 case TARGET_F_GETLK
:
2020 qemu_log("F_GETLK,");
2021 print_pointer(arg2
, 1);
2023 case TARGET_F_SETLK
:
2024 qemu_log("F_SETLK,");
2025 print_pointer(arg2
, 1);
2027 case TARGET_F_SETLKW
:
2028 qemu_log("F_SETLKW,");
2029 print_pointer(arg2
, 1);
2031 case TARGET_F_GETOWN
:
2032 qemu_log("F_GETOWN");
2034 case TARGET_F_SETOWN
:
2035 qemu_log("F_SETOWN,");
2036 print_raw_param(TARGET_ABI_FMT_ld
, arg2
, 0);
2038 case TARGET_F_GETSIG
:
2039 qemu_log("F_GETSIG");
2041 case TARGET_F_SETSIG
:
2042 qemu_log("F_SETSIG,");
2043 print_raw_param(TARGET_ABI_FMT_ld
, arg2
, 0);
2045 #if TARGET_ABI_BITS == 32
2046 case TARGET_F_GETLK64
:
2047 qemu_log("F_GETLK64,");
2048 print_pointer(arg2
, 1);
2050 case TARGET_F_SETLK64
:
2051 qemu_log("F_SETLK64,");
2052 print_pointer(arg2
, 1);
2054 case TARGET_F_SETLKW64
:
2055 qemu_log("F_SETLKW64,");
2056 print_pointer(arg2
, 1);
2059 case TARGET_F_OFD_GETLK
:
2060 qemu_log("F_OFD_GETLK,");
2061 print_pointer(arg2
, 1);
2063 case TARGET_F_OFD_SETLK
:
2064 qemu_log("F_OFD_SETLK,");
2065 print_pointer(arg2
, 1);
2067 case TARGET_F_OFD_SETLKW
:
2068 qemu_log("F_OFD_SETLKW,");
2069 print_pointer(arg2
, 1);
2071 case TARGET_F_SETLEASE
:
2072 qemu_log("F_SETLEASE,");
2073 print_raw_param(TARGET_ABI_FMT_ld
, arg2
, 1);
2075 case TARGET_F_GETLEASE
:
2076 qemu_log("F_GETLEASE");
2078 #ifdef F_DUPFD_CLOEXEC
2079 case TARGET_F_DUPFD_CLOEXEC
:
2080 qemu_log("F_DUPFD_CLOEXEC,");
2081 print_raw_param(TARGET_ABI_FMT_ld
, arg2
, 1);
2084 case TARGET_F_NOTIFY
:
2085 qemu_log("F_NOTIFY,");
2086 print_raw_param(TARGET_ABI_FMT_ld
, arg2
, 1);
2089 case TARGET_F_GETOWN_EX
:
2090 qemu_log("F_GETOWN_EX,");
2091 print_pointer(arg2
, 1);
2095 case TARGET_F_SETOWN_EX
:
2096 qemu_log("F_SETOWN_EX,");
2097 print_pointer(arg2
, 1);
2101 case TARGET_F_SETPIPE_SZ
:
2102 qemu_log("F_SETPIPE_SZ,");
2103 print_raw_param(TARGET_ABI_FMT_ld
, arg2
, 1);
2105 case TARGET_F_GETPIPE_SZ
:
2106 qemu_log("F_GETPIPE_SZ");
2110 case TARGET_F_ADD_SEALS
:
2111 qemu_log("F_ADD_SEALS,");
2112 print_raw_param("0x"TARGET_ABI_FMT_lx
, arg2
, 1);
2114 case TARGET_F_GET_SEALS
:
2115 qemu_log("F_GET_SEALS");
2119 print_raw_param(TARGET_ABI_FMT_ld
, arg1
, 0);
2120 print_pointer(arg2
, 1);
2123 print_syscall_epilogue(name
);
2125 #define print_fcntl64 print_fcntl
2128 #ifdef TARGET_NR_fgetxattr
2130 print_fgetxattr(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2131 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2132 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2134 print_syscall_prologue(name
);
2135 print_raw_param("%d", arg0
, 0);
2136 print_string(arg1
, 0);
2137 print_pointer(arg2
, 0);
2138 print_raw_param(TARGET_FMT_lu
, arg3
, 1);
2139 print_syscall_epilogue(name
);
2143 #ifdef TARGET_NR_flistxattr
2145 print_flistxattr(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2146 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2147 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2149 print_syscall_prologue(name
);
2150 print_raw_param("%d", arg0
, 0);
2151 print_pointer(arg1
, 0);
2152 print_raw_param(TARGET_FMT_lu
, arg2
, 1);
2153 print_syscall_epilogue(name
);
2157 #if defined(TARGET_NR_getxattr) || defined(TARGET_NR_lgetxattr)
2159 print_getxattr(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2160 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2161 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2163 print_syscall_prologue(name
);
2164 print_string(arg0
, 0);
2165 print_string(arg1
, 0);
2166 print_pointer(arg2
, 0);
2167 print_raw_param(TARGET_FMT_lu
, arg3
, 1);
2168 print_syscall_epilogue(name
);
2170 #define print_lgetxattr print_getxattr
2173 #if defined(TARGET_NR_listxattr) || defined(TARGET_NR_llistxattr)
2175 print_listxattr(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2176 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2177 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2179 print_syscall_prologue(name
);
2180 print_string(arg0
, 0);
2181 print_pointer(arg1
, 0);
2182 print_raw_param(TARGET_FMT_lu
, arg2
, 1);
2183 print_syscall_epilogue(name
);
2185 #define print_llistxattr print_listxattr
2188 #if defined(TARGET_NR_fremovexattr)
2190 print_fremovexattr(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2191 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2192 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2194 print_syscall_prologue(name
);
2195 print_raw_param("%d", arg0
, 0);
2196 print_string(arg1
, 1);
2197 print_syscall_epilogue(name
);
2201 #if defined(TARGET_NR_removexattr) || defined(TARGET_NR_lremovexattr)
2203 print_removexattr(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2204 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2205 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2207 print_syscall_prologue(name
);
2208 print_string(arg0
, 0);
2209 print_string(arg1
, 1);
2210 print_syscall_epilogue(name
);
2212 #define print_lremovexattr print_removexattr
2215 #ifdef TARGET_NR_futimesat
2217 print_futimesat(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2218 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2219 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2221 print_syscall_prologue(name
);
2222 print_at_dirfd(arg0
, 0);
2223 print_string(arg1
, 0);
2224 print_timeval(arg2
, 0);
2225 print_timeval(arg2
+ sizeof (struct target_timeval
), 1);
2226 print_syscall_epilogue(name
);
2230 #ifdef TARGET_NR_gettimeofday
2232 print_gettimeofday(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2233 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2234 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2236 print_syscall_prologue(name
);
2237 print_pointer(arg0
, 0);
2238 print_pointer(arg1
, 1);
2239 print_syscall_epilogue(name
);
2243 #ifdef TARGET_NR_settimeofday
2245 print_settimeofday(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2246 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2247 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2249 print_syscall_prologue(name
);
2250 print_timeval(arg0
, 0);
2251 print_timezone(arg1
, 1);
2252 print_syscall_epilogue(name
);
2256 #if defined(TARGET_NR_clock_gettime) || defined(TARGET_NR_clock_getres)
2258 print_clock_gettime(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2259 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2260 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2262 print_syscall_prologue(name
);
2263 print_enums(clockids
, arg0
, 0);
2264 print_pointer(arg1
, 1);
2265 print_syscall_epilogue(name
);
2267 #define print_clock_getres print_clock_gettime
2270 #ifdef TARGET_NR_clock_settime
2272 print_clock_settime(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2273 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2274 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2276 print_syscall_prologue(name
);
2277 print_enums(clockids
, arg0
, 0);
2278 print_timespec(arg1
, 1);
2279 print_syscall_epilogue(name
);
2283 #ifdef TARGET_NR_getitimer
2285 print_getitimer(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2286 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2287 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2289 print_syscall_prologue(name
);
2290 print_enums(itimer_types
, arg0
, 0);
2291 print_pointer(arg1
, 1);
2292 print_syscall_epilogue(name
);
2296 #ifdef TARGET_NR_setitimer
2298 print_setitimer(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2299 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2300 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2302 print_syscall_prologue(name
);
2303 print_enums(itimer_types
, arg0
, 0);
2304 print_itimerval(arg1
, 0);
2305 print_pointer(arg2
, 1);
2306 print_syscall_epilogue(name
);
2310 #ifdef TARGET_NR_link
2312 print_link(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2313 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2314 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2316 print_syscall_prologue(name
);
2317 print_string(arg0
, 0);
2318 print_string(arg1
, 1);
2319 print_syscall_epilogue(name
);
2323 #ifdef TARGET_NR_linkat
2325 print_linkat(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2326 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2327 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2329 print_syscall_prologue(name
);
2330 print_at_dirfd(arg0
, 0);
2331 print_string(arg1
, 0);
2332 print_at_dirfd(arg2
, 0);
2333 print_string(arg3
, 0);
2334 print_flags(at_file_flags
, arg4
, 1);
2335 print_syscall_epilogue(name
);
2339 #if defined(TARGET_NR__llseek) || defined(TARGET_NR_llseek)
2341 print__llseek(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2342 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2343 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2345 const char *whence
= "UNKNOWN";
2346 print_syscall_prologue(name
);
2347 print_raw_param("%d", arg0
, 0);
2348 print_raw_param("%ld", arg1
, 0);
2349 print_raw_param("%ld", arg2
, 0);
2350 print_pointer(arg3
, 0);
2352 case SEEK_SET
: whence
= "SEEK_SET"; break;
2353 case SEEK_CUR
: whence
= "SEEK_CUR"; break;
2354 case SEEK_END
: whence
= "SEEK_END"; break;
2356 qemu_log("%s", whence
);
2357 print_syscall_epilogue(name
);
2359 #define print_llseek print__llseek
2362 #ifdef TARGET_NR_lseek
2364 print_lseek(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2365 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2366 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2368 print_syscall_prologue(name
);
2369 print_raw_param("%d", arg0
, 0);
2370 print_raw_param(TARGET_ABI_FMT_ld
, arg1
, 0);
2373 qemu_log("SEEK_SET"); break;
2375 qemu_log("SEEK_CUR"); break;
2377 qemu_log("SEEK_END"); break;
2380 qemu_log("SEEK_DATA"); break;
2384 qemu_log("SEEK_HOLE"); break;
2387 print_raw_param("%#x", arg2
, 1);
2389 print_syscall_epilogue(name
);
2393 #ifdef TARGET_NR_truncate
2395 print_truncate(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2396 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2397 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2399 print_syscall_prologue(name
);
2400 print_string(arg0
, 0);
2401 print_raw_param(TARGET_ABI_FMT_ld
, arg1
, 1);
2402 print_syscall_epilogue(name
);
2406 #ifdef TARGET_NR_truncate64
2408 print_truncate64(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2409 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2410 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2412 print_syscall_prologue(name
);
2413 print_string(arg0
, 0);
2414 if (regpairs_aligned(cpu_env
, TARGET_NR_truncate64
)) {
2418 print_raw_param("%" PRIu64
, target_offset64(arg1
, arg2
), 1);
2419 print_syscall_epilogue(name
);
2423 #ifdef TARGET_NR_ftruncate64
2425 print_ftruncate64(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2426 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2427 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2429 print_syscall_prologue(name
);
2430 print_raw_param("%d", arg0
, 0);
2431 if (regpairs_aligned(cpu_env
, TARGET_NR_ftruncate64
)) {
2435 print_raw_param("%" PRIu64
, target_offset64(arg1
, arg2
), 1);
2436 print_syscall_epilogue(name
);
2440 #ifdef TARGET_NR_mlockall
2442 print_mlockall(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2443 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2444 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2446 print_syscall_prologue(name
);
2447 print_flags(mlockall_flags
, arg0
, 1);
2448 print_syscall_epilogue(name
);
2452 #if defined(TARGET_NR_socket)
2454 print_socket(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2455 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2456 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2458 abi_ulong domain
= arg0
, type
= arg1
, protocol
= arg2
;
2460 print_syscall_prologue(name
);
2461 print_socket_domain(domain
);
2463 print_socket_type(type
);
2465 if (domain
== AF_PACKET
||
2466 (domain
== AF_INET
&& type
== TARGET_SOCK_PACKET
)) {
2467 protocol
= tswap16(protocol
);
2469 print_socket_protocol(domain
, type
, protocol
);
2470 print_syscall_epilogue(name
);
2475 #if defined(TARGET_NR_socketcall) || defined(TARGET_NR_bind)
2477 static void print_sockfd(abi_long sockfd
, int last
)
2479 print_raw_param(TARGET_ABI_FMT_ld
, sockfd
, last
);
2484 #if defined(TARGET_NR_socketcall)
2486 #define get_user_ualx(x, gaddr, idx) \
2487 get_user_ual(x, (gaddr) + (idx) * sizeof(abi_long))
2489 static void do_print_socket(const char *name
, abi_long arg1
)
2491 abi_ulong domain
, type
, protocol
;
2493 get_user_ualx(domain
, arg1
, 0);
2494 get_user_ualx(type
, arg1
, 1);
2495 get_user_ualx(protocol
, arg1
, 2);
2496 qemu_log("%s(", name
);
2497 print_socket_domain(domain
);
2499 print_socket_type(type
);
2501 if (domain
== AF_PACKET
||
2502 (domain
== AF_INET
&& type
== TARGET_SOCK_PACKET
)) {
2503 protocol
= tswap16(protocol
);
2505 print_socket_protocol(domain
, type
, protocol
);
2509 static void do_print_sockaddr(const char *name
, abi_long arg1
)
2511 abi_ulong sockfd
, addr
, addrlen
;
2513 get_user_ualx(sockfd
, arg1
, 0);
2514 get_user_ualx(addr
, arg1
, 1);
2515 get_user_ualx(addrlen
, arg1
, 2);
2517 qemu_log("%s(", name
);
2518 print_sockfd(sockfd
, 0);
2519 print_sockaddr(addr
, addrlen
, 0);
2523 static void do_print_listen(const char *name
, abi_long arg1
)
2525 abi_ulong sockfd
, backlog
;
2527 get_user_ualx(sockfd
, arg1
, 0);
2528 get_user_ualx(backlog
, arg1
, 1);
2530 qemu_log("%s(", name
);
2531 print_sockfd(sockfd
, 0);
2532 print_raw_param(TARGET_ABI_FMT_ld
, backlog
, 1);
2536 static void do_print_socketpair(const char *name
, abi_long arg1
)
2538 abi_ulong domain
, type
, protocol
, tab
;
2540 get_user_ualx(domain
, arg1
, 0);
2541 get_user_ualx(type
, arg1
, 1);
2542 get_user_ualx(protocol
, arg1
, 2);
2543 get_user_ualx(tab
, arg1
, 3);
2545 qemu_log("%s(", name
);
2546 print_socket_domain(domain
);
2548 print_socket_type(type
);
2550 print_socket_protocol(domain
, type
, protocol
);
2552 print_raw_param(TARGET_ABI_FMT_lx
, tab
, 1);
2556 static void do_print_sendrecv(const char *name
, abi_long arg1
)
2558 abi_ulong sockfd
, msg
, len
, flags
;
2560 get_user_ualx(sockfd
, arg1
, 0);
2561 get_user_ualx(msg
, arg1
, 1);
2562 get_user_ualx(len
, arg1
, 2);
2563 get_user_ualx(flags
, arg1
, 3);
2565 qemu_log("%s(", name
);
2566 print_sockfd(sockfd
, 0);
2567 print_buf(msg
, len
, 0);
2568 print_raw_param(TARGET_ABI_FMT_ld
, len
, 0);
2569 print_flags(msg_flags
, flags
, 1);
2573 static void do_print_msgaddr(const char *name
, abi_long arg1
)
2575 abi_ulong sockfd
, msg
, len
, flags
, addr
, addrlen
;
2577 get_user_ualx(sockfd
, arg1
, 0);
2578 get_user_ualx(msg
, arg1
, 1);
2579 get_user_ualx(len
, arg1
, 2);
2580 get_user_ualx(flags
, arg1
, 3);
2581 get_user_ualx(addr
, arg1
, 4);
2582 get_user_ualx(addrlen
, arg1
, 5);
2584 qemu_log("%s(", name
);
2585 print_sockfd(sockfd
, 0);
2586 print_buf(msg
, len
, 0);
2587 print_raw_param(TARGET_ABI_FMT_ld
, len
, 0);
2588 print_flags(msg_flags
, flags
, 0);
2589 print_sockaddr(addr
, addrlen
, 0);
2593 static void do_print_shutdown(const char *name
, abi_long arg1
)
2595 abi_ulong sockfd
, how
;
2597 get_user_ualx(sockfd
, arg1
, 0);
2598 get_user_ualx(how
, arg1
, 1);
2600 qemu_log("shutdown(");
2601 print_sockfd(sockfd
, 0);
2604 qemu_log("SHUT_RD");
2607 qemu_log("SHUT_WR");
2610 qemu_log("SHUT_RDWR");
2613 print_raw_param(TARGET_ABI_FMT_ld
, how
, 1);
2619 static void do_print_msg(const char *name
, abi_long arg1
)
2621 abi_ulong sockfd
, msg
, flags
;
2623 get_user_ualx(sockfd
, arg1
, 0);
2624 get_user_ualx(msg
, arg1
, 1);
2625 get_user_ualx(flags
, arg1
, 2);
2627 qemu_log("%s(", name
);
2628 print_sockfd(sockfd
, 0);
2629 print_pointer(msg
, 0);
2630 print_flags(msg_flags
, flags
, 1);
2634 static void do_print_sockopt(const char *name
, abi_long arg1
)
2636 abi_ulong sockfd
, level
, optname
, optval
, optlen
;
2638 get_user_ualx(sockfd
, arg1
, 0);
2639 get_user_ualx(level
, arg1
, 1);
2640 get_user_ualx(optname
, arg1
, 2);
2641 get_user_ualx(optval
, arg1
, 3);
2642 get_user_ualx(optlen
, arg1
, 4);
2644 qemu_log("%s(", name
);
2645 print_sockfd(sockfd
, 0);
2648 qemu_log("SOL_TCP,");
2649 print_raw_param(TARGET_ABI_FMT_ld
, optname
, 0);
2650 print_pointer(optval
, 0);
2653 qemu_log("SOL_UDP,");
2654 print_raw_param(TARGET_ABI_FMT_ld
, optname
, 0);
2655 print_pointer(optval
, 0);
2658 qemu_log("SOL_IP,");
2659 print_raw_param(TARGET_ABI_FMT_ld
, optname
, 0);
2660 print_pointer(optval
, 0);
2663 qemu_log("SOL_RAW,");
2664 print_raw_param(TARGET_ABI_FMT_ld
, optname
, 0);
2665 print_pointer(optval
, 0);
2667 case TARGET_SOL_SOCKET
:
2668 qemu_log("SOL_SOCKET,");
2670 case TARGET_SO_DEBUG
:
2671 qemu_log("SO_DEBUG,");
2673 print_number(optval
, 0);
2675 case TARGET_SO_REUSEADDR
:
2676 qemu_log("SO_REUSEADDR,");
2678 case TARGET_SO_REUSEPORT
:
2679 qemu_log("SO_REUSEPORT,");
2681 case TARGET_SO_TYPE
:
2682 qemu_log("SO_TYPE,");
2684 case TARGET_SO_ERROR
:
2685 qemu_log("SO_ERROR,");
2687 case TARGET_SO_DONTROUTE
:
2688 qemu_log("SO_DONTROUTE,");
2690 case TARGET_SO_BROADCAST
:
2691 qemu_log("SO_BROADCAST,");
2693 case TARGET_SO_SNDBUF
:
2694 qemu_log("SO_SNDBUF,");
2696 case TARGET_SO_RCVBUF
:
2697 qemu_log("SO_RCVBUF,");
2699 case TARGET_SO_KEEPALIVE
:
2700 qemu_log("SO_KEEPALIVE,");
2702 case TARGET_SO_OOBINLINE
:
2703 qemu_log("SO_OOBINLINE,");
2705 case TARGET_SO_NO_CHECK
:
2706 qemu_log("SO_NO_CHECK,");
2708 case TARGET_SO_PRIORITY
:
2709 qemu_log("SO_PRIORITY,");
2711 case TARGET_SO_BSDCOMPAT
:
2712 qemu_log("SO_BSDCOMPAT,");
2714 case TARGET_SO_PASSCRED
:
2715 qemu_log("SO_PASSCRED,");
2717 case TARGET_SO_TIMESTAMP
:
2718 qemu_log("SO_TIMESTAMP,");
2720 case TARGET_SO_RCVLOWAT
:
2721 qemu_log("SO_RCVLOWAT,");
2723 case TARGET_SO_RCVTIMEO
:
2724 qemu_log("SO_RCVTIMEO,");
2725 print_timeval(optval
, 0);
2727 case TARGET_SO_SNDTIMEO
:
2728 qemu_log("SO_SNDTIMEO,");
2729 print_timeval(optval
, 0);
2731 case TARGET_SO_ATTACH_FILTER
: {
2732 struct target_sock_fprog
*fprog
;
2734 qemu_log("SO_ATTACH_FILTER,");
2736 if (lock_user_struct(VERIFY_READ
, fprog
, optval
, 0)) {
2737 struct target_sock_filter
*filter
;
2739 if (lock_user_struct(VERIFY_READ
, filter
,
2740 tswapal(fprog
->filter
), 0)) {
2742 for (i
= 0; i
< tswap16(fprog
->len
) - 1; i
++) {
2743 qemu_log("[%d]{0x%x,%d,%d,0x%x},",
2744 i
, tswap16(filter
[i
].code
),
2745 filter
[i
].jt
, filter
[i
].jf
,
2746 tswap32(filter
[i
].k
));
2748 qemu_log("[%d]{0x%x,%d,%d,0x%x}",
2749 i
, tswap16(filter
[i
].code
),
2750 filter
[i
].jt
, filter
[i
].jf
,
2751 tswap32(filter
[i
].k
));
2753 qemu_log(TARGET_ABI_FMT_lx
, tswapal(fprog
->filter
));
2755 qemu_log(",%d},", tswap16(fprog
->len
));
2756 unlock_user(fprog
, optval
, 0);
2758 print_pointer(optval
, 0);
2763 print_raw_param(TARGET_ABI_FMT_ld
, optname
, 0);
2764 print_pointer(optval
, 0);
2769 qemu_log("SOL_IPV6,");
2771 case IPV6_MTU_DISCOVER
:
2772 qemu_log("IPV6_MTU_DISCOVER,");
2775 qemu_log("IPV6_MTU,");
2778 qemu_log("IPV6_V6ONLY,");
2780 case IPV6_RECVPKTINFO
:
2781 qemu_log("IPV6_RECVPKTINFO,");
2783 case IPV6_UNICAST_HOPS
:
2784 qemu_log("IPV6_UNICAST_HOPS,");
2786 case IPV6_MULTICAST_HOPS
:
2787 qemu_log("IPV6_MULTICAST_HOPS,");
2789 case IPV6_MULTICAST_LOOP
:
2790 qemu_log("IPV6_MULTICAST_LOOP,");
2793 qemu_log("IPV6_RECVERR,");
2795 case IPV6_RECVHOPLIMIT
:
2796 qemu_log("IPV6_RECVHOPLIMIT,");
2798 case IPV6_2292HOPLIMIT
:
2799 qemu_log("IPV6_2292HOPLIMIT,");
2802 qemu_log("IPV6_CHECKSUM,");
2805 qemu_log("IPV6_ADDRFORM,");
2807 case IPV6_2292PKTINFO
:
2808 qemu_log("IPV6_2292PKTINFO,");
2810 case IPV6_RECVTCLASS
:
2811 qemu_log("IPV6_RECVTCLASS,");
2813 case IPV6_RECVRTHDR
:
2814 qemu_log("IPV6_RECVRTHDR,");
2816 case IPV6_2292RTHDR
:
2817 qemu_log("IPV6_2292RTHDR,");
2819 case IPV6_RECVHOPOPTS
:
2820 qemu_log("IPV6_RECVHOPOPTS,");
2822 case IPV6_2292HOPOPTS
:
2823 qemu_log("IPV6_2292HOPOPTS,");
2825 case IPV6_RECVDSTOPTS
:
2826 qemu_log("IPV6_RECVDSTOPTS,");
2828 case IPV6_2292DSTOPTS
:
2829 qemu_log("IPV6_2292DSTOPTS,");
2832 qemu_log("IPV6_TCLASS,");
2834 case IPV6_ADDR_PREFERENCES
:
2835 qemu_log("IPV6_ADDR_PREFERENCES,");
2837 #ifdef IPV6_RECVPATHMTU
2838 case IPV6_RECVPATHMTU
:
2839 qemu_log("IPV6_RECVPATHMTU,");
2842 #ifdef IPV6_TRANSPARENT
2843 case IPV6_TRANSPARENT
:
2844 qemu_log("IPV6_TRANSPARENT,");
2847 #ifdef IPV6_FREEBIND
2849 qemu_log("IPV6_FREEBIND,");
2852 #ifdef IPV6_RECVORIGDSTADDR
2853 case IPV6_RECVORIGDSTADDR
:
2854 qemu_log("IPV6_RECVORIGDSTADDR,");
2858 qemu_log("IPV6_PKTINFO,");
2859 print_pointer(optval
, 0);
2861 case IPV6_ADD_MEMBERSHIP
:
2862 qemu_log("IPV6_ADD_MEMBERSHIP,");
2863 print_pointer(optval
, 0);
2865 case IPV6_DROP_MEMBERSHIP
:
2866 qemu_log("IPV6_DROP_MEMBERSHIP,");
2867 print_pointer(optval
, 0);
2870 print_raw_param(TARGET_ABI_FMT_ld
, optname
, 0);
2871 print_pointer(optval
, 0);
2876 print_raw_param(TARGET_ABI_FMT_ld
, level
, 0);
2877 print_raw_param(TARGET_ABI_FMT_ld
, optname
, 0);
2878 print_pointer(optval
, 0);
2881 print_raw_param(TARGET_ABI_FMT_ld
, optlen
, 1);
2885 #define PRINT_SOCKOP(name, func) \
2886 [TARGET_SYS_##name] = { #name, func }
2890 void (*print
)(const char *, abi_long
);
2892 PRINT_SOCKOP(SOCKET
, do_print_socket
),
2893 PRINT_SOCKOP(BIND
, do_print_sockaddr
),
2894 PRINT_SOCKOP(CONNECT
, do_print_sockaddr
),
2895 PRINT_SOCKOP(LISTEN
, do_print_listen
),
2896 PRINT_SOCKOP(ACCEPT
, do_print_sockaddr
),
2897 PRINT_SOCKOP(GETSOCKNAME
, do_print_sockaddr
),
2898 PRINT_SOCKOP(GETPEERNAME
, do_print_sockaddr
),
2899 PRINT_SOCKOP(SOCKETPAIR
, do_print_socketpair
),
2900 PRINT_SOCKOP(SEND
, do_print_sendrecv
),
2901 PRINT_SOCKOP(RECV
, do_print_sendrecv
),
2902 PRINT_SOCKOP(SENDTO
, do_print_msgaddr
),
2903 PRINT_SOCKOP(RECVFROM
, do_print_msgaddr
),
2904 PRINT_SOCKOP(SHUTDOWN
, do_print_shutdown
),
2905 PRINT_SOCKOP(SETSOCKOPT
, do_print_sockopt
),
2906 PRINT_SOCKOP(GETSOCKOPT
, do_print_sockopt
),
2907 PRINT_SOCKOP(SENDMSG
, do_print_msg
),
2908 PRINT_SOCKOP(RECVMSG
, do_print_msg
),
2909 PRINT_SOCKOP(ACCEPT4
, NULL
),
2910 PRINT_SOCKOP(RECVMMSG
, NULL
),
2911 PRINT_SOCKOP(SENDMMSG
, NULL
),
2915 print_socketcall(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2916 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2917 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2919 if (arg0
>= 0 && arg0
< ARRAY_SIZE(scall
) && scall
[arg0
].print
) {
2920 scall
[arg0
].print(scall
[arg0
].name
, arg1
);
2923 print_syscall_prologue(name
);
2924 print_raw_param(TARGET_ABI_FMT_ld
, arg0
, 0);
2925 print_raw_param(TARGET_ABI_FMT_ld
, arg1
, 0);
2926 print_raw_param(TARGET_ABI_FMT_ld
, arg2
, 0);
2927 print_raw_param(TARGET_ABI_FMT_ld
, arg3
, 0);
2928 print_raw_param(TARGET_ABI_FMT_ld
, arg4
, 0);
2929 print_raw_param(TARGET_ABI_FMT_ld
, arg5
, 0);
2930 print_syscall_epilogue(name
);
2934 #if defined(TARGET_NR_bind)
2936 print_bind(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2937 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2938 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2940 print_syscall_prologue(name
);
2941 print_sockfd(arg0
, 0);
2942 print_sockaddr(arg1
, arg2
, 1);
2943 print_syscall_epilogue(name
);
2947 #if defined(TARGET_NR_stat) || defined(TARGET_NR_stat64) || \
2948 defined(TARGET_NR_lstat) || defined(TARGET_NR_lstat64)
2950 print_stat(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2951 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2952 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2954 print_syscall_prologue(name
);
2955 print_string(arg0
, 0);
2956 print_pointer(arg1
, 1);
2957 print_syscall_epilogue(name
);
2959 #define print_lstat print_stat
2960 #define print_stat64 print_stat
2961 #define print_lstat64 print_stat
2964 #if defined(TARGET_NR_fstat) || defined(TARGET_NR_fstat64)
2966 print_fstat(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2967 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2968 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2970 print_syscall_prologue(name
);
2971 print_raw_param("%d", arg0
, 0);
2972 print_pointer(arg1
, 1);
2973 print_syscall_epilogue(name
);
2975 #define print_fstat64 print_fstat
2978 #ifdef TARGET_NR_mkdir
2980 print_mkdir(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2981 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2982 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2984 print_syscall_prologue(name
);
2985 print_string(arg0
, 0);
2986 print_file_mode(arg1
, 1);
2987 print_syscall_epilogue(name
);
2991 #ifdef TARGET_NR_mkdirat
2993 print_mkdirat(CPUArchState
*cpu_env
, const struct syscallname
*name
,
2994 abi_long arg0
, abi_long arg1
, abi_long arg2
,
2995 abi_long arg3
, abi_long arg4
, abi_long arg5
)
2997 print_syscall_prologue(name
);
2998 print_at_dirfd(arg0
, 0);
2999 print_string(arg1
, 0);
3000 print_file_mode(arg2
, 1);
3001 print_syscall_epilogue(name
);
3005 #ifdef TARGET_NR_rmdir
3007 print_rmdir(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3008 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3009 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3011 print_syscall_prologue(name
);
3012 print_string(arg0
, 0);
3013 print_syscall_epilogue(name
);
3017 #ifdef TARGET_NR_rt_sigaction
3019 print_rt_sigaction(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3020 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3021 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3023 print_syscall_prologue(name
);
3024 print_signal(arg0
, 0);
3025 print_pointer(arg1
, 0);
3026 print_pointer(arg2
, 1);
3027 print_syscall_epilogue(name
);
3031 #ifdef TARGET_NR_rt_sigprocmask
3033 print_rt_sigprocmask(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3034 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3035 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3037 const char *how
= "UNKNOWN";
3038 print_syscall_prologue(name
);
3040 case TARGET_SIG_BLOCK
: how
= "SIG_BLOCK"; break;
3041 case TARGET_SIG_UNBLOCK
: how
= "SIG_UNBLOCK"; break;
3042 case TARGET_SIG_SETMASK
: how
= "SIG_SETMASK"; break;
3044 qemu_log("%s,", how
);
3045 print_pointer(arg1
, 0);
3046 print_pointer(arg2
, 1);
3047 print_syscall_epilogue(name
);
3051 #ifdef TARGET_NR_rt_sigqueueinfo
3053 print_rt_sigqueueinfo(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3054 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3055 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3058 target_siginfo_t uinfo
;
3060 print_syscall_prologue(name
);
3061 print_raw_param("%d", arg0
, 0);
3062 print_signal(arg1
, 0);
3063 p
= lock_user(VERIFY_READ
, arg2
, sizeof(target_siginfo_t
), 1);
3065 get_target_siginfo(&uinfo
, p
);
3066 print_siginfo(&uinfo
);
3068 unlock_user(p
, arg2
, 0);
3070 print_pointer(arg2
, 1);
3072 print_syscall_epilogue(name
);
3076 #ifdef TARGET_NR_rt_tgsigqueueinfo
3078 print_rt_tgsigqueueinfo(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3079 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3080 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3083 target_siginfo_t uinfo
;
3085 print_syscall_prologue(name
);
3086 print_raw_param("%d", arg0
, 0);
3087 print_raw_param("%d", arg1
, 0);
3088 print_signal(arg2
, 0);
3089 p
= lock_user(VERIFY_READ
, arg3
, sizeof(target_siginfo_t
), 1);
3091 get_target_siginfo(&uinfo
, p
);
3092 print_siginfo(&uinfo
);
3094 unlock_user(p
, arg3
, 0);
3096 print_pointer(arg3
, 1);
3098 print_syscall_epilogue(name
);
3102 #ifdef TARGET_NR_syslog
3104 print_syslog_action(abi_ulong arg
, int last
)
3109 case TARGET_SYSLOG_ACTION_CLOSE
: {
3110 type
= "SYSLOG_ACTION_CLOSE";
3113 case TARGET_SYSLOG_ACTION_OPEN
: {
3114 type
= "SYSLOG_ACTION_OPEN";
3117 case TARGET_SYSLOG_ACTION_READ
: {
3118 type
= "SYSLOG_ACTION_READ";
3121 case TARGET_SYSLOG_ACTION_READ_ALL
: {
3122 type
= "SYSLOG_ACTION_READ_ALL";
3125 case TARGET_SYSLOG_ACTION_READ_CLEAR
: {
3126 type
= "SYSLOG_ACTION_READ_CLEAR";
3129 case TARGET_SYSLOG_ACTION_CLEAR
: {
3130 type
= "SYSLOG_ACTION_CLEAR";
3133 case TARGET_SYSLOG_ACTION_CONSOLE_OFF
: {
3134 type
= "SYSLOG_ACTION_CONSOLE_OFF";
3137 case TARGET_SYSLOG_ACTION_CONSOLE_ON
: {
3138 type
= "SYSLOG_ACTION_CONSOLE_ON";
3141 case TARGET_SYSLOG_ACTION_CONSOLE_LEVEL
: {
3142 type
= "SYSLOG_ACTION_CONSOLE_LEVEL";
3145 case TARGET_SYSLOG_ACTION_SIZE_UNREAD
: {
3146 type
= "SYSLOG_ACTION_SIZE_UNREAD";
3149 case TARGET_SYSLOG_ACTION_SIZE_BUFFER
: {
3150 type
= "SYSLOG_ACTION_SIZE_BUFFER";
3154 print_raw_param("%ld", arg
, last
);
3158 qemu_log("%s%s", type
, get_comma(last
));
3162 print_syslog(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3163 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3164 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3166 print_syscall_prologue(name
);
3167 print_syslog_action(arg0
, 0);
3168 print_pointer(arg1
, 0);
3169 print_raw_param("%d", arg2
, 1);
3170 print_syscall_epilogue(name
);
3174 #ifdef TARGET_NR_mknod
3176 print_mknod(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3177 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3178 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3180 int hasdev
= (arg1
& (S_IFCHR
|S_IFBLK
));
3182 print_syscall_prologue(name
);
3183 print_string(arg0
, 0);
3184 print_file_mode(arg1
, (hasdev
== 0));
3186 print_raw_param("makedev(%d", major(arg2
), 0);
3187 print_raw_param("%d)", minor(arg2
), 1);
3189 print_syscall_epilogue(name
);
3193 #ifdef TARGET_NR_mknodat
3195 print_mknodat(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3196 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3197 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3199 int hasdev
= (arg2
& (S_IFCHR
|S_IFBLK
));
3201 print_syscall_prologue(name
);
3202 print_at_dirfd(arg0
, 0);
3203 print_string(arg1
, 0);
3204 print_file_mode(arg2
, (hasdev
== 0));
3206 print_raw_param("makedev(%d", major(arg3
), 0);
3207 print_raw_param("%d)", minor(arg3
), 1);
3209 print_syscall_epilogue(name
);
3213 #ifdef TARGET_NR_mq_open
3215 print_mq_open(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3216 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3217 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3219 int is_creat
= (arg1
& TARGET_O_CREAT
);
3221 print_syscall_prologue(name
);
3222 print_string(arg0
, 0);
3223 print_open_flags(arg1
, (is_creat
== 0));
3225 print_file_mode(arg2
, 0);
3226 print_pointer(arg3
, 1);
3228 print_syscall_epilogue(name
);
3232 #ifdef TARGET_NR_open
3234 print_open(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3235 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3236 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3238 int is_creat
= (arg1
& TARGET_O_CREAT
);
3240 print_syscall_prologue(name
);
3241 print_string(arg0
, 0);
3242 print_open_flags(arg1
, (is_creat
== 0));
3244 print_file_mode(arg2
, 1);
3245 print_syscall_epilogue(name
);
3249 #ifdef TARGET_NR_openat
3251 print_openat(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3252 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3253 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3255 int is_creat
= (arg2
& TARGET_O_CREAT
);
3257 print_syscall_prologue(name
);
3258 print_at_dirfd(arg0
, 0);
3259 print_string(arg1
, 0);
3260 print_open_flags(arg2
, (is_creat
== 0));
3262 print_file_mode(arg3
, 1);
3263 print_syscall_epilogue(name
);
3267 #ifdef TARGET_NR_mq_unlink
3269 print_mq_unlink(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3270 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3271 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3273 print_syscall_prologue(name
);
3274 print_string(arg0
, 1);
3275 print_syscall_epilogue(name
);
3279 #if defined(TARGET_NR_fstatat64) || defined(TARGET_NR_newfstatat)
3281 print_fstatat64(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3282 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3283 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3285 print_syscall_prologue(name
);
3286 print_at_dirfd(arg0
, 0);
3287 print_string(arg1
, 0);
3288 print_pointer(arg2
, 0);
3289 print_flags(at_file_flags
, arg3
, 1);
3290 print_syscall_epilogue(name
);
3292 #define print_newfstatat print_fstatat64
3295 #ifdef TARGET_NR_readlink
3297 print_readlink(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3298 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3299 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3301 print_syscall_prologue(name
);
3302 print_string(arg0
, 0);
3303 print_pointer(arg1
, 0);
3304 print_raw_param("%u", arg2
, 1);
3305 print_syscall_epilogue(name
);
3309 #ifdef TARGET_NR_readlinkat
3311 print_readlinkat(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3312 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3313 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3315 print_syscall_prologue(name
);
3316 print_at_dirfd(arg0
, 0);
3317 print_string(arg1
, 0);
3318 print_pointer(arg2
, 0);
3319 print_raw_param("%u", arg3
, 1);
3320 print_syscall_epilogue(name
);
3324 #ifdef TARGET_NR_rename
3326 print_rename(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3327 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3328 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3330 print_syscall_prologue(name
);
3331 print_string(arg0
, 0);
3332 print_string(arg1
, 1);
3333 print_syscall_epilogue(name
);
3337 #ifdef TARGET_NR_renameat
3339 print_renameat(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3340 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3341 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3343 print_syscall_prologue(name
);
3344 print_at_dirfd(arg0
, 0);
3345 print_string(arg1
, 0);
3346 print_at_dirfd(arg2
, 0);
3347 print_string(arg3
, 1);
3348 print_syscall_epilogue(name
);
3352 #ifdef TARGET_NR_statfs
3354 print_statfs(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3355 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3356 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3358 print_syscall_prologue(name
);
3359 print_string(arg0
, 0);
3360 print_pointer(arg1
, 1);
3361 print_syscall_epilogue(name
);
3365 #ifdef TARGET_NR_statfs64
3367 print_statfs64(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3368 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3369 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3371 print_syscall_prologue(name
);
3372 print_string(arg0
, 0);
3373 print_pointer(arg1
, 1);
3374 print_syscall_epilogue(name
);
3378 #ifdef TARGET_NR_symlink
3380 print_symlink(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3381 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3382 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3384 print_syscall_prologue(name
);
3385 print_string(arg0
, 0);
3386 print_string(arg1
, 1);
3387 print_syscall_epilogue(name
);
3391 #ifdef TARGET_NR_symlinkat
3393 print_symlinkat(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3394 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3395 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3397 print_syscall_prologue(name
);
3398 print_string(arg0
, 0);
3399 print_at_dirfd(arg1
, 0);
3400 print_string(arg2
, 1);
3401 print_syscall_epilogue(name
);
3405 #ifdef TARGET_NR_mount
3407 print_mount(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3408 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3409 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3411 print_syscall_prologue(name
);
3412 print_string(arg0
, 0);
3413 print_string(arg1
, 0);
3414 print_string(arg2
, 0);
3415 print_flags(mount_flags
, arg3
, 0);
3416 print_pointer(arg4
, 1);
3417 print_syscall_epilogue(name
);
3421 #ifdef TARGET_NR_umount
3423 print_umount(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3424 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3425 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3427 print_syscall_prologue(name
);
3428 print_string(arg0
, 1);
3429 print_syscall_epilogue(name
);
3433 #ifdef TARGET_NR_umount2
3435 print_umount2(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3436 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3437 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3439 print_syscall_prologue(name
);
3440 print_string(arg0
, 0);
3441 print_flags(umount2_flags
, arg1
, 1);
3442 print_syscall_epilogue(name
);
3446 #ifdef TARGET_NR_unlink
3448 print_unlink(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3449 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3450 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3452 print_syscall_prologue(name
);
3453 print_string(arg0
, 1);
3454 print_syscall_epilogue(name
);
3458 #ifdef TARGET_NR_unlinkat
3460 print_unlinkat(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3461 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3462 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3464 print_syscall_prologue(name
);
3465 print_at_dirfd(arg0
, 0);
3466 print_string(arg1
, 0);
3467 print_flags(unlinkat_flags
, arg2
, 1);
3468 print_syscall_epilogue(name
);
3472 #ifdef TARGET_NR_unshare
3474 print_unshare(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3475 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3476 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3478 print_syscall_prologue(name
);
3479 print_flags(clone_flags
, arg0
, 1);
3480 print_syscall_epilogue(name
);
3484 #ifdef TARGET_NR_utime
3486 print_utime(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3487 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3488 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3490 print_syscall_prologue(name
);
3491 print_string(arg0
, 0);
3492 print_pointer(arg1
, 1);
3493 print_syscall_epilogue(name
);
3497 #ifdef TARGET_NR_utimes
3499 print_utimes(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3500 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3501 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3503 print_syscall_prologue(name
);
3504 print_string(arg0
, 0);
3505 print_pointer(arg1
, 1);
3506 print_syscall_epilogue(name
);
3510 #ifdef TARGET_NR_utimensat
3512 print_utimensat(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3513 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3514 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3516 print_syscall_prologue(name
);
3517 print_at_dirfd(arg0
, 0);
3518 print_string(arg1
, 0);
3519 print_pointer(arg2
, 0);
3520 print_flags(at_file_flags
, arg3
, 1);
3521 print_syscall_epilogue(name
);
3525 #if defined(TARGET_NR_mmap) || defined(TARGET_NR_mmap2)
3527 print_mmap(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3528 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3529 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3531 print_syscall_prologue(name
);
3532 print_pointer(arg0
, 0);
3533 print_raw_param("%d", arg1
, 0);
3534 print_flags(mmap_prot_flags
, arg2
, 0);
3535 print_flags(mmap_flags
, arg3
, 0);
3536 print_raw_param("%d", arg4
, 0);
3537 print_raw_param("%#x", arg5
, 1);
3538 print_syscall_epilogue(name
);
3540 #define print_mmap2 print_mmap
3543 #ifdef TARGET_NR_mprotect
3545 print_mprotect(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3546 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3547 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3549 print_syscall_prologue(name
);
3550 print_pointer(arg0
, 0);
3551 print_raw_param("%d", arg1
, 0);
3552 print_flags(mmap_prot_flags
, arg2
, 1);
3553 print_syscall_epilogue(name
);
3557 #ifdef TARGET_NR_munmap
3559 print_munmap(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3560 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3561 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3563 print_syscall_prologue(name
);
3564 print_pointer(arg0
, 0);
3565 print_raw_param("%d", arg1
, 1);
3566 print_syscall_epilogue(name
);
3570 #ifdef TARGET_NR_futex
3571 static void print_futex_op(abi_long tflag
, int last
)
3573 #define print_op(val) \
3574 if( cmd == val ) { \
3579 int cmd
= (int)tflag
;
3580 #ifdef FUTEX_PRIVATE_FLAG
3581 if (cmd
& FUTEX_PRIVATE_FLAG
) {
3582 qemu_log("FUTEX_PRIVATE_FLAG|");
3583 cmd
&= ~FUTEX_PRIVATE_FLAG
;
3586 #ifdef FUTEX_CLOCK_REALTIME
3587 if (cmd
& FUTEX_CLOCK_REALTIME
) {
3588 qemu_log("FUTEX_CLOCK_REALTIME|");
3589 cmd
&= ~FUTEX_CLOCK_REALTIME
;
3592 print_op(FUTEX_WAIT
)
3593 print_op(FUTEX_WAKE
)
3595 print_op(FUTEX_REQUEUE
)
3596 print_op(FUTEX_CMP_REQUEUE
)
3597 print_op(FUTEX_WAKE_OP
)
3598 print_op(FUTEX_LOCK_PI
)
3599 print_op(FUTEX_UNLOCK_PI
)
3600 print_op(FUTEX_TRYLOCK_PI
)
3601 #ifdef FUTEX_WAIT_BITSET
3602 print_op(FUTEX_WAIT_BITSET
)
3604 #ifdef FUTEX_WAKE_BITSET
3605 print_op(FUTEX_WAKE_BITSET
)
3607 /* unknown values */
3608 qemu_log("%d", cmd
);
3612 print_futex(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3613 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3614 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3616 print_syscall_prologue(name
);
3617 print_pointer(arg0
, 0);
3618 print_futex_op(arg1
, 0);
3619 print_raw_param(",%d", arg2
, 0);
3620 print_pointer(arg3
, 0); /* struct timespec */
3621 print_pointer(arg4
, 0);
3622 print_raw_param("%d", arg4
, 1);
3623 print_syscall_epilogue(name
);
3627 #ifdef TARGET_NR_kill
3629 print_kill(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3630 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3631 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3633 print_syscall_prologue(name
);
3634 print_raw_param("%d", arg0
, 0);
3635 print_signal(arg1
, 1);
3636 print_syscall_epilogue(name
);
3640 #ifdef TARGET_NR_tkill
3642 print_tkill(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3643 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3644 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3646 print_syscall_prologue(name
);
3647 print_raw_param("%d", arg0
, 0);
3648 print_signal(arg1
, 1);
3649 print_syscall_epilogue(name
);
3653 #ifdef TARGET_NR_tgkill
3655 print_tgkill(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3656 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3657 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3659 print_syscall_prologue(name
);
3660 print_raw_param("%d", arg0
, 0);
3661 print_raw_param("%d", arg1
, 0);
3662 print_signal(arg2
, 1);
3663 print_syscall_epilogue(name
);
3667 #ifdef TARGET_NR_statx
3669 print_statx(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3670 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3671 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3673 print_syscall_prologue(name
);
3674 print_at_dirfd(arg0
, 0);
3675 print_string(arg1
, 0);
3676 print_flags(statx_flags
, arg2
, 0);
3677 print_flags(statx_mask
, arg3
, 0);
3678 print_pointer(arg4
, 1);
3679 print_syscall_epilogue(name
);
3683 #ifdef TARGET_NR_ioctl
3685 print_ioctl(CPUArchState
*cpu_env
, const struct syscallname
*name
,
3686 abi_long arg0
, abi_long arg1
, abi_long arg2
,
3687 abi_long arg3
, abi_long arg4
, abi_long arg5
)
3689 print_syscall_prologue(name
);
3690 print_raw_param("%d", arg0
, 0);
3692 const IOCTLEntry
*ie
;
3693 const argtype
*arg_type
;
3697 for (ie
= ioctl_entries
; ie
->target_cmd
!= 0; ie
++) {
3698 if (ie
->target_cmd
== arg1
) {
3703 if (ie
->target_cmd
== 0) {
3704 print_raw_param("%#x", arg1
, 0);
3705 print_raw_param("%#x", arg2
, 1);
3707 qemu_log("%s", ie
->name
);
3708 arg_type
= ie
->arg_type
;
3710 if (arg_type
[0] != TYPE_NULL
) {
3713 switch (arg_type
[0]) {
3715 print_pointer(arg2
, 1);
3720 print_raw_param("%d", arg2
, 1);
3723 print_raw_param(TARGET_ABI_FMT_ld
, arg2
, 1);
3726 print_raw_param(TARGET_ABI_FMT_lu
, arg2
, 1);
3729 switch (ie
->access
) {
3731 print_pointer(arg2
, 1);
3736 target_size
= thunk_type_size(arg_type
, 0);
3737 argptr
= lock_user(VERIFY_READ
, arg2
, target_size
, 1);
3739 thunk_print(argptr
, arg_type
);
3740 unlock_user(argptr
, arg2
, target_size
);
3742 print_pointer(arg2
, 1);
3748 g_assert_not_reached();
3752 print_syscall_epilogue(name
);
3757 * An array of all of the syscalls we know about
3760 static const struct syscallname scnames
[] = {
3761 #include "strace.list"
3764 static int nsyscalls
= ARRAY_SIZE(scnames
);
3767 * The public interface to this module.
3770 print_syscall(CPUArchState
*cpu_env
, int num
,
3771 abi_long arg1
, abi_long arg2
, abi_long arg3
,
3772 abi_long arg4
, abi_long arg5
, abi_long arg6
)
3775 const char *format
="%s(" TARGET_ABI_FMT_ld
"," TARGET_ABI_FMT_ld
"," TARGET_ABI_FMT_ld
"," TARGET_ABI_FMT_ld
"," TARGET_ABI_FMT_ld
"," TARGET_ABI_FMT_ld
")";
3777 qemu_log("%d ", getpid());
3779 for(i
=0;i
<nsyscalls
;i
++)
3780 if( scnames
[i
].nr
== num
) {
3781 if( scnames
[i
].call
!= NULL
) {
3783 cpu_env
, &scnames
[i
], arg1
, arg2
, arg3
, arg4
, arg5
, arg6
);
3785 /* XXX: this format system is broken because it uses
3786 host types and host pointers for strings */
3787 if( scnames
[i
].format
!= NULL
)
3788 format
= scnames
[i
].format
;
3790 scnames
[i
].name
, arg1
, arg2
, arg3
, arg4
, arg5
, arg6
);
3794 qemu_log("Unknown syscall %d\n", num
);
3799 print_syscall_ret(CPUArchState
*cpu_env
, int num
, abi_long ret
,
3800 abi_long arg1
, abi_long arg2
, abi_long arg3
,
3801 abi_long arg4
, abi_long arg5
, abi_long arg6
)
3805 for(i
=0;i
<nsyscalls
;i
++)
3806 if( scnames
[i
].nr
== num
) {
3807 if( scnames
[i
].result
!= NULL
) {
3808 scnames
[i
].result(cpu_env
, &scnames
[i
], ret
,
3812 if (!print_syscall_err(ret
)) {
3813 qemu_log(TARGET_ABI_FMT_ld
, ret
);
3821 void print_taken_signal(int target_signum
, const target_siginfo_t
*tinfo
)
3823 /* Print the strace output for a signal being taken:
3824 * --- SIGSEGV {si_signo=SIGSEGV, si_code=SI_KERNEL, si_addr=0} ---
3827 print_signal(target_signum
, 1);
3829 print_siginfo(tinfo
);