Skip to content

Commit c953ad9

Browse files
committed
fix(arm_semihosting): mark lr as clobbered
A semihosting call updates `lr_svc` like a normal supervisor call does.
1 parent ac32033 commit c953ad9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/arm_semihosting/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ pub unsafe fn syscall1(_nr: usize, _arg: usize) -> usize {
7575
#[cfg(all(thumb, arm, not(feature = "no-semihosting")))]
7676
() => {
7777
let mut nr = _nr;
78-
llvm_asm!("svc 0xAB" : "+{r0}"(nr) : "{r1}"(_arg) :: "volatile");
78+
llvm_asm!("svc 0xAB" : "+{r0}"(nr) : "{r1}"(_arg) : "lr" : "volatile");
7979
nr
8080
}
8181

@@ -85,7 +85,7 @@ pub unsafe fn syscall1(_nr: usize, _arg: usize) -> usize {
8585
#[cfg(all(not(thumb), arm, not(feature = "no-semihosting")))]
8686
() => {
8787
let mut nr = _nr;
88-
llvm_asm!("svc 0x123456" : "+{r0}"(nr) : "{r1}"(_arg) :: "volatile");
88+
llvm_asm!("svc 0x123456" : "+{r0}"(nr) : "{r1}"(_arg) : "lr" : "volatile");
8989
nr
9090
}
9191

0 commit comments

Comments
 (0)