13 #include <linux/sched.h>
14 #include <linux/kernel.h>
15 #include <linux/string.h>
16 #include <linux/errno.h>
17 #include <linux/ptrace.h>
21 #include <linux/module.h>
30 #include <asm/uaccess.h>
33 #include <asm/traps.h>
34 #include <asm/unaligned.h>
39 #include <asm/unwind.h>
40 #include <asm/tlbflush.h>
41 #include <asm/cacheflush.h>
43 #include "../math-emu/math-emu.h"
45 #define PRINT_USER_FAULTS
48 #if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK)
55 static int printbinary(
char *
buf,
unsigned long x,
int nbits)
57 unsigned long mask = 1
UL << (nbits - 1);
59 *buf++ = (mask & x ?
'1' :
'0');
72 #define FFMT "%016llx"
74 #define PRINTREGS(lvl,r,f,fmt,x) \
75 printk("%s%s%02d-%02d " fmt " " fmt " " fmt " " fmt "\n", \
76 lvl, f, (x), (x+3), (r)[(x)+0], (r)[(x)+1], \
77 (r)[(x)+2], (r)[(x)+3])
85 printk(
"%s YZrvWESTHLNXBCVMcbcbcbcbOGFRQPDI\n", level);
86 printbinary(buf, regs->
gr[0], 32);
89 for (i = 0; i < 32; i += 4)
105 asm volatile (
"fstd %%fr0,0(%1) \n\t"
106 "fldd 0(%1),%%fr0 \n\t"
107 :
"=m" (
s) :
"r" (&
s) :
"r0");
110 printk(
"%s VZOUICununcqcqcqcqcqcrmunTDVZOUI\n", level);
111 printbinary(buf,
s.sw[0], 32);
112 printk(
"%sFPSR: %s\n", level, buf);
113 printk(
"%sFPER1: %08x\n", level,
s.sw[1]);
116 for (i = 0; i < 32; i += 4)
124 unsigned long cr30, cr31;
129 print_gr(level, regs);
131 for (i = 0; i < 8; i += 4)
135 print_fr(level, regs);
142 printk(
"%s IIR: %08lx ISR: " RFMT
" IOR: " RFMT
"\n",
144 printk(
"%s CPU: %8d CR30: " RFMT
" CR31: " RFMT
"\n",
149 printk(
"%s IAOQ[0]: " RFMT
"\n", level, regs->
iaoq[0]);
150 printk(
"%s IAOQ[1]: " RFMT
"\n", level, regs->
iaoq[1]);
151 printk(
"%s RP(r2): " RFMT
"\n", level, regs->
gr[2]);
153 printk(
"%s IAOQ[0]: %pS\n", level, (
void *) regs->
iaoq[0]);
154 printk(
"%s IAOQ[1]: %pS\n", level, (
void *) regs->
iaoq[1]);
155 printk(
"%s RP(r2): %pS\n", level, (
void *) regs->
gr[2]);
180 info->
ip, (
void *) info->
ip);
203 asm volatile (
"copy %%r30, %0" :
"=r"(
sp));
208 r.iaoq[0] = (
unsigned long)&&HERE;
209 r.gr[2] = (
unsigned long)__builtin_return_address(0);
219 do_show_stack(&info);
224 return parisc_show_stack(t, sp,
NULL);
240 #ifdef PRINT_USER_FAULTS
253 " _______________________________ \n"
254 " < Your System ate a SPARC! Gah! >\n"
255 " ------------------------------- \n"
288 panic(
"Fatal exception in interrupt");
293 panic(
"Fatal exception");
306 #define GDB_BREAK_INSN 0x10004
307 static void handle_gdb_break(
struct pt_regs *regs,
int wot)
314 si.si_addr = (
void __user *) (regs->
iaoq[0] & ~3);
318 static void handle_break(
struct pt_regs *regs)
335 #ifdef PRINT_USER_FAULTS
338 iir & 31, (iir>>13) & ((1<<13)-1),
348 static void default_trap(
int code,
struct pt_regs *regs)
360 extern unsigned int hpmc_pim_data[];
375 regs->
gr[0] = pim_wide->
cr[22];
377 for (i = 1; i < 32; i++)
378 regs->
gr[i] = pim_wide->
gr[i];
380 for (i = 0; i < 32; i++)
381 regs->
fr[i] = pim_wide->
fr[i];
383 for (i = 0; i < 8; i++)
384 regs->
sr[i] = pim_wide->
sr[i];
386 regs->
iasq[0] = pim_wide->
cr[17];
388 regs->
iaoq[0] = pim_wide->
cr[18];
391 regs->
sar = pim_wide->
cr[11];
392 regs->
iir = pim_wide->
cr[19];
393 regs->
isr = pim_wide->
cr[20];
394 regs->
ior = pim_wide->
cr[21];
399 regs->
gr[0] = pim_narrow->
cr[22];
401 for (i = 1; i < 32; i++)
402 regs->
gr[i] = pim_narrow->
gr[i];
404 for (i = 0; i < 32; i++)
405 regs->
fr[i] = pim_narrow->
fr[i];
407 for (i = 0; i < 8; i++)
408 regs->
sr[i] = pim_narrow->
sr[i];
410 regs->
iasq[0] = pim_narrow->
cr[17];
412 regs->
iaoq[0] = pim_narrow->
cr[18];
415 regs->
sar = pim_narrow->
cr[11];
416 regs->
iir = pim_narrow->
cr[19];
417 regs->
isr = pim_narrow->
cr[20];
418 regs->
ior = pim_narrow->
cr[21];
445 spin_lock(&terminate_lock);
471 do_show_stack(&info);
476 msg, code, regs, offset);
479 spin_unlock(&terminate_lock);
500 unsigned long fault_address = 0;
501 unsigned long fault_space = 0;
529 if (((
unsigned long)regs->
iaoq[0] & 3) &&
530 ((
unsigned long)regs->
iasq[0] != (
unsigned long)regs->
sr[7])) {
532 regs->
iaoq[0] = 0 | 3;
579 fault_address = regs->
iaoq[0];
580 fault_space = regs->
iasq[0];
602 if ((regs->
iir & 0xffdfffe0) == 0x034008a0) {
608 if (regs->
iir & 0x00200000)
678 fault_address = regs->
ior;
679 fault_space = regs->
isr;
692 fault_address = regs->
ior;
693 fault_space = regs->
isr;
738 fault_address = regs->
iaoq[0];
739 fault_space = regs->
iasq[0];
771 #ifdef PRINT_USER_FAULTS
792 #ifdef PRINT_USER_FAULTS
793 if (fault_space == 0)
816 if (fault_space == 0)
830 extern u32 os_hpmc_size;
831 extern const u32 os_hpmc[];
839 if (
strcmp((
char *)iva,
"cows can fly"))
844 for (i = 0; i < 8; i++)
848 length = os_hpmc_size;
851 hpmcp = (
u32 *)os_hpmc;
853 for (i=0; i<length/4; i++)
874 iva = (
void *) &fault_vector_20;
877 panic(
"Can't boot 64-bit OS on PA1.1 processor!");
879 iva = (
void *) &fault_vector_11;
883 panic(
"IVT invalid");