Fix developer-branch-exclusive patches
This commit is contained in:
parent
f85bbfff58
commit
6a280723f8
@ -212,7 +212,12 @@ void main(void)
|
||||
|
||||
loadFirm(firmType, !firmType && updatedSys == !firmSource);
|
||||
|
||||
patchExceptionHandlersInstall((u8 *)firm + section[2].offset, section[2].size);
|
||||
if(DEVMODE)
|
||||
{
|
||||
u32 arm9SectionNum = 0;
|
||||
for(; (u32)(section[arm9SectionNum].address) >> 24 != 0x08 && arm9SectionNum < 4; arm9SectionNum++);
|
||||
patchExceptionHandlersInstall((u8 *)firm + section[arm9SectionNum].offset, section[arm9SectionNum].size);
|
||||
}
|
||||
|
||||
switch(firmType)
|
||||
{
|
||||
|
@ -81,9 +81,16 @@ void patchFirmWriteSafe(u8 *pos, u32 size)
|
||||
|
||||
void patchExceptionHandlersInstall(u8 *pos, u32 size)
|
||||
{
|
||||
const u8 pattern[] = {0x50, 0x50, 0x9F, 0xE5};
|
||||
|
||||
u32 *off = (u32 *)memsearch(pos, pattern, size, 4) - 1;
|
||||
const u8 pattern[] = {
|
||||
0x18, 0x10, 0x80, 0xE5,
|
||||
0x10, 0x10, 0x80, 0xE5,
|
||||
0x20, 0x10, 0x80, 0xE5,
|
||||
0x28, 0x10, 0x80, 0xE5,
|
||||
}; //i.e when it stores ldr pc, [pc, #-4]
|
||||
|
||||
u32* off = (u32 *)(memsearch(pos, pattern, size, sizeof(pattern)));
|
||||
if(off == NULL) return;
|
||||
off += sizeof(pattern)/4;
|
||||
|
||||
u32 r0 = 0x08000000;
|
||||
|
||||
@ -121,11 +128,12 @@ void patchUnitInfoValueSet(u8 *pos, u32 size)
|
||||
void patchKernelFCRAMAndVRAMMappingPermissions(u8 *pos, u32 size)
|
||||
{
|
||||
//Look for MMU config
|
||||
const u8 pattern[] = {0xC4, 0xDD, 0xFA, 0x1F};
|
||||
const u8 pattern[] = {0x97, 0x05, 0x00, 0x00, 0x15, 0xE4, 0x00, 0x00};
|
||||
|
||||
u32* off = (u32 *)memsearch(pos, pattern, size, 4);
|
||||
u32 *off = (u32 *)memsearch(pos, pattern, size, 8);
|
||||
while(off != NULL && *off != 0x16416) off--;
|
||||
|
||||
if(off != NULL) off[1] &= ~(1 << 4); //Clear XN bit
|
||||
if(off != NULL) *off &= ~(1 << 4); //Clear XN bit
|
||||
}
|
||||
|
||||
void reimplementSvcBackdoor(u8 *pos, u32 size)
|
||||
|
Reference in New Issue
Block a user