@@ -62,14 +62,19 @@ MORESTACK:
62
62
#endif
63
63
64
64
// NB: This can be called with the fastcc convention so we
65
- // have to preserve any argument registers we want to use
65
+ // have to preserve any argument registers
66
66
67
67
// NB: __morestack is called misaligned by 4 bytes, i.e.
68
68
// subl $4, %esp would get us to a normal alignment
69
69
70
+ subl $44 ,%esp
71
+
72
+ // Save fastcc arguments
73
+ movl %ecx , 28 (%esp )
74
+ movl %edx , 24 (%esp )
75
+
70
76
// FIXME (1226): main is compiled with the split-stack prologue,
71
77
// causing it to call __morestack, so we have to jump back out
72
- subl $28 ,%esp
73
78
calll RUST_GET_TASK
74
79
testl %eax ,%eax
75
80
jz .L$bail
@@ -88,13 +93,13 @@ MORESTACK:
88
93
// for the unwinder
89
94
leal 20 (%ebp ), %eax
90
95
movl %eax , -4 (%ebp )
91
-
96
+
92
97
// The arguments to rust_new_stack2
93
- movl 40 (%esp ),%eax // Size of stack arguments
98
+ movl 56 (%esp ),%eax // Size of stack arguments
94
99
movl %eax ,20 (%esp )
95
- leal 48 (%esp ),%eax // Address of stack arguments
100
+ leal 64 (%esp ),%eax // Address of stack arguments
96
101
movl %eax ,16 (%esp )
97
- movl 36 (%esp ),%eax // The amount of stack needed
102
+ movl 52 (%esp ),%eax // The amount of stack needed
98
103
movl %eax ,12 (%esp )
99
104
movl $0 , 8 (%esp ) // Out pointer
100
105
@@ -111,11 +116,15 @@ MORESTACK:
111
116
movl %eax ,(%esp )
112
117
call UPCALL_CALL_C
113
118
114
- movl 32 (%esp ),%eax // Grab the return pointer.
119
+ movl 48 (%esp ),%eax // Grab the return pointer.
115
120
inc %eax // Skip past the ret instruction in the parent fn
116
121
122
+ // Restore fastcc arguments
123
+ movl 28 (%esp ), %ecx
124
+ movl 24 (%esp ), %edx
125
+
117
126
movl 8 (%esp ),%esp // Switch stacks.
118
- call *%eax // Re-enter the function that called us.
127
+ call *%eax // Re-enter the function that called us.
119
128
120
129
// Now the function that called us has returned, so we need to delete the
121
130
// old stack space.
@@ -155,7 +164,7 @@ MORESTACK:
155
164
movl 32 (%esp ),%eax
156
165
inc %eax
157
166
158
- addl $28 , %esp
167
+ addl $44 , %esp
159
168
popl %ebp
160
169
addl $4 +8 ,%esp
161
170
0 commit comments