From 9424510f8f0bc6c80632aabe83b2bb6ac33987cc Mon Sep 17 00:00:00 2001 From: Michael Scire Date: Fri, 18 May 2018 07:16:41 -0600 Subject: [PATCH] Exosphere: Fix remaining crt0 bugs, we now make it to pk2ldr. --- exosphere/src/coldboot_init.c | 4 ++-- exosphere/src/start.s | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/exosphere/src/coldboot_init.c b/exosphere/src/coldboot_init.c index 67bab8c09..5cc2d43e5 100644 --- a/exosphere/src/coldboot_init.c +++ b/exosphere/src/coldboot_init.c @@ -107,12 +107,13 @@ static void configure_ttbls(void) { static void do_relocation(const coldboot_crt0_reloc_list_t *reloc_list, size_t index) { extern const uint8_t __glob_origin__[]; uint64_t *p_vma = (uint64_t *)reloc_list->relocs[index].vma; + bool is_clear = reloc_list->relocs[index].lma == 0; size_t offset = reloc_list->relocs[index].lma - (uintptr_t)__glob_origin__; const uint64_t *p_lma = (const uint64_t *)(reloc_list->reloc_base + offset); size_t size = reloc_list->relocs[index].end_vma - reloc_list->relocs[index].vma; for(size_t i = 0; i < size / 8; i++) { - p_vma[i] = offset != 0 ? p_lma[i] : 0; + p_vma[i] = is_clear ? 0 : p_lma[i]; } } @@ -160,7 +161,6 @@ void coldboot_init(coldboot_crt0_reloc_list_t *reloc_list, uintptr_t start_cold) for(size_t i = 0; i < reloc_list->nb_relocs_post_mmu_init; i++) { do_relocation(reloc_list, reloc_list->nb_relocs_pre_mmu_init + i); } - // MAKE_REG32(MMIO_GET_DEVICE_ADDRESS(MMIO_DEVID_RTC_PMC) + 0x400ull) = 0x10; flush_dcache_all(); invalidate_icache_all(); diff --git a/exosphere/src/start.s b/exosphere/src/start.s index e3e0bdc61..e7121126a 100644 --- a/exosphere/src/start.s +++ b/exosphere/src/start.s @@ -111,7 +111,7 @@ _post_cold_crt0_reloc: ldr x0, =0x80010000 add x20, x20, x0 ldr x2, =__loaded_end_lma__ - ldr x3, =0x40020000 + ldr x3, =__glob_origin__ sub x21, x2, x3 mov x1, x19 mov x2, x21