12 #include <linux/sched.h>
13 #include <linux/kernel.h>
14 #include <linux/signal.h>
17 #include <linux/export.h>
19 #include <asm/delay.h>
20 #include <asm/ptrace.h>
21 #include <asm/oplib.h>
23 #include <asm/pgtable.h>
24 #include <asm/unistd.h>
25 #include <asm/traps.h>
32 static void instruction_dump(
unsigned long *
pc)
36 if((((
unsigned long) pc) & 3))
39 for(i = -3; i < 6; i++)
40 printk(
"%c%08lx%c",i?
' ':
'<',pc[i],i?
' ':
'>');
44 #define __SAVE __asm__ __volatile__("save %sp, -0x40, %sp\n\t")
45 #define __RESTORE __asm__ __volatile__("restore %g0, %g0, %g0\n\t")
49 static int die_counter;
78 !(((
unsigned long) rw) & 0x7)) {
79 printk(
"Caller[%08lx]: %pS\n", rw->ins[7],
84 printk(
"Instruction DUMP:");
85 instruction_dump ((
unsigned long *) regs->
pc);
97 printk(
"Unimplemented Sparc TRAP, type = %02lx\n", type);
107 info.si_addr = (
void __user *)regs->
pc;
108 info.si_trapno = type - 0x80;
120 printk(
"Ill instr. at pc=%08lx instruction is %08lx\n",
121 regs->
pc, *(
unsigned long *)regs->
pc);
127 info.si_addr = (
void __user *)pc;
138 die_if_kernel(
"Penguin instruction from Penguin mode??!?!", regs);
142 info.si_addr = (
void __user *)pc;
155 printk(
"KERNEL MNA at pc %08lx npc %08lx called by %08lx\n", pc, npc,
162 instruction_dump ((
unsigned long *) regs->
pc);
168 info.si_addr = (
void *)0;
173 static unsigned long init_fsr = 0x0
UL;
185 die_if_kernel(
"Kernel gets FloatingPenguinUnit disabled trap", regs);
187 put_psr(get_psr() |
PSR_EF);
203 fpload(&init_fregs[0], &init_fsr);
208 fpload(&init_fregs[0], &init_fsr);
213 set_thread_flag(TIF_USEDFPU);
218 static unsigned long fake_fsr;
220 static unsigned long fake_depth;
236 put_psr(get_psr() |
PSR_EF);
244 if (!test_tsk_thread_flag(fpt, TIF_USEDFPU)) {
246 fpsave(&fake_regs[0], &fake_fsr, &fake_queue[0], &fake_depth);
253 printk(
"Hmm, FP exception, fsr was %016lx\n", fpt->
thread.fsr);
256 switch ((fpt->
thread.fsr & 0x1c000)) {
260 printk(
"IEEE_754_exception\n");
269 printk(
"sequence_error (OS bug...)\n");
272 printk(
"hardware_error (uhoh!)\n");
275 printk(
"invalid_fp_register (user error)\n");
287 clear_tsk_thread_flag(fpt, TIF_USEDFPU);
293 printk(
"WARNING: FPU exception from kernel mode. at pc=%08lx\n",
295 regs->
pc = regs->
npc;
307 info.si_addr = (
void __user *)pc;
310 if ((fsr & 0x1c000) == (1 << 14)) {
337 die_if_kernel(
"Penguin overflow trap from kernel mode", regs);
341 info.si_addr = (
void __user *)pc;
350 printk(
"Watchpoint detected at PC %08lx NPC %08lx PSR %08lx\n",
354 panic(
"Tell me what a watchpoint trap is, and I'll then deal "
355 "with such a beast...");
364 printk(
"Register Access Exception at PC %08lx NPC %08lx PSR %08lx\n",
370 info.si_addr = (
void __user *)pc;
383 info.si_addr = (
void __user *)pc;
394 printk(
"Co-Processor Exception at PC %08lx NPC %08lx PSR %08lx\n",
400 info.si_addr = (
void __user *)pc;
413 info.si_addr = (
void __user *)pc;
418 #ifdef CONFIG_DEBUG_BUGVERBOSE
422 printk(
"kernel BUG at %s:%d!\n", file, line);
433 extern void thread_info_offsets_are_bolixed_pete(
void);
451 thread_info_offsets_are_bolixed_pete();