cleanup & update bindings' constants

This commit is contained in:
Nguyen Anh Quynh 2015-09-04 09:43:31 +08:00
parent e54519c09f
commit 0962c4822b
4 changed files with 23 additions and 16 deletions

View File

@ -34,7 +34,7 @@ const (
UC_MODE_MIPS64 = 8 UC_MODE_MIPS64 = 8
UC_ERR_OK = 0 UC_ERR_OK = 0
UC_ERR_OOM = 1 UC_ERR_NOMEM = 1
UC_ERR_ARCH = 2 UC_ERR_ARCH = 2
UC_ERR_HANDLE = 3 UC_ERR_HANDLE = 3
UC_ERR_UCH = 4 UC_ERR_UCH = 4
@ -46,13 +46,16 @@ const (
UC_ERR_HOOK = 10 UC_ERR_HOOK = 10
UC_ERR_INSN_INVALID = 11 UC_ERR_INSN_INVALID = 11
UC_ERR_MAP = 12 UC_ERR_MAP = 12
UC_ERR_MEM_WRITE_NW = 13 UC_ERR_WRITE_PROT = 13
UC_ERR_MEM_READ_NR = 14 UC_ERR_READ_PROT = 14
UC_ERR_EXEC_PROT = 15
UC_ERR_INVAL = 16
UC_MEM_READ = 16 UC_MEM_READ = 16
UC_MEM_WRITE = 17 UC_MEM_WRITE = 17
UC_MEM_READ_WRITE = 18 UC_MEM_READ_WRITE = 18
UC_MEM_WRITE_NW = 19 UC_MEM_WRITE_PROT = 19
UC_MEM_READ_NR = 20 UC_MEM_READ_PROT = 20
UC_MEM_EXEC_PROT = 21
UC_HOOK_INTR = 32 UC_HOOK_INTR = 32
UC_HOOK_INSN = 33 UC_HOOK_INSN = 33
UC_HOOK_CODE = 34 UC_HOOK_CODE = 34
@ -65,5 +68,6 @@ const (
UC_PROT_NONE = 0 UC_PROT_NONE = 0
UC_PROT_READ = 1 UC_PROT_READ = 1
UC_PROT_WRITE = 2 UC_PROT_WRITE = 2
UC_PROT_ALL = 3 UC_PROT_EXEC = 4
UC_PROT_ALL = 7
) )

View File

@ -32,7 +32,7 @@ UC_MODE_MIPS32 = 4
UC_MODE_MIPS64 = 8 UC_MODE_MIPS64 = 8
UC_ERR_OK = 0 UC_ERR_OK = 0
UC_ERR_OOM = 1 UC_ERR_NOMEM = 1
UC_ERR_ARCH = 2 UC_ERR_ARCH = 2
UC_ERR_HANDLE = 3 UC_ERR_HANDLE = 3
UC_ERR_UCH = 4 UC_ERR_UCH = 4
@ -44,13 +44,16 @@ UC_ERR_CODE_INVALID = 9
UC_ERR_HOOK = 10 UC_ERR_HOOK = 10
UC_ERR_INSN_INVALID = 11 UC_ERR_INSN_INVALID = 11
UC_ERR_MAP = 12 UC_ERR_MAP = 12
UC_ERR_MEM_WRITE_NW = 13 UC_ERR_WRITE_PROT = 13
UC_ERR_MEM_READ_NR = 14 UC_ERR_READ_PROT = 14
UC_ERR_EXEC_PROT = 15
UC_ERR_INVAL = 16
UC_MEM_READ = 16 UC_MEM_READ = 16
UC_MEM_WRITE = 17 UC_MEM_WRITE = 17
UC_MEM_READ_WRITE = 18 UC_MEM_READ_WRITE = 18
UC_MEM_WRITE_NW = 19 UC_MEM_WRITE_PROT = 19
UC_MEM_READ_NR = 20 UC_MEM_READ_PROT = 20
UC_MEM_EXEC_PROT = 21
UC_HOOK_INTR = 32 UC_HOOK_INTR = 32
UC_HOOK_INSN = 33 UC_HOOK_INSN = 33
UC_HOOK_CODE = 34 UC_HOOK_CODE = 34
@ -63,4 +66,5 @@ UC_HOOK_MEM_READ_WRITE = 39
UC_PROT_NONE = 0 UC_PROT_NONE = 0
UC_PROT_READ = 1 UC_PROT_READ = 1
UC_PROT_WRITE = 2 UC_PROT_WRITE = 2
UC_PROT_ALL = 3 UC_PROT_EXEC = 4
UC_PROT_ALL = 7

View File

@ -447,9 +447,8 @@ uc_err uc_mem_unmap(uch handle, uint64_t address, size_t size);
This must be some combination of UC_PROT_READ | UC_PROT_WRITE | UC_PROT_EXEC, This must be some combination of UC_PROT_READ | UC_PROT_WRITE | UC_PROT_EXEC,
or this will return with UC_ERR_INVAL error. or this will return with UC_ERR_INVAL error.
@return UC_ERR_OK on success, UC_ERR_HANDLE for an invalid handle, UC_ERR_INVAL @return UC_ERR_OK on success, or other value on failure (refer to uc_err enum
for invalid perms or unaligned address or size, UC_ERR_NOMEM if entire region for detailed error).
is not mapped.
*/ */
UNICORN_EXPORT UNICORN_EXPORT
uc_err uc_mem_protect(uch handle, uint64_t address, size_t size, uint32_t perms); uc_err uc_mem_protect(uch handle, uint64_t address, size_t size, uint32_t perms);

View File

@ -64,7 +64,7 @@ static void test_sparc(void)
// emulate machine code in infinite time (last param = 0), or when // emulate machine code in infinite time (last param = 0), or when
// finishing all the code. // finishing all the code.
err = uc_emu_start(handle, ADDRESS, ADDRESS + sizeof(SPARC_CODE) -1, 0, 0); err = uc_emu_start(handle, ADDRESS, ADDRESS + sizeof(SPARC_CODE) - 1, 0, 0);
if (err) { if (err) {
printf("Failed on uc_emu_start() with error returned: %u (%s)\n", printf("Failed on uc_emu_start() with error returned: %u (%s)\n",
err, uc_strerror(err)); err, uc_strerror(err));