diff --git a/exosphere2/loader_stub/source/secmon_loader_main.cpp b/exosphere2/loader_stub/source/secmon_loader_main.cpp index 70dc8555a..26b194413 100644 --- a/exosphere2/loader_stub/source/secmon_loader_main.cpp +++ b/exosphere2/loader_stub/source/secmon_loader_main.cpp @@ -24,6 +24,7 @@ namespace ams::secmon::loader { /* Uncompress the program image. */ Uncompress(secmon::MemoryRegionPhysicalTzramFullProgramImage.GetPointer(), secmon::MemoryRegionPhysicalTzramFullProgramImage.GetSize(), program_lz4, program_lz4_size); + /* Copy the boot image to the end of IRAM */ u8 *relocated_boot_code = secmon::MemoryRegionPhysicalIramBootCodeImage.GetEndPointer() - boot_code_lz4_size; std::memcpy(relocated_boot_code, boot_code_lz4, boot_code_lz4_size); @@ -31,6 +32,7 @@ namespace ams::secmon::loader { /* Uncompress the boot image. */ Uncompress(secmon::MemoryRegionPhysicalIramBootCodeImage.GetPointer(), secmon::MemoryRegionPhysicalIramBootCodeImage.GetSize(), relocated_boot_code, boot_code_lz4_size); + /* Jump to the boot image. */ reinterpret_cast(secmon::MemoryRegionPhysicalIramBootCodeImage.GetAddress())(); diff --git a/exosphere2/loader_stub/source/start.s b/exosphere2/loader_stub/source/start.s index 2f432aaa7..7476605a7 100644 --- a/exosphere2/loader_stub/source/start.s +++ b/exosphere2/loader_stub/source/start.s @@ -95,7 +95,7 @@ _start: ERRATUM_INVALIDATE_BTB_AT_BOOT /* Set the stack pointer to a temporary location. */ - ldr x20, =0x7C010800 + ldr x20, =0x7C020000 mov sp, x20 /* Call our init array functions. */ diff --git a/exosphere2/program/source/boot/secmon_main.cpp b/exosphere2/program/source/boot/secmon_main.cpp index aa603eec9..6769cd9e7 100644 --- a/exosphere2/program/source/boot/secmon_main.cpp +++ b/exosphere2/program/source/boot/secmon_main.cpp @@ -32,19 +32,19 @@ namespace ams::secmon { void Main() { /* Set library register addresses. */ - actmon::SetRegisterAddress(MemoryRegionVirtualDeviceActivityMonitor.GetAddress()); - clkrst::SetRegisterAddress(MemoryRegionVirtualDeviceClkRst.GetAddress()); - flow::SetRegisterAddress(MemoryRegionVirtualDeviceFlowController.GetAddress()); - fuse::SetRegisterAddress(MemoryRegionVirtualDeviceFuses.GetAddress()); - gic::SetRegisterAddress(MemoryRegionVirtualDeviceGicDistributor.GetAddress(), MemoryRegionVirtualDeviceGicCpuInterface.GetAddress()); - i2c::SetRegisterAddress(i2c::Port_1, MemoryRegionVirtualDeviceI2c1.GetAddress()); - i2c::SetRegisterAddress(i2c::Port_5, MemoryRegionVirtualDeviceI2c5.GetAddress()); - pinmux::SetRegisterAddress(MemoryRegionVirtualDeviceApbMisc.GetAddress(), MemoryRegionVirtualDeviceGpio.GetAddress()); - pmc::SetRegisterAddress(MemoryRegionVirtualDevicePmc.GetAddress()); - se::SetRegisterAddress(MemoryRegionVirtualDeviceSecurityEngine.GetAddress()); - uart::SetRegisterAddress(MemoryRegionVirtualDeviceUart.GetAddress()); - wdt::SetRegisterAddress(MemoryRegionVirtualDeviceTimer.GetAddress()); - util::SetRegisterAddress(MemoryRegionVirtualDeviceTimer.GetAddress()); + actmon::SetRegisterAddress(MemoryRegionVirtualDeviceActivityMonitor.GetAddress()); + clkrst::SetRegisterAddress(MemoryRegionVirtualDeviceClkRst.GetAddress()); + flow::SetRegisterAddress(MemoryRegionVirtualDeviceFlowController.GetAddress()); + fuse::SetRegisterAddress(MemoryRegionVirtualDeviceFuses.GetAddress()); + gic::SetRegisterAddress(MemoryRegionVirtualDeviceGicDistributor.GetAddress(), MemoryRegionVirtualDeviceGicCpuInterface.GetAddress()); + i2c::SetRegisterAddress(i2c::Port_1, MemoryRegionVirtualDeviceI2c1.GetAddress()); + i2c::SetRegisterAddress(i2c::Port_5, MemoryRegionVirtualDeviceI2c5.GetAddress()); + pinmux::SetRegisterAddress(MemoryRegionVirtualDeviceApbMisc.GetAddress(), MemoryRegionVirtualDeviceGpio.GetAddress()); + pmc::SetRegisterAddress(MemoryRegionVirtualDevicePmc.GetAddress()); + se::SetRegisterAddress(MemoryRegionVirtualDeviceSecurityEngine.GetAddress()); + uart::SetRegisterAddress(MemoryRegionVirtualDeviceUart.GetAddress()); + wdt::SetRegisterAddress(MemoryRegionVirtualDeviceTimer.GetAddress()); + util::SetRegisterAddress(MemoryRegionVirtualDeviceTimer.GetAddress()); /* Get the secure monitor parameters. */ auto &secmon_params = *reinterpret_cast(MemoryRegionVirtualDeviceBootloaderParams.GetAddress()); diff --git a/libraries/libexosphere/include/exosphere/mmu/mmu_api.arch.arm64.hpp b/libraries/libexosphere/include/exosphere/mmu/mmu_api.arch.arm64.hpp index d18e2b4f1..ada818af0 100644 --- a/libraries/libexosphere/include/exosphere/mmu/mmu_api.arch.arm64.hpp +++ b/libraries/libexosphere/include/exosphere/mmu/mmu_api.arch.arm64.hpp @@ -174,15 +174,15 @@ namespace ams::mmu::arch::arm64 { } constexpr u64 MakeL1BlockEntry(u64 address, PageTableMappingAttribute attr) { - return address | static_cast(attr) | 0x1ul; + return address | static_cast(attr) | static_cast(PageTableMappingAttribute_AccessFlagAccessed) | 0x1ul; } constexpr u64 MakeL2BlockEntry(u64 address, PageTableMappingAttribute attr) { - return address | static_cast(attr) | 0x1ul; + return address | static_cast(attr) | static_cast(PageTableMappingAttribute_AccessFlagAccessed) | 0x1ul; } constexpr u64 MakeL3BlockEntry(u64 address, PageTableMappingAttribute attr) { - return address | static_cast(attr) | 0x3ul; + return address | static_cast(attr) | static_cast(PageTableMappingAttribute_AccessFlagAccessed) | 0x3ul; } constexpr uintptr_t GetL2Offset(uintptr_t address) {