Re: odd definition of function

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

 



On 8/7/10 12:32 PM, Parmenides wrote:
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. While the first line
merely declare a function without definition owing to the semicolon
behind IRQ3.

2010/8/8 Daniel (Youngwhan) Song<breadncup@xxxxxxxxx>:
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

Probably, I don't quite understand your question on here.

asmlinage void IRQ3; is not a function declaration. This is declaration of variable. not function.
asm() is a statement as you understand.

As long as BUILD_IRQ() is used in a function like

int test_func(void) {
   BUILD_IRQ(3)
...
}
, there is no problem of the definition. It will be extracted like

int test_func(void) {
    asmlinage void IRQ3;
    asm(...);
...
}

I don't understand why a pair of brace is needed in the definition. Am I missing or misunderstand your question?

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