WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

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

To: <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH] linux/x86: fix initial GDT setup
From: "Jan Beulich" <jbeulich@xxxxxxxxxx>
Date: Thu, 06 Dec 2007 15:55:42 +0000
Delivery-date: Thu, 06 Dec 2007 07:55:44 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH] linux/x86: fix initial GDT setup, Jan Beulich <=