diff options
Diffstat (limited to 'src/rt/rust_task.h')
| -rw-r--r-- | src/rt/rust_task.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/rt/rust_task.h b/src/rt/rust_task.h index e46b624c936..8e6a53892ec 100644 --- a/src/rt/rust_task.h +++ b/src/rt/rust_task.h @@ -163,6 +163,10 @@ rust_task : public kernel_owned<rust_task>, rust_cond // The amount of stack we're using, excluding red zones size_t total_stack_sz; + // Used by rust task management routines in libcore/task.rs. + void *task_local_data; + void (*task_local_data_cleanup)(void *data); + private: // Protects state, cond, cond_name @@ -375,6 +379,10 @@ rust_task::call_on_c_stack(void *args, void *fn_ptr) { // Too expensive to check // assert(on_rust_stack()); + // The shim functions generated by rustc contain the morestack prologue, so + // we need to let them know they have enough stack. + record_sp_limit(0); + uintptr_t prev_rust_sp = next_rust_sp; next_rust_sp = get_sp(); @@ -398,12 +406,19 @@ rust_task::call_on_c_stack(void *args, void *fn_ptr) { } next_rust_sp = prev_rust_sp; + + record_stack_limit(); } inline void rust_task::call_on_rust_stack(void *args, void *fn_ptr) { // Too expensive to check // assert(!on_rust_stack()); + + // Because of the hack in the other function that disables the stack limit + // when entering the C stack, here we restore the stack limit again. + record_stack_limit(); + assert(get_sp_limit() != 0 && "Stack must be configured"); assert(next_rust_sp); @@ -427,6 +442,8 @@ rust_task::call_on_rust_stack(void *args, void *fn_ptr) { scoped_lock with(kill_lock); reentered_rust_stack = had_reentered_rust_stack; } + + record_sp_limit(0); } inline void |
