Rizin
unix-like reverse engineering framework and cli tools
|
#include <rz_analysis.h>
Go to the source code of this file.
RZ_API void rz_analysis_il_config_add_label | ( | RZ_NONNULL RzAnalysisILConfig * | cfg, |
RZ_NONNULL RZ_OWN RzILEffectLabel * | label | ||
) |
Add label
to the IL config cfg
to describe that it is globally available in a vm
Definition at line 77 of file analysis_il.c.
References rz_pvector_push(), and rz_return_if_fail.
Referenced by il_config(), rz_arm_cs_32_il_config(), and rz_arm_cs_64_il_config().
RZ_API void rz_analysis_il_config_free | ( | RzAnalysisILConfig * | cfg | ) |
Definition at line 66 of file analysis_il.c.
References free(), rz_analysis_il_config_t::labels, and rz_pvector_fini().
Referenced by il_config(), and rz_analysis_il_vm_new().
RZ_API RZ_OWN RzAnalysisILConfig* rz_analysis_il_config_new | ( | ut32 | pc_size, |
bool | big_endian, | ||
ut32 | mem_key_size | ||
) |
Create an IL config and initialize it with the given minimal mandatory info
Definition at line 53 of file analysis_il.c.
References NULL, r, rz_il_effect_label_free(), RZ_NEW0, rz_pvector_init(), and rz_return_val_if_fail.
Referenced by il_config(), rz_arm_cs_32_il_config(), rz_arm_cs_64_il_config(), rz_avr_il_config(), and rz_sh_il_config().
RZ_API void rz_analysis_il_init_state_free | ( | RzAnalysisILInitState * | state | ) |
RZ_API RzAnalysisILInitState* rz_analysis_il_init_state_new | ( | ) |
Definition at line 19 of file analysis_il.c.
References NULL, r, RZ_NEW0, rz_vector_init(), and var_state_free().
Referenced by il_config().
RZ_API void rz_analysis_il_init_state_set_var | ( | RZ_NONNULL RzAnalysisILInitState * | state, |
RZ_NONNULL const char * | name, | ||
RZ_NONNULL RZ_OWN RzILVal * | val | ||
) |
Set the value of the global variable called name
name to val
in the initial state state
Definition at line 38 of file analysis_il.c.
References name, NULL, rz_il_value_free(), rz_return_if_fail, rz_vector_push(), v, and val.
Referenced by il_config().
RZ_API void rz_analysis_il_vm_cleanup | ( | RzAnalysis * | analysis | ) |
Destroy the global user-faced vm
Definition at line 303 of file analysis_il.c.
References rz_analysis_t::il_vm, NULL, rz_analysis_il_vm_free(), and rz_return_if_fail.
Referenced by rz_analysis_free(), and rz_analysis_il_vm_setup().
RZ_API void rz_analysis_il_vm_free | ( | RZ_NULLABLE RzAnalysisILVM * | vm | ) |
Frees an RzAnalysisILVM instance
Definition at line 125 of file analysis_il.c.
References free(), rz_buf_free(), rz_il_reg_binding_free(), and rz_il_vm_free().
Referenced by print_and_check_il(), and rz_analysis_il_vm_cleanup().
RZ_API RZ_OWN RzAnalysisILVM* rz_analysis_il_vm_new | ( | RzAnalysis * | a, |
RZ_NULLABLE RzReg * | init_state_reg | ||
) |
Create and initialize an RzAnalysisILVM with the current arch/cpu/bits configuration and plugin init_state_reg
optional RzReg to take variable values from, unless the plugin overrides them using RzAnalysisILInitState
Definition at line 98 of file analysis_il.c.
References a, free(), NULL, r, rz_analysis_il_config_free(), rz_buf_free(), rz_buf_new_with_io(), RZ_NEW0, rz_return_val_if_fail, setup_vm_from_config(), and setup_vm_init_state().
Referenced by print_and_check_il(), and rz_analysis_il_vm_setup().
RZ_API bool rz_analysis_il_vm_setup | ( | RzAnalysis * | analysis | ) |
(Re)initialize the global user-faced vm
Definition at line 285 of file analysis_il.c.
References rz_analysis_t::cur, rz_analysis_plugin_t::il_config, rz_analysis_t::il_vm, rz_analysis_t::reg, rz_analysis_il_vm_t::reg_binding, rz_analysis_il_vm_cleanup(), rz_analysis_il_vm_new(), rz_il_vm_sync_to_reg(), rz_return_val_if_fail, and rz_analysis_il_vm_t::vm.
Referenced by rz_analysis_use(), and rz_core_analysis_il_reinit().
RZ_API RzAnalysisILStepResult rz_analysis_il_vm_step | ( | RZ_NONNULL RzAnalysis * | analysis, |
RZ_NONNULL RzAnalysisILVM * | vm, | ||
RZ_NULLABLE RzReg * | reg | ||
) |
Perform a single step in the VM
If given, this syncs the contents of reg
into the vm. Then it disassembles an instruction at the program counter of the vm and executes it. Finally, if no error occured, the contents are optionally synced back to reg
.
Definition at line 240 of file analysis_il.c.
References addr, NULL, r, reg, RZ_ANALYSIS_IL_STEP_IL_RUNTIME_ERROR, RZ_ANALYSIS_IL_STEP_INVALID_OP, RZ_ANALYSIS_IL_STEP_RESULT_NOT_SET_UP, RZ_ANALYSIS_IL_STEP_RESULT_SUCCESS, rz_analysis_il_vm_sync_from_reg(), rz_analysis_il_vm_sync_to_reg(), rz_analysis_op(), rz_analysis_op_fini(), RZ_ANALYSIS_OP_MASK_HINT, RZ_ANALYSIS_OP_MASK_IL, rz_bv_to_ut64(), rz_il_vm_step(), rz_return_val_if_fail, and ut64().
Referenced by rz_core_il_step().
RZ_API void rz_analysis_il_vm_sync_from_reg | ( | RzAnalysisILVM * | vm, |
RZ_NONNULL RzReg * | reg | ||
) |
Set the values of all variables in vm
that are bound to registers and PC to the respective contents from reg
.
This is like the low-level rz_il_vm_sync_from_reg()
, but uses the binding that is part of vm
. See its documentation for details.
Definition at line 213 of file analysis_il.c.
References reg, rz_analysis_il_vm_t::reg_binding, rz_il_vm_sync_from_reg(), rz_return_if_fail, and rz_analysis_il_vm_t::vm.
Referenced by rz_analysis_il_vm_step().
RZ_API bool rz_analysis_il_vm_sync_to_reg | ( | RzAnalysisILVM * | vm, |
RZ_NONNULL RzReg * | reg | ||
) |
Set the values of all bound regs in reg
to the respective variable or PC contents in vm
.
This is like the low-level rz_il_vm_sync_to_reg()
, but uses the binding that is part of vm
. See its documentation for details.
Definition at line 226 of file analysis_il.c.
References reg, rz_analysis_il_vm_t::reg_binding, rz_il_vm_sync_to_reg(), rz_return_val_if_fail, and rz_analysis_il_vm_t::vm.
Referenced by rz_analysis_il_vm_step().
|
static |
Definition at line 135 of file analysis_il.c.
References a, count, free(), reg, rz_analysis_il_vm_t::reg_binding, rz_analysis_il_config_t::reg_bindings, rz_il_reg_binding_derive(), rz_il_reg_binding_exactly(), rz_il_vm_setup_reg_binding(), rz_reg_free(), rz_reg_new(), rz_reg_set_profile_string(), and rz_analysis_il_vm_t::vm.
Referenced by setup_vm_from_config().
|
static |
Definition at line 177 of file analysis_il.c.
References rz_analysis_il_config_t::big_endian, rz_analysis_il_vm_t::io_buf, rz_analysis_il_config_t::labels, rz_analysis_il_config_t::mem_key_size, NULL, rz_analysis_il_config_t::pc_size, rz_il_effect_label_dup(), rz_il_mem_new(), rz_il_vm_add_label(), rz_il_vm_add_mem(), rz_il_vm_free(), rz_il_vm_new(), rz_pvector_foreach, setup_regs(), and rz_analysis_il_vm_t::vm.
Referenced by rz_analysis_il_vm_new().
|
static |
Definition at line 195 of file analysis_il.c.
References reg, rz_analysis_il_vm_t::reg_binding, rz_il_value_dup(), rz_il_vm_set_global_var(), rz_il_vm_sync_from_reg(), rz_vector_foreach, v, and rz_analysis_il_vm_t::vm.
Referenced by rz_analysis_il_vm_new().
|
static |
Definition at line 11 of file analysis_il.c.
References e, rz_il_value_free(), and s.
Referenced by rz_analysis_il_init_state_new().