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

[Xen-changelog] [linux-2.6.18-xen] linux/x86: fix initial GDT setup



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1196956792 0
# Node ID d43906ea0e9c136e9ec28df30f94c225536d588c
# Parent  a235a50c9f1e0f67a96c8cb9e3351ad897623ca3
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.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx>
---
 arch/i386/kernel/cpu/common-xen.c |    4 ++--
 arch/x86_64/kernel/setup64-xen.c  |    6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)

diff -r a235a50c9f1e -r d43906ea0e9c arch/i386/kernel/cpu/common-xen.c
--- a/arch/i386/kernel/cpu/common-xen.c Thu Dec 06 15:51:11 2007 +0000
+++ b/arch/i386/kernel/cpu/common-xen.c Thu Dec 06 15:59:52 2007 +0000
@@ -590,7 +590,7 @@ void __init early_cpu_init(void)
 #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 @@ void __cpuinit cpu_gdt_init(struct Xgt_d
                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();
 }
 
diff -r a235a50c9f1e -r d43906ea0e9c arch/x86_64/kernel/setup64-xen.c
--- a/arch/x86_64/kernel/setup64-xen.c  Thu Dec 06 15:51:11 2007 +0000
+++ b/arch/x86_64/kernel/setup64-xen.c  Thu Dec 06 15:59:52 2007 +0000
@@ -132,7 +132,7 @@ static void switch_pt(void)
        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;
@@ -145,7 +145,7 @@ void __cpuinit cpu_gdt_init(struct desc_
                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();
 }
@@ -155,7 +155,7 @@ static void switch_pt(void)
        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-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

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