Files
KatauOS/include/task.h
T

35 lines
731 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
uint32_t* page_directory;
} Process;
Process* task_create(EntryPoint func, void** args, uint32_t arg_count);
void scheduler_init();
void schedule();
void scheduler_lock();
void scheduler_unlock();
#endif