]> Pileus Git - ~andy/linux/commitdiff
[x86 setup] Work around bug in Xen HVM
authorChristian Ehrhardt <lk@c--e.de>
Mon, 3 Sep 2007 18:32:38 +0000 (20:32 +0200)
committerH. Peter Anvin <hpa@zytor.com>
Wed, 5 Sep 2007 01:37:57 +0000 (02:37 +0100)
Apparently XEN does not keep the contents of the 48-bit gdt_48 data
structure that is passed to lgdt in the XEN machine state. Instead it
appears to save the _address_ of the 48-bit descriptor
somewhere. Unfortunately this data happens to reside on the stack and
is probably no longer availiable at the time of the actual protected
mode jump.

This is Xen bug but given that there is a one-line patch to work
around this problem, the linux kernel should probably do this.  My fix
is to make the gdt_48 description in setup_gdt static (in setup_idt
this is already the case). This allows the kernel to boot under
Xen HVM again.

Signed-off-by: Christian Ehrhardt <lk@c--e.de>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
arch/i386/boot/pm.c

index 6be9ca811d177d936b328987992664eac232cd49..09fb342cc62e1965a4edf12fa73e19589d6b7ab0 100644 (file)
@@ -122,7 +122,11 @@ static void setup_gdt(void)
                /* DS: data, read/write, 4 GB, base 0 */
                [GDT_ENTRY_BOOT_DS] = GDT_ENTRY(0xc093, 0, 0xfffff),
        };
-       struct gdt_ptr gdt;
+       /* Xen HVM incorrectly stores a pointer to the gdt_ptr, instead
+          of the gdt_ptr contents.  Thus, make it static so it will
+          stay in memory, at least long enough that we switch to the
+          proper kernel GDT. */
+       static struct gdt_ptr gdt;
 
        gdt.len = sizeof(boot_gdt)-1;
        gdt.ptr = (u32)&boot_gdt + (ds() << 4);