Rizin
unix-like reverse engineering framework and cli tools
|
#include <rz_il/definitions/mem.h>
Go to the source code of this file.
Macros | |
#define | KEY_LEN_MAX 64 |
#define | return_val_if_key_len_wrong(mem, key, ret) |
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) |
static RzBitVector * | read_n_bits (RzBuffer *buf, ut32 n_bits, RzBitVector *key, bool big_endian) |
static bool | write_n_bits (RzBuffer *buf, RzBitVector *key, RzBitVector *value, bool big_endian) |
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) |
|
static |
Definition at line 105 of file mem.c.
References calloc(), free(), key, NULL, rz_buf_read_at(), rz_bv_len_bytes(), rz_bv_new_zero, rz_bv_set_from_bytes_be(), rz_bv_set_from_bytes_le(), rz_bv_to_ut64(), rz_warn_if_reached, ut64(), and value.
Referenced by rz_il_mem_loadw().
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().
|
static |
Definition at line 131 of file mem.c.
References calloc(), free(), key, rz_buf_write_at(), rz_bv_len_bytes(), rz_bv_set_to_bytes_be(), rz_bv_set_to_bytes_le(), rz_bv_to_ut64(), ut64(), and value.
Referenced by rz_il_mem_storew().