Skip to contentSkip to conversation

x86-64 linux: eliminate idt_table

PATCH New Jan Beulich 1 participant 1 message Feb 15, 2006

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86-64 linux: eliminate idt_table

idt_table is meaningless in paravirtualized guests, but there were still a couple of references to it left. The easiest way to locate them was to get rid of the variable altogether. It depends on the previously submitted patch cleaning up head.S (which, among other things, eliminated early_idt_handler). It also fixes the non-Xen cpu_gdt_init() handling (for easier later merging).

Jan

arch/x86_64/kernel/head-xen.S +2 -1
Index: head-2006-02-14/arch/x86_64/kernel/head-xen.S
===================================================================
@@ -254,6 +254,7 @@ gdt_end:
 	/* zero the remaining page */
 	.fill PAGE_SIZE / 8 - GDT_ENTRIES,8,0
 
+#ifndef CONFIG_XEN
 	.section .bss, "aw", @nobits
 	.align L1_CACHE_BYTES
 ENTRY(idt_table)	
@@ -261,4 +262,4 @@ ENTRY(idt_table)	
 	.quad   0
 	.quad 	0
 	.endr
-
+#endif
arch/x86_64/kernel/setup64-xen.c +3 -12
Index: head-2006-02-14/arch/x86_64/kernel/setup64-xen.c
===================================================================
@@ -40,7 +40,9 @@ cpumask_t cpu_initialized __cpuinitdata 
 struct x8664_pda *_cpu_pda[NR_CPUS] __read_mostly;
 struct x8664_pda boot_cpu_pda[NR_CPUS] __cacheline_aligned;
 
+#ifndef CONFIG_XEN
 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 @@ static void switch_pt(void)
 
 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 @@ void __cpuinit cpu_init (void)
 #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();
arch/x86_64/kernel/traps-xen.c +0 -6
Index: head-2006-02-14/arch/x86_64/kernel/traps-xen.c
===================================================================
@@ -47,8 +47,6 @@
 #include <asm/proto.h>
 #include <asm/nmi.h>
 
-extern struct gate_struct idt_table[256]; 
-
 asmlinkage void divide_error(void);
 asmlinkage void debug(void);
 asmlinkage void nmi(void);
@@ -986,10 +984,6 @@ void __init trap_init(void)
                 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.
 	 */
include/asm-x86_64/mach-xen/asm/desc.h +0 -24
Index: head-2006-02-14/include/asm-x86_64/mach-xen/asm/desc.h
===================================================================
@@ -90,7 +90,6 @@ static inline void clear_LDT(void)
  * something other than this.
  */
 extern struct desc_struct default_ldt[];
-extern struct gate_struct idt_table[]; 
 extern struct desc_ptr cpu_gdt_descr[];
 
 /* the cpu gdt accessor */
@@ -113,29 +112,6 @@ static inline void _set_gate(void *adr, 
 	memcpy(adr, &s, 16); 
 } 
 
-static inline void set_intr_gate(int nr, void *func) 
-{ 
-	BUG_ON((unsigned)nr > 0xFF);
-	_set_gate(&idt_table[nr], GATE_INTERRUPT, (unsigned long) func, 0, 0); 
-} 
-
-static inline void set_intr_gate_ist(int nr, void *func, unsigned ist) 
-{ 
-	BUG_ON((unsigned)nr > 0xFF);
-	_set_gate(&idt_table[nr], GATE_INTERRUPT, (unsigned long) func, 0, ist); 
-} 
-
-static inline void set_system_gate(int nr, void *func) 
-{ 
-	BUG_ON((unsigned)nr > 0xFF);
-	_set_gate(&idt_table[nr], GATE_INTERRUPT, (unsigned long) func, 3, 0); 
-} 
-
-static inline void set_system_gate_ist(int nr, void *func, unsigned ist)
-{
-	_set_gate(&idt_table[nr], GATE_INTERRUPT, (unsigned long) func, 3, ist);
-}
-
 static inline void set_tssldt_descriptor(void *ptr, unsigned long tss, unsigned type, 
 					 unsigned size) 
 { 

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel