kernel: Add missing funcs

This commit is contained in:
IndecisiveTurtle 2024-10-24 00:39:36 +03:00
parent ad8a2022ec
commit ef3341c78c
4 changed files with 16 additions and 3 deletions

View file

@ -16,6 +16,7 @@ void RegisterThreads(Core::Loader::SymbolsResolver* sym) {
RegisterThreadAttr(sym);
RegisterThread(sym);
RegisterRtld(sym);
RegisterPthreadClean(sym);
}
} // namespace Libraries::Kernel

View file

@ -432,6 +432,7 @@ void RegisterThread(Core::Loader::SymbolsResolver* sym) {
LIB_FUNCTION("EotR8a3ASf4", "libScePosix", 1, "libkernel", 1, 1, posix_pthread_self);
LIB_FUNCTION("B5GmVDKwpn0", "libScePosix", 1, "libkernel", 1, 1, posix_pthread_yield);
LIB_FUNCTION("+U1R4WtXvoc", "libScePosix", 1, "libkernel", 1, 1, posix_pthread_detach);
LIB_FUNCTION("FJrT5LuUBAU", "libScePosix", 1, "libkernel", 1, 1, posix_pthread_exit);
LIB_FUNCTION("h9CcP3J0oVM", "libScePosix", 1, "libkernel", 1, 1, posix_pthread_join);
LIB_FUNCTION("OxhIB8LB-PQ", "libScePosix", 1, "libkernel", 1, 1, posix_pthread_create);
LIB_FUNCTION("Jmi+9w9u0E4", "libScePosix", 1, "libkernel", 1, 1, posix_pthread_create_name_np);

View file

@ -327,5 +327,6 @@ void RegisterThreadAttr(Core::Loader::SymbolsResolver* sym);
void RegisterThread(Core::Loader::SymbolsResolver* sym);
void RegisterRtld(Core::Loader::SymbolsResolver* sym);
void RegisterKernelEventFlag(Core::Loader::SymbolsResolver* sym);
void RegisterPthreadClean(Core::Loader::SymbolsResolver* sym);
} // namespace Libraries::Kernel

View file

@ -2,15 +2,15 @@
// SPDX-License-Identifier: GPL-2.0-or-later
#include "core/libraries/kernel/threads/pthread.h"
#include "core/libraries/libs.h"
namespace Libraries::Kernel {
void __pthread_cleanup_push_imp(PthreadCleanupFunc routine, void* arg, PthreadCleanup* newbuf) {
Pthread* curthread = g_curthread;
void PS4_SYSV_ABI __pthread_cleanup_push_imp(PthreadCleanupFunc routine, void* arg, PthreadCleanup* newbuf) {
newbuf->routine = routine;
newbuf->routine_arg = arg;
newbuf->onheap = 0;
curthread->cleanup.push_front(newbuf);
g_curthread->cleanup.push_front(newbuf);
}
void PS4_SYSV_ABI posix_pthread_cleanup_push(PthreadCleanupFunc routine, void* arg) {
@ -40,4 +40,14 @@ void PS4_SYSV_ABI posix_pthread_cleanup_pop(int execute) {
}
}
void RegisterPthreadClean(Core::Loader::SymbolsResolver* sym) {
// Posix
LIB_FUNCTION("4ZeZWcMsAV0", "libScePosix", 1, "libkernel", 1, 1, posix_pthread_cleanup_push);
LIB_FUNCTION("RVxb0Ssa5t0", "libScePosix", 1, "libkernel", 1, 1, posix_pthread_cleanup_pop);
// Posix-Kernel
LIB_FUNCTION("1xvtUVx1-Sg", "libkernel", 1, "libkernel", 1, 1, __pthread_cleanup_push_imp);
LIB_FUNCTION("iWsFlYMf3Kw", "libkernel", 1, "libkernel", 1, 1, posix_pthread_cleanup_pop);
}
} // namespace Libraries::Kernel