This commit is contained in:
lazymio 2021-10-28 15:58:00 +02:00
parent c95364e3ca
commit 4da100b94b
No known key found for this signature in database
GPG Key ID: DFF27E34A47CB873
1 changed files with 30 additions and 17 deletions

View File

@ -397,9 +397,9 @@ typedef enum uc_query_type {
// R/W NR Reserved Type
// [ ] [ ] [ ] [ ]
// 31 29 28 26 25 16 15 0
#define UC_CTL_IO_N (1<<29)
#define UC_CTL_IO_W (1<<30)
#define UC_CTL_IO_R (1<<31)
#define UC_CTL_IO_N (1 << 29)
#define UC_CTL_IO_W (1 << 30)
#define UC_CTL_IO_R (1 << 31)
#define UC_CTL_IO_RW (UC_CTL_IO_W | UC_CTL_IO_R)
#define UC_CTL(type, nr, rw) ((type) | ((nr) << 26) | ((rw) << 29))
@ -414,33 +414,41 @@ typedef enum uc_control_type {
// Current mode.
// Get: @args = (*int)
UC_CTL_UC_MODE,
#define uc_ctl_get_mode(uc, mode) uc_ctl(uc, UC_CTL_R(UC_CTL_UC_MODE, 1), (mode))
#define uc_ctl_get_mode(uc, mode) \
uc_ctl(uc, UC_CTL_R(UC_CTL_UC_MODE, 1), (mode))
// Curent page size.
// Set: @args = (int)
// Get: @args = (*int)
UC_CTL_UC_PAGE_SIZE,
#define uc_ctl_get_page_size(uc, ptr) uc_ctl(uc, UC_CTL_R(UC_CTL_UC_PAGE_SIZE, 1, (ptr))
#define uc_ctl_set_page_size(uc, page_size) uc_ctl(uc, UC_CTL_W(UC_CTL_UC_PAGE_SIZE, 1), (page_size))
#define uc_ctl_get_page_size(uc, ptr) \
uc_ctl(uc, UC_CTL_R(UC_CTL_UC_PAGE_SIZE, 1, (ptr))
#define uc_ctl_set_page_size(uc, page_size) \
uc_ctl(uc, UC_CTL_W(UC_CTL_UC_PAGE_SIZE, 1), (page_size))
// Current arch.
// Get: @args = (*int)
UC_CTL_UC_ARCH,
#define uc_ctl_get_arch(uc, arch) uc_ctl(uc, UC_CTL_R(UC_CTL_UC_ARCH, 1), (arch))
#define uc_ctl_get_arch(uc, arch) \
uc_ctl(uc, UC_CTL_R(UC_CTL_UC_ARCH, 1), (arch))
// Current timeout.
// Get: @args = (*uint64_t)
UC_CTL_UC_TIMEOUT,
#define uc_ctl_get_timeout(uc, ptr) uc_ctl(uc, UC_CTL_R(UC_CTL_UC_TIMEOUT, 1), (ptr))
#define uc_ctl_get_timeout(uc, ptr) \
uc_ctl(uc, UC_CTL_R(UC_CTL_UC_TIMEOUT, 1), (ptr))
// The number of current exists.
// Get: @args = (*size_t)
UC_CTL_UC_EXITS_CNT,
#define uc_ctl_get_exists_cnt(uc, ptr) uc_ctl(uc, UC_CTL_R(UC_CTL_UC_EXITS_CNT, 1), (ptr))
#define uc_ctl_get_exists_cnt(uc, ptr) \
uc_ctl(uc, UC_CTL_R(UC_CTL_UC_EXITS_CNT, 1), (ptr))
// Current exists.
// Set: @args = (*uint64_t exists, size_t len)
// @len = UC_CTL_UC_EXITS_CNT
// Get: @args = (*uint64_t exists, size_t len)
// @len = UC_CTL_UC_EXITS_CNT
UC_CTL_UC_EXITS,
#define uc_ctl_get_exists(uc, buffer, len) uc_ctl(uc, UC_CTL_R(UC_CTL_UC_EXITS, 2), (buffer), (len))
#define uc_ctl_set_exists(uc, buffer, len) uc_ctl(uc, UC_CTL_W(UC_CTL_UC_EXITS, 2), (buffer), (len))
#define uc_ctl_get_exists(uc, buffer, len) \
uc_ctl(uc, UC_CTL_R(UC_CTL_UC_EXITS, 2), (buffer), (len))
#define uc_ctl_set_exists(uc, buffer, len) \
uc_ctl(uc, UC_CTL_W(UC_CTL_UC_EXITS, 2), (buffer), (len))
// Set the cpu model of uc.
// Note this option can only be set before any Unicorn
@ -448,18 +456,23 @@ typedef enum uc_control_type {
// Set: @args = (int)
// Get: @args = (int)
UC_CTL_CPU_MODEL,
#define uc_ctl_get_cpu_model(uc, model) uc_ctl(uc, UC_CTL_R(UC_CTL_CPU_MODEL, 1), (model))
#define uc_ctl_set_cpu_model(uc, model) uc_ctl(uc, UC_CTL_W(UC_CTL_CPU_MODEL, 1), (model))
#define uc_ctl_get_cpu_model(uc, model) \
uc_ctl(uc, UC_CTL_R(UC_CTL_CPU_MODEL, 1), (model))
#define uc_ctl_set_cpu_model(uc, model) \
uc_ctl(uc, UC_CTL_W(UC_CTL_CPU_MODEL, 1), (model))
// Remove TB cache at a specifc address.
// Del: @args = (uint64_t)
// Set: @args = (uint64_t)
UC_CTL_CPU_CACHE,
#define uc_ctl_del_cache(uc, address) uc_ctl(uc, UC_CTL_N(UC_CTL_REMOTE_CACHE, 1), (address))
#define uc_ctl_set_cache(uc, address) uc_ctl(uc, UC_CTL_W(UC_CTL_REMOTE_CACHE, 1), (address))
#define uc_ctl_del_cache(uc, address) \
uc_ctl(uc, UC_CTL_N(UC_CTL_REMOTE_CACHE, 1), (address))
#define uc_ctl_set_cache(uc, address) \
uc_ctl(uc, UC_CTL_W(UC_CTL_REMOTE_CACHE, 1), (address))
// Request the edge of two TBs.
// Get: @args = (uint64_t, uint64_t, *uint64_t)
UC_CTL_CPU_TB_EDGE
#define uc_ctl_get_edge(uc, addr1, addr2, ptr) uc_ctl(uc, UC_CTL_RW(UC_CTL_CPU_TB_EDGE, 3), (address))
#define uc_ctl_get_edge(uc, addr1, addr2, ptr) \
uc_ctl(uc, UC_CTL_RW(UC_CTL_CPU_TB_EDGE, 3), (address))
} uc_control_type;
// Opaque storage for CPU context, used with uc_context_*()