[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: asmlinkage
Eric (eric_begot@xxxxxxxx) wrote:
> Christophe Lucas wrote:
> >Bijoy (bijoyjth@xxxxxxx) wrote:
> >
> >>>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.
> >>
> >>Isnt it the other way around .... when the sys_* function is called ..
> >>the arguments are on the stack .... the syscall handler saves the
> >>register arguments (SAVE_ALL) and then invokes the actual syscall ....
> >>asmlinkage means that the arguments are on the stack and not in registers
> >>.... plz correct me if i am wrong.
> >
> >
> >Hi,
> >
> >As I can understand about syscall and asmlinkage:
> >From user space, syscall's arguments are stored in registers, and number
> >of syscall are in eax.
> >x80 int are launched, and arch/i386/entry.S come to ENTRY(system_call)
> >and arguments are pushed on stack.
> >sys_ functions are called from address stored in sys_call_table.
> >Then the sys_ function is executed and asmlinkage say to not optimized
> >the arguments and to take arguments from stack.
> >
> >If I make a mistake, I will happy you give me the right way.
> >
> >Regards,
>
>
> Ok,
>
> I believe that I effictively made a confusion between user and kernel
> space, more precisely between the wrapper C funtion and the real system
> call.
> It's the real system call which has the tag asmlinkage, right ? Like
> "asmlinkage long sys_open(...)".
Yes, see linux/arch/i386/kernel/sys_i386.c
HTH
--
Amicalement
Christophe
* GNU/Linux & UNIX developer and network administrator
* Membre RotomaLUG (http://www.rotomalug.org)
* Registered User #271267
* Email: c.lucas@xxxxxxxxxxx
* Web Site: http://odie.mcom.fr/~clucas/
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive: http://mail.nl.linux.org/kernelnewbies/
FAQ: http://kernelnewbies.org/faq/