#pragma once #include "interface_types.hpp" struct KitInterface { err_t(*prepare)() = nullptr; err_t(*command_start)(int, const char* const*) = nullptr; void(*command_exit)() = nullptr; void(*subject_start)() = nullptr; void(*subject_exit)() = nullptr; }; bool rewire_init(const KitInterface& iface); bool rewire_run(int argc, const char* const* argv); extern "C" { // Exposure to wirekit is achieved by adding these functions to rewire's symbol tables #define EXPOSED __attribute__((visibility("default"))) EXPOSED err_t rewire_syscall_hook(reg_t syscall, hook_t entry, hook_t exit); EXPOSED err_t rewire_syscall_unhook(reg_t syscall); EXPOSED err_t rewire_syscall_hook_default(hook_t entry, hook_t exit); EXPOSED err_t rewire_syscall_unhook_default(); EXPOSED err_t rewire_subject_id(pid_t* pid); EXPOSED err_t rewire_subject_get_regs(user_regs_struct* regs); EXPOSED err_t rewire_subject_set_regs(const user_regs_struct* regs); EXPOSED err_t rewire_subject_load_cstr(const char* subject_addr, char* buf, uint32_t* read, uint32_t n); }