Skip to content

Commit 050f55e

Browse files
committed
fix: use wfi for retentive suspend
Signed-off-by: YdrMaster <ydrml@hotmail.com>
1 parent afa3b81 commit 050f55e

File tree

2 files changed

+7
-22
lines changed

2 files changed

+7
-22
lines changed

Cargo.lock

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rustsbi-qemu/src/main.rs

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -401,22 +401,7 @@ impl rustsbi::Hsm for Hsm {
401401
}
402402
spec::HART_SUSPEND_TYPE_RETENTIVE => unsafe {
403403
local_hsm().suspend();
404-
asm!(
405-
" la {0}, 1f
406-
csrrw {0}, mtvec, {0}
407-
csrr {1}, mepc
408-
csrrsi {2}, mstatus, {mie}
409-
0: wfi
410-
j 0b
411-
1: csrw mstatus, {2}
412-
csrw mepc, {1}
413-
csrw mtvec, {0}
414-
",
415-
out(reg) _,
416-
out(reg) _,
417-
out(reg) _,
418-
mie = const mstatus::MIE,
419-
);
404+
riscv::asm::wfi();
420405
local_hsm().resume();
421406
SbiRet::success(0)
422407
},

0 commit comments

Comments
 (0)