[patch] Fix GDT re-load on ACPI resume

Nickolai Zeldovich
2004-11-15T20:41:08Z

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