summaryrefslogtreecommitdiff
path: root/src/stem/task.h
diff options
context:
space:
mode:
authorAlexis211 <alexis211@gmail.com>2010-01-25 18:38:43 +0100
committerAlexis211 <alexis211@gmail.com>2010-01-25 18:38:43 +0100
commit4ae83c83f34759172e9c575c8ac875011bfaff2d (patch)
tree26ec6c665cbada6e413bd31e34c60d7c2bbb41c3 /src/stem/task.h
downloadTCE-4ae83c83f34759172e9c575c8ac875011bfaff2d.tar.gz
TCE-4ae83c83f34759172e9c575c8ac875011bfaff2d.zip
First commit
Diffstat (limited to 'src/stem/task.h')
-rw-r--r--src/stem/task.h41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/stem/task.h b/src/stem/task.h
new file mode 100644
index 0000000..3fec9ea
--- /dev/null
+++ b/src/stem/task.h
@@ -0,0 +1,41 @@
+#ifndef DEF_TASK_H
+#define DEF_TASK_H
+
+#include "types.h"
+#include "paging.h"
+#include "idt.h"
+
+struct process {
+ uint32_t pid, uid;
+ struct process *parent;
+ struct page_directory *pagedir;
+
+ struct process *next; //Forms a linked list
+};
+
+#define TS_RUNNING 0
+#define TS_SLEEPING 1 //Sleeping for a defined amount of time
+#define TS_WAIKWAIT 2 //Waiting to be waked up by something precise (thread currently blocked)
+
+typedef void (*thread_entry)(void*);
+
+struct thread {
+ struct process *process;
+ uint32_t esp, ebp, eip;
+ uint8_t state;
+ uint32_t timeWait;
+ void* kernelStack_addr;
+ uint32_t kernelStack_size;
+
+ struct thread *next; //Forms a linked list
+};
+
+extern struct thread *current_thread;
+
+void tasking_init(thread_entry whereToGo, void *data);
+void tasking_switch();
+uint32_t tasking_handleException(struct registers *regs);
+
+void thread_new(struct process *proc, thread_entry entry_point, void *data);
+
+#endif