Changes in boot/arch/riscv64/src/main.c [ae8d7b0:a35b458] in mainline
- File:
-
- 1 edited
-
boot/arch/riscv64/src/main.c (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
boot/arch/riscv64/src/main.c
rae8d7b0 ra35b458 48 48 { 49 49 version_print(); 50 50 51 51 bootinfo.htif_frame = ((uintptr_t) &htif_page) >> PAGE_WIDTH; 52 52 bootinfo.pt_frame = ((uintptr_t) &pt_page) >> PAGE_WIDTH; 53 53 54 54 bootinfo.ucbinfo.tohost = 55 55 (volatile uint64_t *) PA2KA((uintptr_t) &tohost); 56 56 bootinfo.ucbinfo.fromhost = 57 57 (volatile uint64_t *) PA2KA((uintptr_t) &fromhost); 58 58 59 59 // FIXME TODO: read from device tree 60 60 bootinfo.physmem_start = PHYSMEM_START; … … 63 63 bootinfo.memmap.zones[0].start = (void *) PHYSMEM_START; 64 64 bootinfo.memmap.zones[0].size = PHYSMEM_SIZE; 65 65 66 66 printf("\nMemory statistics (total %lu MB, starting at %p)\n\n", 67 67 bootinfo.memmap.total >> 20, (void *) bootinfo.physmem_start); 68 68 printf(" %p: boot info structure\n", &bootinfo); 69 69 70 70 uintptr_t top = BOOT_OFFSET; 71 71 72 72 for (size_t i = 0; i < COMPONENTS; i++) { 73 73 printf(" %p: %s image (%zu/%zu bytes)\n", components[i].addr, 74 74 components[i].name, components[i].inflated, 75 75 components[i].size); 76 76 77 77 uintptr_t tail = (uintptr_t) components[i].addr + 78 78 components[i].size; … … 83 83 } 84 84 } 85 85 86 86 printf(" %p: inflate area\n", (void *) top); 87 87 88 88 void *kernel_entry = NULL; 89 89 void *dest[COMPONENTS]; 90 90 size_t cnt = 0; 91 91 bootinfo.taskmap.cnt = 0; 92 92 93 93 for (size_t i = 0; i < min(COMPONENTS, TASKMAP_MAX_RECORDS); i++) { 94 94 top = ALIGN_UP(top, PAGE_SIZE); 95 95 96 96 if (i > 0) { 97 97 bootinfo.taskmap.tasks[bootinfo.taskmap.cnt].addr = … … 99 99 bootinfo.taskmap.tasks[bootinfo.taskmap.cnt].size = 100 100 components[i].inflated; 101 101 102 102 str_cpy(bootinfo.taskmap.tasks[bootinfo.taskmap.cnt].name, 103 103 BOOTINFO_TASK_NAME_BUFLEN, components[i].name); 104 104 105 105 bootinfo.taskmap.cnt++; 106 106 } else 107 107 kernel_entry = (void *) PA2KA(top); 108 108 109 109 dest[i] = (void *) top; 110 110 top += components[i].inflated; 111 111 cnt++; 112 112 } 113 113 114 114 printf(" %p: kernel entry point\n", kernel_entry); 115 115 116 116 if (top >= bootinfo.physmem_start + bootinfo.memmap.total) { 117 117 printf("Not enough physical memory available.\n"); … … 119 119 halt(); 120 120 } 121 121 122 122 printf("\nInflating components ... "); 123 123 124 124 for (size_t i = cnt; i > 0; i--) { 125 125 printf("%s ", components[i - 1].name); 126 126 127 127 int err = inflate(components[i - 1].addr, components[i - 1].size, 128 128 dest[i - 1], components[i - 1].inflated); 129 129 130 130 if (err != EOK) { 131 131 printf("\n%s: Inflating error %d, halting.\n", … … 134 134 } 135 135 } 136 136 137 137 printf(".\n"); 138 138 139 139 printf("Booting the kernel...\n"); 140 140 jump_to_kernel(PA2KA(&bootinfo));
Note:
See TracChangeset
for help on using the changeset viewer.
