From 86d1bde8458a239cd10571c235400b74f3920904 Mon Sep 17 00:00:00 2001 From: wheremyfoodat <44909372+wheremyfoodat@users.noreply.github.com> Date: Sun, 2 Feb 2025 23:18:54 +0200 Subject: [PATCH 1/2] Temporarily give 80MB to all processes (#715) --- include/kernel/kernel.hpp | 1 + include/kernel/resource_limits.hpp | 4 ++-- include/memory.hpp | 2 +- src/core/kernel/memory_management.cpp | 10 +++++++++- src/core/services/apt.cpp | 2 +- 5 files changed, 14 insertions(+), 5 deletions(-) diff --git a/include/kernel/kernel.hpp b/include/kernel/kernel.hpp index 45085e15..3f20b5e1 100644 --- a/include/kernel/kernel.hpp +++ b/include/kernel/kernel.hpp @@ -253,4 +253,5 @@ public: void sendGPUInterrupt(GPUInterrupt type) { serviceManager.sendGPUInterrupt(type); } void clearInstructionCache(); void clearInstructionCacheRange(u32 start, u32 size); + u32 getSharedFontVaddr(); }; \ No newline at end of file diff --git a/include/kernel/resource_limits.hpp b/include/kernel/resource_limits.hpp index 85f1a59b..fe1154ff 100644 --- a/include/kernel/resource_limits.hpp +++ b/include/kernel/resource_limits.hpp @@ -19,7 +19,7 @@ struct ResourceLimitValues { // APPLICATION resource limit static constexpr ResourceLimitValues appResourceLimits = { .maxPriority = 0x18, - .maxCommit = 0x4000000, + .maxCommit = 64_MB + 16_MB, // We're currently giving 80MB to all apps. TODO: Implement extended memory properly .maxThreads = 0x20, .maxEvents = 0x20, .maxMutexes = 0x20, @@ -33,7 +33,7 @@ static constexpr ResourceLimitValues appResourceLimits = { // SYS_APPLET resource limit static constexpr ResourceLimitValues sysAppletResourceLimits = { .maxPriority = 0x4, - .maxCommit = 0x5E00000, + .maxCommit = 0x5E00000 - 16_MB, .maxThreads = 0x1D, .maxEvents = 0xB, .maxMutexes = 0x8, diff --git a/include/memory.hpp b/include/memory.hpp index bd002c54..b1dd09de 100644 --- a/include/memory.hpp +++ b/include/memory.hpp @@ -132,7 +132,7 @@ public: static constexpr u32 totalPageCount = 1 << (32 - pageShift); static constexpr u32 FCRAM_SIZE = u32(128_MB); - static constexpr u32 FCRAM_APPLICATION_SIZE = u32(64_MB); + static constexpr u32 FCRAM_APPLICATION_SIZE = u32(80_MB); static constexpr u32 FCRAM_PAGE_COUNT = FCRAM_SIZE / pageSize; static constexpr u32 FCRAM_APPLICATION_PAGE_COUNT = FCRAM_APPLICATION_SIZE / pageSize; diff --git a/src/core/kernel/memory_management.cpp b/src/core/kernel/memory_management.cpp index 26f50023..18038d2e 100644 --- a/src/core/kernel/memory_management.cpp +++ b/src/core/kernel/memory_management.cpp @@ -122,7 +122,10 @@ void Kernel::mapMemoryBlock() { } if (KernelHandles::isSharedMemHandle(block)) { - if (block == KernelHandles::FontSharedMemHandle && addr == 0) addr = 0x18000000; + if (block == KernelHandles::FontSharedMemHandle && addr == 0) { + addr = getSharedFontVaddr(); + } + u8* ptr = mem.mapSharedMemory(block, addr, myPerms, otherPerms); // Map shared memory block // Pass pointer to shared memory to the appropriate service @@ -216,3 +219,8 @@ void Kernel::unmapMemoryBlock() { Helpers::warn("Stubbed svcUnmapMemoryBlock!"); regs[0] = Result::Success; } + +u32 Kernel::getSharedFontVaddr() { + // Place shared font at the very beginning of system FCRAM + return mem.getLinearHeapVaddr() + Memory::FCRAM_APPLICATION_SIZE; +} \ No newline at end of file diff --git a/src/core/services/apt.cpp b/src/core/services/apt.cpp index ddeb18de..b1e1d460 100644 --- a/src/core/services/apt.cpp +++ b/src/core/services/apt.cpp @@ -391,7 +391,7 @@ void APTService::setScreencapPostPermission(u32 messagePointer) { void APTService::getSharedFont(u32 messagePointer) { log("APT::GetSharedFont\n"); - constexpr u32 fontVaddr = 0x18000000; + const u32 fontVaddr = kernel.getSharedFontVaddr(); mem.write32(messagePointer, IPC::responseHeader(0x44, 2, 2)); mem.write32(messagePointer + 4, Result::Success); mem.write32(messagePointer + 8, fontVaddr); From 4cb66217c21325c9f5ead231d4ea52d78ffd7fed Mon Sep 17 00:00:00 2001 From: wheremyfoodat <44909372+wheremyfoodat@users.noreply.github.com> Date: Sat, 8 Feb 2025 15:32:04 +0200 Subject: [PATCH 2/2] Try to cross-compile Libretro core for arm64 (#717) * Try to cross-compile Libretro core for arm64 * Bonk * Update Hydra_Build.yml --- .github/workflows/Hydra_Build.yml | 33 +++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/.github/workflows/Hydra_Build.yml b/.github/workflows/Hydra_Build.yml index df851b69..e040a1f8 100644 --- a/.github/workflows/Hydra_Build.yml +++ b/.github/workflows/Hydra_Build.yml @@ -180,3 +180,36 @@ jobs: with: name: Android Hydra core path: '${{github.workspace}}/build/libAlber.so' + + ARM-Libretro: + runs-on: ubuntu-24.04-arm + + steps: + - uses: actions/checkout@v4 + - name: Fetch submodules + run: git submodule update --init --recursive + + - name: Install misc packages + run: | + sudo apt-get update && sudo apt install libx11-dev libxext-dev libgl1 libglx-mesa0 mesa-common-dev libfuse2 libwayland-dev + + - name: Install newer Clang + run: | + wget https://apt.llvm.org/llvm.sh + chmod +x ./llvm.sh + sudo ./llvm.sh 17 + + - name: Configure CMake + run: | + cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_C_COMPILER=clang-17 -DCMAKE_CXX_COMPILER=clang++-17 -DENABLE_USER_BUILD=ON -DBUILD_LIBRETRO_CORE=ON -DENABLE_VULKAN=OFF -DCRYPTOPP_OPT_DISABLE_ASM=ON + + - name: Build + run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} + + - name: Upload Libretro core + uses: actions/upload-artifact@v4 + with: + name: Linux arm64 Libretro core + path: | + ${{github.workspace}}/build/panda3ds_libretro.so + ${{github.workspace}}/docs/libretro/panda3ds_libretro.info