What is asmlinkage ?
Peter Teoh
htmldeveloper at gmail.com
Fri Jan 11 05:06:21 EST 2013
It is defined in include/linux/linkage.h. And more info here:
http://pix.cs.olemiss.edu/csci523/kernelidioms
Part of it quoted below - ultimately it falls on GCC feature ("
__attribute__((regparm(0)))"):
The CPP_ASMLINKAGE __attribute__((regparm(0))) Macro
asmlinkage macro defines as:
#define CPP_ASMLINKAGE __attribute__((regparm(0))) which defines as:
#define extern "C" __attribute__((regparm(0)))
This is used in the system call interface where C library routines enter
the kernel after setting up their arguments and executing the trap instruction
(INT 80) to enter the kernel. The "asmlinkage" tag really should read "C
language linkage."
GCC takes a i386 specific __attribute__((regparm(0))) that causes
the compiler to pass integer data type arguments in the stack instead of
using regesters. Functions that take a variable number of arguments will
continue to be passed all of their arguments on the stack.
On Fri, Jan 11, 2013 at 2:56 PM, Rajat Sharma <fs.rajat at gmail.com> wrote:
>
> > it is defined even in much earlier release:
> http://lxr.free-electrons.com/ident?v=2.6.32;i=asmlinkage
>
> There seems to be no definition for arm here too. I literally meant
> definition as '#define asmlinkage' not the usage of it. For arm it is none
> so default defined in include/linux/linkage.h is used which is nothing
> special and just extern 'C' declaration to avoid garbled naming of C++
> linkage, thats it.
>
> -Rajat
>
>
> On Fri, Jan 11, 2013 at 12:00 PM, Peter Teoh <htmldeveloper at gmail.com>wrote:
>
>>
>>
>> On Fri, Jan 11, 2013 at 1:35 PM, Rajat Sharma <fs.rajat at gmail.com> wrote:
>>
>>> > asmlinkage is defined for almost all arch:
>>> > grep asmlinkage arch/arm/*/* and u got the answer.
>>>
>>> I didn't see a definition of macro atleast in linux source I was
>>> browsing (3.2.0), Could you please point out to any one you have found.
>>>
>>
>> it is defined even in much earlier release:
>>
>> http://lxr.free-electrons.com/ident?v=2.6.32;i=asmlinkage
>>
>> for example, and every arch possible has a use of it.
>>
>> --
>> Regards,
>> Peter Teoh
>
>
>
--
Regards,
Peter Teoh
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20130111/8ef6a89c/attachment.html
More information about the Kernelnewbies
mailing list