Rizin
unix-like reverse engineering framework and cli tools
rz_mem.h
Go to the documentation of this file.
1 #ifndef RZ_MEM_H
2 #define RZ_MEM_H
3 
4 #include <rz_types.h>
5 
6 #ifdef __cplusplus
7 extern "C" {
8 #endif
9 
10 typedef struct rz_mem_pool_t {
12  int ncount;
13  int npool;
14  //
15  int nodesize;
16  int poolsize;
17  int poolcount;
19 
20 RZ_API ut64 rz_mem_get_num(const ut8 *b, int size);
21 
22 /* MEMORY POOL */
23 RZ_API void *rz_mem_dup(const void *s, int l);
24 RZ_API void *rz_mem_alloc(int sz);
25 RZ_API void rz_mem_free(void *);
26 RZ_API void rz_mem_memzero(void *, size_t);
27 RZ_API void rz_mem_reverse(ut8 *b, int l);
28 RZ_API int rz_mem_protect(void *ptr, int size, const char *prot);
29 RZ_API int rz_mem_set_num(ut8 *dest, int dest_size, ut64 num);
30 RZ_API int rz_mem_eq(const ut8 *a, const ut8 *b, int len);
31 RZ_API void rz_mem_copybits(ut8 *dst, const ut8 *src, int bits);
32 RZ_API void rz_mem_copybits_delta(ut8 *dst, int doff, const ut8 *src, int soff, int bits);
33 RZ_API void rz_mem_copyloop(ut8 *dest, const ut8 *orig, int dsize, int osize);
34 RZ_API void *rz_mem_copy(void *dest, size_t dmax, const void *src, size_t smax);
35 RZ_API void rz_mem_swaporcopy(ut8 *dest, const ut8 *src, int len, bool big_endian);
36 RZ_API void rz_mem_swapendian(ut8 *dest, const ut8 *orig, int size);
37 RZ_API int rz_mem_cmp_mask(const ut8 *dest, const ut8 *orig, const ut8 *mask, int len);
38 RZ_API const ut8 *rz_mem_mem(const ut8 *haystack, int hlen, const ut8 *needle, int nlen);
39 RZ_API const ut8 *rz_mem_mem_aligned(const ut8 *haystack, int hlen, const ut8 *needle, int nlen, int align);
40 RZ_API int rz_mem_count(const ut8 **addr);
41 RZ_API bool rz_mem_is_printable(const ut8 *a, int la);
42 RZ_API bool rz_mem_is_zero(const ut8 *b, int l);
43 
44 #ifdef __cplusplus
45 }
46 #endif
47 #endif // RZ_MEM_H
size_t len
Definition: 6502dis.c:15
#define mask()
lzma_index * src
Definition: index.h:567
int bits(struct state *s, int need)
Definition: blast.c:72
#define RZ_API
voidpf void uLong size
Definition: ioapi.h:138
uint8_t ut8
Definition: lh5801.h:11
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
Definition: sflib.h:115
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
Definition: sflib.h:126
char * dst
Definition: lz4.h:724
char * dest
Definition: lz4.h:697
static RzSocket * s
Definition: rtr.c:28
RZ_API int rz_mem_protect(void *ptr, int size, const char *prot)
Definition: mem.c:279
RZ_API void rz_mem_memzero(void *, size_t)
Definition: mem.c:365
RZ_API bool rz_mem_is_printable(const ut8 *a, int la)
Definition: mem.c:337
RZ_API void rz_mem_reverse(ut8 *b, int l)
Definition: mem.c:327
struct rz_mem_pool_t RMemoryPool
RZ_API void rz_mem_copybits_delta(ut8 *dst, int doff, const ut8 *src, int soff, int bits)
Definition: mem.c:141
RZ_API void * rz_mem_copy(void *dest, size_t dmax, const void *src, size_t smax)
Definition: mem.c:50
RZ_API void rz_mem_swapendian(ut8 *dest, const ut8 *orig, int size)
Definition: mem.c:202
RZ_API void * rz_mem_dup(const void *s, int l)
Definition: mem.c:319
RZ_API int rz_mem_cmp_mask(const ut8 *dest, const ut8 *orig, const ut8 *mask, int len)
Definition: mem.c:58
RZ_API int rz_mem_eq(const ut8 *a, const ut8 *b, int len)
Compares memory a with b over len bytes.
Definition: mem.c:31
RZ_API void rz_mem_copyloop(ut8 *dest, const ut8 *orig, int dsize, int osize)
Definition: mem.c:41
RZ_API int rz_mem_set_num(ut8 *dest, int dest_size, ut64 num)
Definition: mem.c:168
RZ_API void rz_mem_copybits(ut8 *dst, const ut8 *src, int bits)
Definition: mem.c:79
RZ_API const ut8 * rz_mem_mem_aligned(const ut8 *haystack, int hlen, const ut8 *needle, int nlen, int align)
Definition: mem.c:260
RZ_API void rz_mem_free(void *)
Definition: mem.c:361
RZ_API void * rz_mem_alloc(int sz)
Definition: mem.c:357
RZ_API void rz_mem_swaporcopy(ut8 *dest, const ut8 *src, int len, bool big_endian)
Definition: mem.c:192
RZ_API const ut8 * rz_mem_mem(const ut8 *haystack, int hlen, const ut8 *needle, int nlen)
Definition: mem.c:246
RZ_API bool rz_mem_is_zero(const ut8 *b, int l)
Definition: mem.c:347
RZ_API int rz_mem_count(const ut8 **addr)
Definition: mem.c:15
RZ_API ut64 rz_mem_get_num(const ut8 *b, int size)
Definition: mem.c:152
#define b(i)
Definition: sha256.c:42
#define a(i)
Definition: sha256.c:41
int npool
Definition: rz_mem.h:13
int poolsize
Definition: rz_mem.h:16
int poolcount
Definition: rz_mem.h:17
int ncount
Definition: rz_mem.h:12
ut8 ** nodes
Definition: rz_mem.h:11
int nodesize
Definition: rz_mem.h:15
ut64(WINAPI *w32_GetEnabledXStateFeatures)()
static int addr
Definition: z80asm.c:58