Skip to content

Commit a223447

Browse files
committed
[Fix] pass x16 register as parameter for SBI call
The previous approach "li x16,0" may prevent the compiler from recognizing x16 as a function parameter, resulting in the caller saved register saving mechanism not being triggered in release mode.
1 parent fee16d2 commit a223447

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

os/src/sbi.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ fn sbi_call(which: usize, arg0: usize, arg1: usize, arg2: usize) -> usize {
1515
let mut ret;
1616
unsafe {
1717
asm!(
18-
"li x16, 0",
1918
"ecall",
2019
inlateout("x10") arg0 => ret,
2120
in("x11") arg1,
2221
in("x12") arg2,
22+
in("x16") 0,
2323
in("x17") which,
2424
);
2525
}

0 commit comments

Comments
 (0)