From 9a3d9aed30579f64e42eb8961f568ffdbdcc08ff Mon Sep 17 00:00:00 2001 From: TuxSH Date: Fri, 9 Jun 2017 02:31:14 +0200 Subject: [PATCH] Always enable ARM9 exceptions, update .gitignore --- .gitignore | 1 + source/firm.c | 24 +++++++++--------------- source/firm.h | 4 ++-- source/main.c | 6 +++--- 4 files changed, 15 insertions(+), 20 deletions(-) diff --git a/.gitignore b/.gitignore index d4d243f..7a13a41 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +.vscode out build arm11/build diff --git a/source/firm.c b/source/firm.c index f9458de..e68739f 100755 --- a/source/firm.c +++ b/source/firm.c @@ -201,7 +201,7 @@ u32 loadFirm(FirmwareType *firmType, FirmwareSource nandType, bool loadFromStora return firmVersion; } -u32 patchNativeFirm(u32 firmVersion, FirmwareSource nandType, bool loadFromStorage, bool isSafeMode, bool doUnitinfoPatch, bool enableExceptionHandlers) +u32 patchNativeFirm(u32 firmVersion, FirmwareSource nandType, bool loadFromStorage, bool isSafeMode, bool doUnitinfoPatch) { u8 *arm9Section = (u8 *)firm + firm->section[2].offset, *arm11Section1 = (u8 *)firm + firm->section[1].offset; @@ -266,13 +266,10 @@ u32 patchNativeFirm(u32 firmVersion, FirmwareSource nandType, bool loadFromStora if(!ISDEVUNIT) ret += patchCheckForDevCommonKey(process9Offset, process9Size); } - if(enableExceptionHandlers) - { - //ARM9 exception handlers - ret += patchArm9ExceptionHandlersInstall(arm9Section, kernel9Size); - ret += patchSvcBreak9(arm9Section, kernel9Size, (u32)firm->section[2].address); - ret += patchKernel9Panic(arm9Section, kernel9Size); - } + //ARM9 exception handlers + ret += patchArm9ExceptionHandlersInstall(arm9Section, kernel9Size); + ret += patchSvcBreak9(arm9Section, kernel9Size, (u32)firm->section[2].address); + ret += patchKernel9Panic(arm9Section, kernel9Size); if(CONFIG(PATCHACCESS)) ret += patchP9AccessChecks(process9Offset, process9Size); @@ -356,7 +353,7 @@ u32 patchAgbFirm(bool loadFromStorage, bool doUnitinfoPatch) return ret; } -u32 patch1x2xNativeAndSafeFirm(bool enableExceptionHandlers) +u32 patch1x2xNativeAndSafeFirm(void) { u8 *arm9Section = (u8 *)firm + firm->section[2].offset; @@ -379,12 +376,9 @@ u32 patch1x2xNativeAndSafeFirm(bool enableExceptionHandlers) ret += ISN3DS ? patchSignatureChecks(process9Offset, process9Size) : patchOldSignatureChecks(process9Offset, process9Size); - if(enableExceptionHandlers) - { - //ARM9 exception handlers - ret += patchArm9ExceptionHandlersInstall(arm9Section, kernel9Size); - ret += patchSvcBreak9(arm9Section, kernel9Size, (u32)firm->section[2].address); - } + //ARM9 exception handlers + ret += patchArm9ExceptionHandlersInstall(arm9Section, kernel9Size); + ret += patchSvcBreak9(arm9Section, kernel9Size, (u32)firm->section[2].address); return ret; } diff --git a/source/firm.h b/source/firm.h index 6bf15dd..5ef3424 100644 --- a/source/firm.h +++ b/source/firm.h @@ -32,10 +32,10 @@ static Firm *const firm = (Firm *const)0x20001000; u32 loadFirm(FirmwareType *firmType, FirmwareSource nandType, bool loadFromStorage, bool isSafeMode); -u32 patchNativeFirm(u32 firmVersion, FirmwareSource nandType, bool loadFromStorage, bool isSafeMode, bool doUnitinfoPatch, bool enableExceptionHandlers); +u32 patchNativeFirm(u32 firmVersion, FirmwareSource nandType, bool loadFromStorage, bool isSafeMode, bool doUnitinfoPatch); u32 patchTwlFirm(u32 firmVersion, bool loadFromStorage, bool doUnitinfoPatch); u32 patchAgbFirm(bool loadFromStorage, bool doUnitinfoPatch); -u32 patch1x2xNativeAndSafeFirm(bool enableExceptionHandlers); +u32 patch1x2xNativeAndSafeFirm(void); bool checkFirmPayload(u32 payloadSize); void launchFirm(int argc, char **argv); diff --git a/source/main.c b/source/main.c index d5f3495..0605e80 100644 --- a/source/main.c +++ b/source/main.c @@ -288,12 +288,12 @@ boot: bool loadFromStorage = CONFIG(LOADEXTFIRMSANDMODULES); u32 firmVersion = loadFirm(&firmType, firmSource, loadFromStorage, isSafeMode); - bool doUnitinfoPatch = CONFIG(PATCHUNITINFO), enableExceptionHandlers = CONFIG(PATCHUNITINFO); + bool doUnitinfoPatch = CONFIG(PATCHUNITINFO); u32 res; switch(firmType) { case NATIVE_FIRM: - res = patchNativeFirm(firmVersion, nandType, loadFromStorage, isSafeMode, doUnitinfoPatch, enableExceptionHandlers); + res = patchNativeFirm(firmVersion, nandType, loadFromStorage, isSafeMode, doUnitinfoPatch); break; case TWL_FIRM: res = patchTwlFirm(firmVersion, loadFromStorage, doUnitinfoPatch); @@ -304,7 +304,7 @@ boot: case SAFE_FIRM: case SYSUPDATER_FIRM: case NATIVE_FIRM1X2X: - res = patch1x2xNativeAndSafeFirm(enableExceptionHandlers); + res = patch1x2xNativeAndSafeFirm(); break; }