From da9c31bbee0e3e1b4388af86f35f68dff9761973 Mon Sep 17 00:00:00 2001 From: Stephen Miller <56742918+StevenMiller123@users.noreply.github.com> Date: Sun, 8 Mar 2026 17:48:16 -0500 Subject: [PATCH 1/2] Fix for rebase --- src/core/libraries/sysmodule/sysmodule_internal.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/core/libraries/sysmodule/sysmodule_internal.cpp b/src/core/libraries/sysmodule/sysmodule_internal.cpp index 55acded94..49d0b7a2b 100644 --- a/src/core/libraries/sysmodule/sysmodule_internal.cpp +++ b/src/core/libraries/sysmodule/sysmodule_internal.cpp @@ -425,6 +425,12 @@ s32 preloadModulesForLibkernel() { continue; } + if (module_index == 1 || module_index == 2) { + // libkernel and libSceLibcInternal aren't directly loaded here. + // All we do for those is increment is_loaded + g_modules_array[module_index].is_loaded++; + } + // Load the actual module s32 result = loadModuleInternal(module_index, 0, nullptr, nullptr); if (result != ORBIS_OK) { From 23a4f918a371e798e66d98e2030b9cce9462e8fd Mon Sep 17 00:00:00 2001 From: Stephen Miller <56742918+StevenMiller123@users.noreply.github.com> Date: Sun, 8 Mar 2026 18:05:29 -0500 Subject: [PATCH 2/2] Some other fixups --- src/core/linker.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/core/linker.cpp b/src/core/linker.cpp index 449066a37..b1b1b684b 100644 --- a/src/core/linker.cpp +++ b/src/core/linker.cpp @@ -80,7 +80,7 @@ void Linker::Execute(const std::vector& args) { // libSceLibcInternal. libSceLibcInternal's _malloc_init serves as an additional initialization // function called by libkernel. heap_api = new HeapAPI{}; - static PS4_SYSV_ABI void (*malloc_init)() = nullptr; + static PS4_SYSV_ABI s32 (*malloc_init)() = nullptr; for (const auto& m : m_modules) { const auto& mod = m.get(); @@ -90,7 +90,7 @@ void Linker::Execute(const std::vector& args) { // and for all the memory allocating functions, so we can initialize our heap API for (const auto& sym : mod->export_sym.GetSymbols()) { if (sym.nid_name.compare("_malloc_init") == 0) { - malloc_init = reinterpret_cast(sym.virtual_address); + malloc_init = reinterpret_cast(sym.virtual_address); } if (sym.nid_name.compare("malloc") == 0) { heap_api->heap_malloc = @@ -184,7 +184,8 @@ void Linker::Execute(const std::vector& args) { if (malloc_init != nullptr) { // Call _malloc_init - malloc_init(); + s32 ret = malloc_init(); + ASSERT_MSG(ret == 0, "malloc_init failed"); } // Have libSceSysmodule preload our libraries.