Go to the source code of this file.
|
RZ_API int | rz_mem_count (const ut8 **addr) |
|
RZ_API int | rz_mem_eq (const ut8 *a, const ut8 *b, int len) |
| Compares memory a with b over len bytes. More...
|
|
RZ_API void | rz_mem_copyloop (ut8 *dest, const ut8 *orig, int dsize, int osize) |
|
RZ_API void * | rz_mem_copy (void *dest, size_t dmax, const void *src, size_t smax) |
|
RZ_API int | rz_mem_cmp_mask (const ut8 *dest, const ut8 *orig, const ut8 *mask, int len) |
|
RZ_API void | rz_mem_copybits (ut8 *dst, const ut8 *src, int bits) |
|
static char | readbit (const ut8 *src, int bitoffset) |
|
static void | writebit (ut8 *dst, int i, bool c) |
|
RZ_API void | rz_mem_copybits_delta (ut8 *dst, int doff, const ut8 *src, int soff, int bits) |
|
RZ_API ut64 | rz_mem_get_num (const ut8 *b, int size) |
|
RZ_API int | rz_mem_set_num (ut8 *dest, int dest_size, ut64 num) |
|
RZ_API void | rz_mem_swaporcopy (ut8 *dest, const ut8 *src, int len, bool big_endian) |
|
RZ_API void | rz_mem_swapendian (ut8 *dest, const ut8 *orig, int size) |
|
RZ_API const ut8 * | rz_mem_mem (const ut8 *haystack, int hlen, const ut8 *needle, int nlen) |
|
RZ_API const ut8 * | rz_mem_mem_aligned (const ut8 *haystack, int hlen, const ut8 *needle, int nlen, int align) |
|
RZ_API int | rz_mem_protect (void *ptr, int size, const char *prot) |
|
RZ_API void * | rz_mem_dup (const void *s, int l) |
|
RZ_API void | rz_mem_reverse (ut8 *b, int l) |
|
RZ_API bool | rz_mem_is_printable (const ut8 *a, int la) |
|
RZ_API bool | rz_mem_is_zero (const ut8 *b, int l) |
|
RZ_API void * | rz_mem_alloc (int sz) |
|
RZ_API void | rz_mem_free (void *p) |
|
RZ_API void | rz_mem_memzero (void *dst, size_t l) |
|
◆ CLR_BIT
#define CLR_BIT |
( |
|
p, |
|
|
|
n |
|
) |
| ((p) &= (~(1) << (n))) |
Definition at line 12 of file mem.c.
◆ SET_BIT
#define SET_BIT |
( |
|
p, |
|
|
|
n |
|
) |
| ((p) |= (1 << (n))) |
Definition at line 11 of file mem.c.
◆ readbit()
Definition at line 120 of file mem.c.
121 const int wholeBytes = bitoffset / 8;
122 const int remainingBits = bitoffset % 8;
124 return (
src[wholeBytes] & 1 << remainingBits);
References src.
Referenced by rz_mem_copybits_delta().
◆ rz_mem_alloc()
◆ rz_mem_cmp_mask()
Definition at line 58 of file mem.c.
69 for (
i = 0;
i <
len;
i++) {
73 int ret = memcmp(mdest, morig,
len);
RZ_API void Ht_() free(HtName_(Ht) *ht)
void * malloc(size_t size)
References dest, free(), i, len, malloc(), and mask.
◆ rz_mem_copy()
Definition at line 50 of file mem.c.
memcpy(mem, inblock.get(), min(CONTAINING_RECORD(inblock.get(), MEMBLOCK, data) ->size, size))
#define rz_return_val_if_fail(expr, val)
References dest, memcpy(), NULL, rz_return_val_if_fail, and src.
Referenced by rz_debug_add_checkpoint(), trace_hook_mem_read(), and trace_hook_mem_write().
◆ rz_mem_copybits()
◆ rz_mem_copybits_delta()
Definition at line 141 of file mem.c.
143 if (doff < 0 || soff < 0 || !
dst || !
src) {
static void writebit(ut8 *dst, int i, bool c)
static char readbit(const ut8 *src, int bitoffset)
References bits(), c, dst, i, readbit(), src, and writebit().
Referenced by rz_asm_disassemble(), and rz_read_me27().
◆ rz_mem_copyloop()
◆ rz_mem_count()
Definition at line 15 of file mem.c.
References addr, and i.
◆ rz_mem_dup()
Definition at line 319 of file mem.c.
References d, malloc(), memcpy(), and s.
Referenced by copy_into_flagitem_list(), debug_qnx_read_at(), DEFINE_HANDLE_TS_FCN_AND_SYMBOL(), drain(), rz_bin_import_clone(), rz_core_cmd_foreach3(), rz_core_cmp_mem_data(), and rz_io_write_at().
◆ rz_mem_eq()
Compares memory a
with b
over len
bytes.
- Parameters
-
a | Pointer to memory a . |
b | Pointer to memory b . |
len | Number of bytes to compare. |
- Returns
- bool True if memory bytes in memory
a
and b
match over len
bytes. False otherwise.
Definition at line 31 of file mem.c.
33 for (
i = 0;
i <
len;
i++) {
References a, b, i, and len.
Referenced by rz_core_cmp_mem_data(), rz_core_cmp_mem_mem(), and rz_str_strchr().
◆ rz_mem_free()
RZ_API void rz_mem_free |
( |
void * |
p | ) |
|
◆ rz_mem_get_num()
◆ rz_mem_is_printable()
◆ rz_mem_is_zero()
Definition at line 347 of file mem.c.
349 for (
i = 0;
i < l;
i++) {
References b, and i.
◆ rz_mem_mem()
Definition at line 246 of file mem.c.
247 int i, until = hlen - nlen + 1;
248 if (hlen < 1 || nlen < 1) {
251 for (
i = 0;
i < until;
i++) {
252 if (!memcmp(haystack +
i, needle, nlen)) {
References i, and NULL.
Referenced by binutils_assemble(), findPair(), rz_cmd_analysis(), rz_cons_memcat(), rz_cons_visual_write(), rz_str_replace_thunked(), rz_str_stripLine(), and visual_search().
◆ rz_mem_mem_aligned()
◆ rz_mem_memzero()
Definition at line 365 of file mem.c.
367 RtlSecureZeroMemory(
dst, l);
369 #if HAVE_EXPLICIT_BZERO
370 explicit_bzero(
dst, l);
371 #elif HAVE_EXPLICIT_MEMSET
372 (void)explicit_memset(
dst, 0, l);
375 __asm__
volatile(
"" ::
"r"(
dst)
return memset(p, 0, total)
References dst, and memset().
Referenced by rz_MD5Final(), SHA256_End(), SHA256_Init(), SHA512_End(), SHA512_Final(), and SHA512_Init().
◆ rz_mem_protect()
Definition at line 279 of file mem.c.
282 if (strchr(
prot,
'x')) {
285 if (strchr(
prot,
'r')) {
288 if (strchr(
prot,
'w')) {
297 r = strchr(
prot,
'r') ? 1 : 0;
298 w = strchr(
prot,
'w') ? 1 : 0;
299 x = strchr(
prot,
'x') ? 1 : 0;
304 p = PAGE_EXECUTE_READ;
310 if (!VirtualProtect(ptr,
size,
p,
NULL)) {
314 #warning Unknown platform
static static sync static getppid static getegid const char static filename char static len const char char static bufsiz static mask static vfork mprotect
static static fork const void static count static fd const char const char static newpath char char char static envp time_t static t const char static mode static whence const char static dir time_t static t unsigned static seconds const char struct utimbuf static buf static inc static sig const char static mode static oldfd struct tms static buf static getgid static geteuid const char static filename static arg static mask struct ustat static ubuf static getppid static setsid static egid sigset_t static set struct timeval struct timezone static tz fd_set fd_set fd_set struct timeval static timeout const char char static bufsiz const char static swapflags void prot
References DWORD, mprotect, NULL, p, prot, PROT_EXEC, PROT_READ, PROT_WRITE, r, w, and x.
Referenced by rz_sys_run().
◆ rz_mem_reverse()
◆ rz_mem_set_num()
Definition at line 168 of file mem.c.
static static fork const void static count static fd const char const char static newpath char char char static envp time_t static t const char static mode static whence const char static dir time_t static t unsigned static seconds const char struct utimbuf static buf static inc static sig const char static mode static oldfd struct tms static buf static getgid static geteuid const char static filename static arg static mask struct ustat static ubuf static getppid static setsid static egid sigset_t static set struct timeval struct timezone static tz fd_set fd_set fd_set struct timeval static timeout const char char static bufsiz const char static swapflags void static offset const char static length static mode static who const char struct statfs static buf unsigned unsigned num
static void rz_write_le32(void *dest, ut32 val)
static void rz_write_le16(void *dest, ut16 val)
static void rz_write_le64(void *dest, ut64 val)
static void rz_write_le8(void *dest, ut8 val)
References dest, num, rz_write_le16(), rz_write_le32(), rz_write_le64(), rz_write_le8(), UT16_MAX, UT32_MAX, and UT8_MAX.
Referenced by rz_analysis_value_set_ut64().
◆ rz_mem_swapendian()
◆ rz_mem_swaporcopy()
◆ writebit()