Changes in boot/arch/arm32/src/main.c [0e63d34:7e752b2] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
boot/arch/arm32/src/main.c
r0e63d34 r7e752b2 50 50 #define TOP2ADDR(top) (((void *) PA2KA(BOOT_OFFSET)) + (top)) 51 51 52 extern void *bdata_start;53 extern void *bdata_end;54 55 56 static inline void invalidate_icache(void)57 {58 /* ICIALLU Invalidate entire ICache */59 asm volatile ("mov r0, #0\n" "mcr p15, 0, r0, c7, c5, 0\n" ::: "r0" );60 }61 62 static inline void invalidate_dcache(void *address, size_t size)63 {64 const uintptr_t addr = (uintptr_t)address;65 /* DCIMVAC - invalidate by address to the point of coherence */66 for (uintptr_t a = addr; a < addr + size; a += 4) {67 asm volatile ("mcr p15, 0, %[a], c7, c6, 1\n" :: [a]"r"(a) : );68 }69 }70 71 static inline void clean_dcache_poc(void *address, size_t size)72 {73 const uintptr_t addr = (uintptr_t)address;74 /* DCCMVAC - clean by address to the point of coherence */75 for (uintptr_t a = addr; a < addr + size; a += 4) {76 asm volatile ("mcr p15, 0, %[a], c7, c10, 1\n" :: [a]"r"(a) : );77 }78 }79 80 52 static bootinfo_t bootinfo; 81 53 82 54 void bootstrap(void) 83 55 { 84 /* Make sure we run in memory code when caches are enabled,85 * make sure we read memory data too. This part is ARMv7 specific as86 * ARMv7 no longer invalidates caches on restart.87 * See chapter B2.2.2 of ARM Architecture Reference Manual p. B2-1263*/88 invalidate_icache();89 invalidate_dcache(&bdata_start, &bdata_end - &bdata_start);90 91 /* Enable MMU and caches */92 56 mmu_start(); 93 57 version_print(); 94 58 95 printf("Boot data: %p -> %p\n", &bdata_start, &bdata_end);96 59 printf("\nMemory statistics\n"); 97 60 printf(" %p|%p: bootstrap stack\n", &boot_stack, &boot_stack); … … 101 64 (void *) PA2KA(BOOT_OFFSET), (void *) BOOT_OFFSET); 102 65 103 for (size_t i = 0; i < COMPONENTS; i++) { 66 size_t i; 67 for (i = 0; i < COMPONENTS; i++) 104 68 printf(" %p|%p: %s image (%u/%u bytes)\n", components[i].start, 105 69 components[i].start, components[i].name, components[i].inflated, 106 70 components[i].size); 107 invalidate_dcache(components[i].start, components[i].size);108 }109 71 110 72 void *dest[COMPONENTS]; … … 112 74 size_t cnt = 0; 113 75 bootinfo.cnt = 0; 114 for ( size_ti = 0; i < min(COMPONENTS, TASKMAP_MAX_RECORDS); i++) {76 for (i = 0; i < min(COMPONENTS, TASKMAP_MAX_RECORDS); i++) { 115 77 top = ALIGN_UP(top, PAGE_SIZE); 116 78 … … 132 94 printf("\nInflating components ... "); 133 95 134 for ( size_ti = cnt; i > 0; i--) {96 for (i = cnt; i > 0; i--) { 135 97 void *tail = components[i - 1].start + components[i - 1].size; 136 98 if (tail >= dest[i - 1]) { … … 144 106 int err = inflate(components[i - 1].start, components[i - 1].size, 145 107 dest[i - 1], components[i - 1].inflated); 108 146 109 if (err != EOK) { 147 110 printf("\n%s: Inflating error %d\n", components[i - 1].name, err); 148 111 halt(); 149 112 } 150 clean_dcache_poc(dest[i - 1], components[i - 1].inflated);151 113 } 152 114 153 115 printf(".\n"); 154 116 155 printf("Booting the kernel... \n");117 printf("Booting the kernel... \n"); 156 118 jump_to_kernel((void *) PA2KA(BOOT_OFFSET), &bootinfo); 157 119 }
Note:
See TracChangeset
for help on using the changeset viewer.