title: Parameter passing in system call in linux
body: <p>From Robert Love's book, (in system call implementation)</p>
  
  <blockquote>
    <p>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.</p>
  </blockquote>
  
  <p>But <code>asymlinkage</code> 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 ?</p>