exo: shuffle logic around to support debug code region in iram

This commit is contained in:
Michael Scire 2020-11-15 01:36:50 -08:00
parent ee3a7e7740
commit 2ef41f0027
11 changed files with 86 additions and 43 deletions

View file

@ -70,7 +70,12 @@ namespace ams::secmon {
secmon::SetupCpuCoreContext();
/* Clear the crt0 code that was present in iram. */
secmon::boot::ClearIram();
secmon::boot::ClearIramBootCode();
/* Clear the debug code from iram, if we're not in debug config. */
#if !defined(AMS_BUILD_FOR_DEBUGGING) && !defined(AMS_BUILD_FOR_AUDITING)
secmon::boot::ClearIramDebugCode();
#endif
/* Alert the bootloader that we're initialized. */
secmon_params.secmon_state = pkg1::SecureMonitorState_Initialized;
@ -117,9 +122,6 @@ namespace ams::secmon {
std::memcpy(dst, src, size);
}
/* Unmap the identity mapping. */
secmon::boot::UnmapPhysicalIdentityMapping();
/* Setup the GPU carveout's magic numbers. */
secmon::boot::WriteGpuCarveoutMagicNumbers();
@ -172,6 +174,12 @@ namespace ams::secmon {
/* Set the core's entrypoint and argument. */
secmon::SetEntryContext(0, Package2LoadAddress + pkg2_meta.entrypoint, 0);
/* Clear the boot keys from iram. */
secmon::boot::ClearIramBootKeys();
/* Unmap the identity mapping. */
secmon::boot::UnmapPhysicalIdentityMapping();
/* Unmap DRAM. */
secmon::boot::UnmapDram();