From ab703646d58eb7c10b4d46e9f591d53bd0c11bad Mon Sep 17 00:00:00 2001 From: Michael Scire Date: Wed, 13 May 2020 20:51:58 -0700 Subject: [PATCH] exo2: by default, map end of iram for debug --- exosphere2/program/source/boot/secmon_make_page_table.cpp | 5 +++++ .../include/exosphere/secmon/secmon_memory_layout.hpp | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/exosphere2/program/source/boot/secmon_make_page_table.cpp b/exosphere2/program/source/boot/secmon_make_page_table.cpp index 876bc54c0..c30ebee86 100644 --- a/exosphere2/program/source/boot/secmon_make_page_table.cpp +++ b/exosphere2/program/source/boot/secmon_make_page_table.cpp @@ -100,6 +100,11 @@ namespace ams::secmon::boot { /* Map the IRAM SC7 firmware region. */ SetL3BlockEntry(l3, MemoryRegionVirtualIramSc7Firmware.GetAddress(), MemoryRegionPhysicalIramSc7Firmware.GetAddress(), MemoryRegionVirtualIramSc7Firmware.GetSize(), MappingAttributesEl3NonSecureDevice); + /* Map the Debug region. */ + /* NOTE: This region is reserved for debug. By default it will be the last 0x8000 bytes of IRAM, but this is subject to change. */ + /* If you are doing development work for exosphere, feel free to locally change this to whatever is useful. */ + SetL3BlockEntry(l3, MemoryRegionVirtualDebug.GetAddress(), MemoryRegionPhysicalIram.GetEndAddress() - 0x8000, 0x8000, MappingAttributesEl3SecureDevice); + /* Map the TZRAM ro alias region. */ SetL3BlockEntry(l3, MemoryRegionVirtualTzramReadOnlyAlias.GetAddress(), MemoryRegionPhysicalTzramReadOnlyAlias.GetAddress(), MemoryRegionVirtualTzramReadOnlyAlias.GetSize(), MappingAttributesEl3SecureRoData); diff --git a/libraries/libexosphere/include/exosphere/secmon/secmon_memory_layout.hpp b/libraries/libexosphere/include/exosphere/secmon/secmon_memory_layout.hpp index ce0fa4cf5..a7818c11c 100644 --- a/libraries/libexosphere/include/exosphere/secmon/secmon_memory_layout.hpp +++ b/libraries/libexosphere/include/exosphere/secmon/secmon_memory_layout.hpp @@ -218,7 +218,7 @@ namespace ams::secmon { static_assert(MemoryRegionPhysicalIram.Contains(MemoryRegionPhysicalIramSc7Firmware)); constexpr inline const MemoryRegion MemoryRegionVirtualDebug = MemoryRegion(UINT64_C(0x1F0160000), 0x10000); - static_assert(MemoryRegionVirtual.Contains(MemoryRegionVirtualIramSc7Firmware)); + static_assert(MemoryRegionVirtual.Contains(MemoryRegionVirtualDebug)); constexpr inline const MemoryRegion MemoryRegionVirtualTzramBootCode = MemoryRegion(UINT64_C(0x1F01C0000), 0x2000); constexpr inline const MemoryRegion MemoryRegionPhysicalTzramBootCode = MemoryRegion( UINT64_C(0x7C010000), 0x2000);