3 #include<libtransistor/cpp/types.hpp>
17 virtual uint8_t *Base() = 0;
18 virtual size_t Size() = 0;
21 enum class ProcessState : uint64_t {
32 enum class LimitableResource : uint32_t {
40 using ThreadId = uint64_t;
42 Result<void*> SetHeapSize(uint32_t size);
43 Result<std::nullopt_t> SetMemoryPermission(
void *addr, uint64_t size, uint32_t permission);
45 Result<std::tuple<memory_info_t, uint32_t>> QueryMemory(
void *addr);
47 Result<std::shared_ptr<MemoryMapping>> MapSharedMemory(KSharedMemory &mem);
48 Result<std::shared_ptr<MemoryMapping>> MapSharedMemory(std::shared_ptr<KSharedMemory> mem);
49 Result<KTransferMemory> CreateTransferMemory(
void *addr, uint64_t size, uint32_t permission);
50 Result<std::nullopt_t> CloseHandle(
handle_t handle);
54 Result<uint64_t> GetProcessId(
handle_t handle);
58 Result<std::shared_ptr<MemoryMapping>> MapTransferMemory(KTransferMemory &mem);
59 Result<std::shared_ptr<MemoryMapping>> MapTransferMemory(std::shared_ptr<KTransferMemory> mem);
63 Result<KDebug> DebugActiveProcess(uint64_t pid);
64 Result<std::nullopt_t> BreakDebugProcess(KDebug &debug);
65 Result<std::nullopt_t> TerminateDebugProcess(KDebug &debug);
66 Result<debug_event_info_t> GetDebugEvent(KDebug &debug);
67 Result<std::nullopt_t> ContinueDebugEvent(KDebug &debug, uint32_t continue_debug_flags, ThreadId *thread_ids, uint32_t num_threads);
68 Result<std::vector<ThreadId>> GetThreadList(uint32_t max, KDebug &debug);
69 Result<thread_context_t> GetDebugThreadContext(KDebug &debug, uint64_t thread_id, uint32_t thread_context_flags);
70 Result<std::nullopt_t> SetDebugThreadContext(KDebug &debug, ThreadId thread_id,
thread_context_t *context, uint32_t flags);
71 Result<std::tuple<memory_info_t, uint32_t>> QueryDebugProcessMemory(KDebug &debug, uint64_t addr);
72 Result<std::nullopt_t> ReadDebugProcessMemory(uint8_t *buffer, KDebug &debug, uint64_t addr,
size_t size);
73 Result<std::nullopt_t> WriteDebugProcessMemory(KDebug &debug, uint8_t *buffer, uint64_t addr,
size_t size);
74 Result<std::nullopt_t> SetHardwareBreakPoint(uint32_t hw_bkpt_id, uint64_t flags, uint64_t value);
75 Result<std::nullopt_t> SetHardwareBreakPoint(uint32_t hw_bkpt_id, uint64_t flags, KDebug &debug);
79 Result<std::nullopt_t> SetProcessMemoryPermission(KProcess &process, uint64_t addr,
size_t size, uint32_t perm);
80 Result<std::shared_ptr<MemoryMapping>> MapProcessMemory(std::shared_ptr<KProcess> process, uint64_t remote_addr,
size_t size);
81 Result<std::tuple<memory_info_t, uint32_t>> QueryProcessMemory(KProcess &process, uint64_t addr);
82 Result<KProcess> CreateProcess(
void *process_info,
void *caps, uint32_t cap_num);
83 Result<std::nullopt_t> StartProcess(KProcess &process, uint32_t main_thread_prio, uint32_t default_cpuid, uint32_t main_thread_stack_size);
84 Result<std::nullopt_t> TerminateProcess(KProcess &process);
85 Result<uint64_t> GetProcessInfo(KProcess &process, uint32_t type);
86 Result<KResourceLimit> CreateResourceLimit();
87 Result<std::nullopt_t> SetResourceLimitLimitValue(KResourceLimit &limit, LimitableResource resource, uint64_t value);
uint32_t handle_t
Resource handle.
Definition: types.h:38