[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH] linux/x86: fix initial GDT setup



cpu_gdt_init() can be static, can have its argument point to const,
and the number of descriptors should be calculated from one more than
the table's limit.

As usual, written and tested against 2.6.24-rc3 and made apply against
2.6.18 without further testing.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx>

Index: head-2007-11-30/arch/i386/kernel/cpu/common-xen.c
===================================================================
--- head-2007-11-30.orig/arch/i386/kernel/cpu/common-xen.c      2007-12-04 
08:34:05.000000000 +0100
+++ head-2007-11-30/arch/i386/kernel/cpu/common-xen.c   2007-12-04 
14:44:46.000000000 +0100
@@ -590,7 +590,7 @@
 #endif
 }
 
-void __cpuinit cpu_gdt_init(struct Xgt_desc_struct *gdt_descr)
+static void __cpuinit cpu_gdt_init(const struct Xgt_desc_struct *gdt_descr)
 {
        unsigned long frames[16];
        unsigned long va;
@@ -603,7 +603,7 @@
                make_lowmem_page_readonly(
                        (void *)va, XENFEAT_writable_descriptor_tables);
        }
-       if (HYPERVISOR_set_gdt(frames, gdt_descr->size / 8))
+       if (HYPERVISOR_set_gdt(frames, (gdt_descr->size + 1) / 8))
                BUG();
 }
 
Index: head-2007-11-30/arch/x86_64/kernel/setup64-xen.c
===================================================================
--- head-2007-11-30.orig/arch/x86_64/kernel/setup64-xen.c       2007-12-06 
11:25:13.000000000 +0100
+++ head-2007-11-30/arch/x86_64/kernel/setup64-xen.c    2007-12-06 
11:25:28.000000000 +0100
@@ -134,7 +134,7 @@
        xen_new_user_pt(__pa_symbol(__user_pgd(init_level4_pgt)));
 }
 
-void __cpuinit cpu_gdt_init(struct desc_ptr *gdt_descr)
+static void __cpuinit cpu_gdt_init(const struct desc_ptr *gdt_descr)
 {
        unsigned long frames[16];
        unsigned long va;
@@ -147,7 +147,7 @@
                make_page_readonly(
                        (void *)va, XENFEAT_writable_descriptor_tables);
        }
-       if (HYPERVISOR_set_gdt(frames, gdt_descr->size /
+       if (HYPERVISOR_set_gdt(frames, (gdt_descr->size + 1) /
                                sizeof (struct desc_struct)))
                BUG();
 }
@@ -157,7 +157,7 @@
        asm volatile("movq %0,%%cr3" :: "r" (__pa_symbol(&init_level4_pgt)));
 }
 
-void __init cpu_gdt_init(struct desc_ptr *gdt_descr)
+static void __cpuinit cpu_gdt_init(const struct desc_ptr *gdt_descr)
 {
        asm volatile("lgdt %0" :: "m" (*gdt_descr));
        asm volatile("lidt %0" :: "m" (idt_descr));




_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.