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