Changes in boot/arch/arm32/src/main.c [9d58539:7cd15b9] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
boot/arch/arm32/src/main.c
r9d58539 r7cd15b9 50 50 #define TOP2ADDR(top) (((void *) PA2KA(BOOT_OFFSET)) + (top)) 51 51 52 extern void *bdata_start; 53 extern void *bdata_end; 54 55 static inline void clean_dcache_poc(void *address, size_t size) 56 { 57 const uintptr_t addr = (uintptr_t)address; 58 for (uintptr_t a = addr; a < addr + size; a += 4) { 59 /* DCCMVAC - clean by address to the point of coherence */ 60 asm volatile ("mcr p15, 0, %[a], c7, c10, 1\n" :: [a]"r"(a) : ); 61 } 62 } 63 52 64 static bootinfo_t bootinfo; 53 65 54 66 void bootstrap(void) 55 67 { 68 /* Enable MMU and caches */ 56 69 mmu_start(); 57 70 version_print(); 58 71 72 printf("Boot data: %p -> %p\n", &bdata_start, &bdata_end); 59 73 printf("\nMemory statistics\n"); 60 74 printf(" %p|%p: bootstrap stack\n", &boot_stack, &boot_stack); … … 64 78 (void *) PA2KA(BOOT_OFFSET), (void *) BOOT_OFFSET); 65 79 66 size_t i; 67 for (i = 0; i < COMPONENTS; i++) 80 for (size_t i = 0; i < COMPONENTS; i++) { 68 81 printf(" %p|%p: %s image (%u/%u bytes)\n", components[i].start, 69 82 components[i].start, components[i].name, components[i].inflated, 70 83 components[i].size); 84 } 71 85 72 86 void *dest[COMPONENTS]; … … 74 88 size_t cnt = 0; 75 89 bootinfo.cnt = 0; 76 for ( i = 0; i < min(COMPONENTS, TASKMAP_MAX_RECORDS); i++) {90 for (size_t i = 0; i < min(COMPONENTS, TASKMAP_MAX_RECORDS); i++) { 77 91 top = ALIGN_UP(top, PAGE_SIZE); 78 92 … … 94 108 printf("\nInflating components ... "); 95 109 96 for ( i = cnt; i > 0; i--) {110 for (size_t i = cnt; i > 0; i--) { 97 111 void *tail = components[i - 1].start + components[i - 1].size; 98 112 if (tail >= dest[i - 1]) { … … 106 120 int err = inflate(components[i - 1].start, components[i - 1].size, 107 121 dest[i - 1], components[i - 1].inflated); 108 109 122 if (err != EOK) { 110 123 printf("\n%s: Inflating error %d\n", components[i - 1].name, err); 111 124 halt(); 112 125 } 126 /* Make sure data are in the memory, ICache will need them */ 127 clean_dcache_poc(dest[i - 1], components[i - 1].inflated); 113 128 } 114 129 115 130 printf(".\n"); 131 132 /* Flush PT too. We need this if we disable caches later */ 133 clean_dcache_poc(boot_pt, PTL0_ENTRIES * PTL0_ENTRY_SIZE); 116 134 117 printf("Booting the kernel... 135 printf("Booting the kernel...\n"); 118 136 jump_to_kernel((void *) PA2KA(BOOT_OFFSET), &bootinfo); 119 137 }
Note:
See TracChangeset
for help on using the changeset viewer.