diff --git a/stratosphere/ams_mitm/source/bpc_mitm/bpc_ams_power_utils.cpp b/stratosphere/ams_mitm/source/bpc_mitm/bpc_ams_power_utils.cpp index 738143fe7..ca4284bc0 100644 --- a/stratosphere/ams_mitm/source/bpc_mitm/bpc_ams_power_utils.cpp +++ b/stratosphere/ams_mitm/source/bpc_mitm/bpc_ams_power_utils.cpp @@ -51,7 +51,20 @@ namespace ams::mitm::bpc { } } - void DoRebootToPayload(const ams::FatalErrorContext *ctx) { + void DoRebootToPayload() { + /* Ensure clean IRAM state. */ + ClearIram(); + + /* Copy in payload. */ + for (size_t ofs = 0; ofs < sizeof(g_reboot_payload); ofs += sizeof(g_work_page)) { + std::memcpy(g_work_page, &g_reboot_payload[ofs], std::min(sizeof(g_reboot_payload) - ofs, sizeof(g_work_page))); + exosphere::CopyToIram(IramPayloadBase + ofs, g_work_page, sizeof(g_work_page)); + } + + exosphere::ForceRebootToIramPayload(); + } + + void DoRebootToFatalError(const ams::FatalErrorContext *ctx) { /* Ensure clean IRAM state. */ ClearIram(); @@ -85,7 +98,7 @@ namespace ams::mitm::bpc { break; case RebootType::ToPayload: default: /* This should never be called with ::Standard */ - DoRebootToPayload(nullptr); + DoRebootToPayload(); break; } } @@ -96,7 +109,7 @@ namespace ams::mitm::bpc { /* Atmosphere power utilities. */ void RebootForFatalError(const ams::FatalErrorContext *ctx) { - DoRebootToPayload(ctx); + DoRebootToFatalError(ctx); } void SetRebootPayload(const void *payload, size_t payload_size) { diff --git a/stratosphere/boot/source/boot_power_utils.cpp b/stratosphere/boot/source/boot_power_utils.cpp index c5cd17a0e..b84ac8674 100644 --- a/stratosphere/boot/source/boot_power_utils.cpp +++ b/stratosphere/boot/source/boot_power_utils.cpp @@ -56,7 +56,7 @@ namespace ams::boot { exosphere::ForceRebootToIramPayload(); } - void DoRebootToFatalError(ams::FatalErrorContext *ctx) { + void DoRebootToFatalError(const ams::FatalErrorContext *ctx) { /* Ensure clean IRAM state. */ ClearIram();