diff --git a/arm9/source/patches.c b/arm9/source/patches.c index 3b308f2..a22e85c 100644 --- a/arm9/source/patches.c +++ b/arm9/source/patches.c @@ -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; diff --git a/k11_extension/source/main.c b/k11_extension/source/main.c index d6f466f..0048189 100644 --- a/k11_extension/source/main.c +++ b/k11_extension/source/main.c @@ -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"); } diff --git a/sysmodules/rosalina/source/draw.c b/sysmodules/rosalina/source/draw.c index 06ba87b..38958a2 100644 --- a/sysmodules/rosalina/source/draw.c +++ b/sysmodules/rosalina/source/draw.c @@ -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; diff --git a/sysmodules/rosalina/source/minisoc.c b/sysmodules/rosalina/source/minisoc.c index e9d3d20..d52d48c 100644 --- a/sysmodules/rosalina/source/minisoc.c +++ b/sysmodules/rosalina/source/minisoc.c @@ -12,6 +12,7 @@ #include <3ds/synchronization.h> #include <3ds/result.h> #include +#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;