mirror of
https://github.com/RPCSX/rpcsx.git
synced 2026-04-20 13:55:21 +00:00
[orbis-kernel] fix ucontext freeze, remove hack for mono
This commit is contained in:
parent
89136596cb
commit
f4adc1ec93
2 changed files with 5 additions and 21 deletions
|
|
@ -1317,7 +1317,6 @@ orbis::SysResult orbis::sys_resume_internal_hdd(Thread *thread /* TODO */) {
|
||||||
return ErrorCode::NOSYS;
|
return ErrorCode::NOSYS;
|
||||||
}
|
}
|
||||||
orbis::SysResult orbis::sys_thr_suspend_ucontext(Thread *thread, lwpid_t tid) {
|
orbis::SysResult orbis::sys_thr_suspend_ucontext(Thread *thread, lwpid_t tid) {
|
||||||
// ORBIS_LOG_FATAL(__FUNCTION__, tid);
|
|
||||||
auto t = tid == thread->tid ? thread
|
auto t = tid == thread->tid ? thread
|
||||||
: thread->tproc->threadsMap.get(tid % 10000 - 1);
|
: thread->tproc->threadsMap.get(tid % 10000 - 1);
|
||||||
if (t == nullptr) {
|
if (t == nullptr) {
|
||||||
|
|
@ -1327,6 +1326,7 @@ orbis::SysResult orbis::sys_thr_suspend_ucontext(Thread *thread, lwpid_t tid) {
|
||||||
while (true) {
|
while (true) {
|
||||||
unsigned prevSuspend = 0;
|
unsigned prevSuspend = 0;
|
||||||
if (t->suspended.compare_exchange_strong(prevSuspend, 1)) {
|
if (t->suspended.compare_exchange_strong(prevSuspend, 1)) {
|
||||||
|
t->suspended.fetch_sub(1);
|
||||||
t->suspend();
|
t->suspend();
|
||||||
|
|
||||||
while (t->suspended == 0) {
|
while (t->suspended == 0) {
|
||||||
|
|
@ -1344,7 +1344,6 @@ orbis::SysResult orbis::sys_thr_suspend_ucontext(Thread *thread, lwpid_t tid) {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
orbis::SysResult orbis::sys_thr_resume_ucontext(Thread *thread, lwpid_t tid) {
|
orbis::SysResult orbis::sys_thr_resume_ucontext(Thread *thread, lwpid_t tid) {
|
||||||
// ORBIS_LOG_FATAL(__FUNCTION__, tid);
|
|
||||||
auto t = tid == thread->tid ? thread
|
auto t = tid == thread->tid ? thread
|
||||||
: thread->tproc->threadsMap.get(tid % 10000 - 1);
|
: thread->tproc->threadsMap.get(tid % 10000 - 1);
|
||||||
if (t == nullptr) {
|
if (t == nullptr) {
|
||||||
|
|
@ -1352,14 +1351,9 @@ orbis::SysResult orbis::sys_thr_resume_ucontext(Thread *thread, lwpid_t tid) {
|
||||||
}
|
}
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
unsigned prevSuspend = 1;
|
unsigned prevSuspend = t->suspended.load();
|
||||||
if (t->suspended.compare_exchange_strong(prevSuspend, 0)) {
|
if (t->suspended == prevSuspend) {
|
||||||
t->resume();
|
t->resume();
|
||||||
|
|
||||||
while (t->suspended != 0) {
|
|
||||||
std::this_thread::yield();
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
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,
|
orbis::SysResult orbis::sys_thr_get_ucontext(Thread *thread, lwpid_t tid,
|
||||||
ptr<UContext> context) {
|
ptr<UContext> context) {
|
||||||
// ORBIS_LOG_FATAL(__FUNCTION__, tid, context);
|
|
||||||
|
|
||||||
auto t = tid == thread->tid ? thread
|
auto t = tid == thread->tid ? thread
|
||||||
: thread->tproc->threadsMap.get(tid % 10000 - 1);
|
: 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) {
|
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) {
|
if (savedContext.mcontext.rip < 0x100'0000'0000) {
|
||||||
return uwrite(context, savedContext);
|
return uwrite(context, savedContext);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ORBIS_LOG_FATAL(__FUNCTION__, "not found guest context");
|
ORBIS_LOG_FATAL(__FUNCTION__, tid, "not found guest context");
|
||||||
*context = {};
|
*context = {};
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -871,15 +871,6 @@ SysResult execve(Thread *thread, ptr<char> fname, ptr<ptr<char>> argv,
|
||||||
|
|
||||||
pthread_setname_np(pthread_self(), name.c_str());
|
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());
|
std::printf("pid: %u\n", ::getpid());
|
||||||
|
|
||||||
// if (thread->tid == 60001) {
|
// if (thread->tid == 60001) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue