Files
2026-05-03 13:05:55 +04:00

45 lines
1.0 KiB
C

// SPDX-License-Identifier: GPL-3.0-or-later
// Copyright (c) 2026 0xKSor
#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);