mirror of
https://github.com/KytyPS5/KytyPS5.git
synced 2026-10-22 03:46:53 +02:00
libs: simplify ABI registration facades
This commit is contained in:
+15
-19
@@ -512,10 +512,6 @@ bool KernelIsDispatchingSignalOnCurrentThread() {
|
||||
return g_dispatching_signal_handler;
|
||||
}
|
||||
|
||||
static void QueuePendingSignal(Pthread thread, int signum) {
|
||||
PthreadQueuePendingSignal(thread, signum);
|
||||
}
|
||||
|
||||
#if KYTY_PLATFORM != KYTY_PLATFORM_WINDOWS
|
||||
static void WaitForSignalDispatch(Pthread thread, int signum) {
|
||||
constexpr auto DISPATCH_WAIT_STEP = std::chrono::microseconds(1000);
|
||||
@@ -529,10 +525,6 @@ static void WaitForSignalDispatch(Pthread thread, int signum) {
|
||||
}
|
||||
#endif
|
||||
|
||||
static bool TakePendingSignal(Pthread thread, int signum) {
|
||||
return PthreadTakePendingSignal(thread, signum);
|
||||
}
|
||||
|
||||
struct SignalMcontext {
|
||||
uint64_t mc_onstack;
|
||||
uint64_t mc_rdi;
|
||||
@@ -985,7 +977,7 @@ static void HostSignalDispatchHandler(int /*host_signal*/, siginfo_t* /*info*/,
|
||||
auto* host_ctx = static_cast<ucontext_t*>(native_context);
|
||||
|
||||
for (int signum = 0; signum < static_cast<int>(std::size(g_exception_handlers)); signum++) {
|
||||
if (!TakePendingSignal(current, signum)) {
|
||||
if (!PthreadTakePendingSignal(current, signum)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -1046,7 +1038,7 @@ static NtQueueApcThreadExFunc GetNtQueueApcThreadEx() {
|
||||
static void SignalApcHandler(void* arg1, void* arg2, void* /*arg3*/, PCONTEXT context) {
|
||||
auto* thread = static_cast<Pthread>(arg1);
|
||||
const auto signum = static_cast<int>(reinterpret_cast<intptr_t>(arg2));
|
||||
if (!TakePendingSignal(thread, signum)) {
|
||||
if (!PthreadTakePendingSignal(thread, signum)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1081,7 +1073,7 @@ void KernelDispatchPendingSignalForCurrentThread() {
|
||||
}
|
||||
|
||||
for (int signum = 0; signum < static_cast<int>(std::size(g_exception_handlers)); signum++) {
|
||||
if (!TakePendingSignal(current, signum)) {
|
||||
if (!PthreadTakePendingSignal(current, signum)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -1159,7 +1151,7 @@ static int KYTY_SYSV_ABI KernelRaiseException(Pthread thread, int signum) {
|
||||
return KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
|
||||
QueuePendingSignal(thread, signum);
|
||||
PthreadQueuePendingSignal(thread, signum);
|
||||
KytyUserApcOption option {};
|
||||
option.UserApcFlags = KytyQueueUserApcFlagsSpecialUserApc;
|
||||
|
||||
@@ -1168,7 +1160,7 @@ static int KYTY_SYSV_ABI KernelRaiseException(Pthread thread, int signum) {
|
||||
reinterpret_cast<void*>(static_cast<intptr_t>(signum)), nullptr);
|
||||
|
||||
if (status != 0) {
|
||||
TakePendingSignal(thread, signum);
|
||||
PthreadTakePendingSignal(thread, signum);
|
||||
CloseHandle(target_thread);
|
||||
LOGF("\t NtQueueApcThreadEx failed: target_os_thread=%" PRIu64 ", status=0x%016" PRIx64
|
||||
"\n",
|
||||
@@ -1194,9 +1186,9 @@ static int KYTY_SYSV_ABI KernelRaiseException(Pthread thread, int signum) {
|
||||
return KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
|
||||
QueuePendingSignal(thread, signum);
|
||||
PthreadQueuePendingSignal(thread, signum);
|
||||
if (!PthreadKillHost(thread, SignalDispatchHostSignal())) {
|
||||
TakePendingSignal(thread, signum);
|
||||
PthreadTakePendingSignal(thread, signum);
|
||||
LOGF("\t pthread_kill failed for target thread\n");
|
||||
return KERNEL_ERROR_EINVAL;
|
||||
}
|
||||
@@ -3028,9 +3020,9 @@ namespace EventQueue = LibKernel::EventQueue;
|
||||
namespace EventFlag = LibKernel::EventFlag;
|
||||
namespace Semaphore = LibKernel::Semaphore;
|
||||
|
||||
LIB_DEFINE(InitFiber_1) {
|
||||
LIB_USING(Fiber);
|
||||
namespace Fiber {
|
||||
|
||||
LIB_DEFINE(InitFiber_1) {
|
||||
LIB_FUNC("hVYD7Ou2pCQ", Fiber::FiberInitialize);
|
||||
LIB_FUNC("7+OJIpko9RY", Fiber::FiberInitializeInternal);
|
||||
LIB_FUNC("asjUJJ+aa8s", Fiber::FiberOptParamInitialize);
|
||||
@@ -3048,13 +3040,17 @@ LIB_DEFINE(InitFiber_1) {
|
||||
LIB_FUNC("0dy4JtMUcMQ", Fiber::FiberGetThreadFramePointerAddress);
|
||||
}
|
||||
|
||||
LIB_DEFINE(InitCoredump_1) {
|
||||
LIB_USING(Coredump);
|
||||
} // namespace Fiber
|
||||
|
||||
namespace Coredump {
|
||||
|
||||
LIB_DEFINE(InitCoredump_1) {
|
||||
LIB_FUNC("8zLSfEfW5AU", Coredump::sceCoredumpRegisterCoredumpHandler);
|
||||
LIB_FUNC("fFkhOgztiCA", Coredump::sceCoredumpUnregisterCoredumpHandler);
|
||||
}
|
||||
|
||||
} // namespace Coredump
|
||||
|
||||
LIB_DEFINE(InitLibKernel_1_FS) {
|
||||
LIB_FUNC("1G3lF1Gg1k8", FileSystem::KernelOpen);
|
||||
LIB_FUNC("UK2Tl2DWUns", FileSystem::KernelClose);
|
||||
|
||||
Reference in New Issue
Block a user