Rev 1833 | Rev 1901 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 1833 | Rev 1894 | ||
|---|---|---|---|
| Line 92... | Line 92... | ||
| 92 | /** Initial user-space tasks */ |
92 | /** Initial user-space tasks */ |
| 93 | init_t init = { |
93 | init_t init = { |
| 94 | 0 |
94 | 0 |
| 95 | }; |
95 | }; |
| 96 | 96 | ||
| - | 97 | /** Boot allocations. */ |
|
| - | 98 | ballocs_t ballocs = { |
|
| - | 99 | .base = NULL, |
|
| - | 100 | .size = 0 |
|
| - | 101 | }; |
|
| - | 102 | ||
| 97 | context_t ctx; |
103 | context_t ctx; |
| 98 | 104 | ||
| 99 | /* |
105 | /* |
| 100 | * These 'hardcoded' variables will be intialized by |
106 | * These 'hardcoded' variables will be intialized by |
| 101 | * the linker or the low level assembler code with |
107 | * the linker or the low level assembler code with |
| Line 103... | Line 109... | ||
| 103 | */ |
109 | */ |
| 104 | uintptr_t hardcoded_load_address = 0; /**< Virtual address of where the kernel is loaded. */ |
110 | 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. */ |
111 | 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. */ |
112 | size_t hardcoded_kdata_size = 0; /**< Size of the kernel data in bytes. */ |
| 107 | 113 | ||
| 108 | uintptr_t stack_safe = 0; /**< Lowest safe stack virtual address */ |
114 | uintptr_t stack_safe = 0; /**< Lowest safe stack virtual address */ |
| 109 | 115 | ||
| 110 | void main_bsp(void); |
116 | void main_bsp(void); |
| 111 | void main_ap(void); |
117 | void main_ap(void); |
| 112 | 118 | ||
| 113 | /* |
119 | /* |
| Line 150... | Line 156... | ||
| 150 | count_t i; |
156 | count_t i; |
| 151 | for (i = 0; i < init.cnt; i++) { |
157 | for (i = 0; i < init.cnt; i++) { |
| 152 | if (PA_overlaps(config.stack_base, config.stack_size, init.tasks[i].addr, init.tasks[i].size)) |
158 | if (PA_overlaps(config.stack_base, config.stack_size, init.tasks[i].addr, init.tasks[i].size)) |
| 153 | config.stack_base = ALIGN_UP(init.tasks[i].addr + init.tasks[i].size, config.stack_size); |
159 | config.stack_base = ALIGN_UP(init.tasks[i].addr + init.tasks[i].size, config.stack_size); |
| 154 | } |
160 | } |
| - | 161 | ||
| - | 162 | /* Avoid placing stack on top of boot allocations. */ |
|
| - | 163 | if (ballocs.size) { |
|
| - | 164 | if (PA_overlaps(config.stack_base, config.stack_size, ballocs.base, ballocs.size)) |
|
| - | 165 | config.stack_base = ALIGN_UP(ballocs.base + ballocs.size, PAGE_SIZE); |
|
| - | 166 | } |
|
| 155 | 167 | ||
| 156 | if (config.stack_base < stack_safe) |
168 | if (config.stack_base < stack_safe) |
| 157 | config.stack_base = ALIGN_UP(stack_safe, PAGE_SIZE); |
169 | config.stack_base = ALIGN_UP(stack_safe, PAGE_SIZE); |
| 158 | 170 | ||
| 159 | context_save(&ctx); |
171 | context_save(&ctx); |