2 * linux/arch/parisc/traps.c
4 * Copyright (C) 1991, 1992 Linus Torvalds
5 * Copyright (C) 1999, 2000 Philipp Rumpf <prumpf@tux.org>
9 * 'Traps.c' handles hardware traps and faults after we have saved some
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>
18 #include <linux/timer.h>
19 #include <linux/delay.h>
21 #include <linux/module.h>
22 #include <linux/smp.h>
23 #include <linux/spinlock.h>
24 #include <linux/init.h>
25 #include <linux/interrupt.h>
26 #include <linux/console.h>
27 #include <linux/kallsyms.h>
28 #include <linux/bug.h>
30 #include <asm/assembly.h>
31 #include <asm/system.h>
32 #include <asm/uaccess.h>
35 #include <asm/traps.h>
36 #include <asm/unaligned.h>
37 #include <asm/atomic.h>
40 #include <asm/pdc_chassis.h>
41 #include <asm/unwind.h>
42 #include <asm/tlbflush.h>
43 #include <asm/cacheflush.h>
45 #include "../math-emu/math-emu.h" /* for handle_fpe() */
47 #define PRINT_USER_FAULTS /* (turn this on if you want user faults to be */
48 /* dumped to the console via printk) */
50 #if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK)
51 DEFINE_SPINLOCK(pa_dbit_lock
);
54 <<<<<<< HEAD
:arch
/parisc
/kernel
/traps
.c
56 void parisc_show_stack(struct task_struct
*t
, unsigned long *sp
,
57 struct pt_regs
*regs
);
59 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a
:arch
/parisc
/kernel
/traps
.c
60 static int printbinary(char *buf
, unsigned long x
, int nbits
)
62 unsigned long mask
= 1UL << (nbits
- 1);
64 *buf
++ = (mask
& x
? '1' : '0');
77 #define FFMT "%016llx" /* fpregs are 64-bit always */
79 #define PRINTREGS(lvl,r,f,fmt,x) \
80 printk("%s%s%02d-%02d " fmt " " fmt " " fmt " " fmt "\n", \
81 lvl, f, (x), (x+3), (r)[(x)+0], (r)[(x)+1], \
82 (r)[(x)+2], (r)[(x)+3])
84 static void print_gr(char *level
, struct pt_regs
*regs
)
89 printk("%s\n", level
);
90 printk("%s YZrvWESTHLNXBCVMcbcbcbcbOGFRQPDI\n", level
);
91 printbinary(buf
, regs
->gr
[0], 32);
92 printk("%sPSW: %s %s\n", level
, buf
, print_tainted());
94 for (i
= 0; i
< 32; i
+= 4)
95 PRINTREGS(level
, regs
->gr
, "r", RFMT
, i
);
98 static void print_fr(char *level
, struct pt_regs
*regs
)
102 struct { u32 sw
[2]; } s
;
104 /* FR are 64bit everywhere. Need to use asm to get the content
105 * of fpsr/fper1, and we assume that we won't have a FP Identify
106 * in our way, otherwise we're screwed.
107 * The fldd is used to restore the T-bit if there was one, as the
108 * store clears it anyway.
109 * PA2.0 book says "thou shall not use fstw on FPSR/FPERs" - T-Bone */
110 asm volatile ("fstd %%fr0,0(%1) \n\t"
111 "fldd 0(%1),%%fr0 \n\t"
112 : "=m" (s
) : "r" (&s
) : "r0");
114 printk("%s\n", level
);
115 printk("%s VZOUICununcqcqcqcqcqcrmunTDVZOUI\n", level
);
116 printbinary(buf
, s
.sw
[0], 32);
117 printk("%sFPSR: %s\n", level
, buf
);
118 printk("%sFPER1: %08x\n", level
, s
.sw
[1]);
120 /* here we'll print fr0 again, tho it'll be meaningless */
121 for (i
= 0; i
< 32; i
+= 4)
122 PRINTREGS(level
, regs
->fr
, "fr", FFMT
, i
);
125 void show_regs(struct pt_regs
*regs
)
129 unsigned long cr30
, cr31
;
131 level
= user_mode(regs
) ? KERN_DEBUG
: KERN_CRIT
;
133 print_gr(level
, regs
);
135 for (i
= 0; i
< 8; i
+= 4)
136 PRINTREGS(level
, regs
->sr
, "sr", RFMT
, i
);
139 print_fr(level
, regs
);
143 printk("%s\n", level
);
144 printk("%sIASQ: " RFMT
" " RFMT
" IAOQ: " RFMT
" " RFMT
"\n",
145 level
, regs
->iasq
[0], regs
->iasq
[1], regs
->iaoq
[0], regs
->iaoq
[1]);
146 printk("%s IIR: %08lx ISR: " RFMT
" IOR: " RFMT
"\n",
147 level
, regs
->iir
, regs
->isr
, regs
->ior
);
148 printk("%s CPU: %8d CR30: " RFMT
" CR31: " RFMT
"\n",
149 level
, current_thread_info()->cpu
, cr30
, cr31
);
150 printk("%s ORIG_R28: " RFMT
"\n", level
, regs
->orig_r28
);
152 print_symbol(" IAOQ[0]: %s\n", regs
->iaoq
[0]);
154 print_symbol(" IAOQ[1]: %s\n", regs
->iaoq
[1]);
156 print_symbol(" RP(r2): %s\n", regs
->gr
[2]);
157 <<<<<<< HEAD
:arch
/parisc
/kernel
/traps
.c
160 parisc_show_stack(current
, NULL
, regs
);
161 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a
:arch
/parisc
/kernel
/traps
.c
165 void dump_stack(void)
167 show_stack(NULL
, NULL
);
170 EXPORT_SYMBOL(dump_stack
);
172 static void do_show_stack(struct unwind_frame_info
*info
)
176 printk(KERN_CRIT
"Backtrace:\n");
178 if (unwind_once(info
) < 0 || info
->ip
== 0)
181 if (__kernel_text_address(info
->ip
)) {
182 printk("%s [<" RFMT
">] ", (i
&0x3)==1 ? KERN_CRIT
: "", info
->ip
);
183 #ifdef CONFIG_KALLSYMS
184 print_symbol("%s\n", info
->ip
);
195 <<<<<<< HEAD
:arch
/parisc
/kernel
/traps
.c
196 void show_stack(struct task_struct
*task
, unsigned long *s
)
198 void parisc_show_stack(struct task_struct
*task
, unsigned long *sp
,
199 struct pt_regs
*regs
)
200 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a
:arch
/parisc
/kernel
/traps
.c
202 struct unwind_frame_info info
;
203 <<<<<<< HEAD
:arch
/parisc
/kernel
/traps
.c
205 struct task_struct
*t
;
207 t
= task
? task
: current
;
209 unwind_frame_init(&info
, t
, regs
);
212 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a
:arch
/parisc
/kernel
/traps
.c
214 <<<<<<< HEAD
:arch
/parisc
/kernel
/traps
.c
218 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a
:arch
/parisc
/kernel
/traps
.c
222 asm volatile ("copy %%r30, %0" : "=r"(sp
));
226 memset(&r
, 0, sizeof(struct pt_regs
));
227 r
.iaoq
[0] = (unsigned long)&&HERE
;
228 r
.gr
[2] = (unsigned long)__builtin_return_address(0);
231 unwind_frame_init(&info
, current
, &r
);
234 <<<<<<< HEAD
:arch
/parisc
/kernel
/traps
.c
235 unwind_frame_init_from_blocked_task(&info
, task
);
237 unwind_frame_init_from_blocked_task(&info
, t
);
238 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a
:arch
/parisc
/kernel
/traps
.c
241 <<<<<<< HEAD
:arch
/parisc
/kernel
/traps
.c
244 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a
:arch
/parisc
/kernel
/traps
.c
245 do_show_stack(&info
);
248 <<<<<<< HEAD
:arch
/parisc
/kernel
/traps
.c
250 void show_stack(struct task_struct
*t
, unsigned long *sp
)
252 return parisc_show_stack(t
, sp
, NULL
);
255 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a
:arch
/parisc
/kernel
/traps
.c
256 int is_valid_bugaddr(unsigned long iaoq
)
261 void die_if_kernel(char *str
, struct pt_regs
*regs
, long err
)
263 if (user_mode(regs
)) {
267 printk(KERN_CRIT
"%s (pid %d): %s (code %ld) at " RFMT
"\n",
268 current
->comm
, task_pid_nr(current
), str
, err
, regs
->iaoq
[0]);
269 #ifdef PRINT_USER_FAULTS
270 /* XXX for debugging only */
276 oops_in_progress
= 1;
278 /* Amuse the user in a SPARC fashion */
280 KERN_CRIT
" _______________________________ \n"
281 KERN_CRIT
" < Your System ate a SPARC! Gah! >\n"
282 KERN_CRIT
" ------------------------------- \n"
283 KERN_CRIT
" \\ ^__^\n"
284 KERN_CRIT
" \\ (xx)\\_______\n"
285 KERN_CRIT
" (__)\\ )\\/\\\n"
286 KERN_CRIT
" U ||----w |\n"
287 KERN_CRIT
" || ||\n");
289 /* unlock the pdc lock if necessary */
290 pdc_emergency_unlock();
292 /* maybe the kernel hasn't booted very far yet and hasn't been able
293 * to initialize the serial or STI console. In that case we should
294 * re-enable the pdc console, so that the user will be able to
295 * identify the problem. */
296 if (!console_drivers
)
297 pdc_console_restart();
300 printk(KERN_CRIT
"%s (pid %d): %s (code %ld)\n",
301 current
->comm
, task_pid_nr(current
), str
, err
);
303 /* Wot's wrong wif bein' racy? */
304 if (current
->thread
.flags
& PARISC_KERNEL_DEATH
) {
305 printk(KERN_CRIT
"%s() recursion detected.\n", __FUNCTION__
);
309 current
->thread
.flags
|= PARISC_KERNEL_DEATH
;
313 add_taint(TAINT_DIE
);
316 panic("Fatal exception in interrupt");
319 printk(KERN_EMERG
"Fatal exception: panic in 5 seconds\n");
321 panic("Fatal exception");
327 int syscall_ipi(int (*syscall
) (struct pt_regs
*), struct pt_regs
*regs
)
329 return syscall(regs
);
332 /* gdb uses break 4,8 */
333 #define GDB_BREAK_INSN 0x10004
334 static void handle_gdb_break(struct pt_regs
*regs
, int wot
)
338 si
.si_signo
= SIGTRAP
;
341 si
.si_addr
= (void __user
*) (regs
->iaoq
[0] & ~3);
342 force_sig_info(SIGTRAP
, &si
, current
);
345 static void handle_break(struct pt_regs
*regs
)
347 unsigned iir
= regs
->iir
;
349 if (unlikely(iir
== PARISC_BUG_BREAK_INSN
&& !user_mode(regs
))) {
350 /* check if a BUG() or WARN() trapped here. */
351 enum bug_trap_type tt
;
352 tt
= report_bug(regs
->iaoq
[0] & ~3, regs
);
353 if (tt
== BUG_TRAP_TYPE_WARN
) {
356 return; /* return to next instruction when WARN_ON(). */
358 die_if_kernel("Unknown kernel breakpoint", regs
,
359 (tt
== BUG_TRAP_TYPE_NONE
) ? 9 : 0);
362 #ifdef PRINT_USER_FAULTS
363 if (unlikely(iir
!= GDB_BREAK_INSN
)) {
364 printk(KERN_DEBUG
"break %d,%d: pid=%d command='%s'\n",
365 iir
& 31, (iir
>>13) & ((1<<13)-1),
366 task_pid_nr(current
), current
->comm
);
371 /* send standard GDB signal */
372 handle_gdb_break(regs
, TRAP_BRKPT
);
375 static void default_trap(int code
, struct pt_regs
*regs
)
377 printk(KERN_ERR
"Trap %d on CPU %d\n", code
, smp_processor_id());
381 void (*cpu_lpmc
) (int code
, struct pt_regs
*regs
) __read_mostly
= default_trap
;
384 void transfer_pim_to_trap_frame(struct pt_regs
*regs
)
387 extern unsigned int hpmc_pim_data
[];
388 struct pdc_hpmc_pim_11
*pim_narrow
;
389 struct pdc_hpmc_pim_20
*pim_wide
;
391 if (boot_cpu_data
.cpu_type
>= pcxu
) {
393 pim_wide
= (struct pdc_hpmc_pim_20
*)hpmc_pim_data
;
396 * Note: The following code will probably generate a
397 * bunch of truncation error warnings from the compiler.
398 * Could be handled with an ifdef, but perhaps there
402 regs
->gr
[0] = pim_wide
->cr
[22];
404 for (i
= 1; i
< 32; i
++)
405 regs
->gr
[i
] = pim_wide
->gr
[i
];
407 for (i
= 0; i
< 32; i
++)
408 regs
->fr
[i
] = pim_wide
->fr
[i
];
410 for (i
= 0; i
< 8; i
++)
411 regs
->sr
[i
] = pim_wide
->sr
[i
];
413 regs
->iasq
[0] = pim_wide
->cr
[17];
414 regs
->iasq
[1] = pim_wide
->iasq_back
;
415 regs
->iaoq
[0] = pim_wide
->cr
[18];
416 regs
->iaoq
[1] = pim_wide
->iaoq_back
;
418 regs
->sar
= pim_wide
->cr
[11];
419 regs
->iir
= pim_wide
->cr
[19];
420 regs
->isr
= pim_wide
->cr
[20];
421 regs
->ior
= pim_wide
->cr
[21];
424 pim_narrow
= (struct pdc_hpmc_pim_11
*)hpmc_pim_data
;
426 regs
->gr
[0] = pim_narrow
->cr
[22];
428 for (i
= 1; i
< 32; i
++)
429 regs
->gr
[i
] = pim_narrow
->gr
[i
];
431 for (i
= 0; i
< 32; i
++)
432 regs
->fr
[i
] = pim_narrow
->fr
[i
];
434 for (i
= 0; i
< 8; i
++)
435 regs
->sr
[i
] = pim_narrow
->sr
[i
];
437 regs
->iasq
[0] = pim_narrow
->cr
[17];
438 regs
->iasq
[1] = pim_narrow
->iasq_back
;
439 regs
->iaoq
[0] = pim_narrow
->cr
[18];
440 regs
->iaoq
[1] = pim_narrow
->iaoq_back
;
442 regs
->sar
= pim_narrow
->cr
[11];
443 regs
->iir
= pim_narrow
->cr
[19];
444 regs
->isr
= pim_narrow
->cr
[20];
445 regs
->ior
= pim_narrow
->cr
[21];
449 * The following fields only have meaning if we came through
450 * another path. So just zero them here.
460 * This routine is called as a last resort when everything else
461 * has gone clearly wrong. We get called for faults in kernel space,
464 void parisc_terminate(char *msg
, struct pt_regs
*regs
, int code
, unsigned long offset
)
466 static DEFINE_SPINLOCK(terminate_lock
);
468 oops_in_progress
= 1;
472 spin_lock(&terminate_lock
);
474 /* unlock the pdc lock if necessary */
475 pdc_emergency_unlock();
477 /* restart pdc console if necessary */
478 if (!console_drivers
)
479 pdc_console_restart();
481 /* Not all paths will gutter the processor... */
485 transfer_pim_to_trap_frame(regs
);
495 /* show_stack(NULL, (unsigned long *)regs->gr[30]); */
496 struct unwind_frame_info info
;
497 unwind_frame_init(&info
, current
, regs
);
498 do_show_stack(&info
);
502 printk(KERN_CRIT
"%s: Code=%d regs=%p (Addr=" RFMT
")\n",
503 msg
, code
, regs
, offset
);
506 spin_unlock(&terminate_lock
);
508 /* put soft power button back under hardware control;
509 * if the user had pressed it once at any time, the
510 * system will shut down immediately right here. */
511 pdc_soft_power_button(0);
513 /* Call kernel panic() so reboot timeouts work properly
514 * FIXME: This function should be on the list of
515 * panic notifiers, and we should call panic
516 * directly from the location that we wish.
517 * e.g. We should not call panic from
518 * parisc_terminate, but rather the oter way around.
519 * This hack works, prints the panic message twice,
520 * and it enables reboot timers!
525 void handle_interruption(int code
, struct pt_regs
*regs
)
527 unsigned long fault_address
= 0;
528 unsigned long fault_space
= 0;
532 pdc_console_restart(); /* switch back to pdc if HPMC */
537 * If the priority level is still user, and the
538 * faulting space is not equal to the active space
539 * then the user is attempting something in a space
540 * that does not belong to them. Kill the process.
542 * This is normally the situation when the user
543 * attempts to jump into the kernel space at the
544 * wrong offset, be it at the gateway page or a
547 * We cannot normally signal the process because it
548 * could *be* on the gateway page, and processes
549 * executing on the gateway page can't have signals
552 * We merely readjust the address into the users
553 * space, at a destination address of zero, and
554 * allow processing to continue.
556 if (((unsigned long)regs
->iaoq
[0] & 3) &&
557 ((unsigned long)regs
->iasq
[0] != (unsigned long)regs
->sr
[7])) {
558 /* Kill the user process later */
559 regs
->iaoq
[0] = 0 | 3;
560 regs
->iaoq
[1] = regs
->iaoq
[0] + 4;
561 regs
->iasq
[0] = regs
->iasq
[0] = regs
->sr
[7];
562 regs
->gr
[0] &= ~PSW_B
;
567 printk(KERN_CRIT
"Interruption # %d\n", code
);
573 /* High-priority machine check (HPMC) */
575 /* set up a new led state on systems shipped with a LED State panel */
576 pdc_chassis_send_status(PDC_CHASSIS_DIRECT_HPMC
);
578 parisc_terminate("High Priority Machine Check (HPMC)",
583 /* Power failure interrupt */
584 printk(KERN_CRIT
"Power failure interrupt !\n");
588 /* Recovery counter trap */
589 regs
->gr
[0] &= ~PSW_R
;
590 if (user_space(regs
))
591 handle_gdb_break(regs
, TRAP_TRACE
);
592 /* else this must be the start of a syscall - just let it run */
596 /* Low-priority machine check */
597 pdc_chassis_send_status(PDC_CHASSIS_DIRECT_LPMC
);
605 /* Instruction TLB miss fault/Instruction page fault */
606 fault_address
= regs
->iaoq
[0];
607 fault_space
= regs
->iasq
[0];
611 /* Illegal instruction trap */
612 die_if_kernel("Illegal instruction", regs
, code
);
613 si
.si_code
= ILL_ILLOPC
;
617 /* Break instruction trap */
622 /* Privileged operation trap */
623 die_if_kernel("Privileged operation", regs
, code
);
624 si
.si_code
= ILL_PRVOPC
;
628 /* Privileged register trap */
629 if ((regs
->iir
& 0xffdfffe0) == 0x034008a0) {
631 /* This is a MFCTL cr26/cr27 to gr instruction.
632 * PCXS traps on this, so we need to emulate it.
635 if (regs
->iir
& 0x00200000)
636 regs
->gr
[regs
->iir
& 0x1f] = mfctl(27);
638 regs
->gr
[regs
->iir
& 0x1f] = mfctl(26);
640 regs
->iaoq
[0] = regs
->iaoq
[1];
642 regs
->iasq
[0] = regs
->iasq
[1];
646 die_if_kernel("Privileged register usage", regs
, code
);
647 si
.si_code
= ILL_PRVREG
;
649 si
.si_signo
= SIGILL
;
651 si
.si_addr
= (void __user
*) regs
->iaoq
[0];
652 force_sig_info(SIGILL
, &si
, current
);
656 /* Overflow Trap, let the userland signal handler do the cleanup */
657 si
.si_signo
= SIGFPE
;
658 si
.si_code
= FPE_INTOVF
;
659 si
.si_addr
= (void __user
*) regs
->iaoq
[0];
660 force_sig_info(SIGFPE
, &si
, current
);
665 The condition succeeds in an instruction which traps
668 si
.si_signo
= SIGFPE
;
669 /* Set to zero, and let the userspace app figure it out from
670 the insn pointed to by si_addr */
672 si
.si_addr
= (void __user
*) regs
->iaoq
[0];
673 force_sig_info(SIGFPE
, &si
, current
);
676 /* The kernel doesn't want to handle condition codes */
680 /* Assist Exception Trap, i.e. floating point exception. */
681 die_if_kernel("Floating point exception", regs
, 0); /* quiet */
686 /* Data TLB miss fault/Data page fault */
689 /* Non-access instruction TLB miss fault */
690 /* The instruction TLB entry needed for the target address of the FIC
691 is absent, and hardware can't find it, so we get to cleanup */
694 /* Non-access data TLB miss fault/Non-access data page fault */
696 Still need to add slow path emulation code here!
697 If the insn used a non-shadow register, then the tlb
698 handlers could not have their side-effect (e.g. probe
699 writing to a target register) emulated since rfir would
700 erase the changes to said register. Instead we have to
701 setup everything, call this function we are in, and emulate
702 by hand. Technically we need to emulate:
703 fdc,fdce,pdc,"fic,4f",prober,probeir,probew, probeiw
705 fault_address
= regs
->ior
;
706 fault_space
= regs
->isr
;
710 /* PCXS only -- later cpu's split this into types 26,27 & 28 */
711 /* Check for unaligned access */
712 if (check_unaligned(regs
)) {
713 handle_unaligned(regs
);
718 /* PCXL: Data memory access rights trap */
719 fault_address
= regs
->ior
;
720 fault_space
= regs
->isr
;
724 /* Data memory break trap */
725 regs
->gr
[0] |= PSW_X
; /* So we can single-step over the trap */
728 /* Page reference trap */
729 handle_gdb_break(regs
, TRAP_HWBKPT
);
733 /* Taken branch trap */
734 regs
->gr
[0] &= ~PSW_T
;
735 if (user_space(regs
))
736 handle_gdb_break(regs
, TRAP_BRANCH
);
737 /* else this must be the start of a syscall - just let it
743 /* Instruction access rights */
744 /* PCXL: Instruction memory protection trap */
747 * This could be caused by either: 1) a process attempting
748 * to execute within a vma that does not have execute
749 * permission, or 2) an access rights violation caused by a
750 * flush only translation set up by ptep_get_and_clear().
751 * So we check the vma permissions to differentiate the two.
752 * If the vma indicates we have execute permission, then
753 * the cause is the latter one. In this case, we need to
754 * call do_page_fault() to fix the problem.
757 if (user_mode(regs
)) {
758 struct vm_area_struct
*vma
;
760 down_read(¤t
->mm
->mmap_sem
);
761 vma
= find_vma(current
->mm
,regs
->iaoq
[0]);
762 if (vma
&& (regs
->iaoq
[0] >= vma
->vm_start
)
763 && (vma
->vm_flags
& VM_EXEC
)) {
765 fault_address
= regs
->iaoq
[0];
766 fault_space
= regs
->iasq
[0];
768 up_read(¤t
->mm
->mmap_sem
);
769 break; /* call do_page_fault() */
771 up_read(¤t
->mm
->mmap_sem
);
775 /* Data memory protection ID trap */
776 die_if_kernel("Protection id trap", regs
, code
);
777 si
.si_code
= SEGV_MAPERR
;
778 si
.si_signo
= SIGSEGV
;
781 si
.si_addr
= (void __user
*) regs
->iaoq
[0];
783 si
.si_addr
= (void __user
*) regs
->ior
;
784 force_sig_info(SIGSEGV
, &si
, current
);
788 /* Unaligned data reference trap */
789 handle_unaligned(regs
);
793 if (user_mode(regs
)) {
794 #ifdef PRINT_USER_FAULTS
795 printk(KERN_DEBUG
"\nhandle_interruption() pid=%d command='%s'\n",
796 task_pid_nr(current
), current
->comm
);
799 /* SIGBUS, for lack of a better one. */
800 si
.si_signo
= SIGBUS
;
801 si
.si_code
= BUS_OBJERR
;
803 si
.si_addr
= (void __user
*) regs
->ior
;
804 force_sig_info(SIGBUS
, &si
, current
);
807 pdc_chassis_send_status(PDC_CHASSIS_DIRECT_PANIC
);
809 parisc_terminate("Unexpected interruption", regs
, code
, 0);
813 if (user_mode(regs
)) {
814 if ((fault_space
>> SPACEID_SHIFT
) != (regs
->sr
[7] >> SPACEID_SHIFT
)) {
815 #ifdef PRINT_USER_FAULTS
816 if (fault_space
== 0)
817 printk(KERN_DEBUG
"User Fault on Kernel Space ");
819 printk(KERN_DEBUG
"User Fault (long pointer) (fault %d) ",
821 printk("pid=%d command='%s'\n", task_pid_nr(current
), current
->comm
);
824 si
.si_signo
= SIGSEGV
;
826 si
.si_code
= SEGV_MAPERR
;
827 si
.si_addr
= (void __user
*) regs
->ior
;
828 force_sig_info(SIGSEGV
, &si
, current
);
835 * The kernel should never fault on its own address space.
838 if (fault_space
== 0)
840 pdc_chassis_send_status(PDC_CHASSIS_DIRECT_PANIC
);
841 parisc_terminate("Kernel Fault", regs
, code
, fault_address
);
846 do_page_fault(regs
, code
, fault_address
);
850 int __init
check_ivt(void *iva
)
852 extern const u32 os_hpmc
[];
853 extern const u32 os_hpmc_end
[];
861 if (strcmp((char *)iva
, "cows can fly"))
866 for (i
= 0; i
< 8; i
++)
869 /* Compute Checksum for HPMC handler */
871 length
= os_hpmc_end
- os_hpmc
;
874 hpmcp
= (u32
*)os_hpmc
;
876 for (i
=0; i
<length
/4; i
++)
888 extern const void fault_vector_11
;
890 extern const void fault_vector_20
;
892 void __init
trap_init(void)
896 if (boot_cpu_data
.cpu_type
>= pcxu
)
897 iva
= (void *) &fault_vector_20
;
900 panic("Can't boot 64-bit OS on PA1.1 processor!");
902 iva
= (void *) &fault_vector_11
;
906 panic("IVT invalid");