patch-2.4.20 linux-2.4.20/arch/i386/kernel/traps.c
Next file: linux-2.4.20/arch/i386/lib/checksum.S
Previous file: linux-2.4.20/arch/i386/kernel/trampoline.S
Back to the patch index
Back to the overall index
- Lines: 98
- Date:
Thu Nov 28 15:53:09 2002
- Orig file:
linux-2.4.19/arch/i386/kernel/traps.c
- Orig date:
Fri Aug 2 17:39:42 2002
diff -urN linux-2.4.19/arch/i386/kernel/traps.c linux-2.4.20/arch/i386/kernel/traps.c
@@ -40,9 +40,9 @@
#include <asm/smp.h>
#include <asm/pgalloc.h>
+#include <asm/fixmap.h>
#ifdef CONFIG_X86_VISWS_APIC
-#include <asm/fixmap.h>
#include <asm/cobalt.h>
#include <asm/lithium.h>
#endif
@@ -186,6 +186,14 @@
show_trace(esp);
}
+/*
+ * The architecture-independent backtrace generator
+ */
+void dump_stack(void)
+{
+ show_stack(0);
+}
+
void show_registers(struct pt_regs *regs)
{
int i;
@@ -305,8 +313,13 @@
static void inline do_trap(int trapnr, int signr, char *str, int vm86,
struct pt_regs * regs, long error_code, siginfo_t *info)
{
- if (vm86 && regs->eflags & VM_MASK)
- goto vm86_trap;
+ if (regs->eflags & VM_MASK) {
+ if (vm86)
+ goto vm86_trap;
+ else
+ goto trap_signal;
+ }
+
if (!(regs->xcs & 3))
goto kernel_trap;
@@ -514,10 +527,15 @@
{
unsigned int condition;
struct task_struct *tsk = current;
+ unsigned long eip = regs->eip;
siginfo_t info;
__asm__ __volatile__("movl %%db6,%0" : "=r" (condition));
+ /* If the user set TF, it's simplest to clear it right away. */
+ if ((eip >=PAGE_OFFSET) && (regs->eflags & TF_MASK))
+ goto clear_TF;
+
/* Mask out spurious debug traps due to lazy DR7 setting */
if (condition & (DR_TRAP0|DR_TRAP1|DR_TRAP2|DR_TRAP3)) {
if (!tsk->thread.debugreg[7])
@@ -758,35 +776,17 @@
#endif /* CONFIG_MATH_EMULATION */
-#ifndef CONFIG_M686
+#ifndef CONFIG_X86_F00F_WORKS_OK
void __init trap_init_f00f_bug(void)
{
- unsigned long page;
- pgd_t * pgd;
- pmd_t * pmd;
- pte_t * pte;
-
- /*
- * Allocate a new page in virtual address space,
- * move the IDT into it and write protect this page.
- */
- page = (unsigned long) vmalloc(PAGE_SIZE);
- pgd = pgd_offset(&init_mm, page);
- pmd = pmd_offset(pgd, page);
- pte = pte_offset(pmd, page);
- __free_page(pte_page(*pte));
- *pte = mk_pte_phys(__pa(&idt_table), PAGE_KERNEL_RO);
- /*
- * Not that any PGE-capable kernel should have the f00f bug ...
- */
- __flush_tlb_all();
-
/*
* "idt" is magic - it overlaps the idt_descr
* variable so that updating idt will automatically
* update the idt descriptor..
*/
- idt = (struct desc_struct *)page;
+ __set_fixmap(FIX_F00F, __pa(&idt_table), PAGE_KERNEL_RO);
+ idt = (struct desc_struct *)__fix_to_virt(FIX_F00F);
+
__asm__ __volatile__("lidt %0": "=m" (idt_descr));
}
#endif
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)