Make clear_bss work regardless of load address

This commit is contained in:
Michael Scire 2018-03-01 00:59:08 -08:00
parent 1d621f3bf4
commit 4025781f1c

View file

@ -136,8 +136,9 @@ FAR_REACHING static void invalidate_icache_all_inner_shareable_tzram_pa(void) {
} }
FAR_REACHING static void clear_bss(void) { FAR_REACHING static void clear_bss(void) {
memset((void *)__pk2ldr_bss_start__, 0, __pk2ldr_end__ - __pk2ldr_bss_start__); volatile uintptr_t v = (uintptr_t)memset;
memset((void *)__main_bss_start__, 0, __main_end__ - __main_bss_start__); ((void (*)(void *, int, size_t))v)((void *)__pk2ldr_bss_start__, 0, __pk2ldr_end__ - __pk2ldr_bss_start__);
((void (*)(void *, int, size_t))v)((void *)__main_bss_start__, 0, __main_end__ - __main_bss_start__);
} }
uintptr_t get_coldboot_crt0_stack_address(void) { uintptr_t get_coldboot_crt0_stack_address(void) {
@ -153,8 +154,11 @@ void coldboot_init(void) {
/* TODO: initialize DMA controllers, etc. */ /* TODO: initialize DMA controllers, etc. */
configure_ttbls(); configure_ttbls();
set_memory_registers_enable_mmu_tzram_pa(); set_memory_registers_enable_mmu_tzram_pa();
copy_other_sections(); copy_other_sections();
flush_dcache_all_tzram_pa(); flush_dcache_all_tzram_pa();
invalidate_icache_all_inner_shareable_tzram_pa(); invalidate_icache_all_inner_shareable_tzram_pa();
/* At this point we can access all the mapped segments (all other functions, data...) normally */ /* At this point we can access all the mapped segments (all other functions, data...) normally */