diff --git a/source/firm.c b/source/firm.c index a2aaade..b6bab08 100755 --- a/source/firm.c +++ b/source/firm.c @@ -293,7 +293,7 @@ static inline void loadFirm(u32 firmType, u32 externalFirm) } } -static inline void patchKernelFCRAMAndVRAMMappingPermissions(u8* arm11Section1) +static inline void patchKernelFCRAMAndVRAMMappingPermissions(void) { static const u8 MMUConfigPattern[] = { 0xC4, 0xDD, 0xFA, 0x1F, @@ -302,6 +302,8 @@ static inline void patchKernelFCRAMAndVRAMMappingPermissions(u8* arm11Section1) 0x00, 0x50, 0xFF, 0x1F }; + u8 *arm11Section1 = (u8 *)firm + section[1].offset; + u32* off = (u32 *)memsearch(arm11Section1, MMUConfigPattern, section[1].size, sizeof(MMUConfigPattern)); if(off != NULL) off[1] &= ~(1 << 4); //clear XN bit } @@ -373,7 +375,7 @@ static inline void patchNativeFirm(u32 nandType, u32 emuHeader, u32 a9lhMode) *unitInfoOffset = unitInfoPatch; //Make FCRAM (and VRAM as a side effect) globally executable from arm11 kernel - patchKernelFCRAMAndVRAMMappingPermissions(arm11Section1); + patchKernelFCRAMAndVRAMMappingPermissions(); } //Replace the FIRM loader with the injector while copying section0 copySection0AndInjectLoader(); diff --git a/source/firm.h b/source/firm.h index a4e567f..2e4cee2 100644 --- a/source/firm.h +++ b/source/firm.h @@ -38,6 +38,7 @@ typedef struct patchData { } patchData; static inline void loadFirm(u32 firmType, u32 externalFirm); +static inline void patchKernelFCRAMAndVRAMMappingPermissions(void); static inline void patchNativeFirm(u32 nandType, u32 emuHeader, u32 a9lhMode); static inline void patchEmuNAND(u8 *arm9Section, u8 *process9Offset, u32 process9Size, u32 emuHeader); static inline void patchReboots(u8 *process9Offset, u32 process9Size, u32 process9MemAddr);