Changes in boot/arch/ppc32/src/main.c [4646710:a35b458] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
boot/arch/ppc32/src/main.c
r4646710 ra35b458 60 60 version_print(); 61 61 ofw_memmap(&bootinfo.memmap); 62 62 63 63 void *bootinfo_pa = ofw_translate(&bootinfo); 64 64 void *real_mode_pa = ofw_translate(&real_mode); 65 65 void *loader_address_pa = ofw_translate((void *) LOADER_ADDRESS); 66 66 67 67 printf("\nMemory statistics (total %llu MB)\n", bootinfo.memmap.total >> 20); 68 68 printf(" %p|%p: real mode trampoline\n", &real_mode, real_mode_pa); … … 72 72 printf(" %p|%p: loader entry point\n", 73 73 (void *) LOADER_ADDRESS, loader_address_pa); 74 74 75 75 size_t i; 76 76 for (i = 0; i < COMPONENTS; i++) … … 78 78 ofw_translate(components[i].addr), components[i].name, 79 79 components[i].inflated, components[i].size); 80 80 81 81 size_t dest[COMPONENTS]; 82 82 size_t top = 0; … … 85 85 for (i = 0; i < min(COMPONENTS, TASKMAP_MAX_RECORDS); i++) { 86 86 top = ALIGN_UP(top, PAGE_SIZE); 87 87 88 88 if (i > 0) { 89 89 bootinfo.taskmap.tasks[bootinfo.taskmap.cnt].addr = … … 91 91 bootinfo.taskmap.tasks[bootinfo.taskmap.cnt].size = 92 92 components[i].inflated; 93 93 94 94 str_cpy(bootinfo.taskmap.tasks[bootinfo.taskmap.cnt].name, 95 95 BOOTINFO_TASK_NAME_BUFLEN, components[i].name); 96 96 97 97 bootinfo.taskmap.cnt++; 98 98 } 99 99 100 100 dest[i] = top; 101 101 top += components[i].inflated; 102 102 cnt++; 103 103 } 104 104 105 105 if (top >= (size_t) loader_address_pa) { 106 106 printf("Inflated components overlap loader area.\n"); … … 108 108 halt(); 109 109 } 110 110 111 111 void *balloc_base; 112 112 void *balloc_base_pa; … … 114 114 BALLOC_MAX_SIZE, loader_address_pa); 115 115 printf(" %p|%p: boot allocator area\n", balloc_base, balloc_base_pa); 116 116 117 117 void *inflate_base; 118 118 void *inflate_base_pa; … … 120 120 loader_address_pa); 121 121 printf(" %p|%p: inflate area\n", inflate_base, inflate_base_pa); 122 122 123 123 uintptr_t balloc_start = ALIGN_UP(top, PAGE_SIZE); 124 124 size_t pages = (balloc_start + ALIGN_UP(BALLOC_MAX_SIZE, PAGE_SIZE)) … … 129 129 pages * sizeof(void *), loader_address_pa); 130 130 printf(" %p|%p: translate table\n", transtable, transtable_pa); 131 131 132 132 check_overlap("boot allocator area", balloc_base_pa, pages); 133 133 check_overlap("inflate area", inflate_base_pa, pages); 134 134 check_overlap("translate table", transtable_pa, pages); 135 135 136 136 printf("\nInflating components ... "); 137 137 138 138 for (i = cnt; i > 0; i--) { 139 139 printf("%s ", components[i - 1].name); 140 140 141 141 int err = inflate(components[i - 1].addr, components[i - 1].size, 142 142 inflate_base + dest[i - 1], components[i - 1].inflated); 143 143 144 144 if (err != EOK) { 145 145 printf("\n%s: Inflating error %d, halting.\n", … … 148 148 } 149 149 } 150 150 151 151 printf(".\n"); 152 152 153 153 printf("Setting up boot allocator ...\n"); 154 154 balloc_init(&bootinfo.ballocs, balloc_base, PA2KA(balloc_start), 155 155 BALLOC_MAX_SIZE); 156 156 157 157 printf("Setting up screens ...\n"); 158 158 ofw_setup_screens(); 159 159 160 160 printf("Canonizing OpenFirmware device tree ...\n"); 161 161 bootinfo.ofw_root = ofw_tree_build(); 162 162 163 163 printf("Setting up translate table ...\n"); 164 164 for (i = 0; i < pages; i++) { 165 165 uintptr_t off = i << PAGE_WIDTH; 166 166 void *phys; 167 167 168 168 if (off < balloc_start) 169 169 phys = ofw_translate(inflate_base + off); 170 170 else 171 171 phys = ofw_translate(balloc_base + off - balloc_start); 172 172 173 173 ((void **) transtable)[i] = phys; 174 174 } 175 175 176 176 printf("Booting the kernel...\n"); 177 177 jump_to_kernel(bootinfo_pa, transtable_pa, pages, real_mode_pa);
Note:
See TracChangeset
for help on using the changeset viewer.