Skip to content

Commit f332643

Browse files
committed
rt: Use %ecx instead of %eax during the second half of __morestack
If Rust code made use of return values then using %eax here would clobber it
1 parent a195ab2 commit f332643

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/rt/arch/i386/morestack.S

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,11 +122,13 @@ MORESTACK:
122122

123123
subl $8, %esp // Alignment
124124

125+
// Now that we're on the return path we want to avoid
126+
// stomping on %eax
125127
#ifdef __APPLE__
126128
call 1f
127-
1: popl %eax
128-
movl L_upcall_del_stack$non_lazy_ptr-1b(%eax),%eax
129-
pushl %eax
129+
1: popl %ecx
130+
movl L_upcall_del_stack$non_lazy_ptr-1b(%ecx),%ecx
131+
pushl %ecx
130132
#else
131133
pushl $UPCALL_DEL_STACK
132134
#endif

0 commit comments

Comments
 (0)