tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: mknodat(2) device argument type change



On Sun, Oct 06, 2013 at 10:51:36PM +0200, Nicolas Joly wrote:
> 
> It needs the PAD, syscalls files generation fails without it
> (sysalign=1).
> 
> /bin/sh makesyscalls.sh syscalls.conf syscalls.master
> syscalls.master: line 905: unexpected dev (expected <a padding argument>)
> line is:
> 460     STD  RUMP        {  int | sys |  | mknodat ( int fd , const char  * 
> path ,                        mode_t mode , dev_t dev ) ;  }

A certain amount of magic (and luck) applies...

On i386 64bit fields in structures are only 4-byte aligned, however when
the arguments for a function are stacked a 64bit field is 8-byte aligned.
For system calls a C stucture gets mapped onto the user stack (copied
into kernel). So the kernel struct for the above argument list needs a pad.

On amd64 the first 6 arguments are all in registers, so the C struct for
the argument list must match the register save area. In this case
the structure members all end up being 64bit. So no pad is needed.
I suspect this is handled 'by magic'.

... searches for the magic ...

I think that the PAD arguments are added by the libc system call stubs
even for 64bit architectures - where they waste a real argument slot.

This doesn't explain why rump needs so much special code in makesyscalls.sh.

        David

-- 
David Laight: david%l8s.co.uk@localhost


Home | Main Index | Thread Index | Old Index