From: Michael D. Lowis Date: Tue, 13 Sep 2022 03:18:51 +0000 (-0400) Subject: started adding process table X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=65cf505964244a9c371ba0d70e15b48c6b949ac1;p=proto%2Fcerise-os.git started adding process table --- 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 ***************************************/