ps5: collect type of process and firmware

add
initial gc and dce ioctls implementation
This commit is contained in:
DH 2024-11-20 23:11:55 +03:00
parent ffe2837915
commit b6556e83ee
11 changed files with 297 additions and 41 deletions

View file

@ -48,6 +48,12 @@ struct UmtxChain {
uint notify_n(const UmtxKey &key, sint count);
};
enum class FwType : std::uint8_t {
Unknown,
Ps4,
Ps5,
};
class alignas(__STDCPP_DEFAULT_NEW_ALIGNMENT__) KernelContext final {
public:
KernelContext();
@ -192,7 +198,10 @@ public:
shared_mutex regMgrMtx;
kmap<std::uint32_t, std::uint32_t> regMgrInt;
std::vector<std::tuple<std::uint8_t*, size_t>> dialogs{};
std::vector<std::tuple<std::uint8_t *, size_t>> dialogs{};
FwType fwType = FwType::Unknown;
bool isDevKit = false;
private:
shared_mutex m_heap_mtx;

View file

@ -15,6 +15,12 @@ namespace orbis {
struct Thread;
struct Process;
enum class DynType : std::uint8_t {
None,
Ps4,
Ps5,
};
struct ModuleNeeded {
utils::kstring name;
std::uint16_t version;
@ -98,6 +104,8 @@ struct Module final {
uint16_t flags{};
uint64_t entryPoint{};
DynType dynType = DynType::None;
uint32_t phNum{};
uint64_t phdrAddress{};

View file

@ -44,6 +44,12 @@ struct NamedMemoryRange {
}
};
enum class ProcessType : std::uint8_t {
FreeBsd,
Ps4,
Ps5,
};
struct Process final {
KernelContext *context = nullptr;
pid_t pid = -1;
@ -54,6 +60,7 @@ struct Process final {
Process *parentProcess = nullptr;
shared_mutex mtx;
int vmId = -1;
ProcessType type = ProcessType::FreeBsd;
void (*onSysEnter)(Thread *thread, int id, uint64_t *args,
int argsCount) = nullptr;
void (*onSysExit)(Thread *thread, int id, uint64_t *args, int argsCount,

View file

@ -189,6 +189,10 @@ static SysResult keventChange(KQueue *kq, KEvent &change, Thread *thread) {
// hp3d idle
nodeIt->triggered = true;
kq->cv.notify_all(kq->mtx);
} else if (g_context.fwType == FwType::Ps5 &&
change.filter == kEvFiltGraphicsCore && change.ident == 0) {
nodeIt->triggered = true;
kq->cv.notify_all(kq->mtx);
}
return {};

View file

@ -202,6 +202,18 @@ SysResult kern_sysctl(Thread *thread, ptr<sint> name, uint namelen,
}
}
if (name[0] == kern && name[1] == proc && name[2] == 55) {
if (g_context.fwType != FwType::Ps5) {
return orbis::ErrorCode::INVAL;
}
if (oldlenp && old && *oldlenp == 4) {
return uwrite<uint32_t>(ptr<uint32_t>(old),
thread->tproc->type == ProcessType::Ps5 ? 1
: 0);
}
}
if (name[0] == kern && name[1] == proc && name[2] == 36) {
Process *process = thread->tproc;
if (process->pid != name[3]) {