diff options
author | Ley Foon Tan <lftan@altera.com> | 2015-04-16 15:19:01 +0800 |
---|---|---|
committer | Ley Foon Tan <lftan@altera.com> | 2015-04-20 11:11:14 +0800 |
commit | baa54ab93c2e1ced7e54f9c021fe102c0d39c090 (patch) | |
tree | d7e6dc664ef3c36d3b93f865dc1e245f2870805f /arch/nios2/kernel/traps.c | |
parent | 170c381f6bcd9ad3235654988aabddb612b34a39 (diff) | |
download | talos-obmc-linux-baa54ab93c2e1ced7e54f9c021fe102c0d39c090.tar.gz talos-obmc-linux-baa54ab93c2e1ced7e54f9c021fe102c0d39c090.zip |
nios2: rework trap handler
Redefine trap handler as below:
0 N/A reserved for system calls
1 SIGUSR1 user-defined signal 1
2 SIGUSR2 user-defined signal 2
3 SIGILL illegal instruction
4..29 reserved (but implemented to raise SIGILL instead of being undefined)
30 SIGTRAP KGDB
31 SIGTRAP trace/breakpoint trap
Signed-off-by: Ley Foon Tan <lftan@altera.com>
Diffstat (limited to 'arch/nios2/kernel/traps.c')
-rw-r--r-- | arch/nios2/kernel/traps.c | 34 |
1 files changed, 27 insertions, 7 deletions
diff --git a/arch/nios2/kernel/traps.c b/arch/nios2/kernel/traps.c index b7b97641a9a6..81f7da7b1d55 100644 --- a/arch/nios2/kernel/traps.c +++ b/arch/nios2/kernel/traps.c @@ -23,6 +23,17 @@ static DEFINE_SPINLOCK(die_lock); +static void _send_sig(int signo, int code, unsigned long addr) +{ + siginfo_t info; + + info.si_signo = signo; + info.si_errno = 0; + info.si_code = code; + info.si_addr = (void __user *) addr; + force_sig_info(signo, &info, current); +} + void die(const char *str, struct pt_regs *regs, long err) { console_verbose(); @@ -39,16 +50,10 @@ void die(const char *str, struct pt_regs *regs, long err) void _exception(int signo, struct pt_regs *regs, int code, unsigned long addr) { - siginfo_t info; - if (!user_mode(regs)) die("Exception in kernel mode", regs, signo); - info.si_signo = signo; - info.si_errno = 0; - info.si_code = code; - info.si_addr = (void __user *) addr; - force_sig_info(signo, &info, current); + _send_sig(signo, code, addr); } /* @@ -183,3 +188,18 @@ asmlinkage void unhandled_exception(struct pt_regs *regs, int cause) pr_emerg("opcode: 0x%08lx\n", *(unsigned long *)(regs->ea)); } + +asmlinkage void handle_trap_1_c(struct pt_regs *fp) +{ + _send_sig(SIGUSR1, 0, fp->ea); +} + +asmlinkage void handle_trap_2_c(struct pt_regs *fp) +{ + _send_sig(SIGUSR2, 0, fp->ea); +} + +asmlinkage void handle_trap_3_c(struct pt_regs *fp) +{ + _send_sig(SIGILL, ILL_ILLTRP, fp->ea); +} |