linux/x86: fix initial GDT setup
PATCH 1/1 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 <[email protected]>
arch/i386/kernel/cpu/common-xen.c +2 -2
@@ -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 (); }
arch/x86_64/kernel/setup64-xen.c +3 -3
@@ -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 @@ asmvolatile ("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) { asmvolatile ("lgdt %0" ::"m" (*gdt_descr)); asmvolatile ("lidt %0" ::"m" (idt_descr));