aboutsummaryrefslogtreecommitdiff
path: root/src/kernel/tasks/process.h
diff options
context:
space:
mode:
authorMarvin Borner2020-04-26 23:23:42 +0200
committerMarvin Borner2020-04-26 23:23:42 +0200
commitf30c9803f05e90087e367953aa142275f8688f61 (patch)
treebea9166fad90c42ad4551094a5e6eec9098a7f19 /src/kernel/tasks/process.h
parent31f671f2137bc09e62de09142bea232c1975c76b (diff)
Awesome new multitasking system and scheduler
Diffstat (limited to 'src/kernel/tasks/process.h')
-rw-r--r--src/kernel/tasks/process.h71
1 files changed, 71 insertions, 0 deletions
diff --git a/src/kernel/tasks/process.h b/src/kernel/tasks/process.h
new file mode 100644
index 0000000..df0f51f
--- /dev/null
+++ b/src/kernel/tasks/process.h
@@ -0,0 +1,71 @@
+#ifndef MELVIX_PROCESS_H
+#define MELVIX_PROCESS_H
+
+#include <stdint.h>
+#include <kernel/memory/paging.h>
+#include <kernel/interrupts/interrupts.h>
+
+struct mmap {
+ uint32_t text;
+ uint32_t bss;
+ uint32_t data;
+ uint32_t stack;
+};
+
+struct process {
+ struct page_directory *cr3;
+ struct regs registers;
+
+ uint32_t pid;
+ uint32_t gid;
+ char *name;
+
+ int state;
+ int thread;
+
+ uint32_t stdint;
+ uint32_t stdout;
+ uint32_t stderr;
+
+ uint32_t brk;
+ uint32_t handlers[6];
+
+ struct process *parent;
+ struct process *next;
+};
+
+void process_kill(uint32_t pid);
+
+uint32_t process_spawn(struct process *process);
+
+void process_suspend(uint32_t pid);
+void process_wake(uint32_t pid);
+uint32_t process_child(struct process *process, uint32_t pid);
+uint32_t process_fork(uint32_t pid);
+
+int process_wait_gid(uint32_t gid, int *status);
+int process_wait_pid(uint32_t pid, int *status);
+
+struct process *process_from_pid(uint32_t pid);
+
+void process_init(struct process *proc);
+
+struct process *process_make_new();
+
+extern struct process *current_proc;
+
+extern uint32_t stack_hold;
+
+#define PID_NOT_FOUND ((struct process *)0xFFFFFFFF)
+
+#define PROC_RUNNING 0
+#define PROC_ASLEEP 1
+
+#define PROC_THREAD 0
+#define PROC_PROC 1
+#define PROC_ROOT 2
+
+#define WAIT_ERROR (-1)
+#define WAIT_OKAY 0
+
+#endif \ No newline at end of file