Changeset View
Changeset View
Standalone View
Standalone View
sys/riscv/riscv/trap.c
Show First 20 Lines • Show All 268 Lines • ▼ Show 20 Lines | |||||
do_trap_supervisor(struct trapframe *frame) | do_trap_supervisor(struct trapframe *frame) | ||||
{ | { | ||||
uint64_t exception; | uint64_t exception; | ||||
/* Ensure we came from supervisor mode, interrupts disabled */ | /* Ensure we came from supervisor mode, interrupts disabled */ | ||||
KASSERT((csr_read(sstatus) & (SSTATUS_SPP | SSTATUS_SIE)) == | KASSERT((csr_read(sstatus) & (SSTATUS_SPP | SSTATUS_SIE)) == | ||||
SSTATUS_SPP, ("Came from S mode with interrupts enabled")); | SSTATUS_SPP, ("Came from S mode with interrupts enabled")); | ||||
KASSERT((csr_read(sstatus) & (SSTATUS_SUM)) == 0, | |||||
("Came from S mode with SUM enabled")); | |||||
exception = frame->tf_scause & SCAUSE_CODE; | exception = frame->tf_scause & SCAUSE_CODE; | ||||
if ((frame->tf_scause & SCAUSE_INTR) != 0) { | if ((frame->tf_scause & SCAUSE_INTR) != 0) { | ||||
/* Interrupt */ | /* Interrupt */ | ||||
riscv_cpu_intr(frame); | riscv_cpu_intr(frame); | ||||
return; | return; | ||||
} | } | ||||
#ifdef KDTRACE_HOOKS | #ifdef KDTRACE_HOOKS | ||||
▲ Show 20 Lines • Show All 51 Lines • ▼ Show 20 Lines | do_trap_user(struct trapframe *frame) | ||||
pcb = td->td_pcb; | pcb = td->td_pcb; | ||||
KASSERT(td->td_frame == frame, | KASSERT(td->td_frame == frame, | ||||
("%s: td_frame %p != frame %p", __func__, 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")); | ||||
KASSERT((csr_read(sstatus) & (SSTATUS_SUM)) == 0, | |||||
("Came from U mode with SUM enabled")); | |||||
exception = frame->tf_scause & SCAUSE_CODE; | exception = frame->tf_scause & SCAUSE_CODE; | ||||
if ((frame->tf_scause & SCAUSE_INTR) != 0) { | if ((frame->tf_scause & SCAUSE_INTR) != 0) { | ||||
/* Interrupt */ | /* Interrupt */ | ||||
riscv_cpu_intr(frame); | riscv_cpu_intr(frame); | ||||
return; | return; | ||||
} | } | ||||
intr_enable(); | intr_enable(); | ||||
▲ Show 20 Lines • Show All 50 Lines • Show Last 20 Lines |