Adjust config mem values
This commit is contained in:
parent
2ab41dbd01
commit
19d68b6df4
@ -94,8 +94,13 @@ extern bool *isDevUnit;
|
|||||||
|
|
||||||
extern vu8 *configPage;
|
extern vu8 *configPage;
|
||||||
extern u32 kernelVersion;
|
extern u32 kernelVersion;
|
||||||
|
extern FcramLayout fcramLayout;
|
||||||
|
|
||||||
|
extern void *originalHandlers[8];
|
||||||
extern u32 nbSection0Modules;
|
extern u32 nbSection0Modules;
|
||||||
|
|
||||||
|
extern u8 __start__[], __end__[], __bss_start__[], __bss_end__[];
|
||||||
|
|
||||||
extern Result (*InterruptManager__MapInterrupt)(InterruptManager *manager, KBaseInterruptEvent *iEvent, u32 interruptID,
|
extern Result (*InterruptManager__MapInterrupt)(InterruptManager *manager, KBaseInterruptEvent *iEvent, u32 interruptID,
|
||||||
u32 coreID, u32 priority, bool disableUponReceipt, bool levelHighActive);
|
u32 coreID, u32 priority, bool disableUponReceipt, bool levelHighActive);
|
||||||
extern InterruptManager *interruptManager;
|
extern InterruptManager *interruptManager;
|
||||||
|
@ -1123,6 +1123,16 @@ typedef union KCacheMaintenanceInterruptEvent
|
|||||||
KCacheMaintenanceInterruptEventO3DS O3DS;
|
KCacheMaintenanceInterruptEventO3DS O3DS;
|
||||||
} KCacheMaintenanceInterruptEvent;
|
} KCacheMaintenanceInterruptEvent;
|
||||||
|
|
||||||
|
typedef struct FcramLayout
|
||||||
|
{
|
||||||
|
void *applicationAddr;
|
||||||
|
u32 applicationSize;
|
||||||
|
void *systemAddr;
|
||||||
|
u32 systemSize;
|
||||||
|
void *baseAddr;
|
||||||
|
u32 baseSize;
|
||||||
|
} FcramLayout;
|
||||||
|
|
||||||
extern bool isN3DS;
|
extern bool isN3DS;
|
||||||
extern void *officialSVCs[0x7E];
|
extern void *officialSVCs[0x7E];
|
||||||
|
|
||||||
|
@ -90,6 +90,10 @@ bool *isDevUnit;
|
|||||||
|
|
||||||
vu8 *configPage;
|
vu8 *configPage;
|
||||||
u32 kernelVersion;
|
u32 kernelVersion;
|
||||||
|
FcramLayout fcramLayout;
|
||||||
|
|
||||||
|
void *originalHandlers[8] = {NULL};
|
||||||
|
|
||||||
u32 nbSection0Modules;
|
u32 nbSection0Modules;
|
||||||
|
|
||||||
Result (*InterruptManager__MapInterrupt)(InterruptManager *manager, KBaseInterruptEvent *iEvent, u32 interruptID,
|
Result (*InterruptManager__MapInterrupt)(InterruptManager *manager, KBaseInterruptEvent *iEvent, u32 interruptID,
|
||||||
|
@ -33,10 +33,6 @@
|
|||||||
#include "svcHandler.h"
|
#include "svcHandler.h"
|
||||||
#include "memory.h"
|
#include "memory.h"
|
||||||
|
|
||||||
void *originalHandlers[8] = {NULL};
|
|
||||||
|
|
||||||
extern u8 __start__[], __end__[], __bss_start__[], __bss_end__[];
|
|
||||||
|
|
||||||
struct KExtParameters
|
struct KExtParameters
|
||||||
{
|
{
|
||||||
u32 ALIGN(0x400) L2MMUTableFor0x40000000[256];
|
u32 ALIGN(0x400) L2MMUTableFor0x40000000[256];
|
||||||
@ -94,6 +90,9 @@ void configHook(vu8 *cfgPage)
|
|||||||
configPage = cfgPage;
|
configPage = cfgPage;
|
||||||
|
|
||||||
kernelVersion = *(vu32 *)configPage;
|
kernelVersion = *(vu32 *)configPage;
|
||||||
|
*(vu32 *)(configPage + 0x40) = fcramLayout.applicationSize;
|
||||||
|
*(vu32 *)(configPage + 0x44) = fcramLayout.systemSize;
|
||||||
|
*(vu32 *)(configPage + 0x48) = fcramLayout.baseSize;
|
||||||
*isDevUnit = true; // enable debug features
|
*isDevUnit = true; // enable debug features
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -248,12 +247,15 @@ static void findUsefulSymbols(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void main(void)
|
void main(FcramLayout *layout)
|
||||||
{
|
{
|
||||||
struct KExtParameters *p = &kExtParameters;
|
struct KExtParameters *p = &kExtParameters;
|
||||||
u32 TTBCR_;
|
u32 TTBCR_;
|
||||||
s64 nb;
|
s64 nb;
|
||||||
|
|
||||||
|
layout->systemSize -= __end__ - __start__;
|
||||||
|
fcramLayout = *layout;
|
||||||
|
|
||||||
__asm__ volatile("mrc p15, 0, %0, c2, c0, 2" : "=r"(TTBCR_));
|
__asm__ volatile("mrc p15, 0, %0, c2, c0, 2" : "=r"(TTBCR_));
|
||||||
TTBCR = TTBCR_;
|
TTBCR = TTBCR_;
|
||||||
isN3DS = getNumberOfCores() == 4;
|
isN3DS = getNumberOfCores() == 4;
|
||||||
|
@ -49,15 +49,7 @@ start:
|
|||||||
|
|
||||||
push {r0-r12, lr}
|
push {r0-r12, lr}
|
||||||
|
|
||||||
@ Adjust the size of the SYSTEM memregion
|
sub r0, r4, #8
|
||||||
sub r4, #8
|
|
||||||
ldr r0, [r4, #0xC]
|
|
||||||
ldr r1, =__end__
|
|
||||||
ldr r2, =__start__
|
|
||||||
sub r1, r2
|
|
||||||
sub r0, r1
|
|
||||||
str r0, [r4, #0xC]
|
|
||||||
|
|
||||||
bl main
|
bl main
|
||||||
|
|
||||||
pop {r0-r12, pc}
|
pop {r0-r12, pc}
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
* reasonable ways as different from the original version.
|
* reasonable ways as different from the original version.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "memory.h"
|
||||||
#include "svc.h"
|
#include "svc.h"
|
||||||
#include "svc/ControlMemory.h"
|
#include "svc/ControlMemory.h"
|
||||||
#include "svc/GetProcessInfo.h"
|
#include "svc/GetProcessInfo.h"
|
||||||
@ -87,6 +88,8 @@ void signalSvcReturn(u8 *pageEnd)
|
|||||||
SignalDebugEvent(DBGEVENT_OUTPUT_STRING, 0xFFFFFFFF, svcId);
|
SignalDebugEvent(DBGEVENT_OUTPUT_STRING, 0xFFFFFFFF, svcId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool doingVeryShittyPmResLimitWorkaround = false; // I feel dirty
|
||||||
|
|
||||||
void *svcHook(u8 *pageEnd)
|
void *svcHook(u8 *pageEnd)
|
||||||
{
|
{
|
||||||
KProcess *currentProcess = currentCoreContext->objectContext.currentProcess;
|
KProcess *currentProcess = currentCoreContext->objectContext.currentProcess;
|
||||||
@ -98,6 +101,13 @@ void *svcHook(u8 *pageEnd)
|
|||||||
{
|
{
|
||||||
case 0x01:
|
case 0x01:
|
||||||
return ControlMemoryHookWrapper;
|
return ControlMemoryHookWrapper;
|
||||||
|
case 0x17:
|
||||||
|
if(strcmp(codeSetOfProcess(currentProcess)->processName, "pm") == 0) // only called twice in pm, by the same function
|
||||||
|
{
|
||||||
|
*(vu32 *)(configPage + 0x44) += __end__ - __start__;
|
||||||
|
doingVeryShittyPmResLimitWorkaround = true;
|
||||||
|
}
|
||||||
|
return officialSVCs[0x17];
|
||||||
case 0x2A:
|
case 0x2A:
|
||||||
return GetSystemInfoHookWrapper;
|
return GetSystemInfoHookWrapper;
|
||||||
case 0x2B:
|
case 0x2B:
|
||||||
@ -116,6 +126,13 @@ void *svcHook(u8 *pageEnd)
|
|||||||
return SetGpuProt;
|
return SetGpuProt;
|
||||||
case 0x5A:
|
case 0x5A:
|
||||||
return SetWifiEnabled;
|
return SetWifiEnabled;
|
||||||
|
case 0x79:
|
||||||
|
if(doingVeryShittyPmResLimitWorkaround)
|
||||||
|
{
|
||||||
|
*(vu32 *)(configPage + 0x44) -= __end__ - __start__;
|
||||||
|
doingVeryShittyPmResLimitWorkaround = false;
|
||||||
|
}
|
||||||
|
return officialSVCs[0x79];
|
||||||
case 0x7B:
|
case 0x7B:
|
||||||
return Backdoor;
|
return Backdoor;
|
||||||
case 0x7C:
|
case 0x7C:
|
||||||
|
Reference in New Issue
Block a user