diff --git a/include/unicorn/unicorn.h b/include/unicorn/unicorn.h index ce8b6ccc..6847bd8b 100644 --- a/include/unicorn/unicorn.h +++ b/include/unicorn/unicorn.h @@ -473,7 +473,8 @@ typedef enum uc_query_type { // The arguments include both input and output arugments. #define UC_CTL_IO_READ_WRITE (UC_CTL_IO_WRITE | UC_CTL_IO_READ) -#define UC_CTL(type, nr, rw) ((type) | ((nr) << 26) | ((rw) << 30)) +#define UC_CTL(type, nr, rw) \ + (uc_control_type)((type) | ((nr) << 26) | ((rw) << 30)) #define UC_CTL_NONE(type, nr) UC_CTL(type, nr, UC_CTL_IO_NONE) #define UC_CTL_READ(type, nr) UC_CTL(type, nr, UC_CTL_IO_READ) #define UC_CTL_WRITE(type, nr) UC_CTL(type, nr, UC_CTL_IO_WRITE) @@ -536,8 +537,10 @@ typedef enum uc_control_type { uc_ctl(uc, UC_CTL_READ(UC_CTL_UC_ARCH, 1), (arch)) #define uc_ctl_get_timeout(uc, ptr) \ uc_ctl(uc, UC_CTL_READ(UC_CTL_UC_TIMEOUT, 1), (ptr)) -#define uc_ctl_exits_enabled(uc, enabled) \ - uc_ctl(uc, UC_CTL_WRITE(UC_CTL_UC_USE_EXITS, 1), (enabled)) +#define uc_ctl_exits_enable(uc) \ + uc_ctl(uc, UC_CTL_WRITE(UC_CTL_UC_USE_EXITS, 1), 1) +#define uc_ctl_exits_disable(uc) \ + uc_ctl(uc, UC_CTL_WRITE(UC_CTL_UC_USE_EXITS, 1), 0) #define uc_ctl_get_exits_cnt(uc, ptr) \ uc_ctl(uc, UC_CTL_READ(UC_CTL_UC_EXITS_CNT, 1), (ptr)) #define uc_ctl_get_exits(uc, buffer, len) \ diff --git a/samples/sample_ctl.c b/samples/sample_ctl.c index 35fcbc06..119d1f02 100644 --- a/samples/sample_ctl.c +++ b/samples/sample_ctl.c @@ -118,7 +118,7 @@ void test_uc_ctl_exits() } // Enable multiple exits. - err = uc_ctl_exits_enabled(uc, true); + err = uc_ctl_exits_enable(uc); if (err) { printf("Failed on uc_ctl() with error returned: %u\n", err); return; diff --git a/tests/unit/test_ctl.c b/tests/unit/test_ctl.c index 04861c60..b4fa563f 100644 --- a/tests/unit/test_ctl.c +++ b/tests/unit/test_ctl.c @@ -88,7 +88,7 @@ static void test_uc_ctl_exits() uint64_t exits[] = {code_start + 6, code_start + 8}; uc_common_setup(&uc, UC_ARCH_X86, UC_MODE_32, code, sizeof(code) - 1); - OK(uc_ctl_exits_enabled(uc, true)); + OK(uc_ctl_exits_enable(uc)); OK(uc_ctl_set_exits(uc, exits, 2)); r_eax = 0; r_ebx = 0;