aboutsummaryrefslogtreecommitdiff
path: root/common/tcb.c
diff options
context:
space:
mode:
authorKimplul <kimi.h.kuparinen@gmail.com>2022-10-21 17:43:31 +0300
committerKimplul <kimi.h.kuparinen@gmail.com>2022-10-21 17:43:31 +0300
commitec989bbe7d9bb7a844eeddeceaeb7bb7e4d5dab6 (patch)
tree51221980ad2d4c8701e1a6e762a47495dec289de /common/tcb.c
parenta06dbb8a63d825ebb1ad65372ce1ce1f572891bc (diff)
downloadkmi-ec989bbe7d9bb7a844eeddeceaeb7bb7e4d5dab6.tar.gz
kmi-ec989bbe7d9bb7a844eeddeceaeb7bb7e4d5dab6.zip
initial implementation of swap
+ Slightly unsure if it should be a syscall, or if assign would be enough. Also, which thread should run in a fork/spawn? For now, old thread, though this might increase latency. Or add swap flag to these calls?
Diffstat (limited to 'common/tcb.c')
-rw-r--r--common/tcb.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/common/tcb.c b/common/tcb.c
index f618cd6..42e634d 100644
--- a/common/tcb.c
+++ b/common/tcb.c
@@ -305,9 +305,13 @@ struct tcb *cur_proc()
void use_tcb(struct tcb *t)
{
+ cpu_assign(t);
+
id_t cpu = cpu_id();
t->cpu_id = cpu;
cpu_tcb[cpu] = t;
+
+ use_vmem(t->proc.vmem);
}
struct tcb *get_tcb(id_t tid)