Run clang-format

This commit is contained in:
Isaac Marovitz 2023-07-06 17:16:25 +01:00
parent d999edfd2c
commit 1f05a8a6a6
125 changed files with 10664 additions and 7154 deletions

View file

@ -1,45 +1,58 @@
#pragma once
#include "../error/SysResult.hpp"
#include "../module/ModuleHandle.hpp"
#include "orbis-config.hpp"
#include "../thread/types.hpp"
#include "orbis-config.hpp"
namespace orbis {
struct Thread;
struct Module;
struct ProcessOps {
SysResult (*mmap)(Thread *thread, caddr_t addr, size_t len, sint prot, sint flags, sint fd, off_t pos);
SysResult (*mmap)(Thread *thread, caddr_t addr, size_t len, sint prot,
sint flags, sint fd, off_t pos);
SysResult (*munmap)(Thread *thread, ptr<void> addr, size_t len);
SysResult (*msync)(Thread *thread, ptr<void> addr, size_t len, sint flags);
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);
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);
SysResult (*madvise)(Thread *thread, ptr<void> addr, size_t len, sint behav);
SysResult (*mincore)(Thread *thread, ptr<const void> addr, size_t len, ptr<char> vec);
SysResult (*mincore)(Thread *thread, ptr<const void> addr, size_t len,
ptr<char> vec);
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);
SysResult (*virtual_query)(Thread *thread, ptr<const void> addr, sint flags, ptr<void> info, ulong infoSize);
SysResult (*virtual_query)(Thread *thread, ptr<const void> addr, sint flags,
ptr<void> info, ulong infoSize);
SysResult (*open)(Thread *thread, ptr<const char> path, sint flags, sint mode);
SysResult (*open)(Thread *thread, ptr<const char> path, sint flags,
sint mode);
SysResult (*close)(Thread *thread, sint fd);
SysResult (*ioctl)(Thread *thread, sint fd, ulong com, caddr_t argp);
SysResult (*write)(Thread *thread, sint fd, ptr<const void> data, ulong size);
SysResult (*read)(Thread *thread, sint fd, ptr<void> data, ulong size);
SysResult (*pread)(Thread *thread, sint fd, ptr<void> data, ulong size, ulong offset);
SysResult (*pwrite)(Thread *thread, sint fd, ptr<const void> data, ulong size, ulong offset);
SysResult (*pread)(Thread *thread, sint fd, ptr<void> data, ulong size,
ulong offset);
SysResult (*pwrite)(Thread *thread, sint fd, ptr<const void> data, ulong size,
ulong offset);
SysResult (*lseek)(Thread *thread, sint fd, ulong offset, sint whence);
SysResult (*ftruncate)(Thread *thread, sint fd, off_t length);
SysResult (*truncate)(Thread *thread, ptr<const char> path, off_t length);
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);
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);
SysResult (*dynlib_do_copy_relocations)(Thread *thread);
SysResult (*dynlib_load_prx)(Thread *thread, ptr<const char> name, uint64_t arg1, ptr<ModuleHandle> pHandle, uint64_t arg3);
SysResult (*dynlib_load_prx)(Thread *thread, ptr<const char> name,
uint64_t arg1, ptr<ModuleHandle> pHandle,
uint64_t arg3);
SysResult (*dynlib_unload_prx)(Thread *thread, ModuleHandle handle);
SysResult (*thr_create)(Thread *thread, ptr<struct ucontext> ctxt, ptr<slong> arg, sint flags);
SysResult (*thr_create)(Thread *thread, ptr<struct 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);
SysResult (*thr_kill)(Thread *thread, slong id, sint sig);

View file

@ -1,8 +1,8 @@
#pragma once
#include "ThreadState.hpp"
#include "orbis-config.hpp"
#include "types.hpp"
#include "ThreadState.hpp"
#include "../utils/SharedMutex.hpp"
@ -19,10 +19,7 @@ struct Thread {
uint64_t gsBase{};
char name[32];
uint64_t sigMask[4] = {
0x7fff'ffff,
0
};
uint64_t sigMask[4] = {0x7fff'ffff, 0};
lwpid_t tid = -1;
ThreadState state = ThreadState::INACTIVE;

View file

@ -3,5 +3,11 @@
#include <cstdint>
namespace orbis {
enum class ThreadState : std::uint32_t { INACTIVE, INHIBITED, CAN_RUN, RUNQ, RUNNING };
enum class ThreadState : std::uint32_t {
INACTIVE,
INHIBITED,
CAN_RUN,
RUNQ,
RUNNING
};
} // namespace orbis

View file

@ -13,15 +13,19 @@ struct rtprio {
};
struct thr_param {
ptr<void(void *)> start_func;
ptr<void> arg;
ptr<char> stack_base;
size_t stack_size;
ptr<char> tls_base;
size_t tls_size;
ptr<slong> child_tid; // Address to store the new thread identifier, for the child's use
ptr<slong> parent_tid; // Address to store the new thread identifier, for the parent's use
sint flags; // Thread creation flags. The flags member may specify the following flags:
ptr<rtprio> rtp; // Real-time scheduling priority for the new thread. May be NULL to inherit the priority from the creating thread
ptr<void(void *)> start_func;
ptr<void> arg;
ptr<char> stack_base;
size_t stack_size;
ptr<char> tls_base;
size_t tls_size;
ptr<slong> child_tid; // Address to store the new thread identifier, for the
// child's use
ptr<slong> parent_tid; // Address to store the new thread identifier, for the
// parent's use
sint flags; // Thread creation flags. The flags member may specify the
// following flags:
ptr<rtprio> rtp; // Real-time scheduling priority for the new thread. May be
// NULL to inherit the priority from the creating thread
};
} // namespace orbis