Skip to content

Commit 07879e0

Browse files
committed
---
yaml --- r: 6855 b: refs/heads/master c: 1bfc4e2 h: refs/heads/master i: 6853: 7fc8314 6851: 74e6595 6847: bf66054 v: v3
1 parent b4ef2e0 commit 07879e0

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: c3569abb8c7f81e521bc6002b351c3b4fbfcce4c
2+
refs/heads/master: 1bfc4e2e6c931ca59d31e4621608e05035945f0b

trunk/src/rt/arch/i386/morestack.S

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,11 +198,17 @@ MORESTACK:
198198
// Realign stack - remember that __morestack was called misaligned
199199
subl $12, %esp
200200

201+
// Save the return value of the function we allocated space for
202+
movl %eax, (%esp)
203+
201204
// Now that we're on the return path we want to avoid
202205
// stomping on %eax. FIXME: Need to save and restore %eax to
203206
// actually preserve it across the call to delete the stack
204207
call UPCALL_DEL_STACK
205208

209+
// And restore it
210+
movl (%esp), %eax
211+
206212
addl $12,%esp
207213

208214
popl %ebp

trunk/src/rt/arch/x86_64/morestack.S

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,8 @@ MORESTACK:
100100
// Switch back to the rust stack
101101
movq %rbp, %rsp
102102

103-
// Align the stack again
104-
pushq $0
103+
// Save the return value
104+
pushq %rax
105105

106106
// FIXME: Should preserve %rax here
107107
#ifdef __APPLE__
@@ -111,7 +111,7 @@ MORESTACK:
111111
call UPCALL_DEL_STACK@PLT
112112
#endif
113113

114-
addq $8, %rsp
114+
popq %rax // Restore the return value
115115
popq %rbp
116116
// FIXME: I don't think these rules are necessary
117117
// since the unwinder should never encounter an instruction

0 commit comments

Comments
 (0)