Rev 1757 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 1757 | Rev 1780 | ||
|---|---|---|---|
| Line 99... | Line 99... | ||
| 99 | /* |
99 | /* |
| 100 | * These 'hardcoded' variables will be intialized by |
100 | * These 'hardcoded' variables will be intialized by |
| 101 | * the linker or the low level assembler code with |
101 | * the linker or the low level assembler code with |
| 102 | * appropriate sizes and addresses. |
102 | * appropriate sizes and addresses. |
| 103 | */ |
103 | */ |
| 104 | __address hardcoded_load_address = 0; /**< Virtual address of where the kernel is loaded. */ |
104 | uintptr_t hardcoded_load_address = 0; /**< Virtual address of where the kernel is loaded. */ |
| 105 | size_t hardcoded_ktext_size = 0; /**< Size of the kernel code in bytes. */ |
105 | size_t hardcoded_ktext_size = 0; /**< Size of the kernel code in bytes. */ |
| 106 | size_t hardcoded_kdata_size = 0; /**< Size of the kernel data in bytes. */ |
106 | size_t hardcoded_kdata_size = 0; /**< Size of the kernel data in bytes. */ |
| 107 | 107 | ||
| 108 | void main_bsp(void); |
108 | void main_bsp(void); |
| 109 | void main_ap(void); |
109 | void main_ap(void); |
| Line 130... | Line 130... | ||
| 130 | * Assuming interrupts_disable(). |
130 | * Assuming interrupts_disable(). |
| 131 | * |
131 | * |
| 132 | */ |
132 | */ |
| 133 | void main_bsp(void) |
133 | void main_bsp(void) |
| 134 | { |
134 | { |
| 135 | __address stackaddr; |
135 | uintptr_t stackaddr; |
| 136 | 136 | ||
| 137 | config.cpu_count = 1; |
137 | config.cpu_count = 1; |
| 138 | config.cpu_active = 1; |
138 | config.cpu_active = 1; |
| 139 | 139 | ||
| 140 | config.base = hardcoded_load_address; |
140 | config.base = hardcoded_load_address; |
| Line 200... | Line 200... | ||
| 200 | page_init(); |
200 | page_init(); |
| 201 | tlb_init(); |
201 | tlb_init(); |
| 202 | arch_post_mm_init(); |
202 | arch_post_mm_init(); |
| 203 | 203 | ||
| 204 | version_print(); |
204 | version_print(); |
| 205 | printf("%.*p: hardcoded_ktext_size=%zdK, hardcoded_kdata_size=%zdK\n", sizeof(__address) * 2, config.base, hardcoded_ktext_size >> 10, hardcoded_kdata_size >> 10); |
205 | printf("%.*p: hardcoded_ktext_size=%zdK, hardcoded_kdata_size=%zdK\n", sizeof(uintptr_t) * 2, config.base, hardcoded_ktext_size >> 10, hardcoded_kdata_size >> 10); |
| 206 | 206 | ||
| 207 | arch_pre_smp_init(); |
207 | arch_pre_smp_init(); |
| 208 | smp_init(); |
208 | smp_init(); |
| 209 | 209 | ||
| 210 | slab_enable_cpucache(); /* Slab must be initialized AFTER we know the number of processors */ |
210 | slab_enable_cpucache(); /* Slab must be initialized AFTER we know the number of processors */ |
| Line 221... | Line 221... | ||
| 221 | thread_init(); |
221 | thread_init(); |
| 222 | futex_init(); |
222 | futex_init(); |
| 223 | klog_init(); |
223 | klog_init(); |
| 224 | 224 | ||
| 225 | for (i = 0; i < init.cnt; i++) |
225 | for (i = 0; i < init.cnt; i++) |
| 226 | printf("init[%zd].addr=%.*p, init[%zd].size=%zd\n", i, sizeof(__address) * 2, init.tasks[i].addr, i, init.tasks[i].size); |
226 | printf("init[%zd].addr=%.*p, init[%zd].size=%zd\n", i, sizeof(uintptr_t) * 2, init.tasks[i].addr, i, init.tasks[i].size); |
| 227 | 227 | ||
| 228 | ipc_init(); |
228 | ipc_init(); |
| 229 | 229 | ||
| 230 | /* |
230 | /* |
| 231 | * Create kernel task. |
231 | * Create kernel task. |
| Line 295... | Line 295... | ||
| 295 | /* |
295 | /* |
| 296 | * If we woke kmp up before we left the kernel stack, we could |
296 | * If we woke kmp up before we left the kernel stack, we could |
| 297 | * collide with another CPU coming up. To prevent this, we |
297 | * collide with another CPU coming up. To prevent this, we |
| 298 | * switch to this cpu's private stack prior to waking kmp up. |
298 | * switch to this cpu's private stack prior to waking kmp up. |
| 299 | */ |
299 | */ |
| 300 | context_set(&CPU->saved_context, FADDR(main_ap_separated_stack), (__address) CPU->stack, CPU_STACK_SIZE); |
300 | context_set(&CPU->saved_context, FADDR(main_ap_separated_stack), (uintptr_t) CPU->stack, CPU_STACK_SIZE); |
| 301 | context_restore(&CPU->saved_context); |
301 | context_restore(&CPU->saved_context); |
| 302 | /* not reached */ |
302 | /* not reached */ |
| 303 | } |
303 | } |
| 304 | 304 | ||
| 305 | 305 | ||