Skip to content

Commit 82e26e7

Browse files
committed
add unwind information on morestack
1 parent 0d40a5e commit 82e26e7

File tree

1 file changed

+19
-14
lines changed

1 file changed

+19
-14
lines changed

src/rt/arch/arm/morestack.S

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,19 @@
1010

1111
// r4 and r5 are scratch registers for __morestack due to llvm
1212
// ARMFrameLowering::adjustForSegmentedStacks() implementation.
13-
.align 2
14-
.type __morestack,%function
13+
.type __morestack,%function
1514
__morestack:
15+
.fnstart
16+
// Save frame pointer and return address
17+
.save {r4, r5}
18+
.save {lr}
19+
.save {r6, fp, lr}
20+
push {r6, fp, lr}
1621

17-
// Save frame pointer and return address
18-
push {fp, lr}
19-
20-
mov fp, sp
22+
.movsp r6
23+
mov r6, sp
24+
.setfp fp, sp, #4
25+
add fp, sp, #4
2126

2227
// Save argument registers of the original function
2328
push {r0, r1, r2, r3, lr}
@@ -42,20 +47,20 @@ __morestack:
4247
mov pc, r4 // Call the original function
4348

4449
// Switch back to rust stack
45-
mov sp, fp
50+
mov sp, r6
4651

4752
// Save return value
48-
push {r0, r1}
53+
mov r4, r0
54+
mov r5, r1
4955

5056
// Remove the new allocated stack
5157
bl upcall_del_stack@plt
5258

5359
// Restore return value
54-
pop {r0, r1}
55-
60+
mov r0, r4
61+
mov r1, r5
62+
5663
// Return
57-
pop {fp, lr}
64+
pop {r6, fp, lr}
5865
mov pc, lr
59-
.endofmorestack:
60-
.size __morestack, .endofmorestack-__morestack
61-
66+
.fnend

0 commit comments

Comments
 (0)