rt: Refactor record_sp into task::record_stack_limit
This commit is contained in:
parent
d1fd7d49a7
commit
6da1a3fcd6
@ -367,14 +367,11 @@ rust_scheduler::init_tls() {
|
|||||||
tls_initialized = true;
|
tls_initialized = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" CDECL void
|
|
||||||
record_sp(void *limit);
|
|
||||||
|
|
||||||
void
|
void
|
||||||
rust_scheduler::place_task_in_tls(rust_task *task) {
|
rust_scheduler::place_task_in_tls(rust_task *task) {
|
||||||
int result = pthread_setspecific(task_key, task);
|
int result = pthread_setspecific(task_key, task);
|
||||||
assert(!result && "Couldn't place the task in TLS!");
|
assert(!result && "Couldn't place the task in TLS!");
|
||||||
record_sp(task->stk->data + RED_ZONE_SIZE);
|
task->record_stack_limit();
|
||||||
}
|
}
|
||||||
|
|
||||||
rust_task *
|
rust_task *
|
||||||
|
@ -576,16 +576,20 @@ rust_task::new_stack(size_t stk_sz, void *args_addr, size_t args_sz) {
|
|||||||
new_sp = align_down(new_sp - (args_sz + sizeof_retaddr));
|
new_sp = align_down(new_sp - (args_sz + sizeof_retaddr));
|
||||||
new_sp += sizeof_retaddr;
|
new_sp += sizeof_retaddr;
|
||||||
memcpy(new_sp, args_addr, args_sz);
|
memcpy(new_sp, args_addr, args_sz);
|
||||||
record_sp(stk_seg->data + RED_ZONE_SIZE);
|
record_stack_limit();
|
||||||
return new_sp;
|
return new_sp;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
rust_task::del_stack() {
|
rust_task::del_stack() {
|
||||||
del_stk(this, stk);
|
del_stk(this, stk);
|
||||||
record_sp(stk->data + RED_ZONE_SIZE);
|
record_stack_limit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
rust_task::record_stack_limit() {
|
||||||
|
record_sp(stk->data + RED_ZONE_SIZE);
|
||||||
|
}
|
||||||
//
|
//
|
||||||
// Local Variables:
|
// Local Variables:
|
||||||
// mode: C++
|
// mode: C++
|
||||||
|
@ -199,6 +199,7 @@ rust_task : public kernel_owned<rust_task>, rust_cond
|
|||||||
|
|
||||||
void *new_stack(size_t stk_sz, void *args_addr, size_t args_sz);
|
void *new_stack(size_t stk_sz, void *args_addr, size_t args_sz);
|
||||||
void del_stack();
|
void del_stack();
|
||||||
|
void record_stack_limit();
|
||||||
};
|
};
|
||||||
|
|
||||||
//
|
//
|
||||||
|
Loading…
Reference in New Issue
Block a user