2025-01-13 09:46:09 -05:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "list.h"
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
|
2025-01-17 06:56:05 -05:00
|
|
|
extern struct task *current_task;
|
|
|
|
|
2025-01-13 09:46:09 -05:00
|
|
|
enum status { ZOMBIE, THREAD, RUN };
|
2025-01-17 06:56:05 -05:00
|
|
|
enum owner { OWNER_KERNEL, OWNER_USER };
|
2025-01-13 09:46:09 -05:00
|
|
|
|
|
|
|
struct task {
|
|
|
|
uint32_t *esp;
|
|
|
|
uint32_t *esp0;
|
2025-01-17 06:56:05 -05:00
|
|
|
uint32_t *cr3; // physical
|
|
|
|
uint32_t *heap; // virtual
|
|
|
|
uint32_t *eip;
|
2025-01-13 09:46:09 -05:00
|
|
|
uint16_t pid;
|
|
|
|
uint8_t status;
|
2025-01-17 06:56:05 -05:00
|
|
|
uint8_t owner_id;
|
2025-01-13 09:46:09 -05:00
|
|
|
struct task *daddy;
|
|
|
|
struct task *child;
|
|
|
|
struct list **signals;
|
|
|
|
struct task *next;
|
2025-01-17 06:56:05 -05:00
|
|
|
struct task *prev;
|
2025-01-13 09:46:09 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
void scheduler(void);
|
|
|
|
void switch_to_task(struct task *next_task);
|
2025-01-17 06:56:05 -05:00
|
|
|
void exec_fn(void (*fn)(void));
|