diff --git a/orbis-kernel/src/sys/sys_sce.cpp b/orbis-kernel/src/sys/sys_sce.cpp index c263e4ca2..1feb49b70 100644 --- a/orbis-kernel/src/sys/sys_sce.cpp +++ b/orbis-kernel/src/sys/sys_sce.cpp @@ -1317,7 +1317,6 @@ orbis::SysResult orbis::sys_resume_internal_hdd(Thread *thread /* TODO */) { return ErrorCode::NOSYS; } orbis::SysResult orbis::sys_thr_suspend_ucontext(Thread *thread, lwpid_t tid) { - // ORBIS_LOG_FATAL(__FUNCTION__, tid); auto t = tid == thread->tid ? thread : thread->tproc->threadsMap.get(tid % 10000 - 1); if (t == nullptr) { @@ -1327,6 +1326,7 @@ orbis::SysResult orbis::sys_thr_suspend_ucontext(Thread *thread, lwpid_t tid) { while (true) { unsigned prevSuspend = 0; if (t->suspended.compare_exchange_strong(prevSuspend, 1)) { + t->suspended.fetch_sub(1); t->suspend(); while (t->suspended == 0) { @@ -1344,7 +1344,6 @@ orbis::SysResult orbis::sys_thr_suspend_ucontext(Thread *thread, lwpid_t tid) { return {}; } orbis::SysResult orbis::sys_thr_resume_ucontext(Thread *thread, lwpid_t tid) { - // ORBIS_LOG_FATAL(__FUNCTION__, tid); auto t = tid == thread->tid ? thread : thread->tproc->threadsMap.get(tid % 10000 - 1); if (t == nullptr) { @@ -1352,14 +1351,9 @@ orbis::SysResult orbis::sys_thr_resume_ucontext(Thread *thread, lwpid_t tid) { } while (true) { - unsigned prevSuspend = 1; - if (t->suspended.compare_exchange_strong(prevSuspend, 0)) { + unsigned prevSuspend = t->suspended.load(); + if (t->suspended == prevSuspend) { t->resume(); - - while (t->suspended != 0) { - std::this_thread::yield(); - } - break; } @@ -1375,7 +1369,6 @@ orbis::SysResult orbis::sys_thr_resume_ucontext(Thread *thread, lwpid_t tid) { } orbis::SysResult orbis::sys_thr_get_ucontext(Thread *thread, lwpid_t tid, ptr context) { - // ORBIS_LOG_FATAL(__FUNCTION__, tid, context); auto t = tid == thread->tid ? thread : thread->tproc->threadsMap.get(tid % 10000 - 1); @@ -1390,12 +1383,12 @@ orbis::SysResult orbis::sys_thr_get_ucontext(Thread *thread, lwpid_t tid, } for (auto it = t->sigReturns.rbegin(); it != t->sigReturns.rend(); ++it) { - auto &savedContext = t->sigReturns.back(); + auto &savedContext = *it; if (savedContext.mcontext.rip < 0x100'0000'0000) { return uwrite(context, savedContext); } } - ORBIS_LOG_FATAL(__FUNCTION__, "not found guest context"); + ORBIS_LOG_FATAL(__FUNCTION__, tid, "not found guest context"); *context = {}; return {}; } diff --git a/rpcsx-os/ops.cpp b/rpcsx-os/ops.cpp index 7c98fcdcb..a643fc1dd 100644 --- a/rpcsx-os/ops.cpp +++ b/rpcsx-os/ops.cpp @@ -871,15 +871,6 @@ SysResult execve(Thread *thread, ptr fname, ptr> argv, pthread_setname_np(pthread_self(), name.c_str()); } - - if (fname == std::string_view{"/app0/eboot.bin"}) { - // FIXME: remove hack - // _envv.push_back("MONO_LOG_LEVEL=debug"); - _envv.push_back("MONO_GC_PARAMS=nursery-size=128m"); - // _envv.push_back("MONO_GC_DEBUG=2,heap-dump=/app0/mono.dump"); - // _envv.push_back("GC_DONT_GC"); - } - std::printf("pid: %u\n", ::getpid()); // if (thread->tid == 60001) {