]> git.mdlowis.com Git - proto/cerise-os.git/commitdiff
started adding process table
authorMichael D. Lowis <mike@mdlowis.com>
Tue, 13 Sep 2022 03:18:51 +0000 (23:18 -0400)
committerMichael D. Lowis <mike@mdlowis.com>
Tue, 13 Sep 2022 03:18:51 +0000 (23:18 -0400)
Kernel.c

index 9a8fd27c62a15461a6f3c181f62777e4a989045f..fc22d9ac1c8257594c1f0626ccabf73e5b9d04d0 100644 (file)
--- a/Kernel.c
+++ b/Kernel.c
 
 #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
 ***************************************/