so bascially rosalina's image...

was in BASE (hardcoded by kernel) while its heaps were in SYSTEM. Fix this; also put the kext where BASE was.
This commit is contained in:
TuxSH
2020-05-18 01:15:44 +01:00
parent b02d0346fd
commit adda19ecb2
11 changed files with 47 additions and 14 deletions

View File

@@ -133,6 +133,7 @@ typedef struct CfwInfo
extern CfwInfo cfwInfo;
extern u32 kextBasePa;
extern u32 stolenSystemMemRegionSize;
extern vu32 rosalinaState;
extern bool hasStartedRosalinaNetworkFuncsOnce;

View File

@@ -1126,11 +1126,11 @@ typedef union KCacheMaintenanceInterruptEvent
typedef struct FcramLayout
{
void *applicationAddr;
u32 applicationAddr;
u32 applicationSize;
void *systemAddr;
u32 systemAddr;
u32 systemSize;
void *baseAddr;
u32 baseAddr;
u32 baseSize;
} FcramLayout;

View File

@@ -109,6 +109,7 @@ void (*coreBarrier)(void);
CfwInfo cfwInfo;
u32 kextBasePa;
u32 stolenSystemMemRegionSize;
vu32 rosalinaState;
bool hasStartedRosalinaNetworkFuncsOnce;

View File

@@ -37,6 +37,7 @@
struct KExtParameters
{
u32 basePA;
u32 stolenSystemMemRegionSize;
void *originalHandlers[4];
u32 L1MMUTableAddrs[4];
@@ -261,7 +262,14 @@ void main(FcramLayout *layout, KCoreContext *ctxs)
u32 TTBCR_;
s64 nb;
layout->systemSize -= __end__ - __start__;
cfwInfo = p->cfwInfo;
kextBasePa = p->basePA;
stolenSystemMemRegionSize = p->stolenSystemMemRegionSize;
u32 kextSize = (u32)(__end__ - __start__);
layout->systemSize -= stolenSystemMemRegionSize;
layout->baseAddr = layout->baseAddr - stolenSystemMemRegionSize + kextSize;
layout->baseSize = layout->baseSize + stolenSystemMemRegionSize - kextSize;
fcramLayout = *layout;
coreCtxs = ctxs;
@@ -270,8 +278,6 @@ void main(FcramLayout *layout, KCoreContext *ctxs)
isN3DS = getNumberOfCores() == 4;
memcpy(L1MMUTableAddrs, (const void *)p->L1MMUTableAddrs, 16);
exceptionStackTop = (u32 *)0xFFFF2000 + (1 << (32 - TTBCR - 20));
cfwInfo = p->cfwInfo;
kextBasePa = p->basePA;
memcpy(originalHandlers + 1, p->originalHandlers, 16);
void **arm11SvcTable = (void**)originalHandlers[2];

View File

@@ -82,6 +82,10 @@ Result GetSystemInfoHook(s64 *out, s32 type, s32 param)
*out = (s64)(((u64)kextBasePa << 32) | (u64)(__end__ - __start__));
break;
case 0x301: // stolen SYSTEM memory size
*out = stolenSystemMemRegionSize;
break;
default:
*out = 0;
res = 0xF8C007F4; // not implemented