Skip to content

Commit 03116f2

Browse files
ILyoanbrson
authored andcommitted
add unwind information on morestack
1 parent a34948a commit 03116f2

File tree

1 file changed

+19
-14
lines changed

1 file changed

+19
-14
lines changed

src/rt/arch/arm/morestack.S

+19-14
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,19 @@
1515

1616
// r4 and r5 are scratch registers for __morestack due to llvm
1717
// ARMFrameLowering::adjustForSegmentedStacks() implementation.
18-
.align 2
19-
.type __morestack,%function
18+
.type __morestack,%function
2019
__morestack:
20+
.fnstart
21+
// Save frame pointer and return address
22+
.save {r4, r5}
23+
.save {lr}
24+
.save {r6, fp, lr}
25+
push {r6, fp, lr}
2126

22-
// Save frame pointer and return address
23-
push {fp, lr}
24-
25-
mov fp, sp
27+
.movsp r6
28+
mov r6, sp
29+
.setfp fp, sp, #4
30+
add fp, sp, #4
2631

2732
// Save argument registers of the original function
2833
push {r0, r1, r2, r3, lr}
@@ -47,20 +52,20 @@ __morestack:
4752
mov pc, r4 // Call the original function
4853

4954
// Switch back to rust stack
50-
mov sp, fp
55+
mov sp, r6
5156

5257
// Save return value
53-
push {r0, r1}
58+
mov r4, r0
59+
mov r5, r1
5460

5561
// Remove the new allocated stack
5662
bl upcall_del_stack@plt
5763

5864
// Restore return value
59-
pop {r0, r1}
60-
65+
mov r0, r4
66+
mov r1, r5
67+
6168
// Return
62-
pop {fp, lr}
69+
pop {r6, fp, lr}
6370
mov pc, lr
64-
.endofmorestack:
65-
.size __morestack, .endofmorestack-__morestack
66-
71+
.fnend

0 commit comments

Comments
 (0)