From 131af4eec38752a27e6e56579fbf76178e022ec1 Mon Sep 17 00:00:00 2001 From: Kimplul Date: Thu, 1 Dec 2022 02:05:19 +0200 Subject: start looking into memory handling + Now 10M alloc/frees succeed, which totals more memory than the virtual machine has, so no too obvious leaks are occuring. For future debugging speed, changed 10M to 1M. + Also quick fix to rpcs, stacks are now assigned. Not entirely sure why they worked before this, but good that I found it. --- common/tcb.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'common/tcb.c') diff --git a/common/tcb.c b/common/tcb.c index ef15788..fb2f934 100644 --- a/common/tcb.c +++ b/common/tcb.c @@ -435,7 +435,7 @@ struct call_ctx { id_t pid; }; -void save_context(struct tcb *t) +void enter_rpc(struct tcb *t) { vm_t rpc_stack = t->rpc_stack; if (is_rpc(t)) @@ -447,6 +447,10 @@ void save_context(struct tcb *t) rpc_stack = align_down(get_stack(t), BASE_PAGE_SIZE); + /* make sure updates are visible when swapping to the new virtual memory */ + mark_rpc_inaccessible(t, rpc_stack, t->rpc_stack); + use_vmem(t->rpc.vmem); + struct call_ctx *ctx = (struct call_ctx *)(rpc_stack) - 1; ctx->exec = t->exec; ctx->pid = t->pid; @@ -468,12 +472,12 @@ void save_context(struct tcb *t) * we'll handle it separately and if the process isn't going over the * limit just give it more. * */ - mark_rpc_inaccessible(t, rpc_stack, t->rpc_stack); t->rpc_stack = rpc_stack; t->regs = (vm_t)ctx; + set_stack(t, rpc_stack); } -void load_context(struct tcb *t) +void leave_rpc(struct tcb *t) { vm_t rpc_stack = t->rpc_stack + BASE_PAGE_SIZE; struct call_ctx *ctx = (struct call_ctx *)(rpc_stack) - 1; -- cgit v1.3