Re: odd definition of function

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

 



On 8/7/10 6:05 AM, Parmenides wrote:
Oh, my question is really no clear. Actually, there is a simicolon at
the end of the declaration of IRQ0x01_interrupt, while the statement
of __asm__ is not enclosed by a pair of brace, namely that no the body
of function. So, I don't think this is a traditional definition of
function.

ps: the original excerpt of the code is a macro like this:

#define BUILD_IRQ(nr) \
asmlinkage void IRQ_NAME(nr); \
__asm__( \
"\n"__ALIGN_STR"\n" \
SYMBOL_NAME_STR(IRQ) #nr "_interrupt:\n\t" \
         "pushl $"#nr"-256\n\t" \
         "jmp common_interrupt");


2010/8/7 Mulyadi Santosa<mulyadi.santosa@xxxxxxxxx>:
On Fri, Aug 6, 2010 at 02:52, Parmenides<mobile.parmenides@xxxxxxxxx>  wrote:
Hi,
   In i8259.c, there is an odd funciton definition as follows:

asmlinkage void IRQ0x01_interrupt();
__asm__( ...);
you mean asmlinkage thing? here's the explanation:
http://kernelnewbies.org/FAQ/asmlinkage

And if you ask about __asm__, that's, AFAIK, a way to directly embed
assembly instruction into your C code.

--
regards,

Mulyadi Santosa
Freelance Linux trainer and consultant

blog: the-hydra.blogspot.com
training: mulyaditraining.blogspot.com

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ

Hi Parmendies,

IRQ_NAME defined as IRQ##nr, so it declares void IRQ##nr, and the next assembly code is performed by BUILD_IRQ definition. So, if you use BUILD_IRQ(3), it extracts like

asmlinage void IRQ3;
asm(...);

Daniel

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at 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