RE: asmlinkage in system call

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

 




> -----Original Message-----
> From: Anurag Verma [mailto:averma@xxxxxxxxxxxxxxxxxxx]
> Sent: Tuesday, July 19, 2005 11:58 AM
> To: Sanjay Kumar, Noida
> Cc: KERNEL
> Subject: RE: asmlinkage in system call
> 
> 
> > >From the user space when we actually call int 0x80 for making a
system
> > call (placing all arguments in registers), control goes to
'system_call'
> > (in entry.S).
> > 'system_call' expects to find arguments on registers. As a first
step it
> > calls 'SAVE_ALL' which pushes register contents onto the stack
before
> > actually invoking the appropriate system call 'sys_xxx'.
> > Now since the arguments are now on stack, the 'asmlinkage' tag
directs
> > the 'sys_xxx' function to find the arguments on stack.
> 
> 
> So when control transfers to a system call then , how does the system
> call know which arguments it has to pop off.

The system call can find arguments in the stack as any normal function
would do. 

The stack will contain the return address of the calling routine
('system_call' here), then first argument, then next and so on.

Actually 'SAVE_ALL' (called from 'system_call' pushes the arguments in
the stack in an order so that the system_call can use its stack as any
normal function will do.

Sanjay


> Thanks
> Anurag
> 
> 
> 
>
************************************************************************
**
> ******
> Network Programs is a SEI-CMM Level 5 & ISO 9001: 2000 Certified
Company
>
************************************************************************
**
> ******
> The information contained in this communication (including any
> attachments) is
> intended solely for the use of the individual or entity to whom it is
> addressed
> and others authorized to receive it. It may contain confidential or
> legally
> privileged information. If you are not the intended recipient you are
> hereby
> notified that any disclosure, copying, distribution or taking any
action
> in
> reliance on the contents of this information is strictly prohibited
and
> may be
> unlawful. If you have received this communication in error, please
notify
> us
> immediately by responding to this email and delete it from your
system.
> Network Programs (India) Limited is neither liable for the proper and
> complete
> transmission of the information contained in this communication nor
for
> any
> delay in its receipt.
>
************************************************************************
**
> ******


--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux