diff options
| author | Kimplul <kimi.h.kuparinen@gmail.com> | 2024-10-30 00:57:33 +0200 |
|---|---|---|
| committer | Kimplul <kimi.h.kuparinen@gmail.com> | 2024-10-30 00:57:33 +0200 |
| commit | 44a73ecab6e91519627786a5101cd4f1a2f2b0d7 (patch) | |
| tree | f5c811050a4d5ee832f5883c4d0c27efddd60817 /src/tcb.c | |
| parent | 5976ad390a15726c3ddfacf8c8b282c8350f9554 (diff) | |
| download | kmi-44a73ecab6e91519627786a5101cd4f1a2f2b0d7.tar.gz kmi-44a73ecab6e91519627786a5101cd4f1a2f2b0d7.zip | |
most of the way to passing tests
Diffstat (limited to 'src/tcb.c')
| -rw-r--r-- | src/tcb.c | 28 |
1 files changed, 3 insertions, 25 deletions
@@ -90,24 +90,6 @@ static id_t __alloc_tid(struct tcb *t) return ERR_NF; } -stat_t alloc_stack(struct tcb *t) -{ - /* get parent process */ - struct tcb *p = get_tcb(t->eid); - assert(p); - - if (setup_rpc_stack(t)) - return ERR_OOMEM; - - t->regs = t->rpc_stack - sizeof(struct call_ctx); - return OK; -} - -void free_stack(struct tcb *t) -{ - destroy_rpc_stack(t); -} - static stat_t __init_free_thread(struct tcb *t) { if (!(t->proc.vmem = create_vmem())) @@ -130,6 +112,7 @@ static stat_t __init_free_thread(struct tcb *t) return ERR_OOMEM; } + t->regs = t->rpc_stack - sizeof(struct call_ctx); t->pid = t->tid; t->eid = t->tid; t->rid = t->tid; @@ -156,6 +139,7 @@ static stat_t __init_owned_thread(struct tcb *p, struct tcb *t) return ERR_OOMEM; } + t->regs = t->rpc_stack - sizeof(struct call_ctx); reference_thread(p); return OK; } @@ -208,16 +192,12 @@ struct tcb *create_thread(struct tcb *p) static stat_t __copy_proc(struct tcb *p, struct tcb *n) { /** @todo setup rpc stack stuff */ - /** @todo I think keeping track of userspace stack stuff is unnecessary, - * unless we want unlimited stack size but that sounds dumb. Anycase, we - * need to duplicate stack info, whatever we do. */ n->exec = p->exec; n->callback = p->callback; - n->thread_stack = p->thread_stack; - n->thread_stack_size = p->thread_stack_size; copy_regs(n, p); copy_caps(n->caps, p->caps); + copy_rpc_stack(p, n); return copy_uvmem(n, p); } @@ -270,8 +250,6 @@ stat_t destroy_thread(struct tcb *t) /* if we're our own root process, we unreference ourselves later */ unreference_thread(r); - free_stack(t); - /* free memory backing rpc stack */ destroy_rpc_stack(t); |
