2010/8/7 Jakub Kiciński <[email protected]>

> Dnia 07-08-2010 o 21:32:49 Parmenides <[email protected]>
> napisał(a):
>
>
>  asmlinage void IRQ3;
>>> asm(...);
>>>
>> yes, we get it exactly. But, asm(...) is just a statement and in my
>> opinion, it should belong to some function body.
>
>
but if the asm were inside a function body, it would contradict
the asmlinkage function *declaration* in the previous line !

functions have C linkage, but reduce to labels, which are just addresses.
the label is probably defined in the asm(), and linker knows how to call it,
with asmlinkage.




> While the first line
>> merely declare a function without definition owing to the semicolon
>> behind IRQ3.
>>
>>
> GCC allow to declare asms outside functions. In this case asm statement
> (which is _outside_ any function) is preceded by function declaration. Later
> in the asm macro places a label having the same name as the function
> declared above. This is function definition. Actually AFAIK from the linker
> point of view functions are just labels placed somewhere in the code.
>
> I'm just a noob so I'm probably wrong here, but using BUILD_IRQ(0x01)
> should produce something like:
>
> asmlinkage void IRQ0x01_interrupt(void);
>
> __asm__(
> "\n"__ALIGN_STR"\n" <- some alignment will replace this
>        "IRQ0x01_interrupt:\n\t" <- label == function
>        "pushl $"0x01"-256\n\t"
>        "jmp common_interrupt");
>
>
Yes, that looks right to me.

Reply via email to