2023-07-03 13:10:16 +02:00
|
|
|
#pragma once
|
|
|
|
|
#include "../error/SysResult.hpp"
|
|
|
|
|
#include "../module/ModuleHandle.hpp"
|
|
|
|
|
#include "../thread/types.hpp"
|
2023-07-06 18:16:25 +02:00
|
|
|
#include "orbis-config.hpp"
|
2023-07-29 18:53:34 +02:00
|
|
|
#include "orbis/utils/Rc.hpp"
|
2023-07-03 13:10:16 +02:00
|
|
|
|
|
|
|
|
namespace orbis {
|
|
|
|
|
struct Thread;
|
|
|
|
|
struct Module;
|
2023-07-12 04:22:44 +02:00
|
|
|
struct timespec;
|
2023-07-29 18:53:34 +02:00
|
|
|
struct File;
|
2023-08-01 14:40:35 +02:00
|
|
|
struct MemoryProtection;
|
2023-07-03 13:10:16 +02:00
|
|
|
|
|
|
|
|
struct ProcessOps {
|
2023-07-06 18:16:25 +02:00
|
|
|
SysResult (*mmap)(Thread *thread, caddr_t addr, size_t len, sint prot,
|
|
|
|
|
sint flags, sint fd, off_t pos);
|
2023-07-30 00:30:36 +02:00
|
|
|
SysResult (*dmem_mmap)(Thread *thread, caddr_t addr, size_t len,
|
|
|
|
|
sint memoryType, sint prot, sint flags,
|
|
|
|
|
off_t directMemoryStart);
|
2023-07-03 13:10:16 +02:00
|
|
|
SysResult (*munmap)(Thread *thread, ptr<void> addr, size_t len);
|
|
|
|
|
SysResult (*msync)(Thread *thread, ptr<void> addr, size_t len, sint flags);
|
2023-07-06 18:16:25 +02:00
|
|
|
SysResult (*mprotect)(Thread *thread, ptr<const void> addr, size_t len,
|
|
|
|
|
sint prot);
|
|
|
|
|
SysResult (*minherit)(Thread *thread, ptr<void> addr, size_t len,
|
|
|
|
|
sint inherit);
|
2023-07-03 13:10:16 +02:00
|
|
|
SysResult (*madvise)(Thread *thread, ptr<void> addr, size_t len, sint behav);
|
2023-07-06 18:16:25 +02:00
|
|
|
SysResult (*mincore)(Thread *thread, ptr<const void> addr, size_t len,
|
|
|
|
|
ptr<char> vec);
|
2023-07-03 13:10:16 +02:00
|
|
|
SysResult (*mlock)(Thread *thread, ptr<const void> addr, size_t len);
|
|
|
|
|
SysResult (*mlockall)(Thread *thread, sint how);
|
|
|
|
|
SysResult (*munlockall)(Thread *thread);
|
|
|
|
|
SysResult (*munlock)(Thread *thread, ptr<const void> addr, size_t len);
|
2023-07-06 18:16:25 +02:00
|
|
|
SysResult (*virtual_query)(Thread *thread, ptr<const void> addr, sint flags,
|
|
|
|
|
ptr<void> info, ulong infoSize);
|
2023-08-01 14:40:35 +02:00
|
|
|
SysResult (*query_memory_protection)(Thread *thread, ptr<void> address,
|
|
|
|
|
ptr<MemoryProtection> protection);
|
2023-07-03 13:10:16 +02:00
|
|
|
|
2023-07-29 18:53:34 +02:00
|
|
|
SysResult (*open)(Thread *thread, ptr<const char> path, sint flags, sint mode,
|
|
|
|
|
Ref<File> *file);
|
2023-07-29 21:46:28 +02:00
|
|
|
SysResult (*shm_open)(Thread *thread, const char *path, sint flags, sint mode,
|
|
|
|
|
Ref<File> *file);
|
2023-07-30 13:56:25 +02:00
|
|
|
SysResult (*blockpool_open)(Thread *thread, Ref<File> *file);
|
|
|
|
|
SysResult (*blockpool_map)(Thread *thread, caddr_t addr, size_t len,
|
|
|
|
|
sint prot, sint flags);
|
|
|
|
|
SysResult (*blockpool_unmap)(Thread *thread, caddr_t addr, size_t len);
|
2023-07-19 17:04:26 +02:00
|
|
|
SysResult (*socket)(Thread *thread, ptr<const char> name, sint domain,
|
2023-07-29 18:53:34 +02:00
|
|
|
sint type, sint protocol, Ref<File> *file);
|
2023-07-29 21:46:28 +02:00
|
|
|
SysResult (*shm_unlink)(Thread *thread, const char *path);
|
2023-07-06 18:16:25 +02:00
|
|
|
SysResult (*dynlib_get_obj_member)(Thread *thread, ModuleHandle handle,
|
|
|
|
|
uint64_t index, ptr<ptr<void>> addrp);
|
|
|
|
|
SysResult (*dynlib_dlsym)(Thread *thread, ModuleHandle handle,
|
|
|
|
|
ptr<const char> symbol, ptr<ptr<void>> addrp);
|
2023-07-03 13:10:16 +02:00
|
|
|
SysResult (*dynlib_do_copy_relocations)(Thread *thread);
|
2023-07-06 18:16:25 +02:00
|
|
|
SysResult (*dynlib_load_prx)(Thread *thread, ptr<const char> name,
|
|
|
|
|
uint64_t arg1, ptr<ModuleHandle> pHandle,
|
|
|
|
|
uint64_t arg3);
|
2023-07-03 13:10:16 +02:00
|
|
|
SysResult (*dynlib_unload_prx)(Thread *thread, ModuleHandle handle);
|
|
|
|
|
|
2023-07-06 18:16:25 +02:00
|
|
|
SysResult (*thr_create)(Thread *thread, ptr<struct ucontext> ctxt,
|
|
|
|
|
ptr<slong> arg, sint flags);
|
2023-07-06 16:23:50 +02:00
|
|
|
SysResult (*thr_new)(Thread *thread, ptr<thr_param> param, sint param_size);
|
2023-07-03 13:10:16 +02:00
|
|
|
SysResult (*thr_exit)(Thread *thread, ptr<slong> state);
|
|
|
|
|
SysResult (*thr_kill)(Thread *thread, slong id, sint sig);
|
|
|
|
|
SysResult (*thr_kill2)(Thread *thread, pid_t pid, slong id, sint sig);
|
2023-07-12 04:22:44 +02:00
|
|
|
SysResult (*thr_suspend)(Thread *thread, ptr<const timespec> timeout);
|
2023-07-03 13:10:16 +02:00
|
|
|
SysResult (*thr_wake)(Thread *thread, slong id);
|
|
|
|
|
SysResult (*thr_set_name)(Thread *thread, slong id, ptr<const char> name);
|
|
|
|
|
|
|
|
|
|
SysResult (*exit)(Thread *thread, sint status);
|
|
|
|
|
|
|
|
|
|
SysResult (*processNeeded)(Thread *thread);
|
|
|
|
|
SysResult (*registerEhFrames)(Thread *thread);
|
2023-07-20 17:18:12 +02:00
|
|
|
|
|
|
|
|
void (*where)(Thread *);
|
2023-07-03 13:10:16 +02:00
|
|
|
};
|
|
|
|
|
} // namespace orbis
|