From: Andy Lutomirski
> Sent: 25 January 2018 21:31
...
> Another potentially useful if rather minor optimization would be to
> rejigger the SYSCALL_DEFINE macros a bit.  Currently we treat all
> syscalls like this:
> 
> long func(long arg0, long arg1, long arg2, long arg3, long arg4, long arg5);
> 
> I wonder if we'd be better off doing:
> 
> long func(const struct pt_regs *regs);
> 
> and autogenerating:
> 
> static long SyS_read(const struct pt_regs *regs)
> {
>    return sys_reg(regs->di, ...);
> }

Hmmm....
NetBSD (and the other BSD?) defines a structure for the arguments to each 
syscall.
On systems where all function arguments are put on stack the user stack that
contains the arguments is copied into a kernel buffer.
For amd64 I changed the register save area layout so that the arguments were in
the right order [1]. Then added an extra area for the extra arguments that had 
to be
read from the user stack.
Just passing a pointer into the save area has to be better than reading
all the values again.

[1] There was some horrid fallout from that :-(

        David

Reply via email to