[PATCH] xtensa: always retrieve all syscall arguments
chris at zankel.net
Mon May 6 23:49:01 UTC 2013
On 05/06/2013 04:15 PM, Dmitry V. Levin wrote:
> On Mon, May 06, 2013 at 03:17:55PM -0700, Chris Zankel wrote:
>> The number of arguments specified in syscallent.h does not include
>> registers that are skipped to align 64-bit arguments to even/odd
>> register pairs. So, always retrieve all registers used for arguments.
> The number of arguments specified in syscallent.h is used for two purposes:
> - it is the number of syscall arguments to fetch from registers
> (and maybe memory on some architectures);
> - it is also the number of syscall arguments to print by printargs
> (and in rare cases by other parsers).
> Fetching all registers is not the best approach to fix the issue
> for two reasons:
> - printargs would still print wrong number of arguments;
> - on xtensa, every extra argument fetch means extra upeek call.
> I'd prefer to have syscallent.h fixed instead.
Thanks for your feedback, but I'm not sure what the right fix is.
As you said, the n-args field in syscallent serves two purposes. In the
case of readahead (int fd, off64_t offset, size_t count), for example,
these two numbers would differ:
The syscall arguments are in a6 (fd), a3 (skipped), a4/a5 (offset),
Number of arguments to readahead is 3,
Number of registers used for arguments is 4,
Number of actual registers used is 5,
Now, readahead, and possibly all other syscalls that take 64-bit
arguments are handled by specific functions, so the problem doesn't
really exist in those cases. However, looking at arm (5), powerpc (5),
mips (5), tile (4), x86 (4), they seem to use the syscallent field as
the number of registers that need to be fetched from the kernel rather
than the number of arguments printed.
I can change syscallent to reflect the number of registers used
including skipped (or shifted) registers. Let me know.
(You are right that the extra argument fetch means extra upeeks, so it's
probably better to avoid that. Note that it doesn't have any effect on
the number of arguments printed)
Note also that SH uses 5 registers for readahead, so, presumably it also
needs to be added to the arch that needs 'shifted' arguments (but I'm
not too familiar with SH).
More information about the Strace-devel