[rpcsx-os/orbis-kernel] random bugfixes

ipmi: fixed respond sync, get message, try get message, try send message
event: detach event emitter from file
signals: basic implementation
linker: fixed zero symbol relocation, fixed exec relocation
shared_cv/mutex: implement eintr response support
shared_cv: fixed possible loop instead of wait
ipmi: implement invoke async, respond async, get result, get client app id, client get name
rpcsx-os: add safemode flag
This commit is contained in:
DH 2024-01-13 20:57:02 +03:00
parent 8791312d4f
commit 65e653f5ef
81 changed files with 2586 additions and 761 deletions

View file

@ -66,6 +66,7 @@ struct Process final {
bool isInSandbox = false;
EventEmitter event;
std::uint32_t sdkVersion = -1;
std::uint64_t nextTlsSlot = 1;
std::uint64_t lastTlsOffset = 0;
@ -81,6 +82,8 @@ struct Process final {
utils::kmap<void *, utils::kstring> namedObjNames;
utils::OwningIdMap<NamedObjInfo, uint, 65535, 1> namedObjIds;
utils::kmap<std::int32_t, SigAction> sigActions;
// Named memory ranges for debugging
utils::shared_mutex namedMemMutex;
utils::kmap<NamedMemoryRange, utils::kstring> namedMem;

View file

@ -12,6 +12,7 @@ struct timespec;
struct File;
struct MemoryProtection;
struct IoVec;
struct UContext;
struct ProcessOps {
SysResult (*mmap)(Thread *thread, caddr_t addr, size_t len, sint prot,
@ -64,7 +65,7 @@ struct ProcessOps {
uint64_t arg3);
SysResult (*dynlib_unload_prx)(Thread *thread, ModuleHandle handle);
SysResult (*thr_create)(Thread *thread, ptr<struct ucontext> ctxt,
SysResult (*thr_create)(Thread *thread, ptr<UContext> ctxt,
ptr<slong> arg, sint flags);
SysResult (*thr_new)(Thread *thread, ptr<thr_param> param, sint param_size);
SysResult (*thr_exit)(Thread *thread, ptr<slong> state);

View file

@ -19,5 +19,6 @@ enum class RegisterId {
rax,
rsp,
rflags,
rip,
};
} // namespace orbis

View file

@ -4,12 +4,16 @@
#include "orbis-config.hpp"
#include "types.hpp"
#include "../KernelAllocator.hpp"
#include "../ucontext.hpp"
#include "../utils/SharedCV.hpp"
#include "../utils/SharedMutex.hpp"
#include <atomic>
#include <thread>
namespace orbis {
struct Process;
struct Thread {
utils::shared_mutex mtx;
Process *tproc = nullptr;
@ -21,8 +25,14 @@ struct Thread {
uint64_t gsBase{};
char name[32]{};
uint64_t sigMask[4] = {0x7fff'ffff, 0};
SigSet sigMask = {0x7fff'ffff, ~0u, ~0u, ~0u};
utils::shared_mutex suspend_mtx;
utils::shared_cv suspend_cv;
kdeque<int> signalQueue;
kvector<UContext> sigReturns;
std::atomic<unsigned> suspended{0};
std::int64_t hostTid = -1;
lwpid_t tid = -1;
ThreadState state = ThreadState::INACTIVE;
std::thread handle;
@ -35,6 +45,10 @@ struct Thread {
// Print backtrace
void where();
void suspend();
void resume();
void sendSignal(int signo);
// FIXME: implement thread destruction
void incRef() {}
void decRef() {}