Exosphere: Fix crt0 bug resulting in bad relocation calculations

This commit is contained in:
Michael Scire 2018-05-10 18:36:52 -06:00
parent f8cf7adad7
commit 02e01360fd
2 changed files with 5 additions and 3 deletions

View file

@ -131,14 +131,15 @@ uintptr_t get_coldboot_crt0_stack_address(void) {
return TZRAM_GET_SEGMENT_PA(TZRAM_SEGMENT_ID_CORE3_STACK) + 0x800; return TZRAM_GET_SEGMENT_PA(TZRAM_SEGMENT_ID_CORE3_STACK) + 0x800;
} }
void coldboot_init(coldboot_crt0_reloc_list_t *reloc_list, boot_func_list_t *func_list, boot_func_list_t *func_list_warmboot) { void coldboot_init(coldboot_crt0_reloc_list_t *reloc_list, boot_func_list_t *func_list, boot_func_list_t *func_list_warmboot, uintptr_t start_cold) {
MAILBOX_NX_SECMON_BOOT_TIME = TIMERUS_CNTR_1US_0; //MAILBOX_NX_SECMON_BOOT_TIME = TIMERUS_CNTR_1US_0;
boot_func_list_t func_copy = *func_list; boot_func_list_t func_copy = *func_list;
/* Custom approach */ /* Custom approach */
reloc_list->reloc_base = (uintptr_t)__start_cold; reloc_list->reloc_base = start_cold;
translate_func_list(reloc_list, func_list, false); translate_func_list(reloc_list, func_list, false);
/* /*
From https://events.static.linuxfound.org/sites/events/files/slides/slides_17.pdf : From https://events.static.linuxfound.org/sites/events/files/slides/slides_17.pdf :
Caches may write back dirty lines at any time: Caches may write back dirty lines at any time:

View file

@ -90,6 +90,7 @@ __start_cold:
mov x19, x0 mov x19, x0
adr x1, g_coldboot_crt0_main_func_list adr x1, g_coldboot_crt0_main_func_list
ldr x2, =g_warmboot_crt0_main_func_list ldr x2, =g_warmboot_crt0_main_func_list
adr x3, __start_cold
bl coldboot_init bl coldboot_init
ldr x16, =__jump_to_main_cold ldr x16, =__jump_to_main_cold