Makes the hook types consistent, with a single indicator for each of

read, write and fetch.

This commit only adds the enum values. The functionality still has to be
updated.

As per issue #111
This commit is contained in:
Sean Heelan 2015-09-22 12:26:01 +07:00
parent 734aa15fa6
commit 75c5904ec1
2 changed files with 22 additions and 20 deletions

View File

@ -53,19 +53,20 @@ UC_ERR_WRITE_UNALIGNED = 18
UC_ERR_FETCH_UNALIGNED = 19 UC_ERR_FETCH_UNALIGNED = 19
UC_MEM_READ = 16 UC_MEM_READ = 16
UC_MEM_WRITE = 17 UC_MEM_WRITE = 17
UC_MEM_READ_WRITE = 18 UC_MEM_FETCH = 18
UC_MEM_FETCH = 19 UC_MEM_WRITE_PROT = 19
UC_MEM_WRITE_PROT = 20 UC_MEM_READ_PROT = 20
UC_MEM_READ_PROT = 21 UC_MEM_FETCH_PROT = 21
UC_MEM_EXEC_PROT = 22
UC_HOOK_INTR = 32 UC_HOOK_INTR = 32
UC_HOOK_INSN = 33 UC_HOOK_INSN = 33
UC_HOOK_CODE = 34 UC_HOOK_CODE = 34
UC_HOOK_BLOCK = 35 UC_HOOK_BLOCK = 35
UC_HOOK_MEM_INVALID = 36 UC_HOOK_MEM_INVALID_READ = 36
UC_HOOK_MEM_READ = 37 UC_HOOK_MEM_INVALID_WRITE = 37
UC_HOOK_MEM_WRITE = 38 UC_HOOK_MEM_INVALID_FETCH = 38
UC_HOOK_MEM_READ_WRITE = 39 UC_HOOK_MEM_READ = 39
UC_HOOK_MEM_WRITE = 40
UC_HOOK_MEM_FETCH = 41
UC_PROT_NONE = 0 UC_PROT_NONE = 0
UC_PROT_READ = 1 UC_PROT_READ = 1

View File

@ -155,23 +155,24 @@ typedef void (*uc_cb_insn_out_t)(uc_engine *uc, uint32_t port, int size, uint32_
typedef enum uc_mem_type { typedef enum uc_mem_type {
UC_MEM_READ = 16, // Unmapped memory is read from UC_MEM_READ = 16, // Unmapped memory is read from
UC_MEM_WRITE, // Unmapped memory is written to UC_MEM_WRITE, // Unmapped memory is written to
UC_MEM_READ_WRITE, // Unmapped memory is accessed (either READ or WRITE) UC_MEM_FETCH, // Unmapped memory is fetched
UC_MEM_FETCH, // Unmapped memory is fetched
UC_MEM_WRITE_PROT, // Write to write protected, but mapped, memory UC_MEM_WRITE_PROT, // Write to write protected, but mapped, memory
UC_MEM_READ_PROT, // Read from read protected, but mapped, memory UC_MEM_READ_PROT, // Read from read protected, but mapped, memory
UC_MEM_EXEC_PROT, // Fetch from non-executable, but mapped, memory UC_MEM_FETCH_PROT, // Fetch from non-executable, but mapped, memory
} uc_mem_type; } uc_mem_type;
// All type of hooks for uc_hook_add() API. // All type of hooks for uc_hook_add() API.
typedef enum uc_hook_type { typedef enum uc_hook_type {
UC_HOOK_INTR = 32, // Hook all interrupt events UC_HOOK_INTR = 32, // Hook all interrupt events
UC_HOOK_INSN, // Hook a particular instruction UC_HOOK_INSN, // Hook a particular instruction
UC_HOOK_CODE, // Hook a range of code UC_HOOK_CODE, // Hook a range of code
UC_HOOK_BLOCK, // Hook basic blocks UC_HOOK_BLOCK, // Hook basic blocks
UC_HOOK_MEM_INVALID, // Hook for all invalid memory access events UC_HOOK_MEM_INVALID_READ, // Hook for invalid memory read events
UC_HOOK_MEM_READ, // Hook all memory read events. UC_HOOK_MEM_INVALID_WRITE, // Hook for invalid memory write events
UC_HOOK_MEM_WRITE, // Hook all memory write events. UC_HOOK_MEM_INVALID_FETCH, // Hook for invalid memory fetch for execution events
UC_HOOK_MEM_READ_WRITE, // Hook all memory accesses (either READ or WRITE). UC_HOOK_MEM_READ, // Hook all memory read events.
UC_HOOK_MEM_WRITE, // Hook all memory write events.
UC_HOOK_MEM_FETCH, // Hook all memory fetch for execution events
} uc_hook_type; } uc_hook_type;
// Callback function for hooking memory (UC_HOOK_MEM_*) // Callback function for hooking memory (UC_HOOK_MEM_*)