Rev 207 | Rev 212 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 207 | Rev 210 | ||
---|---|---|---|
Line 51... | Line 51... | ||
51 | #include <mm/frame.h> |
51 | #include <mm/frame.h> |
52 | #include <mm/page.h> |
52 | #include <mm/page.h> |
53 | #include <mm/tlb.h> |
53 | #include <mm/tlb.h> |
54 | #include <synch/waitq.h> |
54 | #include <synch/waitq.h> |
55 | 55 | ||
- | 56 | #include <arch/arch.h> |
|
56 | #include <arch.h> |
57 | #include <arch.h> |
57 | #include <arch/faddr.h> |
58 | #include <arch/faddr.h> |
58 | 59 | ||
59 | #include <typedefs.h> |
60 | #include <typedefs.h> |
60 | 61 | ||
Line 115... | Line 116... | ||
115 | config.base = hardcoded_load_address; |
116 | config.base = hardcoded_load_address; |
116 | config.memory_size = get_memory_size(); |
117 | config.memory_size = get_memory_size(); |
117 | config.kernel_size = kernel_size + CONFIG_STACK_SIZE; |
118 | config.kernel_size = kernel_size + CONFIG_STACK_SIZE; |
118 | 119 | ||
119 | context_save(&ctx); |
120 | context_save(&ctx); |
- | 121 | early_mapping(config.base + hardcoded_ktext_size + hardcoded_kdata_size + heap_delta, CONFIG_STACK_SIZE + CONFIG_HEAP_SIZE); |
|
120 | context_set(&ctx, FADDR(main_bsp_separated_stack), config.base + kernel_size, CONFIG_STACK_SIZE); |
122 | context_set(&ctx, FADDR(main_bsp_separated_stack), config.base + kernel_size, CONFIG_STACK_SIZE); |
121 | context_map_stack(config.base + kernel_size, CONFIG_STACK_SIZE); |
- | |
122 | context_restore(&ctx); |
123 | context_restore(&ctx); |
123 | /* not reached */ |
124 | /* not reached */ |
124 | } |
125 | } |
125 | 126 | ||
126 | 127 | ||
Line 165... | Line 166... | ||
165 | 166 | ||
166 | /* |
167 | /* |
167 | * Create kernel vm mapping. |
168 | * Create kernel vm mapping. |
168 | */ |
169 | */ |
169 | m = vm_create(GET_PTL0_ADDRESS()); |
170 | m = vm_create(GET_PTL0_ADDRESS()); |
- | 171 | if (!m) |
|
170 | if (!m) panic("can't create kernel vm address space\n"); |
172 | panic("can't create kernel vm address space\n"); |
171 | 173 | ||
172 | /* |
174 | /* |
173 | * Create kernel task. |
175 | * Create kernel task. |
174 | */ |
176 | */ |
175 | k = task_create(m); |
177 | k = task_create(m); |
- | 178 | if (!k) |
|
176 | if (!k) panic("can't create kernel task\n"); |
179 | panic("can't create kernel task\n"); |
177 | 180 | ||
178 | /* |
181 | /* |
179 | * Create the first thread. |
182 | * Create the first thread. |
180 | */ |
183 | */ |
181 | t = thread_create(kinit, NULL, k, 0); |
184 | t = thread_create(kinit, NULL, k, 0); |
- | 185 | if (!t) |
|
182 | if (!t) panic("can't create kinit thread\n"); |
186 | panic("can't create kinit thread\n"); |
183 | thread_ready(t); |
187 | thread_ready(t); |
184 | 188 | ||
185 | /* |
189 | /* |
186 | * This call to scheduler() will return to kinit, |
190 | * This call to scheduler() will return to kinit, |
187 | * starting the thread of kernel threads. |
191 | * starting the thread of kernel threads. |