rt: Move more setup code into create_stack
This commit is contained in:
@@ -17,7 +17,10 @@ template <class T>
|
|||||||
stk_seg *
|
stk_seg *
|
||||||
create_stack(T allocer, size_t sz) {
|
create_stack(T allocer, size_t sz) {
|
||||||
size_t total_sz = sizeof(stk_seg) + sz;
|
size_t total_sz = sizeof(stk_seg) + sz;
|
||||||
return (stk_seg *)allocer->malloc(total_sz, "stack");
|
stk_seg *stk = (stk_seg *)allocer->malloc(total_sz, "stack");
|
||||||
|
memset(stk, 0, sizeof(stk_seg));
|
||||||
|
stk->end = (uintptr_t) &stk->data[sz];
|
||||||
|
return stk;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
|
|||||||
@@ -584,11 +584,9 @@ rust_task::new_stack(size_t requested_sz) {
|
|||||||
size_t sz = rust_stk_sz + RED_ZONE_SIZE;
|
size_t sz = rust_stk_sz + RED_ZONE_SIZE;
|
||||||
stk_seg *new_stk = create_stack(this, sz);
|
stk_seg *new_stk = create_stack(this, sz);
|
||||||
LOGPTR(thread, "new stk", (uintptr_t)new_stk);
|
LOGPTR(thread, "new stk", (uintptr_t)new_stk);
|
||||||
memset(new_stk, 0, sizeof(stk_seg));
|
|
||||||
add_stack_canary(new_stk);
|
add_stack_canary(new_stk);
|
||||||
new_stk->prev = NULL;
|
new_stk->prev = NULL;
|
||||||
new_stk->next = stk;
|
new_stk->next = stk;
|
||||||
new_stk->end = (uintptr_t) &new_stk->data[rust_stk_sz + RED_ZONE_SIZE];
|
|
||||||
LOGPTR(thread, "stk end", new_stk->end);
|
LOGPTR(thread, "stk end", new_stk->end);
|
||||||
|
|
||||||
stk = new_stk;
|
stk = new_stk;
|
||||||
|
|||||||
Reference in New Issue
Block a user