feat(scheduler): working scheduler

This commit is contained in:
karina
2026-04-29 17:00:11 +04:00
parent 3f51d93a4e
commit e06abbcb23
12 changed files with 220 additions and 17 deletions
+42
View File
@@ -0,0 +1,42 @@
#pragma once
#include <Types.h>
typedef enum OSTaskState {
OSTaskStateDead,
OSTaskStateRunning,
OSTaskStateReady,
OSTaskStateBlocked,
OSTaskStateSleeping,
} OSTaskState;
typedef struct OSProcess {
UInt64 id;
OSTaskState state;
Address* l0Table;
Address heapStart;
Address heapCurrent;
struct OSProcess* parent;
ASCII name[32];
} OSProcess;
typedef struct OSTask {
Address stackPointer;
struct OSTask* next;
UInt32 id;
UInt32 sleepTicks;
OSTaskState state;
Address kernelStackTop;
Pointer kernelStackBase;
OSProcess* process;
Int32 waitingForProcessId;
} OSTask;
enum {
kOSSchedulerTaskStackSize = 16 * 1024,
kOSSchedulerExceptionNumber = 0xF0F0
};
void SchedulerInitialize();
OSTask* SchedulerSpawn(void(*entryPoint)(), OSProcess* owner, Boolean isUser, Address fixedUserStackAddress);
Address SchedulerNext(Address stackPointer);
void SchedulerYield(UInt64 ticks);