File tree Expand file tree Collapse file tree 3 files changed +31
-14
lines changed Expand file tree Collapse file tree 3 files changed +31
-14
lines changed Original file line number Diff line number Diff line change @@ -75,11 +75,12 @@ MORESTACK:
75
75
76
76
// The arguments to rust_new_stack2
77
77
movl 40 (%esp ),%eax // Size of stack arguments
78
- movl %eax ,16 (%esp )
78
+ movl %eax ,20 (%esp )
79
79
leal 48 (%esp ),%eax // Address of stack arguments
80
- movl %eax ,12 (%esp )
80
+ movl %eax ,16 (%esp )
81
81
movl 36 (%esp ),%eax // The amount of stack needed
82
- movl %eax ,8 (%esp )
82
+ movl %eax ,12 (%esp )
83
+ movl $0 , 8 (%esp ) // Out pointer
83
84
84
85
#ifdef __APPLE__
85
86
call 1f
@@ -97,7 +98,7 @@ MORESTACK:
97
98
movl 32 (%esp ),%edx // Grab the return pointer.
98
99
inc %edx // Skip past the ret instruction in the parent fn
99
100
100
- movl %eax ,%esp // Switch stacks.
101
+ movl 8 ( %esp ) ,%esp // Switch stacks.
101
102
call *%edx // Re-enter the function that called us.
102
103
103
104
// Now the function that called us has returned, so we need to delete the
Original file line number Diff line number Diff line change @@ -81,9 +81,12 @@ MORESTACK:
81
81
movq %rbp , %rcx
82
82
addq $24 , %rcx // Base pointer, return address x2
83
83
84
+ pushq $0 // Alignment
85
+
84
86
pushq %r11 // Size of stack arguments
85
87
pushq %rcx // Address of stack arguments
86
88
pushq %r10 // The amount of stack needed
89
+ pushq $0 // Out pointer
87
90
88
91
movq UPCALL_NEW_STACK@GOTPCREL(%rip ), %rsi
89
92
movq %rsp , %rdi
@@ -95,7 +98,8 @@ MORESTACK:
95
98
#endif
96
99
97
100
// Pop the new_stack_args struct
98
- addq $24 , %rsp
101
+ popq %rax
102
+ addq $32 , %rsp
99
103
100
104
// Pop the saved arguments
101
105
popq %r9
Original file line number Diff line number Diff line change @@ -217,28 +217,40 @@ extern "C" void record_sp(void *limit);
217
217
*/
218
218
extern " C" CDECL void
219
219
upcall_call_shim_on_c_stack (void *args, void *fn_ptr) {
220
+ rust_task *task = rust_scheduler::get_task ();
221
+
220
222
// FIXME (1226) - The shim functions generated by rustc contain the
221
223
// morestack prologue, so we need to let them know they have enough
222
224
// stack.
223
- record_sp (0 );
224
- rust_task *task = rust_scheduler::get_task ();
225
+ // record_sp(0);
226
+
225
227
rust_scheduler *sched = task->sched ;
226
- sched->c_context .call_shim_on_c_stack (args, fn_ptr);
227
- task->record_stack_limit ();
228
+ try {
229
+ sched->c_context .call_shim_on_c_stack (args, fn_ptr);
230
+ } catch (...) {
231
+ // task = rust_scheduler::get_task();
232
+ // task->record_stack_limit();
233
+ throw ;
234
+ }
235
+ // task = rust_scheduler::get_task();
236
+ // task->record_stack_limit();
228
237
}
229
238
230
239
struct rust_new_stack2_args {
231
- size_t stk_sz;
232
- void *args_addr;
233
- size_t args_sz;
240
+ void *new_stack;
241
+ size_t stk_sz;
242
+ void *args_addr;
243
+ size_t args_sz;
234
244
};
235
245
236
246
// A new stack function suitable for calling through
237
247
// upcall_call_shim_on_c_stack
238
- extern " C" CDECL void *
248
+ extern " C" CDECL void
239
249
upcall_new_stack (struct rust_new_stack2_args *args) {
240
250
rust_task *task = rust_scheduler::get_task ();
241
- return task->new_stack (args->stk_sz , args->args_addr , args->args_sz );
251
+ args->new_stack = task->new_stack (args->stk_sz ,
252
+ args->args_addr ,
253
+ args->args_sz );
242
254
}
243
255
244
256
extern " C" CDECL void
You can’t perform that action at this time.
0 commit comments