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

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

diff -u --recursive --new-file v2.1.65/linux/arch/i386/kernel/traps.c linux/arch/i386/kernel/traps.c
@@ -103,7 +103,6 @@
 asmlinkage void stack_segment(void);
 asmlinkage void general_protection(void);
 asmlinkage void page_fault(void);
-asmlinkage void page_fault_f00f(void);
 asmlinkage void coprocessor_error(void);
 asmlinkage void reserved(void);
 asmlinkage void alignment_check(void);
@@ -417,14 +416,9 @@
 __initfunc(void trap_init_f00f_bug(void))
 {
 	unsigned long page;
-
-	/*
-	 * We use a special page fault handler, to actually detect
-	 * 'bounced' traps/exceptions #0-6. This new page fault
-	 * handler is a few tens of cycles slower than the 'normal'
-	 * one.
-	 */
-	set_trap_gate(14,&page_fault_f00f);
+	pgd_t * pgd;
+	pmd_t * pmd;
+	pte_t * pte;
 
 	/*
 	 * Allocate a new page in virtual address space, 
@@ -433,16 +427,21 @@
 	 * fault for IDT entries #0-#6..
 	 */
 	page = (unsigned long) vmalloc(PAGE_SIZE);
-	memcpy((void *) page, idt_table + 7, (256-7)*8);
+	memcpy((void *) page, idt_table, 256*8);
+
+	pgd = pgd_offset(&init_mm, page);
+	pmd = pmd_offset(pgd, page);
+	pte = pte_offset(pmd, page);
+	*pte = pte_wrprotect(*pte);
+	local_flush_tlb();
 
 	/*
 	 * "idt" is magic - it overlaps the idt_descr
 	 * variable so that updating idt will automatically
 	 * update the idt descriptor..
 	 */
-	idt = (struct desc_struct *)(page - 7*8);
+	idt = (struct desc_struct *)page;
 	__asm__ __volatile__("lidt %0": "=m" (idt_descr));
-
 }
 
 

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