2 * Copyright (c) 1991, 1992 Paul Kranenburg <pk@cs.few.eur.nl>
3 * Copyright (c) 1993 Branko Lankester <branko@hacktic.nl>
4 * Copyright (c) 1993, 1994, 1995, 1996 Rick Sladkey <jrs@world.std.com>
5 * Copyright (c) 1996-1999 Wichert Akkerman <wichert@cistron.nl>
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * 3. The name of the author may not be used to endorse or promote products
17 * derived from this software without specific prior written permission.
19 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
20 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
21 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
22 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
23 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
24 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38 sys_read(struct tcb *tcp)
41 printfd(tcp, tcp->u_arg[0]);
45 tprintf("%#lx", tcp->u_arg[1]);
47 printstr(tcp, tcp->u_arg[1], tcp->u_rval);
48 tprintf(", %lu", tcp->u_arg[2]);
54 sys_write(struct tcb *tcp)
57 printfd(tcp, tcp->u_arg[0]);
59 printstr(tcp, tcp->u_arg[1], tcp->u_arg[2]);
60 tprintf(", %lu", tcp->u_arg[2]);
67 tprint_iov(struct tcb *tcp, unsigned long len, unsigned long addr, int decode_iov)
69 #if SUPPORTED_PERSONALITIES > 1
71 struct { u_int32_t base; u_int32_t len; } iov32;
72 struct { u_int64_t base; u_int64_t len; } iov64;
75 (personality_wordsize[current_personality] == 4 \
76 ? sizeof(iov.iov32) : sizeof(iov.iov64))
77 #define iov_iov_base \
78 (personality_wordsize[current_personality] == 4 \
79 ? (u_int64_t) iov.iov32.base : iov.iov64.base)
81 (personality_wordsize[current_personality] == 4 \
82 ? (u_int64_t) iov.iov32.len : iov.iov64.len)
85 #define sizeof_iov sizeof(iov)
86 #define iov_iov_base iov.iov_base
87 #define iov_iov_len iov.iov_len
89 unsigned long size, cur, end, abbrev_end;
96 size = len * sizeof_iov;
98 if (!verbose(tcp) || size / sizeof_iov != len || end < addr) {
99 tprintf("%#lx", addr);
103 abbrev_end = addr + max_strlen * sizeof_iov;
104 if (abbrev_end < addr)
110 for (cur = addr; cur < end; cur += sizeof_iov) {
113 if (cur >= abbrev_end) {
117 if (umoven(tcp, cur, sizeof_iov, (char *) &iov) < 0) {
124 printstr(tcp, (long) iov_iov_base, iov_iov_len);
126 tprintf("%#lx", (long) iov_iov_base);
127 tprintf(", %lu}", (unsigned long)iov_iov_len);
131 tprintf(" %#lx", addr);
138 sys_readv(struct tcb *tcp)
141 printfd(tcp, tcp->u_arg[0]);
146 tcp->u_arg[1], tcp->u_arg[2]);
149 tprint_iov(tcp, tcp->u_arg[2], tcp->u_arg[1], 1);
150 tprintf(", %lu", tcp->u_arg[2]);
156 sys_writev(struct tcb *tcp)
159 printfd(tcp, tcp->u_arg[0]);
161 tprint_iov(tcp, tcp->u_arg[2], tcp->u_arg[1], 1);
162 tprintf(", %lu", tcp->u_arg[2]);
168 /* The SH4 ABI does allow long longs in odd-numbered registers, but
169 does not allow them to be split between registers and memory - and
170 there are only four argument registers for normal functions. As a
171 result pread takes an extra padding argument before the offset. This
172 was changed late in the 2.4 series (around 2.4.20). */
174 #define PREAD_OFFSET_ARG 4
176 #define PREAD_OFFSET_ARG 3
180 sys_pread(struct tcb *tcp)
183 printfd(tcp, tcp->u_arg[0]);
187 tprintf("%#lx", tcp->u_arg[1]);
189 printstr(tcp, tcp->u_arg[1], tcp->u_rval);
190 tprintf(", %lu, ", tcp->u_arg[2]);
191 printllval(tcp, "%llu", PREAD_OFFSET_ARG);
197 sys_pwrite(struct tcb *tcp)
200 printfd(tcp, tcp->u_arg[0]);
202 printstr(tcp, tcp->u_arg[1], tcp->u_arg[2]);
203 tprintf(", %lu, ", tcp->u_arg[2]);
204 printllval(tcp, "%llu", PREAD_OFFSET_ARG);
211 sys_preadv(struct tcb *tcp)
214 printfd(tcp, tcp->u_arg[0]);
218 tprintf("%#lx, %lu", tcp->u_arg[1], tcp->u_arg[2]);
221 tprint_iov(tcp, tcp->u_arg[2], tcp->u_arg[1], 1);
222 tprintf(", %lu, ", tcp->u_arg[2]);
223 printllval(tcp, "%llu", PREAD_OFFSET_ARG);
229 sys_pwritev(struct tcb *tcp)
232 printfd(tcp, tcp->u_arg[0]);
234 tprint_iov(tcp, tcp->u_arg[2], tcp->u_arg[1], 1);
235 tprintf(", %lu, ", tcp->u_arg[2]);
236 printllval(tcp, "%llu", PREAD_OFFSET_ARG);
240 #endif /* HAVE_SYS_UIO_H */
243 sys_sendfile(struct tcb *tcp)
248 printfd(tcp, tcp->u_arg[0]);
250 printfd(tcp, tcp->u_arg[1]);
254 else if (umove(tcp, tcp->u_arg[2], &offset) < 0)
255 tprintf("%#lx", tcp->u_arg[2]);
257 #ifdef HAVE_LONG_LONG_OFF_T
258 tprintf("[%llu]", offset);
260 tprintf("[%lu]", offset);
262 tprintf(", %lu", tcp->u_arg[3]);
268 print_loff_t(struct tcb *tcp, long addr)
274 else if (umove(tcp, addr, &offset) < 0)
275 tprintf("%#lx", addr);
277 tprintf("[%llu]", (unsigned long long int) offset);
281 sys_sendfile64(struct tcb *tcp)
284 printfd(tcp, tcp->u_arg[0]);
286 printfd(tcp, tcp->u_arg[1]);
288 print_loff_t(tcp, tcp->u_arg[2]);
289 tprintf(", %lu", tcp->u_arg[3]);
294 static const struct xlat splice_flags[] = {
296 { SPLICE_F_MOVE, "SPLICE_F_MOVE" },
298 #ifdef SPLICE_F_NONBLOCK
299 { SPLICE_F_NONBLOCK, "SPLICE_F_NONBLOCK" },
302 { SPLICE_F_MORE, "SPLICE_F_MORE" },
305 { SPLICE_F_GIFT, "SPLICE_F_GIFT" },
311 sys_tee(struct tcb *tcp)
315 printfd(tcp, tcp->u_arg[0]);
318 printfd(tcp, tcp->u_arg[1]);
321 tprintf("%lu, ", tcp->u_arg[2]);
322 /* unsigned int flags */
323 printflags(splice_flags, tcp->u_arg[3], "SPLICE_F_???");
329 sys_splice(struct tcb *tcp)
333 printfd(tcp, tcp->u_arg[0]);
336 print_loff_t(tcp, tcp->u_arg[1]);
339 printfd(tcp, tcp->u_arg[2]);
341 /* loff_t *off_out */
342 print_loff_t(tcp, tcp->u_arg[3]);
345 tprintf("%lu, ", tcp->u_arg[4]);
346 /* unsigned int flags */
347 printflags(splice_flags, tcp->u_arg[5], "SPLICE_F_???");
353 sys_vmsplice(struct tcb *tcp)
357 printfd(tcp, tcp->u_arg[0]);
359 /* const struct iovec *iov, unsigned long nr_segs */
360 tprint_iov(tcp, tcp->u_arg[2], tcp->u_arg[1], 1);
361 tprintf(", %lu, ", tcp->u_arg[2]);
362 /* unsigned int flags */
363 printflags(splice_flags, tcp->u_arg[3], "SPLICE_F_???");
369 sys_ioctl(struct tcb *tcp)
371 const struct ioctlent *iop;
374 printfd(tcp, tcp->u_arg[0]);
376 iop = ioctl_lookup(tcp->u_arg[1]);
378 tprints(iop->symbol);
379 while ((iop = ioctl_next_match(iop)))
380 tprintf(" or %s", iop->symbol);
382 tprintf("%#lx", tcp->u_arg[1]);
383 ioctl_decode(tcp, tcp->u_arg[1], tcp->u_arg[2]);
386 int ret = ioctl_decode(tcp, tcp->u_arg[1], tcp->u_arg[2]);
388 tprintf(", %#lx", tcp->u_arg[2]);