/********************************************************************** * Switches to the C-stack and invokes |fn_ptr|, passing |args| as argument. * This is used by the C compiler to call native functions and by other * upcalls to switch to the C stack. The return value is passed through a * field in the args parameter. This upcall is specifically for switching * to the shim functions generated by rustc. */ extern "C" CDECL void upcall_call_shim_on_c_stack(void *args, void *fn_ptr) { rust_task *task = rust_task_thread::get_task(); // FIXME (1226) - The shim functions generated by rustc contain the // morestack prologue, so we need to let them know they have enough // stack. record_sp(0); try { task->call_on_c_stack(args, fn_ptr); } catch (...) { LOG_ERR(task, task, "Native code threw an exception"); abort(); } task->record_stack_limit(); }
/** * Switches to the C-stack and invokes |fn_ptr|, passing |args| as argument. * This is used by the C compiler to call native functions and by other * upcalls to switch to the C stack. */ extern "C" CDECL void upcall_call_shim_on_c_stack(void *args, void *fn_ptr) { rust_task *task = rust_scheduler::get_task(); // FIXME (1226) - The shim functions generated by rustc contain the // morestack prologue, so we need to let them know they have enough // stack. record_sp(0); rust_scheduler *sched = task->sched; try { sched->c_context.call_shim_on_c_stack(args, fn_ptr); } catch (...) { task = rust_scheduler::get_task(); task->record_stack_limit(); throw; } task = rust_scheduler::get_task(); task->record_stack_limit(); }