[patch] Fix GDT re-load on ACPI resume

From: Nickolai Zeldovich
Date: Mon Nov 15 2004 - 16:43:06 EST

The ACPI resume code currently uses a real-mode 16-bit lgdt instruction to
reload the GDT. This only restores the lower 24 bits of the GDT base
address. In recent kernels, the GDT seems to have moved out of the lower
16 megs, thereby causing the ACPI resume to fail -- an invalid GDT was
being loaded.

This simple patch adds the 0x66 prefix to lgdt, which forces it to load
all 32 bits of the GDT base address, thereby removing any restrictions on
where the GDT can be placed in memory. This makes ACPI resume work for me
on a Thinkpad T40 laptop.

-- kolya

--- linux-2.6.9/arch/i386/kernel/acpi/wakeup.S 2004/11/15 09:00:34 1.1
+++ linux-2.6.9/arch/i386/kernel/acpi/wakeup.S 2004/11/15 20:33:27
@@ -67,6 +67,8 @@
movw $0x0e00 + 'i', %fs:(0x12)

# need a gdt
+ .byte 0x66 # force 32-bit operands in case
+ # the GDT is past 16 megabytes
lgdt real_save_gdt - wakeup_code

movl real_save_cr0 - wakeup_code, %eax
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/