[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: BUG()
On Fri, 2 Jul 2004 11:44:25 +0200, Borislav Petkov
<borislav.petkov@xxxxxxxxxxx> wrote:
>
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> 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.?
i don't know. i will see if i can find something...
> 2. Where does the compiler get those __LINE__ and __FILE__ from?
they are gcc specific. i know of __FUNCTION__ which provides the
function name. i am sure there are others too...
kind regards
anupam
>
> Thanks in advance for your patience,
> Boris.
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.2.4 (GNU/Linux)
>
> iD4DBQFA5S59iBySr3Fn37QRAkGEAJsHBryqVQ+0JMOss3VbwHCQ6XIIwQCY0w1J
> 1WsQ29Rtna0rQ7OQyb3AnA==
> =vvr7
> -----END PGP SIGNATURE-----
>
> --
> 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/