42_KFS/headers/task.h
2025-01-20 15:11:22 +01:00

32 lines
578 B
C

#pragma once
#include "list.h"
#include <stdint.h>
extern struct task *current_task;
enum status { ZOMBIE, THREAD, RUN };
enum owner { OWNER_KERNEL, OWNER_USER };
struct task {
uint32_t *esp;
uint32_t *esp0;
uint32_t *cr3; // physical
uint32_t *heap; // virtual
uint32_t *eip;
uint16_t pid;
uint8_t status;
uint8_t owner_id;
struct task *daddy;
struct task *child;
struct list **signals;
struct task *next;
struct task *prev;
};
void scheduler(void);
void switch_to_task(struct task *next_task);
void exec_fn(void (*fn)(void));
int create_kernel_task(void);