diff --git a/arm11/linker.specs b/arm11/linker.specs index 3009904..9dbe4ff 100644 --- a/arm11/linker.specs +++ b/arm11/linker.specs @@ -1,7 +1,7 @@ %rename link old_link *link: -%(old_link) -T %:getenv(TOPDIR /linker.ld) --nmagic --gc-sections +%(old_link) -T %:getenv(TOPDIR /linker.ld) --nmagic --gc-sections --no-warn-rwx-segments *startfile: crti%O%s crtbegin%O%s diff --git a/arm9/linker.specs b/arm9/linker.specs index 3009904..9dbe4ff 100644 --- a/arm9/linker.specs +++ b/arm9/linker.specs @@ -1,7 +1,7 @@ %rename link old_link *link: -%(old_link) -T %:getenv(TOPDIR /linker.ld) --nmagic --gc-sections +%(old_link) -T %:getenv(TOPDIR /linker.ld) --nmagic --gc-sections --no-warn-rwx-segments *startfile: crti%O%s crtbegin%O%s diff --git a/arm9/source/patches.c b/arm9/source/patches.c index 9a0fb75..e4c3799 100644 --- a/arm9/source/patches.c +++ b/arm9/source/patches.c @@ -271,6 +271,23 @@ u32 patchKernel11(u8 *pos, u32 size, u32 baseK11VA, u32 *arm11SvcTable, u32 *arm off[-5] = 0xE51FF004; off[-4] = K11EXT_VA + 0x2C; + if (ISN3DS) + { + // Patch SvcSetProcessIdealProcessor and SvcCreate thread to always allow + // for core2 and core3 to be used. Normally, processes with the 0x2000 kernel flag + // have access to core2, and BASE processes have access to both core2 and core3. + // We're patching the if (memory region == BASE) check to be always true. + off = (u32 *)pos; + for (u32 i = 0; i < 2 && (u8 *)off < pos + size; i++) + { + // cmp r2, #0x300; beq... + for (; (off[0] != 0xE3520C03 || off[1] != 0x0A000003) && (u8 *)off < pos + size; off++); + if ((u8 *)off > pos + size) + return 1; + off[1] = 0xEA000003; + } + } + return 0; } @@ -581,7 +598,7 @@ u32 patchP9AMTicketWrapperZeroKeyIV(u8 *pos, u32 size, u32 firmVersion) //Beyond limit if(opjumpdistance < -0x1fffff || opjumpdistance > 0x1fffff) return 1; - //r0 and r1 for old call are already correct for this one + //r0 and r1 for old call are already correct for this one //BLX __rt_memclr u32 op = (0xE800F000U | (((u32)opjumpdistance & 0x7FF) << 16) | (((u32)opjumpdistance >> 11) & 0x3FF) | (((u32)opjumpdistance >> 21) & 0x400)) & ~(1<<16); diff --git a/k11_extension/linker.specs b/k11_extension/linker.specs index 3009904..9dbe4ff 100644 --- a/k11_extension/linker.specs +++ b/k11_extension/linker.specs @@ -1,7 +1,7 @@ %rename link old_link *link: -%(old_link) -T %:getenv(TOPDIR /linker.ld) --nmagic --gc-sections +%(old_link) -T %:getenv(TOPDIR /linker.ld) --nmagic --gc-sections --no-warn-rwx-segments *startfile: crti%O%s crtbegin%O%s