mirror of
https://github.com/RPCSX/rpcsx.git
synced 2026-04-05 14:37:08 +00:00
orbis: implement initial guest signals support
This commit is contained in:
parent
36b9e969c2
commit
70fa577a7b
12 changed files with 239 additions and 51 deletions
|
|
@ -73,6 +73,7 @@ struct ProcessOps {
|
|||
SysResult (*thr_kill2)(Thread *thread, pid_t pid, slong id, sint sig);
|
||||
SysResult (*thr_suspend)(Thread *thread, ptr<const timespec> timeout);
|
||||
SysResult (*thr_wake)(Thread *thread, slong id);
|
||||
SysResult (*sigreturn)(Thread *thread, ptr<UContext> context);
|
||||
SysResult (*thr_set_name)(Thread *thread, slong id, ptr<const char> name);
|
||||
|
||||
SysResult (*unmount)(Thread *thread, ptr<char> path, sint flags);
|
||||
|
|
|
|||
|
|
@ -41,6 +41,8 @@ struct Thread {
|
|||
kvector<SigInfo> queuedSignals;
|
||||
shared_atomic32 suspendFlags{0};
|
||||
|
||||
utils::shared_atomic32 interruptedMtx{ 0 };
|
||||
|
||||
std::int64_t hostTid = -1;
|
||||
lwpid_t tid = -1;
|
||||
unsigned unblocked = 0;
|
||||
|
|
@ -64,13 +66,14 @@ struct Thread {
|
|||
// Print backtrace
|
||||
void where();
|
||||
|
||||
void unblock();
|
||||
void block();
|
||||
bool unblock();
|
||||
bool block();
|
||||
|
||||
void suspend();
|
||||
void resume();
|
||||
void sendSignal(int signo);
|
||||
void notifyUnblockedSignal(int signo);
|
||||
void setSigMask(SigSet newSigMask);
|
||||
|
||||
// FIXME: implement thread destruction
|
||||
void incRef() {}
|
||||
|
|
|
|||
|
|
@ -162,4 +162,10 @@ struct SigInfo {
|
|||
} spare;
|
||||
} reason;
|
||||
};
|
||||
|
||||
struct SigFrame {
|
||||
uint64_t handler;
|
||||
UContext context;
|
||||
SigInfo info;
|
||||
};
|
||||
} // namespace orbis
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ static constexpr auto kRelaxSpinCount = 12;
|
|||
static constexpr auto kSpinCount = 16;
|
||||
|
||||
inline namespace utils {
|
||||
inline thread_local void (*g_scopedUnblock)(bool) = nullptr;
|
||||
inline thread_local bool (*g_scopedUnblock)(bool) = nullptr;
|
||||
|
||||
bool try_spin_wait(auto &&pred) {
|
||||
for (std::size_t i = 0; i < kSpinCount; ++i) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue