From 74da8a48850b21147ca9b0e65f6cf4197a95e14f Mon Sep 17 00:00:00 2001 From: Michael Scire Date: Sun, 15 Nov 2020 08:43:55 -0800 Subject: [PATCH] exo: map stack region for mariko-only program --- exosphere/program/source/boot/secmon_make_page_table.cpp | 3 +++ .../include/exosphere/secmon/secmon_memory_layout.hpp | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/exosphere/program/source/boot/secmon_make_page_table.cpp b/exosphere/program/source/boot/secmon_make_page_table.cpp index 42e3cf97b..ed4c2ec30 100644 --- a/exosphere/program/source/boot/secmon_make_page_table.cpp +++ b/exosphere/program/source/boot/secmon_make_page_table.cpp @@ -128,6 +128,9 @@ namespace ams::secmon::boot { /* Map the mariko program region as rwx. */ SetL3BlockEntry(l3, MemoryRegionVirtualTzramMarikoProgram.GetAddress(), MemoryRegionPhysicalTzramMarikoProgram.GetAddress(), MemoryRegionPhysicalTzramMarikoProgram.GetSize(), MappingAttributesEl3SecureRwCode); + /* Map the mariko program region as rwx. */ + SetL3BlockEntry(l3, MemoryRegionVirtualTzramMarikoProgramStack.GetAddress(), MemoryRegionPhysicalTzramMarikoProgramStack.GetAddress(), MemoryRegionPhysicalTzramMarikoProgramStack.GetSize(), MappingAttributesEl3SecureRwData); + /* Map the boot code region. */ SetL3BlockEntry(l3, MemoryRegionVirtualTzramBootCode.GetAddress(), MemoryRegionPhysicalTzramBootCode.GetAddress(), MemoryRegionVirtualTzramBootCode.GetSize(), MappingAttributesEl3SecureRwCode); diff --git a/libraries/libexosphere/include/exosphere/secmon/secmon_memory_layout.hpp b/libraries/libexosphere/include/exosphere/secmon/secmon_memory_layout.hpp index a1208ede6..620b08866 100644 --- a/libraries/libexosphere/include/exosphere/secmon/secmon_memory_layout.hpp +++ b/libraries/libexosphere/include/exosphere/secmon/secmon_memory_layout.hpp @@ -199,6 +199,10 @@ namespace ams::secmon { constexpr inline const MemoryRegion MemoryRegionPhysicalTzramMarikoProgram(UINT64_C(0x7C020000), 0x20000); static_assert(MemoryRegionPhysicalTzramMariko.Contains(MemoryRegionPhysicalTzramMarikoProgram)); + constexpr inline const MemoryRegion MemoryRegionVirtualTzramMarikoProgramStack(UINT64_C(0x1F00F4000), 0x8000); + constexpr inline const MemoryRegion MemoryRegionPhysicalTzramMarikoProgramStack(UINT64_C(0x7C040000), 0x8000); + static_assert(MemoryRegionPhysicalTzramMariko.Contains(MemoryRegionPhysicalTzramMarikoProgramStack)); + constexpr inline const MemoryRegion MemoryRegionPhysicalMarikoProgramImage(UINT64_C(0x80020000), 0x20000); static_assert(MemoryRegionDram.Contains(MemoryRegionPhysicalMarikoProgramImage));