Skip to content

Commit f2d01b0

Browse files
committed
microlib_sub.S: Correct FRAME directives
`FRAME PUSH {regs},offset` doesn't work the way I expected, or that would be more useful - it puts the registers at the new stack position, not below the old one. Use `FRAME SAVE` and `FRAME ADDRESS` manually instead.
1 parent a51a7d8 commit f2d01b0

File tree

1 file changed

+10
-7
lines changed
  • platform/source/TARGET_CORTEX_M/TOOLCHAIN_ARM_MICRO/TARGET_CORTEX_M_BASELINE

1 file changed

+10
-7
lines changed

platform/source/TARGET_CORTEX_M/TOOLCHAIN_ARM_MICRO/TARGET_CORTEX_M_BASELINE/microlib_sub.S

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
MULS r3,r0,r3
4444
MULS r1,r2,r1
4545
PUSH {r4,r5,lr}
46-
FRAME PUSH {r4,r5,lr}
46+
FRAME PUSH {r4,r5,lr}
4747
ADDS r4,r3,r1
4848
LSRS r1,r0,#16
4949
LSRS r3,r2,#16
@@ -304,7 +304,8 @@ hard_divbyzero
304304
RSBS r0,r0,#0
305305
divbyzero
306306
PUSH {r0,lr}
307-
FRAME PUSH {lr},8
307+
FRAME SAVE {lr},-4
308+
FRAME ADDRESS sp,8
308309
LDR r1,=0x7fffffff
309310
CMP r0,#0
310311
BGT do_divbyzero_r1
@@ -336,8 +337,9 @@ do_divbyzero
336337
ENDFUNC
337338
|$Sub$$__aeabi_uldivmod| FUNCTION
338339
PUSH {r1-r7,lr}
339-
FRAME PUSH {r4-r7,lr},32
340-
FRAME STATE REMEMBER
340+
FRAME SAVE {r4-r7,lr},-20
341+
FRAME ADDRESS sp,32
342+
FRAME STATE REMEMBER
341343
MOV r4,r0
342344
MOV r0,r2
343345
MOV r5,r1
@@ -467,11 +469,12 @@ ldiv_return_remainder_r12_lr
467469
MOV r3,r12
468470
ldiv_return
469471
ADD sp,#12
470-
FRAME POP 12
472+
FRAME POP 12
471473
POP {r4-r7,pc}
474+
FRAME POP {r4-r7,pc}
472475
B ldivbyzero ; Not clear what this instruction is doing in library - retained for diff check
473476
ldivbyzero
474-
FRAME STATE RESTORE
477+
FRAME STATE RESTORE
475478
MOV r0,r4
476479
ORRS r0,r5
477480
BEQ ldivzerobyzero
@@ -498,7 +501,7 @@ ldivzerobyzero
498501
ENDFUNC
499502
|$Sub$$__aeabi_ldivmod| FUNCTION
500503
PUSH {r4-r6,lr}
501-
FRAME PUSH {r4-r6,lr}
504+
FRAME PUSH {r4-r6,lr}
502505
MOV r5,r0
503506
MOV r0,r2
504507
MOV r4,r1

0 commit comments

Comments
 (0)