Take the 2-minute tour ×

From Robert Love's book, (in system call implementation)

Somehow, user-space must relay the parameters to the kernel during the trap. The easiest way to do this is via the same means that the syscall number is passed: The parameters are stored in registers. On x86-32,the registers ebx, ecx, edx, esi, and edi contain, inorder, the first five arguments.In the unlikely case of six or more argu- ments, a single register is used to hold a pointer to user-space where all the parameters are stored.

But asymlinkage is prefixed for each and every system call which will expect the parameters to be in system stack. And also when the mode-switch happens how the parameters are copied into kernel stack ?

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

The parameters are placed onto the stack by the system call glue logic. All system calls are made through a single interrupt trap (int 0x80 on x86, I believe). The kernel code for this interrupt handler does the necessary work to put the parameters onto the stack for the system call handlers.

Check out this FAQ to answer the very question: http://kernelnewbies.org/FAQ/asmlinkage

share|improve this answer
"system call glue logic" -> tatz exactly my question. Can you point me the code in the kernel that does this logic ? –  viji Jul 20 '12 at 13:46
That can be found in fxr.watson.org/fxr/source/arch/x86/kernel/… –  chmeee Jul 20 '12 at 13:54
Note that on x86-32 you have two valid system call ways: int 0x80 and sysenter. On x86-64 there may be up to four ways: int 0x80, sysenter, syscall32 and syscall. –  Ilya Matveychikov Jul 24 '12 at 4:06
add comment

Your Answer


