mirror of
https://github.com/KytyPS5/KytyPS5.git
synced 2026-10-29 08:41:20 +00:00
kernel: memory mapping, event flags and condvar fixes
- Event flags gain a zero-timeout polling path, which this title uses heavily, and map their results to the right errno. - Memory mapping, address-space and file-system corrections its startup path depends on. - pthread condvar waits dispatch pending signals while waiting.
This commit is contained in:
1 parent
ed44795511
commit
0551010010
6 files changed
+312
-9
No files matched your search
+11
-2
@@ -2855,11 +2855,11 @@ int KYTY_SYSV_ABI PthreadCondBroadcast(PthreadCond* cond) {
|
||||
bool notify = false;
|
||||
{
|
||||
std::lock_guard lock((*cond)->m);
|
||||
(*cond)->sequence++;
|
||||
if (!(*cond)->waiters.empty()) {
|
||||
(*cond)->sequence++;
|
||||
CondClearWaiters(*cond);
|
||||
notify = true;
|
||||
}
|
||||
notify = true;
|
||||
}
|
||||
if (notify) {
|
||||
(*cond)->cv.notify_all();
|
||||
@@ -3179,6 +3179,9 @@ int KYTY_SYSV_ABI PthreadCondTimedwaitAbs(PthreadCond* cond, PthreadMutex* mutex
|
||||
}
|
||||
}
|
||||
|
||||
thread_local uint64_t g_guest_wait_caller = 0;
|
||||
thread_local uint64_t g_guest_wait_r13 = 0;
|
||||
|
||||
int KYTY_SYSV_ABI PthreadCondWait(PthreadCond* cond, PthreadMutex* mutex) {
|
||||
PRINT_NAME();
|
||||
|
||||
@@ -3373,6 +3376,8 @@ static void* RunThread(void* arg) {
|
||||
thread->unique_id = Common::Thread::GetThreadIdUnique();
|
||||
|
||||
g_pthread_self = thread;
|
||||
#if KYTY_PLATFORM == KYTY_PLATFORM_WINDOWS
|
||||
#endif
|
||||
|
||||
uint64_t os_thread_id = 0;
|
||||
#if KYTY_PLATFORM == KYTY_PLATFORM_WINDOWS
|
||||
@@ -4445,6 +4450,10 @@ int KYTY_SYSV_ABI pthread_condattr_destroy(LibKernel::PthreadCondattr* attr) {
|
||||
int KYTY_SYSV_ABI pthread_cond_wait(LibKernel::PthreadCond* cond, LibKernel::PthreadMutex* mutex) {
|
||||
// PRINT_NAME();
|
||||
|
||||
uint64_t guest_r13 = 0;
|
||||
__asm__ volatile("movq %%r13, %0" : "=r"(guest_r13));
|
||||
LibKernel::g_guest_wait_r13 = guest_r13;
|
||||
LibKernel::g_guest_wait_caller = reinterpret_cast<uint64_t>(__builtin_return_address(0));
|
||||
return POSIX_PTHREAD_CALL(LibKernel::PthreadCondWait(cond, mutex));
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user