On Thu, Apr 01, 2004 at 16:41:29 +0200, Eric wrote: > Hi, > > > "All system calls are marked with the asmlinkage tag, so they all look > to the stack for arguments" > From kernelnewbies.org on the FAQ at "What is asmlinkage ?". > > I find this a bit strange :) > Let's take the exemple of the system call dup(0). > The C funtion dup() will call the real dup system call (by tne Interrupt > Software int 0x80). But the arguments of the real system call have to be > passed on registers (0 on ebx for the example). > Becoz when we call a system call, we're generally in user space. So the > stack is different. > So why system calls are marked with the asmlinkage tag ? I don't > understand. So they all look to the stack for arguments! > Or perhaps there's or i make a confusion between system call and C > function wrapper of system calls. You are probably confusing the user-space and the kernel-space side of the thing. On the user-side, the wrapper takes arguments from the stack and loads them to the registers. And calls the trap. Now the kernel parts comes to play. It does some setup and calls the sys_* function. But the arguments are still in registers. So the asmlinkage tells the compiler, that the function will have the args in registers and not on the stack, as would be expected for C function. ------------------------------------------------------------------------------- Jan 'Bulb' Hudec <bulb@ucw.cz>
Attachment:
signature.asc
Description: Digital signature