Mailing List Archive

Eliminate x86_64 idt_table.
# HG changeset patch
# User cl349@firebug.cl.cam.ac.uk
# Node ID 9bf99522ce5e2dbb0592565f289c4fb1c78ea79a
# Parent f572c467d9c32e617064c8b26b530bd8f96648fd
Eliminate x86_64 idt_table.
Add CONFIG_X86_NO_IDT to exclude all code which references the idt table.
Also fix the non-Xen cpu_gdt_init() handling.

From: Jan Beulich <JBeulich@novell.com>
Signed-off-by: Christian Limpach <Christian.Limpach@cl.cam.ac.uk>

diff -r f572c467d9c3 -r 9bf99522ce5e linux-2.6-xen-sparse/arch/x86_64/Kconfig
--- a/linux-2.6-xen-sparse/arch/x86_64/Kconfig Mon Feb 20 17:22:00 2006
+++ b/linux-2.6-xen-sparse/arch/x86_64/Kconfig Mon Feb 20 17:32:29 2006
@@ -126,6 +126,11 @@
This option will compile a kernel compatible with Xen hypervisor

config X86_NO_TSS
+ bool
+ depends on X86_64_XEN
+ default y
+
+config X86_NO_IDT
bool
depends on X86_64_XEN
default y
diff -r f572c467d9c3 -r 9bf99522ce5e linux-2.6-xen-sparse/arch/x86_64/kernel/head-xen.S
--- a/linux-2.6-xen-sparse/arch/x86_64/kernel/head-xen.S Mon Feb 20 17:22:00 2006
+++ b/linux-2.6-xen-sparse/arch/x86_64/kernel/head-xen.S Mon Feb 20 17:32:29 2006
@@ -129,14 +129,6 @@
/* zero the remaining page */
.fill PAGE_SIZE / 8 - GDT_ENTRIES,8,0

- .section .bss, "aw", @nobits
- .align L1_CACHE_BYTES
-ENTRY(idt_table)
- .rept 256
- .quad 0
- .quad 0
- .endr
-
/*
* __xen_guest information
*/
diff -r f572c467d9c3 -r 9bf99522ce5e linux-2.6-xen-sparse/arch/x86_64/kernel/setup64-xen.c
--- a/linux-2.6-xen-sparse/arch/x86_64/kernel/setup64-xen.c Mon Feb 20 17:22:00 2006
+++ b/linux-2.6-xen-sparse/arch/x86_64/kernel/setup64-xen.c Mon Feb 20 17:32:29 2006
@@ -40,7 +40,9 @@
struct x8664_pda *_cpu_pda[NR_CPUS] __read_mostly;
struct x8664_pda boot_cpu_pda[NR_CPUS] __cacheline_aligned;

+#ifndef CONFIG_X86_NO_IDT
struct desc_ptr idt_descr = { 256 * 16, (unsigned long) idt_table };
+#endif

char boot_cpu_stack[IRQSTACKSIZE] __attribute__((section(".bss.page_aligned")));

@@ -155,13 +157,7 @@

void __init cpu_gdt_init(struct desc_ptr *gdt_descr)
{
-#ifdef CONFIG_SMP
- int cpu = stack_smp_processor_id();
-#else
- int cpu = smp_processor_id();
-#endif
-
- asm volatile("lgdt %0" :: "m" (cpu_gdt_descr[cpu]));
+ asm volatile("lgdt %0" :: "m" (*gdt_descr));
asm volatile("lidt %0" :: "m" (idt_descr));
}
#endif
@@ -285,12 +281,7 @@
#endif

cpu_gdt_descr[cpu].size = GDT_SIZE;
-#ifndef CONFIG_XEN
- asm volatile("lgdt %0" :: "m" (cpu_gdt_descr[cpu]));
- asm volatile("lidt %0" :: "m" (idt_descr));
-#else
cpu_gdt_init(&cpu_gdt_descr[cpu]);
-#endif

memset(me->thread.tls_array, 0, GDT_ENTRY_TLS_ENTRIES * 8);
syscall_init();
diff -r f572c467d9c3 -r 9bf99522ce5e linux-2.6-xen-sparse/arch/x86_64/kernel/traps-xen.c
--- a/linux-2.6-xen-sparse/arch/x86_64/kernel/traps-xen.c Mon Feb 20 17:22:00 2006
+++ b/linux-2.6-xen-sparse/arch/x86_64/kernel/traps-xen.c Mon Feb 20 17:32:29 2006
@@ -47,7 +47,9 @@
#include <asm/proto.h>
#include <asm/nmi.h>

+#ifndef CONFIG_X86_NO_IDT
extern struct gate_struct idt_table[256];
+#endif

asmlinkage void divide_error(void);
asmlinkage void debug(void);
@@ -986,10 +988,6 @@
printk("HYPERVISOR_set_trap_table faild: error %d\n",
ret);

-#ifdef CONFIG_IA32_EMULATION
- set_system_gate(IA32_SYSCALL_VECTOR, ia32_syscall);
-#endif
-
/*
* Should be a barrier for any external CPU state.
*/
diff -r f572c467d9c3 -r 9bf99522ce5e linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/desc.h
--- a/linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/desc.h Mon Feb 20 17:22:00 2006
+++ b/linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/desc.h Mon Feb 20 17:32:29 2006
@@ -90,7 +90,9 @@
* something other than this.
*/
extern struct desc_struct default_ldt[];
+#ifndef CONFIG_X86_NO_IDT
extern struct gate_struct idt_table[];
+#endif
extern struct desc_ptr cpu_gdt_descr[];

/* the cpu gdt accessor */
@@ -113,6 +115,7 @@
memcpy(adr, &s, 16);
}

+#ifndef CONFIG_X86_NO_IDT
static inline void set_intr_gate(int nr, void *func)
{
BUG_ON((unsigned)nr > 0xFF);
@@ -135,6 +138,7 @@
{
_set_gate(&idt_table[nr], GATE_INTERRUPT, (unsigned long) func, 3, ist);
}
+#endif

static inline void set_tssldt_descriptor(void *ptr, unsigned long tss, unsigned type,
unsigned size)

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