Skip to content

Expose the bounds of the C stack from the runtime #5887

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/libcore/gc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ pub mod rustrt {
pub unsafe fn rust_gc_metadata() -> *Word;

pub unsafe fn rust_get_stack_segment() -> *StackSegment;
pub unsafe fn rust_get_c_stack() -> *StackSegment;
}
}

Expand Down
5 changes: 5 additions & 0 deletions src/rt/rust_builtin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,11 @@ rust_get_stack_segment() {
return rust_get_current_task()->stk;
}

extern "C" CDECL stk_seg *
rust_get_c_stack() {
return rust_get_current_task()->get_c_stack();
}

extern "C" CDECL void
start_task(rust_task *target, fn_env_pair *f) {
target->start(f->f, f->env, NULL);
Expand Down
1 change: 1 addition & 0 deletions src/rt/rust_task.h
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,7 @@ rust_task : public kernel_owned<rust_task>
void call_on_c_stack(void *args, void *fn_ptr);
void call_on_rust_stack(void *args, void *fn_ptr);
bool have_c_stack() { return c_stack != NULL; }
stk_seg *get_c_stack() { return c_stack; }

rust_task_state get_state() { return state; }
rust_cond *get_cond() { return cond; }
Expand Down
1 change: 1 addition & 0 deletions src/rt/rustrt.def.in
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ rust_task_yield
rust_task_is_unwinding
rust_get_task
rust_get_stack_segment
rust_get_c_stack
rust_log_str
start_task
vec_reserve_shared_actual
Expand Down