Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F151137596
D23511.id67828.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D23511.id67828.diff
View Options
Index: head/sys/riscv/riscv/trap.c
===================================================================
--- head/sys/riscv/riscv/trap.c
+++ head/sys/riscv/riscv/trap.c
@@ -245,12 +245,10 @@
do_trap_supervisor(struct trapframe *frame)
{
uint64_t exception;
- uint64_t sstatus;
/* Ensure we came from supervisor mode, interrupts disabled */
- __asm __volatile("csrr %0, sstatus" : "=&r" (sstatus));
- KASSERT((sstatus & (SSTATUS_SPP | SSTATUS_SIE)) == SSTATUS_SPP,
- ("We must came from S mode with interrupts disabled"));
+ KASSERT((csr_read(sstatus) & (SSTATUS_SPP | SSTATUS_SIE)) ==
+ SSTATUS_SPP, ("Came from S mode with interrupts enabled"));
exception = (frame->tf_scause & EXCP_MASK);
if (frame->tf_scause & EXCP_INTR) {
@@ -305,7 +303,6 @@
{
uint64_t exception;
struct thread *td;
- uint64_t sstatus;
struct pcb *pcb;
td = curthread;
@@ -313,9 +310,8 @@
pcb = td->td_pcb;
/* Ensure we came from usermode, interrupts disabled */
- __asm __volatile("csrr %0, sstatus" : "=&r" (sstatus));
- KASSERT((sstatus & (SSTATUS_SPP | SSTATUS_SIE)) == 0,
- ("We must came from U mode with interrupts disabled"));
+ KASSERT((csr_read(sstatus) & (SSTATUS_SPP | SSTATUS_SIE)) == 0,
+ ("Came from U mode with interrupts enabled"));
exception = (frame->tf_scause & EXCP_MASK);
if (frame->tf_scause & EXCP_INTR) {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Apr 7, 8:30 AM (2 h, 38 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
31000389
Default Alt Text
D23511.id67828.diff (1 KB)
Attached To
Mode
D23511: Use csr_read() to read sstatus instead of inline assembly.
Attached
Detach File
Event Timeline
Log In to Comment