patch-2.1.63 linux/arch/i386/kernel/traps.c

Next file: linux/arch/i386/mm/fault.c
Previous file: linux/arch/i386/kernel/setup.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.62/linux/arch/i386/kernel/traps.c linux/arch/i386/kernel/traps.c
@@ -413,6 +413,51 @@
 
 #endif /* CONFIG_MATH_EMULATION */
 
+static struct
+{
+	short limit __attribute__((packed));
+	void * addr __attribute__((packed));
+	short __pad __attribute__((packed));
+} idt_d;
+
+void * idt2;
+
+__initfunc(void trap_init_f00f_bug(void))
+{
+	pgd_t * pgd;
+	pmd_t * pmd;
+	pte_t * pte;
+	unsigned long twopage;
+
+	printk("moving IDT ... ");
+
+	twopage = (unsigned long) vmalloc (2*PAGE_SIZE);
+
+	idt2 = (void *)(twopage + 4096-7*8);
+
+	memcpy(idt2,&idt,sizeof(idt));
+
+	idt_d.limit = 256*8-1;
+	idt_d.addr = idt2;
+	idt_d.__pad = 0;
+
+        __asm__ __volatile__("\tlidt %0": "=m" (idt_d));
+
+	/*
+	 * Unmap lower page:
+	 */
+	pgd = pgd_offset(current->mm, twopage);
+	pmd = pmd_offset(pgd, twopage);
+	pte = pte_offset(pmd, twopage);
+
+	pte_clear(pte);
+	flush_tlb_all();
+
+	printk(" ... done\n");
+}
+
+
+
 __initfunc(void trap_init(void))
 {
 	int i;

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov