|
@@ -28,10 +28,9 @@ void __init trap_init(void)
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
-void die(const char *str, struct pt_regs *regs, unsigned long address,
|
|
|
- unsigned long cause_reg)
|
|
|
+void die(const char *str, struct pt_regs *regs, unsigned long address)
|
|
|
{
|
|
|
- show_kernel_fault_diag(str, regs, address, cause_reg);
|
|
|
+ show_kernel_fault_diag(str, regs, address);
|
|
|
|
|
|
/* DEAD END */
|
|
|
__asm__("flag 1");
|
|
@@ -42,14 +41,13 @@ void die(const char *str, struct pt_regs *regs, unsigned long address,
|
|
|
* -for user faults enqueues requested signal
|
|
|
* -for kernel, chk if due to copy_(to|from)_user, otherwise die()
|
|
|
*/
|
|
|
-static noinline int handle_exception(unsigned long cause, char *str,
|
|
|
- struct pt_regs *regs, siginfo_t *info)
|
|
|
+static noinline int
|
|
|
+handle_exception(const char *str, struct pt_regs *regs, siginfo_t *info)
|
|
|
{
|
|
|
if (user_mode(regs)) {
|
|
|
struct task_struct *tsk = current;
|
|
|
|
|
|
tsk->thread.fault_address = (__force unsigned int)info->si_addr;
|
|
|
- tsk->thread.cause_code = cause;
|
|
|
|
|
|
force_sig_info(info->si_signo, info, tsk);
|
|
|
|
|
@@ -58,14 +56,14 @@ static noinline int handle_exception(unsigned long cause, char *str,
|
|
|
if (fixup_exception(regs))
|
|
|
return 0;
|
|
|
|
|
|
- die(str, regs, (unsigned long)info->si_addr, cause);
|
|
|
+ die(str, regs, (unsigned long)info->si_addr);
|
|
|
}
|
|
|
|
|
|
return 1;
|
|
|
}
|
|
|
|
|
|
#define DO_ERROR_INFO(signr, str, name, sicode) \
|
|
|
-int name(unsigned long cause, unsigned long address, struct pt_regs *regs) \
|
|
|
+int name(unsigned long address, struct pt_regs *regs) \
|
|
|
{ \
|
|
|
siginfo_t info = { \
|
|
|
.si_signo = signr, \
|
|
@@ -73,7 +71,7 @@ int name(unsigned long cause, unsigned long address, struct pt_regs *regs) \
|
|
|
.si_code = sicode, \
|
|
|
.si_addr = (void __user *)address, \
|
|
|
}; \
|
|
|
- return handle_exception(cause, str, regs, &info);\
|
|
|
+ return handle_exception(str, regs, &info);\
|
|
|
}
|
|
|
|
|
|
/*
|
|
@@ -90,11 +88,11 @@ DO_ERROR_INFO(SIGBUS, "Misaligned Access", do_misaligned_error, BUS_ADRALN)
|
|
|
/*
|
|
|
* Entry Point for Misaligned Data access Exception, for emulating in software
|
|
|
*/
|
|
|
-int do_misaligned_access(unsigned long cause, unsigned long address,
|
|
|
- struct pt_regs *regs, struct callee_regs *cregs)
|
|
|
+int do_misaligned_access(unsigned long address, struct pt_regs *regs,
|
|
|
+ struct callee_regs *cregs)
|
|
|
{
|
|
|
- if (misaligned_fixup(address, regs, cause, cregs) != 0)
|
|
|
- return do_misaligned_error(cause, address, regs);
|
|
|
+ if (misaligned_fixup(address, regs, cregs) != 0)
|
|
|
+ return do_misaligned_error(address, regs);
|
|
|
|
|
|
return 0;
|
|
|
}
|
|
@@ -104,10 +102,9 @@ int do_misaligned_access(unsigned long cause, unsigned long address,
|
|
|
* Entry point for miscll errors such as Nested Exceptions
|
|
|
* -Duplicate TLB entry is handled seperately though
|
|
|
*/
|
|
|
-void do_machine_check_fault(unsigned long cause, unsigned long address,
|
|
|
- struct pt_regs *regs)
|
|
|
+void do_machine_check_fault(unsigned long address, struct pt_regs *regs)
|
|
|
{
|
|
|
- die("Machine Check Exception", regs, address, cause);
|
|
|
+ die("Machine Check Exception", regs, address);
|
|
|
}
|
|
|
|
|
|
|
|
@@ -120,23 +117,22 @@ void do_machine_check_fault(unsigned long cause, unsigned long address,
|
|
|
* -1 used for software breakpointing (gdb)
|
|
|
* -2 used by kprobes
|
|
|
*/
|
|
|
-void do_non_swi_trap(unsigned long cause, unsigned long address,
|
|
|
- struct pt_regs *regs)
|
|
|
+void do_non_swi_trap(unsigned long address, struct pt_regs *regs)
|
|
|
{
|
|
|
- unsigned int param = cause & 0xff;
|
|
|
+ unsigned int param = regs->ecr_param;
|
|
|
|
|
|
switch (param) {
|
|
|
case 1:
|
|
|
- trap_is_brkpt(cause, address, regs);
|
|
|
+ trap_is_brkpt(address, regs);
|
|
|
break;
|
|
|
|
|
|
case 2:
|
|
|
- trap_is_kprobe(param, address, regs);
|
|
|
+ trap_is_kprobe(address, regs);
|
|
|
break;
|
|
|
|
|
|
case 3:
|
|
|
case 4:
|
|
|
- kgdb_trap(regs, param);
|
|
|
+ kgdb_trap(regs);
|
|
|
break;
|
|
|
|
|
|
default:
|
|
@@ -149,14 +145,14 @@ void do_non_swi_trap(unsigned long cause, unsigned long address,
|
|
|
* -For a corner case, ARC kprobes implementation resorts to using
|
|
|
* this exception, hence the check
|
|
|
*/
|
|
|
-void do_insterror_or_kprobe(unsigned long cause,
|
|
|
- unsigned long address,
|
|
|
- struct pt_regs *regs)
|
|
|
+void do_insterror_or_kprobe(unsigned long address, struct pt_regs *regs)
|
|
|
{
|
|
|
+ int rc;
|
|
|
+
|
|
|
/* Check if this exception is caused by kprobes */
|
|
|
- if (notify_die(DIE_IERR, "kprobe_ierr", regs, address,
|
|
|
- cause, SIGILL) == NOTIFY_STOP)
|
|
|
+ rc = notify_die(DIE_IERR, "kprobe_ierr", regs, address, 0, SIGILL);
|
|
|
+ if (rc == NOTIFY_STOP)
|
|
|
return;
|
|
|
|
|
|
- insterror_is_error(cause, address, regs);
|
|
|
+ insterror_is_error(address, regs);
|
|
|
}
|