Changeset d59718e in mainline for kernel/generic/src/main/main.c
- Timestamp:
- 2018-10-21T21:57:23Z (5 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- cfdeedc
- Parents:
- 566457ad
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/main/main.c
r566457ad rd59718e 172 172 config.kernel_size = 173 173 ALIGN_UP((uintptr_t) kdata_end - config.base, PAGE_SIZE); 174 175 /* Place the stack after the kernel, init and ballocs. */ 176 config.stack_base = config.base + config.kernel_size; 174 177 config.stack_size = STACK_SIZE; 175 176 /* Initialy the stack is placed just after the kernel */177 config.stack_base = config.base + config.kernel_size;178 178 179 179 /* Avoid placing stack on top of init */ 180 180 size_t i; 181 181 for (i = 0; i < init.cnt; i++) { 182 if (overlaps(KA2PA(config.stack_base), config.stack_size, 183 init.tasks[i].paddr, init.tasks[i].size)) { 184 /* 185 * The init task overlaps with the memory behind the 186 * kernel image so it must be in low memory and we can 187 * use PA2KA on the init task's physical address. 188 */ 189 config.stack_base = ALIGN_UP( 190 PA2KA(init.tasks[i].paddr) + init.tasks[i].size, 191 config.stack_size); 192 } 182 uintptr_t p = init.tasks[i].paddr + init.tasks[i].size; 183 uintptr_t bottom = PA2KA(ALIGN_UP(p, PAGE_SIZE)); 184 185 if (config.stack_base < bottom) 186 config.stack_base = bottom; 193 187 } 194 188 195 189 /* Avoid placing stack on top of boot allocations. */ 196 190 if (ballocs.size) { 197 if (PA_OVERLAPS(config.stack_base, config.stack_size,198 ballocs.base, ballocs.size))199 config.stack_base = ALIGN_UP(ballocs.base +200 ballocs.size, PAGE_SIZE);191 uintptr_t bottom = 192 ALIGN_UP(ballocs.base + ballocs.size, PAGE_SIZE); 193 if (config.stack_base < bottom) 194 config.stack_base = bottom; 201 195 } 202 196
Note:
See TracChangeset
for help on using the changeset viewer.