mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2024-11-23 04:12:02 +00:00
ams.mitm: fix reboot to payload/fatal error distinction
This commit is contained in:
parent
51aeb280f1
commit
87512439a3
2 changed files with 17 additions and 4 deletions
|
@ -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. */
|
/* Ensure clean IRAM state. */
|
||||||
ClearIram();
|
ClearIram();
|
||||||
|
|
||||||
|
@ -85,7 +98,7 @@ namespace ams::mitm::bpc {
|
||||||
break;
|
break;
|
||||||
case RebootType::ToPayload:
|
case RebootType::ToPayload:
|
||||||
default: /* This should never be called with ::Standard */
|
default: /* This should never be called with ::Standard */
|
||||||
DoRebootToPayload(nullptr);
|
DoRebootToPayload();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -96,7 +109,7 @@ namespace ams::mitm::bpc {
|
||||||
|
|
||||||
/* Atmosphere power utilities. */
|
/* Atmosphere power utilities. */
|
||||||
void RebootForFatalError(const ams::FatalErrorContext *ctx) {
|
void RebootForFatalError(const ams::FatalErrorContext *ctx) {
|
||||||
DoRebootToPayload(ctx);
|
DoRebootToFatalError(ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetRebootPayload(const void *payload, size_t payload_size) {
|
void SetRebootPayload(const void *payload, size_t payload_size) {
|
||||||
|
|
|
@ -56,7 +56,7 @@ namespace ams::boot {
|
||||||
exosphere::ForceRebootToIramPayload();
|
exosphere::ForceRebootToIramPayload();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DoRebootToFatalError(ams::FatalErrorContext *ctx) {
|
void DoRebootToFatalError(const ams::FatalErrorContext *ctx) {
|
||||||
/* Ensure clean IRAM state. */
|
/* Ensure clean IRAM state. */
|
||||||
ClearIram();
|
ClearIram();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue