From 33434e21efafd691e18dc33a6a54d27a6f7a3a14 Mon Sep 17 00:00:00 2001 From: Michael Scire Date: Mon, 13 Jul 2020 17:00:51 -0700 Subject: [PATCH] kern: Prepare to commit cardinal sin --- mesosphere/kernel_ldr/source/kern_init_loader.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mesosphere/kernel_ldr/source/kern_init_loader.cpp b/mesosphere/kernel_ldr/source/kern_init_loader.cpp index cb36fab23..8af887b15 100644 --- a/mesosphere/kernel_ldr/source/kern_init_loader.cpp +++ b/mesosphere/kernel_ldr/source/kern_init_loader.cpp @@ -317,12 +317,12 @@ namespace ams::kern::init::loader { const Elf::Dyn *kernel_dynamic = reinterpret_cast(GetInteger(virtual_base_address) + dynamic_offset); Elf::ApplyRelocations(GetInteger(virtual_base_address), kernel_dynamic); - /* Reprotect .rodata as R-- */ - ttbr1_table.Reprotect(virtual_base_address + ro_offset, ro_end_offset - ro_offset, KernelRwDataAttribute, KernelRoDataAttribute); - /* Call the kernel's init array functions. */ Elf::CallInitArrayFuncs(GetInteger(virtual_base_address) + init_array_offset, GetInteger(virtual_base_address) + init_array_end_offset); + /* Reprotect .rodata as R-- */ + ttbr1_table.Reprotect(virtual_base_address + ro_offset, ro_end_offset - ro_offset, KernelRwDataAttribute, KernelRoDataAttribute); + /* Return the difference between the random virtual base and the physical base. */ return GetInteger(virtual_base_address) - base_address; }