Skip to content

Commit ac9f96f

Browse files
author
Jorge Aparicio
authored
Merge pull request #34 from Amanieu/thumbv6m_asm
Fix inline assembly to work on ARMv6-M
2 parents 7ac5155 + 97217e3 commit ac9f96f

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

src/arm.rs

+10-7
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,24 @@ pub unsafe fn __aeabi_uidivmod() {
99
sub sp, sp, #4
1010
mov r2, sp
1111
bl __udivmodsi4
12-
ldr r1, [sp], #4
12+
ldr r1, [sp]
13+
add sp, sp, #4
1314
pop {pc}");
1415
intrinsics::unreachable();
1516
}
1617

1718
#[naked]
1819
#[cfg_attr(not(test), no_mangle)]
1920
pub unsafe fn __aeabi_uldivmod() {
20-
asm!("push {lr}
21-
sub r12, sp, #12
22-
str r12, [sp, #-20]!
21+
asm!("push {r4, lr}
22+
sub sp, sp, #16
23+
add r4, sp, #8
24+
str r4, [sp]
2325
bl __udivmoddi4
24-
ldrd r2, r3, [sp, #8]
25-
add sp, sp, #20
26-
pop {pc}");
26+
ldr r2, [sp, #8]
27+
ldr r3, [sp, #12]
28+
add sp, sp, #16
29+
pop {r4, pc}");
2730
intrinsics::unreachable();
2831
}
2932

0 commit comments

Comments
 (0)