Changeset 32817cc in mainline for kernel/generic/src/main
- Timestamp:
- 2012-01-25T22:59:35Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 4dee0cb
- Parents:
- 7943c43
- Location:
- kernel/generic/src/main
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/main/kinit.c
r7943c43 r32817cc 57 57 #include <mm/as.h> 58 58 #include <mm/frame.h> 59 #include <mm/km.h> 59 60 #include <print.h> 60 61 #include <memstr.h> … … 68 69 #include <str.h> 69 70 #include <sysinfo/stats.h> 71 #include <align.h> 70 72 71 73 #ifdef CONFIG_SMP … … 178 180 179 181 for (i = 0; i < init.cnt; i++) { 180 if (init.tasks[i]. addr % FRAME_SIZE) {182 if (init.tasks[i].paddr % FRAME_SIZE) { 181 183 printf("init[%zu]: Address is not frame aligned\n", i); 182 184 programs[i].task = NULL; … … 199 201 str_cpy(namebuf + INIT_PREFIX_LEN, 200 202 TASK_NAME_BUFLEN - INIT_PREFIX_LEN, name); 201 202 int rc = program_create_from_image((void *) init.tasks[i].addr, 203 namebuf, &programs[i]); 203 204 /* 205 * Create virtual memory mappings for init task images. 206 */ 207 size_t size = ALIGN_UP(init.tasks[i].size, PAGE_SIZE); 208 size_t offs; 209 uintptr_t page = km_page_alloc(size, PAGE_SIZE); 210 uintptr_t frame = init.tasks[i].paddr; 211 212 page_table_lock(AS_KERNEL, true); 213 for (offs = 0; offs < size; offs += PAGE_SIZE) { 214 page_mapping_insert(AS_KERNEL, page + offs, 215 frame + offs, 216 PAGE_READ | PAGE_WRITE | PAGE_CACHEABLE | 217 PAGE_PRESENT); 218 } 219 page_table_unlock(AS_KERNEL, true); 220 221 int rc = program_create_from_image((void *) page, namebuf, 222 &programs[i]); 204 223 205 224 if (rc == 0) { … … 224 243 * Assume the last task is the RAM disk. 225 244 */ 226 init_rd((void *) init.tasks[i].addr, init.tasks[i].size);245 init_rd((void *) frame, init.tasks[i].size); 227 246 } else 228 247 printf("init[%zu]: Init binary load failed (error %d)\n", i, rc); -
kernel/generic/src/main/main.c
r7943c43 r32817cc 151 151 size_t i; 152 152 for (i = 0; i < init.cnt; i++) { 153 if (PA_OVERLAPS(config.stack_base, config.stack_size, 154 init.tasks[i].addr, init.tasks[i].size)) 155 config.stack_base = ALIGN_UP(init.tasks[i].addr + 156 init.tasks[i].size, config.stack_size); 153 if (overlaps(KA2PA(config.stack_base), config.stack_size, 154 init.tasks[i].paddr, init.tasks[i].size)) { 155 /* 156 * The init task overlaps with the memory behind the 157 * kernel image so it must be in low memory and we can 158 * use PA2KA on the init task's physical address. 159 */ 160 config.stack_base = ALIGN_UP( 161 PA2KA(init.tasks[i].paddr) + init.tasks[i].size, 162 config.stack_size); 163 } 157 164 } 158 165
Note:
See TracChangeset
for help on using the changeset viewer.
