Mercurial > lcfOS
comparison cos/kernel/kernel.h @ 25:d3c4bf3720a3
Beginning of multitasking
author | windel |
---|---|
date | Tue, 27 Dec 2011 13:31:38 +0100 |
parents | d8627924d40d |
children | dcce92b1efbc |
comparison
equal
deleted
inserted
replaced
24:d8627924d40d | 25:d3c4bf3720a3 |
---|---|
29 // memory alloc functions: | 29 // memory alloc functions: |
30 void init_heap(); | 30 void init_heap(); |
31 void* kmalloc(uint64_t size); | 31 void* kmalloc(uint64_t size); |
32 void kfree(void* ptr); | 32 void kfree(void* ptr); |
33 | 33 |
34 // task related functions: | |
35 void initialize_tasking(); | |
36 void new_task(); | |
37 void task_scheduler(); | |
38 | |
34 // STDout funcs: | 39 // STDout funcs: |
35 void printf(const char* fmt, ... ); | 40 void printf(const char* fmt, ... ); |
36 void memset(void* ptr, uint32_t value, uint32_t num); | 41 void memset(void* ptr, uint32_t value, uint32_t num); |
37 void memcpy(void* dst, void* src, uint32_t num); | 42 void memcpy(void* dst, void* src, uint32_t num); |
38 int strncmp(const char* s1, const char* s2, int size); | 43 int strncmp(const char* s1, const char* s2, int size); |
54 void setupIDT(void); | 59 void setupIDT(void); |
55 void PICremap(void); | 60 void PICremap(void); |
56 | 61 |
57 // ASM helper: | 62 // ASM helper: |
58 void loadIDT(void); | 63 void loadIDT(void); |
64 uint64_t read_rip(); | |
59 | 65 |
60 // Panic exit: | 66 // Panic exit: |
61 void halt(void); | 67 void halt(void); |
62 void panic(char *msg); | 68 void panic(char *msg); |
63 | 69 |
76 uint64_t getTimeMS(); | 82 uint64_t getTimeMS(); |
77 | 83 |
78 // Memory functions: | 84 // Memory functions: |
79 void mappage(uint64_t address); | 85 void mappage(uint64_t address); |
80 | 86 |
81 int querymode(void); | |
82 void loadPageTable(void* tableAddress); | 87 void loadPageTable(void* tableAddress); |
83 | 88 |
84 // Variable argument list things: | 89 // Variable argument list things: |
85 #define va_start(v,l) __builtin_va_start(v,l) | 90 #define va_start(v,l) __builtin_va_start(v,l) |
86 #define va_end(v) __builtin_va_end(v) | 91 #define va_end(v) __builtin_va_end(v) |
120 { | 125 { |
121 char name[32]; // Name of the console | 126 char name[32]; // Name of the console |
122 unsigned char screendata[80*25]; // All chars in the console! | 127 unsigned char screendata[80*25]; // All chars in the console! |
123 } console_t; | 128 } console_t; |
124 | 129 |
125 typedef struct { | 130 typedef struct task_t { |
126 uint32_t esp; | 131 struct task_t* next; |
127 uint32_t ss; | |
128 uint32_t kstack; | 132 uint32_t kstack; |
129 uint32_t ustack; | 133 uint32_t ustack; |
130 uint32_t cr3; | |
131 | 134 |
132 uint32_t number; | 135 uint64_t cr3; |
136 uint64_t rip; | |
137 uint64_t rsp; | |
138 uint64_t rbp; | |
139 | |
140 uint32_t pid; | |
133 uint32_t parent; | 141 uint32_t parent; |
134 uint32_t owner; | 142 uint32_t owner; |
135 uint32_t groups; | 143 uint32_t groups; |
136 uint32_t timetorun; | 144 uint32_t timetorun; |
137 uint32_t sleep; | 145 uint32_t sleep; |
138 uint32_t priority; | 146 uint32_t priority; |
139 uint32_t filehandle; | 147 uint32_t filehandle; |
140 char naam[32]; | 148 char naam[32]; |
141 | 149 |
142 console_t *console; | 150 console_t *console; |
143 } programma_t; | 151 } task_t; |
144 | 152 |
145 #endif | 153 #endif |
146 | 154 |