[rpcsx-os] implement sys_query_memory_protection

This commit is contained in:
DH 2023-08-01 15:40:35 +03:00
parent 5edfdb037c
commit 0c59167c38
8 changed files with 95 additions and 11 deletions

View file

@ -1,4 +1,3 @@
#include <array>
#include <orbis/error.hpp>
#include <orbis/thread.hpp>
#include <orbis/time.hpp>
@ -12,6 +11,7 @@ using cpuwhich_t = sint;
using cpulevel_t = sint;
using SceKernelModule = ModuleHandle;
struct MemoryProtection;
struct ModuleInfo;
struct ModuleInfoEx;
struct KEvent;
@ -631,7 +631,8 @@ SysResult sys_evf_set(Thread *thread, sint id, uint64_t value);
SysResult sys_evf_clear(Thread *thread, sint id, uint64_t value);
SysResult sys_evf_cancel(Thread *thread, sint id, uint64_t value,
ptr<sint> pNumWaitThreads);
SysResult sys_query_memory_protection(Thread *thread /* TODO */);
SysResult sys_query_memory_protection(Thread *thread, ptr<void> address,
ptr<MemoryProtection> protection);
SysResult sys_batch_map(Thread *thread /* TODO */);
SysResult sys_osem_create(Thread *thread, ptr<const char[32]> name, uint attrs,
sint initCount, sint maxCount);

View file

@ -10,6 +10,7 @@ struct Thread;
struct Module;
struct timespec;
struct File;
struct MemoryProtection;
struct ProcessOps {
SysResult (*mmap)(Thread *thread, caddr_t addr, size_t len, sint prot,
@ -32,6 +33,8 @@ struct ProcessOps {
SysResult (*munlock)(Thread *thread, ptr<const void> addr, size_t len);
SysResult (*virtual_query)(Thread *thread, ptr<const void> addr, sint flags,
ptr<void> info, ulong infoSize);
SysResult (*query_memory_protection)(Thread *thread, ptr<void> address,
ptr<MemoryProtection> protection);
SysResult (*open)(Thread *thread, ptr<const char> path, sint flags, sint mode,
Ref<File> *file);

View file

@ -0,0 +1,13 @@
#pragma once
#include "orbis-config.hpp"
namespace orbis {
struct MemoryProtection {
uint64_t startAddress;
uint64_t endAddress;
int32_t prot;
};
static_assert(sizeof(MemoryProtection) == 24);
} // namespace orbis