From 65cf505964244a9c371ba0d70e15b48c6b949ac1 Mon Sep 17 00:00:00 2001 From: "Michael D. Lowis" Date: Mon, 12 Sep 2022 23:18:51 -0400 Subject: [PATCH] started adding process table --- Kernel.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Kernel.c b/Kernel.c index 9a8fd27..fc22d9a 100644 --- a/Kernel.c +++ b/Kernel.c @@ -17,10 +17,19 @@ #define WAIT_TIMEOUT_MS 100u #define WORD_SIZE sizeof(void*) +#define MAX_TASKS 4194304 #define WORD_ALIGN(x) \ (((x) + WORD_SIZE) & ~(WORD_SIZE)) +typedef enum { + STATE_READY = 0, + STATE_RUNNING, + STATE_SEND_BLOCKED, + STATE_RECV_BLOCKED, + STATE_TERMINATED +} TaskState_T; + typedef struct Task_T { long* stack_top; // top of task's stack long* heap_top; // top of task's heap @@ -50,6 +59,9 @@ static TaskQueue_T ReadyQueue = {0}; static CpuState_T* Running = NULL; static int CpuCount; +static long NextTask = 0; +static Task_T* Tasks[MAX_TASKS]; + /*************************************** Lock and Condition Operations ***************************************/ -- 2.55.0