summaryrefslogtreecommitdiff
path: root/kernel/sched/scheduler.h
diff options
context:
space:
mode:
authorAnton Kling <anton@kling.gg>2024-02-07 11:36:21 +0100
committerAnton Kling <anton@kling.gg>2024-02-07 22:25:47 +0100
commit35958c8c6b600482f68fef08ac26547b5655e987 (patch)
treea3329136adc1b92885c60462e7dd74c98eaa0953 /kernel/sched/scheduler.h
parentb7fa1457727338416499d1b0144f1042a6878a97 (diff)
A lot of small changes
Diffstat (limited to 'kernel/sched/scheduler.h')
-rw-r--r--kernel/sched/scheduler.h15
1 files changed, 14 insertions, 1 deletions
diff --git a/kernel/sched/scheduler.h b/kernel/sched/scheduler.h
index 17e5d56..01276dc 100644
--- a/kernel/sched/scheduler.h
+++ b/kernel/sched/scheduler.h
@@ -14,7 +14,7 @@
int fork(void);
int exec(const char *filename, char **argv);
-void switch_task();
+void switch_task(int save);
void tasking_init(void);
void exit(int status);
@@ -34,14 +34,23 @@ typedef struct {
typedef struct Process process_t;
+typedef struct TCB {
+ uint32_t ESP;
+ uint32_t CR3;
+ uint32_t ESP0;
+} __attribute__((packed)) TCB;
+
struct Process {
u32 pid;
char program_name[100];
char current_working_directory[MAX_PATH];
u32 eip, esp, ebp;
+ u32 saved_eip, saved_esp, saved_ebp;
+ u32 useresp;
u8 incoming_signal;
u32 signal_handler_stack;
void *signal_handlers[20];
+ void *interrupt_handler;
PageDirectory *cr3;
struct IpcMailbox ipc_mailbox;
vfs_fd_t *file_descriptors[100];
@@ -53,6 +62,9 @@ struct Process {
void *data_segment_end;
process_t *next;
process_t *parent;
+
+ TCB *tcb;
+
// TODO: Create a linkedlist of childs so that the parent process
// can do stuff such as reap zombies and get status.
process_t *child;
@@ -66,4 +78,5 @@ bool get_task_from_pid(u32 pid, process_t **out);
process_t *get_current_task(void);
int get_free_fd(process_t *p, int allocate);
void free_process(void);
+void *get_free_virtual_memory(size_t length);
#endif