Date: Mon, 22 Feb 2016 14:54:51 +0000 (UTC) From: Ruslan Bukin <br@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r295893 - head/sys/riscv/riscv Message-ID: <201602221454.u1MEspOc093658@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: br Date: Mon Feb 22 14:54:50 2016 New Revision: 295893 URL: https://svnweb.freebsd.org/changeset/base/295893 Log: Add basic trap handlers for illegal instruction and breakpoint exceptions. Modified: head/sys/riscv/riscv/trap.c Modified: head/sys/riscv/riscv/trap.c ============================================================================== --- head/sys/riscv/riscv/trap.c Mon Feb 22 14:19:45 2016 (r295892) +++ head/sys/riscv/riscv/trap.c Mon Feb 22 14:54:50 2016 (r295893) @@ -270,6 +270,17 @@ do_trap_supervisor(struct trapframe *fra case EXCP_INSTR_ACCESS_FAULT: data_abort(frame, 0); break; + case EXCP_INSTR_BREAKPOINT: +#ifdef KDB + kdb_trap(exception, 0, frame); +#else + dump_regs(frame); + panic("No debugger in kernel.\n"); +#endif + case EXCP_INSTR_ILLEGAL: + dump_regs(frame); + panic("Illegal instruction at %x\n", frame->tf_sepc); + break; default: dump_regs(frame); panic("Unknown kernel exception %x badaddr %lx\n", @@ -281,6 +292,10 @@ void do_trap_user(struct trapframe *frame) { uint64_t exception; + struct thread *td; + + td = curthread; + td->td_frame = frame; exception = (frame->tf_scause & EXCP_MASK); if (frame->tf_scause & EXCP_INTR) { @@ -302,6 +317,14 @@ do_trap_user(struct trapframe *frame) frame->tf_sepc += 4; /* Next instruction */ svc_handler(frame); break; + case EXCP_INSTR_ILLEGAL: + call_trapsignal(td, SIGILL, ILL_ILLTRP, (void *)frame->tf_sepc); + userret(td, frame); + break; + case EXCP_INSTR_BREAKPOINT: + call_trapsignal(td, SIGTRAP, TRAP_BRKPT, (void *)frame->tf_sepc); + userret(td, frame); + break; default: dump_regs(frame); panic("Unknown userland exception %x badaddr %lx\n",
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201602221454.u1MEspOc093658>