From a12e50e5a7dae52ed8bd5a24cc6576371e20985b Mon Sep 17 00:00:00 2001 From: Kimplul Date: Mon, 27 Dec 2021 20:40:44 +0200 Subject: Started work on syscalls --- common/tcb.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'common/tcb.c') diff --git a/common/tcb.c b/common/tcb.c index 5b00524..8a1e95e 100644 --- a/common/tcb.c +++ b/common/tcb.c @@ -3,6 +3,7 @@ #include static struct sp_root t_root = (struct sp_root){0}; +static struct tcb *__tcb_cache[MAX_CPUS] = {0}; #define tcb_container(x) \ container_of(x, struct tcb, sp_n) @@ -53,3 +54,18 @@ struct tcb *threads_find(id_t tid) return 0; } + +struct tcb *get_tcb(id_t pid) +{ + /* TODO: figure out how exactly thread IDs are related to process IDs, + * and figure out mapping between them. */ + return 0; +} + +struct tcb *cur_tcb() +{ + /* TODO: probably keep an array of processor ID's somewhere where each + * ID has a corresponding 'currently executing thread ID' field, and + * reutrn that. */ + return __tcb_cache[cpu_id()]; +} -- cgit v1.3