47 HtPPOptions lbl_options = { 0 };
48 lbl_options.cmp = (HtPPListComparator)strcmp;
49 lbl_options.hashfn = (HtPPHashFunction)
sdb_hash;
50 lbl_options.dupkey = (HtPPDupKey)
strdup;
51 lbl_options.dupvalue =
NULL;
53 lbl_options.elem_size =
sizeof(HtPPKv);
54 lbl_options.calcsizeK = (HtPPCalcSizeK)strlen;
57 RZ_LOG_ERROR(
"RzIL: cannot allocate VM label hashmap\n");
64 RZ_LOG_ERROR(
"RzIL: cannot allocate VM program counter\n");
293 return ht_pp_find(vm->vm_global_label_table, lbl_name,
NULL);
298 ht_pp_update(vm->vm_global_label_table,
label->label_id,
label);
RZ_API void Ht_() free(HtName_(Ht) *ht)
RZ_API const KEY_TYPE bool * found
RZ_API void rz_il_mem_free(RzILMem *mem)
RZ_API RzILSortPure rz_il_value_get_sort(RZ_NONNULL RzILVal *val)
RZ_API RZ_OWN RzILVal * rz_il_value_new_zero_of(RzILSortPure sort)
RZ_API void rz_il_value_free(RZ_NULLABLE RzILVal *val)
RZ_API void rz_il_event_free(RZ_NULLABLE RzILEvent *evt)
RZ_API RZ_BORROW RzILEffectLabel * rz_il_vm_create_label(RZ_NONNULL RzILVM *vm, RZ_NONNULL const char *name, RZ_NONNULL RZ_BORROW RzBitVector *addr)
RZ_API void rz_il_vm_set_local_var(RZ_NONNULL RzILVM *vm, RZ_NONNULL const char *name, RZ_OWN RzILVal *val)
RZ_API RZ_BORROW RzBitVector * rz_il_hash_find_addr_by_lblname(RZ_NONNULL RzILVM *vm, RZ_NONNULL const char *lbl_name)
RZ_API void rz_il_vm_set_global_var(RZ_NONNULL RzILVM *vm, RZ_NONNULL const char *name, RZ_OWN RzILVal *val)
RZ_API void rz_il_vm_add_mem(RzILVM *vm, RzILMemIndex index, RZ_OWN RzILMem *mem)
RZ_API RzILLocalPurePrev rz_il_vm_push_local_pure_var(RZ_NONNULL RzILVM *vm, RZ_NONNULL const char *name, RzILVal *val)
Create and assign a new local let binding.
RZ_IPI RzILOpEffectHandler rz_il_op_handler_effect_table_default[RZ_IL_OP_EFFECT_MAX]
RZ_API void rz_il_vm_fini(RzILVM *vm)
static void free_label_kv(HtPPKv *kv)
static RzILVarSet * var_set_of_kind(RzILVM *vm, RzILVarKind kind)
RZ_API void rz_il_vm_pop_local_pure_var(RZ_NONNULL RzILVM *vm, RZ_NONNULL const char *name, RzILLocalPurePrev prev)
Remove a local let binding and restore the state for the outer context.
RZ_API RZ_BORROW RzILEffectLabel * rz_il_vm_update_label(RZ_NONNULL RzILVM *vm, RZ_NONNULL char *name, RZ_NONNULL RZ_BORROW RzBitVector *addr)
RZ_API RZ_BORROW RzILEffectLabel * rz_il_vm_create_label_lazy(RZ_NONNULL RzILVM *vm, RZ_NONNULL const char *name)
RZ_API RZ_BORROW RzILEffectLabel * rz_il_vm_find_label_by_name(RZ_NONNULL RzILVM *vm, RZ_NONNULL const char *lbl_name)
RZ_API RZ_OWN RzPVector * rz_il_vm_get_all_vars(RZ_NONNULL RzILVM *vm, RzILVarKind kind)
RZ_API RZ_BORROW RzILVal * rz_il_vm_get_var_value(RZ_NONNULL RzILVM *vm, RzILVarKind kind, const char *name)
RZ_API RzILMem * rz_il_vm_get_mem(RzILVM *vm, RzILMemIndex index)
RZ_API RZ_BORROW RzILVar * rz_il_vm_create_global_var(RZ_NONNULL RzILVM *vm, RZ_NONNULL const char *name, RzILSortPure sort)
RZ_IPI RzILOpPureHandler rz_il_op_handler_pure_table_default[RZ_IL_OP_PURE_MAX]
RZ_API RzILVM * rz_il_vm_new(ut64 start_addr, ut32 addr_size, bool big_endian)
RZ_API void rz_il_vm_free(RzILVM *vm)
RZ_API bool rz_il_vm_init(RzILVM *vm, ut64 start_addr, ut32 addr_size, bool big_endian)
RZ_API RZ_BORROW RzILVar * rz_il_vm_get_var(RZ_NONNULL RzILVM *vm, RzILVarKind kind, const char *name)
RZ_API ut32 rz_il_vm_get_pc_len(RzILVM *vm)
RZ_API void rz_il_vm_add_label(RZ_NONNULL RzILVM *vm, RZ_NONNULL RzILEffectLabel *label)
RZ_API RzILEffectLabel * rz_il_effect_label_new(RZ_NONNULL const char *name, RzILEffectLabelType type)
RZ_API void rz_il_effect_label_free(RzILEffectLabel *lbl)
memcpy(mem, inblock.get(), min(CONTAINING_RECORD(inblock.get(), MEMBLOCK, data) ->size, size))
RZ_API RZ_OWN RzList * rz_list_newf(RzListFree f)
Returns a new initialized RzList pointer and sets the free method.
RZ_API void rz_list_free(RZ_NONNULL RzList *list)
Empties the list and frees the list pointer.
return strdup("=SP r13\n" "=LR r14\n" "=PC r15\n" "=A0 r0\n" "=A1 r1\n" "=A2 r2\n" "=A3 r3\n" "=ZF zf\n" "=SF nf\n" "=OF vf\n" "=CF cf\n" "=SN or0\n" "gpr lr .32 56 0\n" "gpr pc .32 60 0\n" "gpr cpsr .32 64 0 ____tfiae_________________qvczn\n" "gpr or0 .32 68 0\n" "gpr tf .1 64.5 0 thumb\n" "gpr ef .1 64.9 0 endian\n" "gpr jf .1 64.24 0 java\n" "gpr qf .1 64.27 0 sticky_overflow\n" "gpr vf .1 64.28 0 overflow\n" "gpr cf .1 64.29 0 carry\n" "gpr zf .1 64.30 0 zero\n" "gpr nf .1 64.31 0 negative\n" "gpr itc .4 64.10 0 if_then_count\n" "gpr gef .4 64.16 0 great_or_equal\n" "gpr r0 .32 0 0\n" "gpr r1 .32 4 0\n" "gpr r2 .32 8 0\n" "gpr r3 .32 12 0\n" "gpr r4 .32 16 0\n" "gpr r5 .32 20 0\n" "gpr r6 .32 24 0\n" "gpr r7 .32 28 0\n" "gpr r8 .32 32 0\n" "gpr r9 .32 36 0\n" "gpr r10 .32 40 0\n" "gpr r11 .32 44 0\n" "gpr r12 .32 48 0\n" "gpr r13 .32 52 0\n" "gpr r14 .32 56 0\n" "gpr r15 .32 60 0\n" "gpr r16 .32 64 0\n" "gpr r17 .32 68 0\n")
#define rz_warn_if_reached()
#define rz_warn_if_fail(expr)
#define rz_return_if_fail(expr)
#define rz_return_val_if_fail(expr, val)
RZ_API RZ_OWN RzBitVector * rz_bv_dup(const RZ_NONNULL RzBitVector *bv)
RZ_API void rz_bv_free(RZ_NULLABLE RzBitVector *bv)
RZ_API ut32 rz_bv_len(RZ_NONNULL const RzBitVector *bv)
RZ_API RZ_OWN RzBitVector * rz_bv_new_from_ut64(ut32 length, ut64 value)
void *(* RzILOpPureHandler)(RzILVM *vm, RzILOpPure *op, RZ_NONNULL RZ_OUT RzILTypePure *type)
Evaluation callback for a single pure opcode.
bool(* RzILOpEffectHandler)(RzILVM *vm, RzILOpEffect *op)
Evaluation (execution) callback for a single effect opcode.
RZ_NULLABLE RzILVal * RzILLocalPurePrev
void(* RzListFree)(void *ptr)
#define RZ_LOG_ERROR(fmtstr,...)
RZ_API void rz_mem_free(void *)
static void ** rz_pvector_reserve(RzPVector *vec, size_t capacity)
static void rz_pvector_set(RzPVector *vec, size_t index, void *e)
RZ_API void rz_pvector_init(RzPVector *vec, RzPVectorFree free)
RZ_API void rz_pvector_fini(RzPVector *vec)
static size_t rz_pvector_len(const RzPVector *vec)
void(* RzPVectorFree)(void *e)
static void ** rz_pvector_push(RzPVector *vec, void *x)
static void * rz_pvector_at(const RzPVector *vec, size_t index)
RZ_API ut32 sdb_hash(const char *key)
RzBitVector * addr
RzBitVector address if EFFECT_LABEL_ADDR.
A single memory as part of the RzIL VM.
Holds a set of variable definitions and their current contents This is meant only as a low-level cont...
Definition of a variable inside the vm.
Low-level VM to execute raw IL code.
RzILOpPureHandler * op_handler_pure_table
Array of Handler, handler can be indexed by opcode.
RzILVarSet local_vars
All local variables, created by local set ops.
ut32 lab_count
count for VM predefined things
RzList * events
List of events that has happened in the last step.
ut32 addr_size
size of address space
bool big_endian
Sets the endianness of the memory reads/writes operations.
RzILVarSet local_pure_vars
All local variables, during execution temporarily bound by let, only usable in pure expressions and i...
RzILVarSet global_vars
All global variables (usually bound to registers)
RzBitVector * pc
Program Counter of VM.
RzPVector vm_memory
Memories available in the VM, by their index. May be sparse (contain NULLs).
HtPP * vm_global_label_table
Hashtable to maintain the label and address.
RzILOpEffectHandler * op_handler_effect_table
Array of Handler, handler can be indexed by opcode.
RZ_API RZ_BORROW RzILVar * rz_il_var_set_create_var(RzILVarSet *vs, const char *name, RzILSortPure sort)
RZ_API bool rz_il_var_set_bind(RzILVarSet *vs, const char *name, RZ_OWN RzILVal *val)
RZ_API bool rz_il_var_set_init(RzILVarSet *vs)
RZ_API RZ_OWN RzPVector * rz_il_var_set_get_all(RzILVarSet *vs)
RZ_API RZ_BORROW RzILVar * rz_il_var_set_get(RzILVarSet *vs, const char *name)
RZ_API RZ_BORROW RzILVal * rz_il_var_set_get_value(RzILVarSet *vs, const char *name)
RZ_API void rz_il_var_set_fini(RzILVarSet *vs)
RZ_API RZ_OWN RZ_NULLABLE RzILVal * rz_il_var_set_remove_var(RzILVarSet *vs, const char *name)
@ RZ_IL_VAR_KIND_GLOBAL
global var, usually bound to a physical representation like a register.
@ RZ_IL_VAR_KIND_LOCAL
local var, defined and assigned by set ops, mutable and useable across effects.
@ RZ_IL_VAR_KIND_LOCAL_PURE
local pure var, bound only by let expressions, scope is limited to the let's pure body,...
ut64(WINAPI *w32_GetEnabledXStateFeatures)()