2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
6 * Copyright (C) 1999 Ralf Baechle
7 * Copyright (C) 1999 Silicon Graphics, Inc.
9 * TLB debugging routines. These perform horribly slow but can easily be
10 * modified for debugging purposes.
12 #include <linux/linkage.h>
13 #include <linux/kernel.h>
14 #include <linux/sched.h>
17 #include <asm/pgtable.h>
18 #include <asm/ptrace.h>
19 #include <asm/system.h>
21 asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long write,
22 unsigned long address);
24 asmlinkage void tlb_refill_debug(struct pt_regs regs)
27 panic("%s called. This Does Not Happen (TM).", __FUNCTION__);
30 asmlinkage void xtlb_refill_debug(struct pt_regs *regs)
37 addr = regs->cp0_badvaddr & ~((PAGE_SIZE << 1) - 1);
38 pgd = pgd_offset(current->active_mm, addr);
39 pmd = pmd_offset(pgd, addr);
40 pte = pte_offset(pmd, addr);
42 write_c0_entrylo0(pte_val(pte[0]) >> 6);
43 write_c0_entrylo1(pte_val(pte[1]) >> 6);
44 __asm__ __volatile__("nop;nop;nop");
49 asmlinkage void xtlb_mod_debug(struct pt_regs *regs)
53 addr = regs->cp0_badvaddr;
54 do_page_fault(regs, 1, addr);
57 asmlinkage void xtlb_tlbl_debug(struct pt_regs *regs)
61 addr = regs->cp0_badvaddr;
62 do_page_fault(regs, 0, addr);
65 asmlinkage void xtlb_tlbs_debug(struct pt_regs *regs)
69 addr = regs->cp0_badvaddr;
70 do_page_fault(regs, 1, addr);