Changeset View
Changeset View
Standalone View
Standalone View
sys/riscv/riscv/trap.c
Show First 20 Lines • Show All 71 Lines • ▼ Show 20 Lines | |||||
#endif | #endif | ||||
int (*dtrace_invop_jump_addr)(struct trapframe *); | int (*dtrace_invop_jump_addr)(struct trapframe *); | ||||
extern register_t fsu_intr_fault; | extern register_t fsu_intr_fault; | ||||
/* Called from exception.S */ | /* Called from exception.S */ | ||||
void do_trap_supervisor(struct trapframe *); | void do_trap_supervisor(struct trapframe *); | ||||
void do_trap_user(struct trapframe *); | void do_trap_user(void); | ||||
static __inline void | static __inline void | ||||
call_trapsignal(struct thread *td, int sig, int code, void *addr, int trapno) | call_trapsignal(struct thread *td, int sig, int code, void *addr, int trapno) | ||||
{ | { | ||||
ksiginfo_t ksi; | ksiginfo_t ksi; | ||||
ksiginfo_init_trap(&ksi); | ksiginfo_init_trap(&ksi); | ||||
ksi.ksi_signo = sig; | ksi.ksi_signo = sig; | ||||
▲ Show 20 Lines • Show All 220 Lines • ▼ Show 20 Lines | #endif | ||||
default: | default: | ||||
dump_regs(frame); | dump_regs(frame); | ||||
panic("Unknown kernel exception %lx trap value %lx\n", | panic("Unknown kernel exception %lx trap value %lx\n", | ||||
exception, frame->tf_stval); | exception, frame->tf_stval); | ||||
} | } | ||||
} | } | ||||
void | void | ||||
do_trap_user(struct trapframe *frame) | do_trap_user(void) | ||||
{ | { | ||||
uint64_t exception; | uint64_t exception; | ||||
struct thread *td; | struct thread *td; | ||||
struct trapframe *frame; | |||||
struct pcb *pcb; | struct pcb *pcb; | ||||
td = curthread; | td = curthread; | ||||
pcb = td->td_pcb; | pcb = td->td_pcb; | ||||
frame = td->td_frame; | |||||
KASSERT(td->td_frame == frame, | |||||
("%s: td_frame %p != frame %p", __func__, td->td_frame, frame)); | |||||
/* Ensure we came from usermode, interrupts disabled */ | /* Ensure we came from usermode, interrupts disabled */ | ||||
KASSERT((csr_read(sstatus) & (SSTATUS_SPP | SSTATUS_SIE)) == 0, | KASSERT((csr_read(sstatus) & (SSTATUS_SPP | SSTATUS_SIE)) == 0, | ||||
("Came from U mode with interrupts enabled")); | ("Came from U mode with interrupts enabled")); | ||||
exception = frame->tf_scause & EXCP_MASK; | exception = frame->tf_scause & EXCP_MASK; | ||||
if (frame->tf_scause & EXCP_INTR) { | if (frame->tf_scause & EXCP_INTR) { | ||||
/* Interrupt */ | /* Interrupt */ | ||||
▲ Show 20 Lines • Show All 54 Lines • Show Last 20 Lines |