ChangeSet@1.1136.1.65 2003-12-05 15:53:34-02:00 mikpe at se [PATCH] fix reboot/no_idt bug When compiling 2.4.23 with gcc-3.3.2, gcc generates the following warning for arch/i386/kernel/process.c: process.c: In function `machine_restart': process.c:427: warning: use of memory input without lvalue in asm operand 0 is deprecated The warning identifies a real bug. no_idt is passed to lidt with an "m" constraint, which requires an l-value. Since no_idt is faked as an array, gcc creates an anonymous variable pointing to no_idt and passes that to lidt(*), so at runtime lidt sees the wrong address. Not good. (The bug, while real, is unlikely to trigger since it sits in an infrequently used path in the reboot code.) The fix is to make no_idt a struct (and thus an l-lvalue) like the other gdt/idt descriptors. This patch is a backport of the fix Linus made for the same bug in 2.6.0-test4. [Andi: x86-64 appears to have the same bug] (*) Verified by inspection of the assembly code. /Mikael --- linux-2.4.23/arch/i386/kernel/process.c.orig Tue Dec 9 00:29:52 2003 +++ linux-2.4.23/arch/i386/kernel/process.c Tue Dec 9 00:30:46 2003 @@ -153,7 +153,6 @@ __setup("idle=", idle_setup); -static long no_idt[2]; static int reboot_mode; int reboot_thru_bios; @@ -224,7 +223,8 @@ unsigned long long * base __attribute__ ((packed)); } real_mode_gdt = { sizeof (real_mode_gdt_entries) - 1, real_mode_gdt_entries }, -real_mode_idt = { 0x3ff, 0 }; +real_mode_idt = { 0x3ff, 0 }, +no_idt = { 0, 0 }; /* This is 16-bit protected mode code to disable paging and the cache, switch to real mode and jump to the BIOS reset code.