Skip to content

Commit 1ef3986

Browse files
authored
Update clobber to match ARM ARM
I just learned about this `asm!` feature, which prompted me to look at whether we were using it. Not sure if some of the others were options when #381 was written, but strictly speaking arm cores are defined to follow the `AAPCS` on exception entry/exit. In practice, I _think_ `C` and `aapcs` (and the others here) are just aliases that do the same thing. Nonetheless, just in case, we should probably put the 'most correct' name here. Relevant doc: https://doc.rust-lang.org/nightly/reference/inline-assembly.html#abi-clobbers
1 parent 6831522 commit 1ef3986

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

runtime/src/syscalls_impl_arm.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ unsafe impl RawSyscalls for crate::TockSyscalls {
66
// Safety: This matches the invariants required by the documentation on
77
// RawSyscalls::yield1
88
// the use of `clobber_abi` allows us this to run on both Thumb-1 and Thumb-2
9+
// see https://doc.rust-lang.org/nightly/reference/inline-assembly.html#abi-clobbers
910
unsafe {
1011
asm!("svc 0",
1112
inlateout("r0") r0 => _, // a1
@@ -17,7 +18,7 @@ unsafe impl RawSyscalls for crate::TockSyscalls {
1718
// r13 is the stack pointer and must be restored by the callee.
1819
// r15 is the program counter.
1920

20-
clobber_abi("C"), // a2, a3, a4, ip (r12), lr (r14)
21+
clobber_abi("aapcs"), // r[0-3], r12, r14, s[0-15], d[0-7], d[16-31]
2122
);
2223
}
2324
}
@@ -26,6 +27,7 @@ unsafe impl RawSyscalls for crate::TockSyscalls {
2627
// Safety: This matches the invariants required by the documentation on
2728
// RawSyscalls::yield2
2829
// the use of `clobber_abi` allows us this to run on both Thumb-1 and Thumb-2
30+
// see https://doc.rust-lang.org/nightly/reference/inline-assembly.html#abi-clobbers
2931
unsafe {
3032
asm!("svc 0",
3133
inlateout("r0") r0 => _, // a1
@@ -38,7 +40,7 @@ unsafe impl RawSyscalls for crate::TockSyscalls {
3840
// r13 is the stack pointer and must be restored by the callee.
3941
// r15 is the program counter.
4042

41-
clobber_abi("C"), // a3, a4, ip (r12), lr (r14)
43+
clobber_abi("aapcs"), // r[0-3], r12, r14, s[0-15], d[0-7], d[16-31]
4244
);
4345
}
4446
}

0 commit comments

Comments
 (0)