Rizin
unix-like reverse engineering framework and cli tools
|
#include <rz_util.h>
Go to the source code of this file.
Classes | |
struct | rz_il_mem_t |
A single memory as part of the RzIL VM. More... | |
Typedefs | |
typedef ut32 | RzILMemIndex |
typedef struct rz_il_mem_t | RzILMem |
A single memory as part of the RzIL VM. More... | |
Functions | |
RZ_API RzILMem * | rz_il_mem_new (RzBuffer *buf, ut32 key_len) |
RZ_API void | rz_il_mem_free (RzILMem *mem) |
RZ_API ut32 | rz_il_mem_key_len (RzILMem *mem) |
Get the bit-size of a key (address) into the memory. More... | |
RZ_API ut32 | rz_il_mem_value_len (RzILMem *mem) |
Get the bit-size of a value in the memory. More... | |
RZ_API RzBitVector * | rz_il_mem_load (RzILMem *mem, RzBitVector *key) |
RZ_API bool | rz_il_mem_store (RzILMem *mem, RzBitVector *key, RzBitVector *value) |
RZ_API RzBitVector * | rz_il_mem_loadw (RzILMem *mem, RzBitVector *key, ut32 n_bits, bool big_endian) |
RZ_API bool | rz_il_mem_storew (RzILMem *mem, RzBitVector *key, RzBitVector *value, bool big_endian) |
typedef struct rz_il_mem_t RzILMem |
A single memory as part of the RzIL VM.
This can be seen as an array of bitvectors, indexed by bitvector keys, covering a certain address space. It corresponds to ('a, 'b) mem
in bap where 'a and 'b statically determine the size of all keys and values, respectively. Because currently our memory can only bind to an RzBuffer, the key size is limited to a maximum of 64bits and the value size is always 8, but this can be extended in the future if necessary.
typedef ut32 RzILMemIndex |
Free a Mem
mem | memory to be free |
Definition at line 34 of file mem.c.
References free(), mem, and rz_buf_free().
Referenced by rz_il_vm_init().
Get the bit-size of a key (address) into the memory.
For all k, rz_bv_len(rz_il_mem_load(mem, k)) == rz_il_mem_value_len(mem)
. So this could be seen as the size of a byte. Because we only support RzBuffer-based mems at the moment, this is always 8, but more options may be available in the future.
Definition at line 49 of file mem.c.
References mem.
Referenced by rz_il_validate_global_context_new_from_vm().
RZ_API RzBitVector* rz_il_mem_load | ( | RzILMem * | mem, |
RzBitVector * | key | ||
) |
Load a single memory value (bitvector) from current address (bitvector)
mem | Memory |
key | address (bitvector) |
Definition at line 79 of file mem.c.
References key, mem, NULL, return_val_if_key_len_wrong, rz_buf_read_at(), rz_bv_new_from_ut64(), rz_bv_to_ut64(), rz_il_mem_value_len(), rz_return_val_if_fail, and v.
Referenced by rz_il_vm_mem_load(), and rz_il_vm_mem_store().
RZ_API RzBitVector* rz_il_mem_loadw | ( | RzILMem * | mem, |
RzBitVector * | key, | ||
ut32 | n_bits, | ||
bool | big_endian | ||
) |
Load an entire work of the given size from the given address
key | address (bitvector) |
n_bits | How many bits to read. This also determines the size of the returned bitvector |
Definition at line 157 of file mem.c.
References key, mem, NULL, read_n_bits(), return_val_if_key_len_wrong, and rz_return_val_if_fail.
Referenced by rz_il_vm_mem_loadw(), and rz_il_vm_mem_storew().
Create a memory for accessing the given buffer.
Definition at line 13 of file mem.c.
References rz_il_mem_t::buf, rz_il_mem_t::key_len, KEY_LEN_MAX, NULL, rz_buf_ref(), RZ_NEW0, and rz_return_val_if_fail.
Referenced by setup_vm_from_config().
RZ_API bool rz_il_mem_store | ( | RzILMem * | mem, |
RzBitVector * | key, | ||
RzBitVector * | value | ||
) |
Store a single memory value (bitvector) into an address (bitvector)
key | address |
value | data |
Definition at line 93 of file mem.c.
References key, mem, return_val_if_key_len_wrong, rz_buf_write_at(), rz_bv_len(), rz_bv_to_ut64(), rz_bv_to_ut8(), rz_il_mem_value_len(), RZ_LOG_ERROR, rz_return_val_if_fail, v, and value.
Referenced by rz_il_vm_mem_store().
RZ_API bool rz_il_mem_storew | ( | RzILMem * | mem, |
RzBitVector * | key, | ||
RzBitVector * | value, | ||
bool | big_endian | ||
) |
Store an entire word or arbitrary size at an address
key | address |
value | data |
Definition at line 169 of file mem.c.
References key, mem, return_val_if_key_len_wrong, rz_return_val_if_fail, value, and write_n_bits().
Referenced by rz_il_vm_mem_storew().
Get the bit-size of a value in the memory.
For all k, rz_bv_len(rz_il_mem_load(mem, k)) == rz_il_mem_value_len(mem)
. So this could be seen as the size of a byte. Because we only support RzBuffer-based mems at the moment, this is always 8, but more options may be available in the future.
Definition at line 60 of file mem.c.
Referenced by rz_il_mem_load(), rz_il_mem_store(), and rz_il_validate_global_context_new_from_vm().