2022-09-20 17:58:04 +00:00
|
|
|
#pragma once
|
|
|
|
#include "interrupts/Context.h"
|
|
|
|
|
|
|
|
struct Task
|
|
|
|
{
|
2022-09-21 19:06:00 +00:00
|
|
|
enum TaskState
|
|
|
|
{
|
|
|
|
Idle,
|
|
|
|
Running,
|
|
|
|
Sleeping,
|
|
|
|
Exited
|
|
|
|
};
|
|
|
|
|
2022-09-20 17:58:04 +00:00
|
|
|
uint64_t id;
|
|
|
|
Context regs;
|
|
|
|
|
|
|
|
int64_t task_sleep = 0;
|
|
|
|
int64_t task_time = 0;
|
|
|
|
|
|
|
|
Task* next_task = nullptr;
|
2022-09-21 19:06:00 +00:00
|
|
|
Task* prev_task = nullptr;
|
|
|
|
|
|
|
|
uint64_t allocated_stack = 0;
|
|
|
|
|
|
|
|
TaskState state;
|
2022-09-25 15:49:51 +00:00
|
|
|
|
|
|
|
uint64_t cpu_time = 0;
|
2022-09-20 17:58:04 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
void set_context_from_task(Task& task, Context* ctx);
|
|
|
|
void get_context_to_task(Task& task, Context* ctx);
|