revert the memory map to the old one (mostly)

This commit is contained in:
TuxSH 2020-05-18 22:15:34 +01:00
parent 905837468c
commit 704e08dc23
4 changed files with 9 additions and 7 deletions

View File

@ -139,8 +139,8 @@ u32 installK11Extension(u8 *pos, u32 size, bool needToInitSd, u32 baseK11VA, u32
static const u8 patternHook3_4[] = {0x00, 0x00, 0xA0, 0xE1, 0x03, 0xF0, 0x20, 0xE3, 0xFD, 0xFF, 0xFF, 0xEA}; //SGI0 setup code, etc.
//Our kernel11 extension is initially loaded in VRAM
//u32 kextTotalSize = *(u32 *)0x18000020 - K11EXT_VA;
u32 stolenSystemMemRegionSize = ISN3DS ? 0 : 0 << 10; // no need to steal any mem on N3DS. Currently, everything fits in BASE on O3DS too (?)
u32 kextTotalSize = *(u32 *)0x18000020 - K11EXT_VA;
u32 stolenSystemMemRegionSize = kextTotalSize; // no need to steal any more mem on N3DS. Currently, everything fits in BASE on O3DS too (?)
u32 dstKextPA = (ISN3DS ? 0x2E000000 : 0x26C00000) - stolenSystemMemRegionSize; // start of BASE memregion (note: linear heap ---> <--- the rest)
u32 *hookVeneers = (u32 *)*freeK11Space;

View File

@ -288,10 +288,7 @@ void main(FcramLayout *layout, KCoreContext *ctxs)
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;
@ -313,4 +310,8 @@ void main(FcramLayout *layout, KCoreContext *ctxs)
rosalinaState = 0;
hasStartedRosalinaNetworkFuncsOnce = false;
// DSB, Flush Prefetch Buffer (more or less "isb")
__asm__ __volatile__ ("mcr p15, 0, %0, c7, c10, 4" :: "r" (0) : "memory");
__asm__ __volatile__ ("mcr p15, 0, %0, c7, c5, 4" :: "r" (0) : "memory");
}

View File

@ -140,7 +140,7 @@ u32 Draw_AllocateFramebufferCache(void)
u32 remaining = (u32)osGetMemRegionFree(MEMREGION_SYSTEM);
u32 size = remaining < maxSize ? remaining : maxSize;
if (size < minSize || R_FAILED(svcControlMemory(&tmp, addr, 0, size, MEMOP_ALLOC, MEMPERM_READ | MEMPERM_WRITE)))
if (size < minSize || R_FAILED(svcControlMemoryEx(&tmp, addr, 0, size, MEMOP_ALLOC, MEMREGION_SYSTEM | MEMPERM_READ | MEMPERM_WRITE, true)))
{
framebufferCache = NULL;
framebufferCacheSize = 0;

View File

@ -12,6 +12,7 @@
#include <3ds/synchronization.h>
#include <3ds/result.h>
#include <string.h>
#include "csvc.h"
s32 miniSocRefCount = 0;
static u32 socContextAddr = 0x08000000;
@ -75,7 +76,7 @@ Result miniSocInit(void)
ret = srvGetServiceHandle(&miniSocHandle, "soc:U");
if(ret != 0) goto cleanup;
ret = svcControlMemory(&tmp, socContextAddr, 0, socContextSize, MEMOP_ALLOC, MEMPERM_READ | MEMPERM_WRITE);
ret = svcControlMemoryEx(&tmp, socContextAddr, 0, socContextSize, MEMOP_ALLOC, MEMREGION_SYSTEM | MEMPERM_READ | MEMPERM_WRITE, true);
if(ret != 0) goto cleanup;
socContextAddr = tmp;