aboutsummaryrefslogtreecommitdiffstats
path: root/arch/i386/kernel
diff options
context:
space:
mode:
authorJeremy Fitzhardinge <jeremy@goop.org>2007-05-02 13:27:15 -0400
committerAndi Kleen <andi@basil.nowhere.org>2007-05-02 13:27:15 -0400
commit7a61d35d4b4056e7711031202da7605e052f4137 (patch)
tree4b21e0d541d0a189c2f9f16f53eb6489f07c5a84 /arch/i386/kernel
parent39b7ee06859b07ca5fd4fabb44c4600316532574 (diff)
[PATCH] i386: Page-align the GDT
Xen wants a dedicated page for the GDT. I believe VMI likes it too. lguest, KVM and native don't care. Simple transformation to page-aligned "struct gdt_page". Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Signed-off-by: Andi Kleen <ak@suse.de> Acked-by: Jeremy Fitzhardinge <jeremy@xensource.com>
Diffstat (limited to 'arch/i386/kernel')
-rw-r--r--arch/i386/kernel/cpu/common.c6
-rw-r--r--arch/i386/kernel/entry.S2
-rw-r--r--arch/i386/kernel/head.S2
-rw-r--r--arch/i386/kernel/traps.c2
4 files changed, 6 insertions, 6 deletions
diff --git a/arch/i386/kernel/cpu/common.c b/arch/i386/kernel/cpu/common.c
index 58128585ae60..7a4c036d93c8 100644
--- a/arch/i386/kernel/cpu/common.c
+++ b/arch/i386/kernel/cpu/common.c
@@ -22,7 +22,7 @@
22 22
23#include "cpu.h" 23#include "cpu.h"
24 24
25DEFINE_PER_CPU(struct desc_struct, cpu_gdt[GDT_ENTRIES]) = { 25DEFINE_PER_CPU(struct gdt_page, gdt_page) = { .gdt = {
26 [GDT_ENTRY_KERNEL_CS] = { 0x0000ffff, 0x00cf9a00 }, 26 [GDT_ENTRY_KERNEL_CS] = { 0x0000ffff, 0x00cf9a00 },
27 [GDT_ENTRY_KERNEL_DS] = { 0x0000ffff, 0x00cf9200 }, 27 [GDT_ENTRY_KERNEL_DS] = { 0x0000ffff, 0x00cf9200 },
28 [GDT_ENTRY_DEFAULT_USER_CS] = { 0x0000ffff, 0x00cffa00 }, 28 [GDT_ENTRY_DEFAULT_USER_CS] = { 0x0000ffff, 0x00cffa00 },
@@ -48,8 +48,8 @@ DEFINE_PER_CPU(struct desc_struct, cpu_gdt[GDT_ENTRIES]) = {
48 48
49 [GDT_ENTRY_ESPFIX_SS] = { 0x00000000, 0x00c09200 }, 49 [GDT_ENTRY_ESPFIX_SS] = { 0x00000000, 0x00c09200 },
50 [GDT_ENTRY_PDA] = { 0x00000000, 0x00c09200 }, /* set in setup_pda */ 50 [GDT_ENTRY_PDA] = { 0x00000000, 0x00c09200 }, /* set in setup_pda */
51}; 51} };
52EXPORT_PER_CPU_SYMBOL_GPL(cpu_gdt); 52EXPORT_PER_CPU_SYMBOL_GPL(gdt_page);
53 53
54DEFINE_PER_CPU(struct i386_pda, _cpu_pda); 54DEFINE_PER_CPU(struct i386_pda, _cpu_pda);
55EXPORT_PER_CPU_SYMBOL(_cpu_pda); 55EXPORT_PER_CPU_SYMBOL(_cpu_pda);
diff --git a/arch/i386/kernel/entry.S b/arch/i386/kernel/entry.S
index e07473c0d3e7..3e4aa1fd33e2 100644
--- a/arch/i386/kernel/entry.S
+++ b/arch/i386/kernel/entry.S
@@ -557,7 +557,7 @@ END(syscall_badsys)
557#define FIXUP_ESPFIX_STACK \ 557#define FIXUP_ESPFIX_STACK \
558 /* since we are on a wrong stack, we cant make it a C code :( */ \ 558 /* since we are on a wrong stack, we cant make it a C code :( */ \
559 movl %fs:PDA_cpu, %ebx; \ 559 movl %fs:PDA_cpu, %ebx; \
560 PER_CPU(cpu_gdt, %ebx); \ 560 PER_CPU(gdt_page, %ebx); \
561 GET_DESC_BASE(GDT_ENTRY_ESPFIX_SS, %ebx, %eax, %ax, %al, %ah); \ 561 GET_DESC_BASE(GDT_ENTRY_ESPFIX_SS, %ebx, %eax, %ax, %al, %ah); \
562 addl %esp, %eax; \ 562 addl %esp, %eax; \
563 pushl $__KERNEL_DS; \ 563 pushl $__KERNEL_DS; \
diff --git a/arch/i386/kernel/head.S b/arch/i386/kernel/head.S
index cc46494787e8..bb36c24311b4 100644
--- a/arch/i386/kernel/head.S
+++ b/arch/i386/kernel/head.S
@@ -598,7 +598,7 @@ idt_descr:
598 .word 0 # 32 bit align gdt_desc.address 598 .word 0 # 32 bit align gdt_desc.address
599ENTRY(early_gdt_descr) 599ENTRY(early_gdt_descr)
600 .word GDT_ENTRIES*8-1 600 .word GDT_ENTRIES*8-1
601 .long per_cpu__cpu_gdt /* Overwritten for secondary CPUs */ 601 .long per_cpu__gdt_page /* Overwritten for secondary CPUs */
602 602
603/* 603/*
604 * The boot_gdt must mirror the equivalent in setup.S and is 604 * The boot_gdt must mirror the equivalent in setup.S and is
diff --git a/arch/i386/kernel/traps.c b/arch/i386/kernel/traps.c
index e0a23bee6967..f21b41e7770c 100644
--- a/arch/i386/kernel/traps.c
+++ b/arch/i386/kernel/traps.c
@@ -1030,7 +1030,7 @@ fastcall void do_spurious_interrupt_bug(struct pt_regs * regs,
1030fastcall unsigned long patch_espfix_desc(unsigned long uesp, 1030fastcall unsigned long patch_espfix_desc(unsigned long uesp,
1031 unsigned long kesp) 1031 unsigned long kesp)
1032{ 1032{
1033 struct desc_struct *gdt = __get_cpu_var(cpu_gdt); 1033 struct desc_struct *gdt = __get_cpu_var(gdt_page).gdt;
1034 unsigned long base = (kesp - uesp) & -THREAD_SIZE; 1034 unsigned long base = (kesp - uesp) & -THREAD_SIZE;
1035 unsigned long new_kesp = kesp - base; 1035 unsigned long new_kesp = kesp - base;
1036 unsigned long lim_pages = (new_kesp | (THREAD_SIZE - 1)) >> PAGE_SHIFT; 1036 unsigned long lim_pages = (new_kesp | (THREAD_SIZE - 1)) >> PAGE_SHIFT;