Changeset 63a045c in mainline for boot/arch/ia64/src/main.c
- Timestamp:
- 2018-10-10T17:41:44Z (6 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 9286475
- Parents:
- 63c1dd5
- git-author:
- Jiří Zárevúcky <zarevucky.jiri@…> (2018-10-10 17:11:15)
- git-committer:
- Jiří Zárevúcky <zarevucky.jiri@…> (2018-10-10 17:41:44)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
boot/arch/ia64/src/main.c
r63c1dd5 r63a045c 43 43 #include <str.h> 44 44 #include <errno.h> 45 #include <inflate.h> 46 #include "../../components.h" 45 #include <payload.h> 47 46 48 47 #define DEFAULT_MEMORY_BASE 0x4000000ULL … … 150 149 version_print(); 151 150 151 printf("Boot loader: %p -> %p\n", loader_start, loader_end); 152 152 printf(" %p|%p: boot info structure\n", &bootinfo, &bootinfo); 153 153 printf(" %p|%p: kernel entry point\n", … … 156 156 (void *) LOADER_ADDRESS, (void *) LOADER_ADDRESS); 157 157 158 size_t i;159 for (i = 0; i < COMPONENTS; i++)160 printf(" %p|%p: %s image (%zu/%zu bytes)\n", components[i].addr,161 components[i].addr, components[i].name,162 components[i].inflated, components[i].size);163 164 void *dest[COMPONENTS];165 size_t top = KERNEL_ADDRESS;166 size_t cnt = 0;167 bootinfo.taskmap.cnt = 0;168 for (i = 0; i < min(COMPONENTS, TASKMAP_MAX_RECORDS); i++) {169 top = ALIGN_UP(top, PAGE_SIZE);170 171 if (i > 0) {172 bootinfo.taskmap.tasks[bootinfo.taskmap.cnt].addr =173 (void *) top;174 bootinfo.taskmap.tasks[bootinfo.taskmap.cnt].size =175 components[i].inflated;176 177 str_cpy(bootinfo.taskmap.tasks[bootinfo.taskmap.cnt].name,178 BOOTINFO_TASK_NAME_BUFLEN, components[i].name);179 180 bootinfo.taskmap.cnt++;181 }182 183 dest[i] = (void *) top;184 top += components[i].inflated;185 cnt++;186 }187 188 printf("\nInflating components ... ");189 190 /*191 * We will use the next available address for a copy of each component to192 * make sure that inflate() works with disjunctive memory regions.193 */194 top = ALIGN_UP(top, PAGE_SIZE);195 196 for (i = cnt; i > 0; i--) {197 printf("%s ", components[i - 1].name);198 199 /*200 * Copy the component to a location which is guaranteed not to201 * overlap with the destination for inflate().202 */203 memmove((void *) top, components[i - 1].addr, components[i - 1].size);204 205 int err = inflate((void *) top, components[i - 1].size,206 dest[i - 1], components[i - 1].inflated);207 208 if (err != EOK) {209 printf("\n%s: Inflating error %d, halting.\n",210 components[i - 1].name, err);211 halt();212 }213 }214 215 printf(".\n");216 217 158 read_efi_memmap(); 218 159 read_sal_configuration(); 219 160 read_pal_configuration(); 220 161 162 uint8_t *kernel_start = (uint8_t *) KERNEL_ADDRESS; 163 uint8_t *ram_end = NULL; 164 165 /* Find the end of the memory area occupied by the kernel. */ 166 for (unsigned i = 0; i < bootinfo.memmap_items; i++) { 167 memmap_item_t m = bootinfo.memmap[i]; 168 if (m.type == MEMMAP_FREE_MEM && 169 m.base <= (uintptr_t) kernel_start && 170 m.base + m.size > (uintptr_t) kernel_start) { 171 ram_end = (uint8_t *) (m.base + m.size); 172 } 173 } 174 175 if (ram_end == NULL) { 176 printf("Memory map doesn't contain usable area at kernel's address.\n"); 177 halt(); 178 } 179 180 // FIXME: Correct kernel's logical address. 181 extract_payload(&bootinfo.taskmap, kernel_start, ram_end, 182 (uintptr_t) kernel_start, NULL); 183 221 184 printf("Booting the kernel ...\n"); 222 185 jump_to_kernel(&bootinfo);
Note:
See TracChangeset
for help on using the changeset viewer.