*参照元 [#w0e03eb9] #backlinks *説明 [#t3020dbb] -パス: [[linux-2.6.33/arch/x86/include/asm/bug.h]] -BUG() マクロの実装です。x86 版です。 **引数 [#g6f89863] -なし **返り値 [#b8ec9c00] -なし **参考 [#yd1d7a70] *実装 [#n055fa36] ***CONFIG_DEBUG_BUGVERBOSE が On の場合 [#xe433e31] #ifdef CONFIG_DEBUG_BUGVERBOSE - --[[linux-2.6.33/CONFIG_DEBUG_BUGVERBOSE]] #ifdef CONFIG_X86_32 -32bit の場合は c0 が 32ビットになる。 --[[linux-2.6.33/CONFIG_X86_32]] # define __BUG_C0 "2:\t.long 1b, %c0\n" #else -64bit の場合は c0 が 64ビットになる。 # define __BUG_C0 "2:\t.quad 1b, %c0\n" #endif #define BUG() \ do { \ asm volatile("1:\tud2\n" \ ".pushsection __bug_table,\"a\"\n" \ __BUG_C0 \ "\t.word %c1, 0\n" \ "\t.org 2b+%c2\n" \ ".popsection" \ : : "i" (__FILE__), "i" (__LINE__), \ "i" (sizeof(struct bug_entry))); \ unreachable(); \ - --[[linux-2.6.33/unreachable()]] } while (0) ***CONFIG_DEBUG_BUGVERBOSE が Off の場合 [#e43efc0a] #else #define BUG() \ do { \ asm volatile("ud2"); \ -無効命令を実行する。無効命令実行割り込みが入る。 -コンパイラの最適化で移動、消去されない ように volatile キーワードをつける。 unreachable(); \ - } while (0) #endif *コメント [#zae4d2f4]