Rizin
unix-like reverse engineering framework and cli tools
|
#include <rz_reg.h>
Go to the source code of this file.
Classes | |
struct | rz_il_reg_binding_item_t |
struct | rz_il_reg_binding_t |
Typedefs | |
typedef struct rz_il_reg_binding_item_t | RzILRegBindingItem |
typedef struct rz_il_reg_binding_t | RzILRegBinding |
Functions | |
RZ_API RzILRegBinding * | rz_il_reg_binding_derive (RZ_NONNULL RzReg *reg) |
Calculate a new binding of IL variables against the profile of the given RzReg. More... | |
RZ_API RzILRegBinding * | rz_il_reg_binding_exactly (RZ_NONNULL RzReg *reg, size_t regs_count, RZ_NONNULL RZ_BORROW const char **regs) |
RZ_API void | rz_il_reg_binding_free (RzILRegBinding *rb) |
RZ_API void | rz_il_vm_setup_reg_binding (RZ_NONNULL struct rz_il_vm_t *vm, RZ_NONNULL RZ_BORROW RzILRegBinding *rb) |
RZ_API bool | rz_il_vm_sync_to_reg (RZ_NONNULL struct rz_il_vm_t *vm, RZ_NONNULL RzILRegBinding *rb, RZ_NONNULL RzReg *reg) |
RZ_API void | rz_il_vm_sync_from_reg (RZ_NONNULL struct rz_il_vm_t *vm, RZ_NONNULL RzILRegBinding *rb, RZ_NONNULL RzReg *reg) |
typedef struct rz_il_reg_binding_t RzILRegBinding |
An object that describes what registers are bound to variables in an RzILVM. Registers of size 1 are bound as boolean variables, others as bitvector ones.
typedef struct rz_il_reg_binding_item_t RzILRegBindingItem |
RZ_API RzILRegBinding* rz_il_reg_binding_derive | ( | RZ_NONNULL RzReg * | reg | ) |
Calculate a new binding of IL variables against the profile of the given RzReg.
Because registers can overlap, not all registers may get a binding. Informally, only the "larger" ones, containing "smaller" ones are bound, except for 1-bit registers, which are always preferred.
More specifically, the set of registers to be bound is determined like this: First, bind all 1-bit registers (flags). Then, bind a (sub)set of the remaining registers like this:
If two registers have the same offset and size, the result is currently undefined.
Definition at line 35 of file il_reg.c.
References err, flags, free(), i, name, rz_il_reg_binding_item_t::name, rz_reg_item_t::name, NULL, rz_reg_item_t::offset, pc, reg, reg_binding_item_fini(), reg_offset_cmp(), regs, rz_il_reg_binding_t::regs, rz_il_reg_binding_t::regs_count, rz_list_free(), rz_list_new(), rz_list_push(), rz_list_sort(), RZ_NEW0, rz_reg_filter_items_covered(), rz_reg_get_name(), RZ_REG_NAME_PC, RZ_REG_TYPE_LAST, rz_return_val_if_fail, rz_vector_fini(), rz_vector_flush(), rz_vector_init(), rz_vector_len(), rz_vector_push(), rz_il_reg_binding_item_t::size, rz_reg_item_t::size, and strdup().
Referenced by setup_regs().
RZ_API RzILRegBinding* rz_il_reg_binding_exactly | ( | RZ_NONNULL RzReg * | reg, |
size_t | regs_count, | ||
RZ_NONNULL RZ_BORROW const char ** | regs | ||
) |
Create a new binding that binds exactly the given register names, querying reg
for any additionally needed info
regs | array of regs_count names of registers. Each of these must be part of reg and they must not overlap. |
Definition at line 154 of file il_reg.c.
References free(), i, rz_il_reg_binding_item_t::name, NULL, rz_reg_item_t::offset, reg, reg_binding_item_fini(), regs, rz_il_reg_binding_t::regs, rz_il_reg_binding_t::regs_count, RZ_NEW, RZ_NEWS, RZ_NEWS0, rz_reg_get(), RZ_REG_TYPE_ANY, rz_return_val_if_fail, rz_il_reg_binding_item_t::size, rz_reg_item_t::size, strdup(), type, and rz_reg_item_t::type.
Referenced by setup_regs().
RZ_API void rz_il_reg_binding_free | ( | RzILRegBinding * | rb | ) |
Definition at line 207 of file il_reg.c.
References free(), i, NULL, reg_binding_item_fini(), rz_il_reg_binding_t::regs, and rz_il_reg_binding_t::regs_count.
Referenced by rz_analysis_il_vm_free().
RZ_API void rz_il_vm_setup_reg_binding | ( | RZ_NONNULL struct rz_il_vm_t * | vm, |
RZ_NONNULL RZ_BORROW RzILRegBinding * | rb | ||
) |
RZ_API void rz_il_vm_sync_from_reg | ( | RZ_NONNULL struct rz_il_vm_t * | vm, |
RZ_NONNULL RzILRegBinding * | rb, | ||
RZ_NONNULL RzReg * | reg | ||
) |
RZ_API bool rz_il_vm_sync_to_reg | ( | RZ_NONNULL struct rz_il_vm_t * | vm, |
RZ_NONNULL RzILRegBinding * | rb, | ||
RZ_NONNULL RzReg * | reg | ||
) |