diff options
| author | Kimplul <kimi.h.kuparinen@gmail.com> | 2022-11-13 06:11:43 +0200 |
|---|---|---|
| committer | Kimplul <kimi.h.kuparinen@gmail.com> | 2022-11-13 06:11:43 +0200 |
| commit | 6d3586aa42409fc720e30856cb5df5284329463a (patch) | |
| tree | 571136fdb4f6fb333c1bb4b1274a76eb70263de9 /common/tcb.c | |
| parent | 7da8912c0eee10315dac37cecd4c84f11e5dad59 (diff) | |
| download | kmi-6d3586aa42409fc720e30856cb5df5284329463a.tar.gz kmi-6d3586aa42409fc720e30856cb5df5284329463a.zip | |
~700k ipc requests
+ Eliminated need for save/load_regs, now the register save area is
behind a pointer which _slightly_ increases overall syscall delay, but
speeds up ipc requests by a fair bit.
Diffstat (limited to 'common/tcb.c')
| -rw-r--r-- | common/tcb.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/common/tcb.c b/common/tcb.c index 478bd05..f774fbc 100644 --- a/common/tcb.c +++ b/common/tcb.c @@ -163,6 +163,8 @@ struct tcb *create_thread(struct tcb *p) t->rpc.vmem = create_vmem(); __setup_rpc_stack(t, __call_stack_size); + t->regs = (vm_t)t; + set_canary(t); return t; } @@ -180,7 +182,6 @@ static stat_t __copy_proc(struct tcb *p, struct tcb *n) /** @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. */ - /** @todo should there be in-kernel child tracking? */ n->exec = p->exec; n->callback = p->callback; n->thread_stack = p->thread_stack; @@ -409,6 +410,7 @@ static void mark_rpc_accessible(struct tcb *t, vm_t start, vm_t end) struct call_ctx { vm_t exec; + vm_t regs; vm_t rpc_stack; id_t eid, pid; }; @@ -420,27 +422,29 @@ void save_context(struct tcb *t) /** @todo what if user uses their own stack? */ rpc_stack = align_down(get_stack(t), BASE_PAGE_SIZE); - rpc_stack -= BASE_PAGE_SIZE; - struct call_ctx *ctx = (struct call_ctx *)rpc_stack; + struct call_ctx *ctx = (struct call_ctx *)(rpc_stack) - 1; ctx->exec = t->exec; ctx->pid = t->pid; ctx->eid = t->eid; - ctx->rpc_stack = rpc_stack + BASE_PAGE_SIZE; - save_regs(t, ctx + 1); + ctx->regs = t->regs; + ctx->rpc_stack = rpc_stack; + + rpc_stack -= BASE_PAGE_SIZE; mark_rpc_inaccessible(t, rpc_stack, t->rpc_stack); t->rpc_stack = rpc_stack; + t->regs = (vm_t)ctx; } void load_context(struct tcb *t) { - vm_t rpc_stack = t->rpc_stack; - struct call_ctx *ctx = (struct call_ctx *)rpc_stack; + vm_t rpc_stack = t->rpc_stack + BASE_PAGE_SIZE; + struct call_ctx *ctx = (struct call_ctx *)(rpc_stack) - 1; set_return(t, ctx->exec); mark_rpc_accessible(t, t->rpc_stack, ctx->rpc_stack); - load_regs(ctx + 1, t); t->rpc_stack = ctx->rpc_stack; t->pid = ctx->pid; t->eid = ctx->eid; + t->regs = ctx->regs; } |
