Move SH-specific argument number calculation to getllval
This change prevents scattering of ll-related hacks and simplifies pread/pwrite syscalls parsers' logic a bit. * util.c (getllval): Add fixup for arg_no for SuperH when argument number is equal to 3. * io.c (PREAD_OFFSET_ARG): Remove. (SYS_FUNC(pread)): Always use argument number 3 for "count" argument printing. (SYS_FUNC(pwrite)): Likewise.
This commit is contained in:
parent
ae5feb49c2
commit
714a162048
15
io.c
15
io.c
@ -150,17 +150,6 @@ SYS_FUNC(writev)
|
||||
return RVAL_DECODED;
|
||||
}
|
||||
|
||||
/* The SH4 ABI does allow long longs in odd-numbered registers, but
|
||||
does not allow them to be split between registers and memory - and
|
||||
there are only four argument registers for normal functions. As a
|
||||
result pread takes an extra padding argument before the offset. This
|
||||
was changed late in the 2.4 series (around 2.4.20). */
|
||||
#if defined(SH)
|
||||
#define PREAD_OFFSET_ARG 4
|
||||
#else
|
||||
#define PREAD_OFFSET_ARG 3
|
||||
#endif
|
||||
|
||||
SYS_FUNC(pread)
|
||||
{
|
||||
if (entering(tcp)) {
|
||||
@ -172,7 +161,7 @@ SYS_FUNC(pread)
|
||||
else
|
||||
printstr(tcp, tcp->u_arg[1], tcp->u_rval);
|
||||
tprintf(", %lu, ", tcp->u_arg[2]);
|
||||
printllval(tcp, "%lld", PREAD_OFFSET_ARG);
|
||||
printllval(tcp, "%lld", 3);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -183,7 +172,7 @@ SYS_FUNC(pwrite)
|
||||
tprints(", ");
|
||||
printstr(tcp, tcp->u_arg[1], tcp->u_arg[2]);
|
||||
tprintf(", %lu, ", tcp->u_arg[2]);
|
||||
printllval(tcp, "%lld", PREAD_OFFSET_ARG);
|
||||
printllval(tcp, "%lld", 3);
|
||||
|
||||
return RVAL_DECODED;
|
||||
}
|
||||
|
12
util.c
12
util.c
@ -275,7 +275,17 @@ getllval(struct tcb *tcp, unsigned long long *val, int arg_no)
|
||||
defined XTENSA
|
||||
/* Align arg_no to the next even number. */
|
||||
arg_no = (arg_no + 1) & 0xe;
|
||||
# endif
|
||||
# elif defined SH
|
||||
/*
|
||||
* The SH4 ABI does allow long longs in odd-numbered registers, but
|
||||
* does not allow them to be split between registers and memory - and
|
||||
* there are only four argument registers for normal functions. As a
|
||||
* result, pread, for example, takes an extra padding argument before
|
||||
* the offset. This was changed late in the 2.4 series (around 2.4.20).
|
||||
*/
|
||||
if (arg_no == 3)
|
||||
arg_no++;
|
||||
# endif /* __ARM_EABI__ || LINUX_MIPSO32 || POWERPC || XTENSA || SH */
|
||||
*val = LONG_LONG(tcp->u_arg[arg_no], tcp->u_arg[arg_no + 1]);
|
||||
arg_no += 2;
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user