@@ -175,8 +175,11 @@ fn upcall_glue(int n_args) -> vec[str] {
175
175
*/
176
176
177
177
fn copy_arg ( uint i) -> str {
178
- auto src_off = wstr ( 5 + ( i as int ) ) ;
179
- auto dst_off = wstr ( 1 + ( i as int ) ) ;
178
+ if ( i == 0 u) {
179
+ ret "movl %edx, (%esp)" ;
180
+ }
181
+ auto src_off = wstr ( 4 + ( i as int ) ) ;
182
+ auto dst_off = wstr ( 0 + ( i as int ) ) ;
180
183
auto m = vec ( "movl " + src_off + "(%ebp),%eax" ,
181
184
"movl %eax," + dst_off + "(%esp)" ) ;
182
185
ret _str. connect ( m, "\n \t " ) ;
@@ -193,14 +196,13 @@ fn upcall_glue(int n_args) -> vec[str] {
193
196
+ load_esp_from_runtime_sp ( )
194
197
195
198
+ vec ( "subl $" + wstr ( n_args + 1 ) + ", %esp # esp -= args" ,
196
- "andl $~0xf, %esp # align esp down" ,
197
- "movl %ecx, (%esp) # arg[0] = rust_task " )
199
+ "andl $~0xf, %esp # align esp down" )
198
200
199
- + _vec. init_fn [ str] ( carg, n_args as uint )
201
+ + _vec. init_fn [ str] ( carg, ( n_args + 1 ) as uint )
200
202
201
- + vec ( "movl %ecx , %edi # save task from ecx to edi" ,
202
- "call *%edx # call *%edx" ,
203
- "movl %edi, %ecx # restore edi-saved task to ecx" )
203
+ + vec ( "movl %edx , %edi # save task from ecx to edi" ,
204
+ "call *%ecx # call *%edx" ,
205
+ "movl %edi, %edx # restore edi-saved task to ecx" )
204
206
205
207
+ load_esp_from_rust_sp ( )
206
208
+ restore_callee_saves ( )
0 commit comments