From 3dd777be70fabcfbba191750b56bf4ca340407f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Lam?= Date: Wed, 6 Dec 2017 21:14:59 +0100 Subject: [PATCH] Boot: Add default exception handlers Some homebrew expect exception handlers to be present -- which is almost always the case on console, since most of the time homebrew are launched from either a libogc or SDK title) -- and break if they are not. To fix this, we just need to include default, dummy handlers. --- Source/Core/Core/Boot/Boot.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Source/Core/Core/Boot/Boot.cpp b/Source/Core/Core/Boot/Boot.cpp index 96baaa9e05..981cebc550 100644 --- a/Source/Core/Core/Boot/Boot.cpp +++ b/Source/Core/Core/Boot/Boot.cpp @@ -282,6 +282,18 @@ static void SetDefaultDisc() SetDisc(DiscIO::CreateVolumeFromFilename(config.m_strDefaultISO)); } +static void CopyDefaultExceptionHandlers() +{ + constexpr u32 EXCEPTION_HANDLER_ADDRESSES[] = {0x00000100, 0x00000200, 0x00000300, 0x00000400, + 0x00000500, 0x00000600, 0x00000700, 0x00000800, + 0x00000900, 0x00000C00, 0x00000D00, 0x00000F00, + 0x00001300, 0x00001400, 0x00001700}; + + constexpr u32 RFI_INSTRUCTION = 0x4C000064; + for (const u32 address : EXCEPTION_HANDLER_ADDRESSES) + Memory::Write_U32(RFI_INSTRUCTION, address); +} + // Third boot step after BootManager and Core. See Call schedule in BootManager.cpp bool CBoot::BootUp(std::unique_ptr boot) { @@ -332,6 +344,7 @@ bool CBoot::BootUp(std::unique_ptr boot) SetupMSR(); SetupBAT(config.bWii); + CopyDefaultExceptionHandlers(); if (config.bWii) {