diff options
Diffstat (limited to 'src/kernel/task/task.h')
-rw-r--r-- | src/kernel/task/task.h | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/src/kernel/task/task.h b/src/kernel/task/task.h index 47d7632..69b431d 100644 --- a/src/kernel/task/task.h +++ b/src/kernel/task/task.h @@ -20,8 +20,10 @@ typedef void (*thread_entry)(void*); -struct thread; -struct process { +class thread; +class process { + public: + uint32_t pid, uid, privilege, thread_count; process *parent; page_directory *pagedir; @@ -31,10 +33,15 @@ struct process { process *next; //Forms a linked list thread *threads; + + process() {} // must not be used directly + process(process *parent, uint32_t uid, uint32_t privilege); }; -struct thread { - struct process *process; +class thread { + public: + + class process *process; uint32_t esp, ebp, eip; uint8_t state; uint32_t timeWait; @@ -42,6 +49,10 @@ struct thread { uint32_t kernelStack_size; thread *next, *queue_next; //queue_next is used in sched.c + + thread(class process *proc, thread_entry entry_point, void *data, void *u_esp); + + void wakeUp(); }; extern thread *current_thread; @@ -56,10 +67,7 @@ void tasking_updateKernelPagetable(uint32_t idx, page_table *table, uint32_t tab uint32_t tasking_handleException(registers *regs); void thread_goInactive(); //Blocks the current thread. it is then waked up by another thread or a system event. -void thread_wakeUp(thread *t); int proc_priv(); //Returns current privilege level -thread * thread_new(process *proc, thread_entry entry_point, void *data, void *u_esp); -process* process_new(process *parent, uint32_t uid, uint32_t privilege); void thread_exit(); //syscall void process_exit(size_t retval); //syscall |