aboutsummaryrefslogtreecommitdiff
path: root/common/tcb.c
diff options
context:
space:
mode:
authorKimplul <kimi.h.kuparinen@gmail.com>2022-12-01 02:05:19 +0200
committerKimplul <kimi.h.kuparinen@gmail.com>2022-12-01 02:05:19 +0200
commit131af4eec38752a27e6e56579fbf76178e022ec1 (patch)
tree1940634f69a44395fc6945b25c5cbc8b68bba876 /common/tcb.c
parente25f1e7a8f8f2320546ad4950464713d85b47785 (diff)
downloadkmi-131af4eec38752a27e6e56579fbf76178e022ec1.tar.gz
kmi-131af4eec38752a27e6e56579fbf76178e022ec1.zip
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.
Diffstat (limited to 'common/tcb.c')
-rw-r--r--common/tcb.c10
1 files changed, 7 insertions, 3 deletions
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;