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

Re: BUG()



You can find sth useful in the following link, buddy :)
http://osdev.neopages.net/tutorials/gccasmtut.php?the_id=68

On Friday 02 July 2004 17:44, Borislav Petkov wrote:
> Hi there guys,
> a new day - a new question :))
> 
> I've been trying to figure out today how BUG() works, it is inline assembly,
> again:
> 
> <from include/asm-i386/bug.h:12>
>  12 #if 1   /* Set to zero for a slightly smaller kernel */
>  13 #define BUG()                           \
>  14  __asm__ __volatile__(  "ud2\n"         \
>  15                         "\t.word %c0\n" \
>  16                         "\t.long %c1\n" \
>  17                          : : "i" (__LINE__), "i" (__FILE__))
> 
> I know that ud2 means undefined and generates invalid opcode 
exception, .word
> and .long are as directives, "i" as an input operand constraint is an
> immediate integer operand with constant value, but what I can't understand
> after looking into the as and gcc manuals is:
> 
> 1. what does the c mean in the constraint %c0, %c1 resp.?
> 2. Where does the compiler get those __LINE__ and __FILE__ from?
> 
> Thanks in advance for your patience,
> Boris.
> 
> --
> Kernelnewbies: Help each other learn about the Linux kernel.
> Archive:       http://mail.nl.linux.org/kernelnewbies/
> FAQ:           http://kernelnewbies.org/faq/
> 
> 
> 

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