Skip to content

Commit 564d885

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 754802a commit 564d885

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
@@ -12,11 +12,11 @@ fn sbi_call(which: usize, arg0: usize, arg1: usize, arg2: usize) -> usize {
1212
let mut ret;
1313
unsafe {
1414
asm!(
15-
"li x16, 0",
1615
"ecall",
1716
inlateout("x10") arg0 => ret,
1817
in("x11") arg1,
1918
in("x12") arg2,
19+
in("x16") 0,
2020
in("x17") which,
2121
);
2222
}

0 commit comments

Comments
 (0)