mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2025-01-22 05:51:06 +00:00
s/uc_hook_h/uchook/g
This commit is contained in:
parent
99e34d212a
commit
5f32e2c1ae
2
hook.c
2
hook.c
|
@ -91,7 +91,7 @@ size_t hook_add(struct uc_struct *uc, int type, uint64_t begin, uint64_t end, vo
|
|||
}
|
||||
|
||||
// return 0 on success, -1 on failure
|
||||
uc_err hook_del(struct uc_struct *uc, uc_hook_h hh)
|
||||
uc_err hook_del(struct uc_struct *uc, uchook hh)
|
||||
{
|
||||
if (hh == uc->hook_block_idx) {
|
||||
uc->hook_block_idx = 0;
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
size_t hook_add(struct uc_struct *uc, int type, uint64_t begin, uint64_t end, void *callback, void *user_data);
|
||||
|
||||
// return 0 on success, -1 on failure
|
||||
uc_err hook_del(struct uc_struct *uc, uc_hook_h hh);
|
||||
uc_err hook_del(struct uc_struct *uc, uchook hh);
|
||||
|
||||
// return NULL on failure
|
||||
struct hook_struct *hook_find(struct uc_struct *uc, int type, uint64_t address);
|
||||
|
|
|
@ -22,7 +22,7 @@ extern "C" {
|
|||
struct uc_struct;
|
||||
typedef struct uc_struct ucengine;
|
||||
|
||||
typedef size_t uc_hook_h;
|
||||
typedef size_t uchook;
|
||||
|
||||
#include "m68k.h"
|
||||
#include "x86.h"
|
||||
|
@ -375,7 +375,7 @@ uc_err uc_emu_stop(ucengine *uc);
|
|||
for detailed error).
|
||||
*/
|
||||
UNICORN_EXPORT
|
||||
uc_err uc_hook_add(ucengine *uc, uc_hook_h *hh, uc_hook_t type, void *callback, void *user_data, ...);
|
||||
uc_err uc_hook_add(ucengine *uc, uchook *hh, uc_hook_t type, void *callback, void *user_data, ...);
|
||||
|
||||
/*
|
||||
Unregister (remove) a hook callback.
|
||||
|
@ -390,7 +390,7 @@ uc_err uc_hook_add(ucengine *uc, uc_hook_h *hh, uc_hook_t type, void *callback,
|
|||
for detailed error).
|
||||
*/
|
||||
UNICORN_EXPORT
|
||||
uc_err uc_hook_del(ucengine *uc, uc_hook_h hh);
|
||||
uc_err uc_hook_del(ucengine *uc, uchook hh);
|
||||
|
||||
typedef enum uc_prot {
|
||||
UC_PROT_NONE = 0,
|
||||
|
|
|
@ -62,7 +62,7 @@ int main() {
|
|||
}
|
||||
fprintf(stderr, "ok %d - uc_mem_write\n", count++);
|
||||
|
||||
uc_hook_h h1, h2;
|
||||
uchook h1, h2;
|
||||
|
||||
err = uc_hook_add(uc, &h1, UC_HOOK_BLOCK, cb_hookblock, NULL, (uint64_t)1, (uint64_t)0);
|
||||
if (err != UC_ERR_OK) {
|
||||
|
|
|
@ -55,7 +55,7 @@ static bool hook_mem_invalid(ucengine *uc, uc_mem_type type,
|
|||
int main(int argc, char **argv, char **envp)
|
||||
{
|
||||
ucengine *uc;
|
||||
uc_hook_h trace1, trace2;
|
||||
uchook trace1, trace2;
|
||||
uc_err err;
|
||||
uint32_t eax, ebx;
|
||||
|
||||
|
|
|
@ -90,7 +90,7 @@ static void hook_mem_write(ucengine *uc, uc_mem_type type,
|
|||
int main(int argc, char **argv, char **envp)
|
||||
{
|
||||
ucengine *uc;
|
||||
uc_hook_h trace1, trace2;
|
||||
uchook trace1, trace2;
|
||||
uc_err err;
|
||||
uint8_t buf1[100], readbuf[100];
|
||||
|
||||
|
|
|
@ -95,7 +95,7 @@ static bool hook_mem_invalid(ucengine *uc, uc_mem_type type,
|
|||
int main(int argc, char **argv, char **envp)
|
||||
{
|
||||
ucengine *uc;
|
||||
uc_hook_h trace1, trace2;
|
||||
uchook trace1, trace2;
|
||||
uc_err err;
|
||||
uint8_t bytes[8];
|
||||
uint32_t esp;
|
||||
|
|
|
@ -21,7 +21,7 @@ int main()
|
|||
int size;
|
||||
uint8_t *buf;
|
||||
ucengine *uc;
|
||||
uc_hook_h uh_trap;
|
||||
uchook uh_trap;
|
||||
uc_err err = uc_open (UC_ARCH_X86, UC_MODE_64, &uc);
|
||||
if (err) {
|
||||
fprintf (stderr, "Cannot initialize unicorn\n");
|
||||
|
|
|
@ -38,7 +38,7 @@ static void test_arm(void)
|
|||
{
|
||||
ucengine *uc;
|
||||
uc_err err;
|
||||
uc_hook_h trace1, trace2;
|
||||
uchook trace1, trace2;
|
||||
|
||||
int r0 = 0x1234; // R0 register
|
||||
int r2 = 0x6789; // R1 register
|
||||
|
@ -94,7 +94,7 @@ static void test_thumb(void)
|
|||
{
|
||||
ucengine *uc;
|
||||
uc_err err;
|
||||
uc_hook_h trace1, trace2;
|
||||
uchook trace1, trace2;
|
||||
|
||||
int sp = 0x1234; // R0 register
|
||||
|
||||
|
|
|
@ -143,7 +143,7 @@ static bool hook_mem_invalid(ucengine *uc, uc_mem_type type,
|
|||
int main(int argc, char **argv, char **envp)
|
||||
{
|
||||
ucengine *uc;
|
||||
uc_hook_h trace1, trace2;
|
||||
uchook trace1, trace2;
|
||||
uc_err err;
|
||||
uint32_t esp, eip;
|
||||
int32_t buf1[1024], buf2[1024], readbuf[1024];
|
||||
|
|
|
@ -161,7 +161,7 @@ static bool hook_mem_invalid(ucengine *uc, uc_mem_type type,
|
|||
int main(int argc, char **argv, char **envp)
|
||||
{
|
||||
ucengine *uc;
|
||||
uc_hook_h trace1, trace2;
|
||||
uchook trace1, trace2;
|
||||
uc_err err;
|
||||
uint32_t addr, testval;
|
||||
int32_t buf1[1024], buf2[1024], readbuf[1024];
|
||||
|
|
|
@ -156,7 +156,7 @@ static bool hook_mem_invalid(ucengine *uc, uc_mem_type type,
|
|||
int main(int argc, char **argv, char **envp)
|
||||
{
|
||||
ucengine *uc;
|
||||
uc_hook_h trace1, trace2;
|
||||
uchook trace1, trace2;
|
||||
uc_err err;
|
||||
uint32_t addr, testval;
|
||||
int32_t buf1[1024], buf2[1024], readbuf[1024];
|
||||
|
|
|
@ -29,7 +29,7 @@ static void test_arm(void)
|
|||
{
|
||||
ucengine *uc;
|
||||
uc_err err;
|
||||
uc_hook_h trace1, trace2;
|
||||
uchook trace1, trace2;
|
||||
|
||||
int r0 = 0x1234; // R0 register
|
||||
int r2 = 0x6789; // R1 register
|
||||
|
@ -85,7 +85,7 @@ static void test_thumb(void)
|
|||
{
|
||||
ucengine *uc;
|
||||
uc_err err;
|
||||
uc_hook_h trace1, trace2;
|
||||
uchook trace1, trace2;
|
||||
|
||||
int sp = 0x1234; // R0 register
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ static void test_arm64(void)
|
|||
{
|
||||
ucengine *uc;
|
||||
uc_err err;
|
||||
uc_hook_h trace1, trace2;
|
||||
uchook trace1, trace2;
|
||||
|
||||
int64_t x11 = 0x1234; // X11 register
|
||||
int64_t x13 = 0x6789; // X13 register
|
||||
|
|
|
@ -25,7 +25,7 @@ static void hook_code(ucengine *uc, uint64_t address, uint32_t size, void *user_
|
|||
static void test_m68k(void)
|
||||
{
|
||||
ucengine *uc;
|
||||
uc_hook_h trace1, trace2;
|
||||
uchook trace1, trace2;
|
||||
uc_err err;
|
||||
|
||||
int d0 = 0x0000; // d0 data register
|
||||
|
|
|
@ -29,7 +29,7 @@ static void test_mips_eb(void)
|
|||
{
|
||||
ucengine *uc;
|
||||
uc_err err;
|
||||
uc_hook_h trace1, trace2;
|
||||
uchook trace1, trace2;
|
||||
|
||||
int r1 = 0x6789; // R1 register
|
||||
|
||||
|
@ -78,7 +78,7 @@ static void test_mips_el(void)
|
|||
{
|
||||
ucengine *uc;
|
||||
uc_err err;
|
||||
uc_hook_h trace1, trace2;
|
||||
uchook trace1, trace2;
|
||||
|
||||
int r1 = 0x6789; // R1 register
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ static void test_sparc(void)
|
|||
{
|
||||
ucengine *uc;
|
||||
uc_err err;
|
||||
uc_hook_h trace1, trace2;
|
||||
uchook trace1, trace2;
|
||||
|
||||
int g1 = 0x1230; // G1 register
|
||||
int g2 = 0x6789; // G2 register
|
||||
|
|
|
@ -171,7 +171,7 @@ static void test_i386(void)
|
|||
ucengine *uc;
|
||||
uc_err err;
|
||||
uint32_t tmp;
|
||||
uc_hook_h trace1, trace2;
|
||||
uchook trace1, trace2;
|
||||
|
||||
int r_ecx = 0x1234; // ECX register
|
||||
int r_edx = 0x7890; // EDX register
|
||||
|
@ -232,7 +232,7 @@ static void test_i386_jump(void)
|
|||
{
|
||||
ucengine *uc;
|
||||
uc_err err;
|
||||
uc_hook_h trace1, trace2;
|
||||
uchook trace1, trace2;
|
||||
|
||||
printf("===================================\n");
|
||||
printf("Emulate i386 code with jump\n");
|
||||
|
@ -328,7 +328,7 @@ static void test_i386_invalid_mem_read(void)
|
|||
{
|
||||
ucengine *uc;
|
||||
uc_err err;
|
||||
uc_hook_h trace1, trace2;
|
||||
uchook trace1, trace2;
|
||||
|
||||
int r_ecx = 0x1234; // ECX register
|
||||
int r_edx = 0x7890; // EDX register
|
||||
|
@ -385,7 +385,7 @@ static void test_i386_invalid_mem_write(void)
|
|||
{
|
||||
ucengine *uc;
|
||||
uc_err err;
|
||||
uc_hook_h trace1, trace2, trace3;
|
||||
uchook trace1, trace2, trace3;
|
||||
uint32_t tmp;
|
||||
|
||||
int r_ecx = 0x1234; // ECX register
|
||||
|
@ -457,7 +457,7 @@ static void test_i386_jump_invalid(void)
|
|||
{
|
||||
ucengine *uc;
|
||||
uc_err err;
|
||||
uc_hook_h trace1, trace2;
|
||||
uchook trace1, trace2;
|
||||
|
||||
int r_ecx = 0x1234; // ECX register
|
||||
int r_edx = 0x7890; // EDX register
|
||||
|
@ -513,7 +513,7 @@ static void test_i386_inout(void)
|
|||
{
|
||||
ucengine *uc;
|
||||
uc_err err;
|
||||
uc_hook_h trace1, trace2, trace3, trace4;
|
||||
uchook trace1, trace2, trace3, trace4;
|
||||
|
||||
int r_eax = 0x1234; // EAX register
|
||||
int r_ecx = 0x6789; // ECX register
|
||||
|
@ -574,7 +574,7 @@ static void test_x86_64(void)
|
|||
{
|
||||
ucengine *uc;
|
||||
uc_err err;
|
||||
uc_hook_h trace1, trace2, trace3, trace4;
|
||||
uchook trace1, trace2, trace3, trace4;
|
||||
|
||||
int64_t rax = 0x71f3029efd49d41d;
|
||||
int64_t rbx = 0xd87b45277f133ddb;
|
||||
|
@ -689,7 +689,7 @@ static void test_x86_64(void)
|
|||
static void test_x86_64_syscall(void)
|
||||
{
|
||||
ucengine *uc;
|
||||
uc_hook_h trace1;
|
||||
uchook trace1;
|
||||
uc_err err;
|
||||
|
||||
int64_t rax = 0x100;
|
||||
|
|
|
@ -90,7 +90,7 @@ static void test_i386(void)
|
|||
{
|
||||
ucengine *uc;
|
||||
uc_err err;
|
||||
uc_hook_h trace1, trace2;
|
||||
uchook trace1, trace2;
|
||||
|
||||
int r_esp = ADDRESS + 0x200000; // ESP register
|
||||
|
||||
|
|
14
uc.c
14
uc.c
|
@ -521,7 +521,7 @@ uc_err uc_emu_stop(ucengine *uc)
|
|||
|
||||
|
||||
static int _hook_code(ucengine *uc, int type, uint64_t begin, uint64_t end,
|
||||
void *callback, void *user_data, uc_hook_h *hh)
|
||||
void *callback, void *user_data, uchook *hh)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
@ -537,7 +537,7 @@ static int _hook_code(ucengine *uc, int type, uint64_t begin, uint64_t end,
|
|||
|
||||
static uc_err _hook_mem_access(ucengine *uc, uc_hook_t type,
|
||||
uint64_t begin, uint64_t end,
|
||||
void *callback, void *user_data, uc_hook_h *hh)
|
||||
void *callback, void *user_data, uchook *hh)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
@ -806,7 +806,7 @@ MemoryRegion *memory_mapping(struct uc_struct* uc, uint64_t address)
|
|||
}
|
||||
|
||||
static uc_err _hook_mem_invalid(struct uc_struct* uc, uc_cb_eventmem_t callback,
|
||||
void *user_data, uc_hook_h *evh)
|
||||
void *user_data, uchook *evh)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
|
@ -825,7 +825,7 @@ static uc_err _hook_mem_invalid(struct uc_struct* uc, uc_cb_eventmem_t callback,
|
|||
|
||||
|
||||
static uc_err _hook_intr(struct uc_struct* uc, void *callback,
|
||||
void *user_data, uc_hook_h *evh)
|
||||
void *user_data, uchook *evh)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
|
@ -844,7 +844,7 @@ static uc_err _hook_intr(struct uc_struct* uc, void *callback,
|
|||
|
||||
|
||||
static uc_err _hook_insn(struct uc_struct *uc, unsigned int insn_id, void *callback,
|
||||
void *user_data, uc_hook_h *evh)
|
||||
void *user_data, uchook *evh)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
|
@ -895,7 +895,7 @@ static uc_err _hook_insn(struct uc_struct *uc, unsigned int insn_id, void *callb
|
|||
}
|
||||
|
||||
UNICORN_EXPORT
|
||||
uc_err uc_hook_add(ucengine *uc, uc_hook_h *hh, uc_hook_t type, void *callback, void *user_data, ...)
|
||||
uc_err uc_hook_add(ucengine *uc, uchook *hh, uc_hook_t type, void *callback, void *user_data, ...)
|
||||
{
|
||||
va_list valist;
|
||||
int ret = UC_ERR_OK;
|
||||
|
@ -951,7 +951,7 @@ uc_err uc_hook_add(ucengine *uc, uc_hook_h *hh, uc_hook_t type, void *callback,
|
|||
}
|
||||
|
||||
UNICORN_EXPORT
|
||||
uc_err uc_hook_del(ucengine *uc, uc_hook_h hh)
|
||||
uc_err uc_hook_del(ucengine *uc, uchook hh)
|
||||
{
|
||||
return hook_del(uc, hh);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue