Files
KatauOS/include/task.h
T
2025-03-31 14:51:33 +03:00

33 lines
670 B
C

#ifndef TASK_H
#define TASK_H
#include <stdint.h>
typedef enum TaskState
{
Ready,
Running,
Waiting,
Terminated
} TaskState;
typedef void (*EntryPoint)(void);
typedef struct Process
{
uint32_t pid; // Process ID
TaskState state; // Process state
uintptr_t programCounter; // Program Counter
uintptr_t* stackBase; // Top of the stack
uintptr_t* stackPointer; // Stack Pointer
uint32_t flags; // Status/Flags register
struct Process* next; // Pointer to the next task in the list
} Process;
Process* task_create(EntryPoint func);
void scheduler_init();
void schedule();
void scheduler_lock();
void scheduler_unlock();
#endif