2016-07-10 13:02:01 +00:00
|
|
|
#ifndef R_MEM_H
|
|
|
|
#define R_MEM_H
|
|
|
|
|
|
|
|
typedef struct r_mmap_t {
|
|
|
|
ut8 *buf;
|
|
|
|
ut64 base;
|
|
|
|
int len;
|
|
|
|
int fd;
|
|
|
|
int rw;
|
|
|
|
#if __WINDOWS__
|
|
|
|
HANDLE fh;
|
|
|
|
HANDLE fm;
|
|
|
|
#endif
|
|
|
|
} RMmap;
|
|
|
|
|
|
|
|
typedef struct r_mem_pool_t {
|
|
|
|
ut8 **nodes;
|
|
|
|
int ncount;
|
|
|
|
int npool;
|
|
|
|
//
|
|
|
|
int nodesize;
|
|
|
|
int poolsize;
|
|
|
|
int poolcount;
|
|
|
|
} RMemoryPool;
|
|
|
|
|
|
|
|
R_API ut64 r_mem_get_num(const ut8 *b, int size);
|
|
|
|
|
|
|
|
/* MEMORY POOL */
|
|
|
|
R_API RMemoryPool* r_mem_pool_deinit(RMemoryPool *pool);
|
|
|
|
R_API RMemoryPool *r_mem_pool_new(int nodesize, int poolsize, int poolcount);
|
|
|
|
R_API RMemoryPool *r_mem_pool_free(RMemoryPool *pool);
|
|
|
|
R_API void* r_mem_pool_alloc(RMemoryPool *pool);
|
2016-07-10 19:54:31 +00:00
|
|
|
R_API void *r_mem_dup(void *s, int l);
|
2016-07-10 13:02:01 +00:00
|
|
|
R_API void r_mem_reverse(ut8 *b, int l);
|
|
|
|
R_API int r_mem_protect(void *ptr, int size, const char *prot);
|
2016-07-10 19:54:31 +00:00
|
|
|
R_API int r_mem_set_num(ut8 *dest, int dest_size, ut64 num);
|
2016-07-10 13:02:01 +00:00
|
|
|
R_API int r_mem_eq(ut8 *a, ut8 *b, int len);
|
|
|
|
R_API void r_mem_copybits(ut8 *dst, const ut8 *src, int bits);
|
2016-07-10 19:54:31 +00:00
|
|
|
R_API void r_mem_copyloop(ut8 *dest, const ut8 *orig, int dsize, int osize);
|
|
|
|
R_API void r_mem_swaporcopy(ut8 *dest, const ut8 *src, int len, bool big_endian);
|
|
|
|
R_API void r_mem_swapendian(ut8 *dest, const ut8 *orig, int size);
|
|
|
|
R_API int r_mem_cmp_mask(const ut8 *dest, const ut8 *orig, const ut8 *mask, int len);
|
|
|
|
R_API const ut8 *r_mem_mem(const ut8 *haystack, int hlen, const ut8 *needle, int nlen);
|
2016-07-10 13:02:01 +00:00
|
|
|
R_API const ut8 *r_mem_mem_aligned(const ut8 *haystack, int hlen, const ut8 *needle, int nlen, int align);
|
|
|
|
R_API int r_mem_count(const ut8 **addr);
|
2017-01-09 02:18:14 +00:00
|
|
|
R_API bool r_mem_is_printable (const ut8 *a, int la);
|
2016-07-10 13:02:01 +00:00
|
|
|
#endif // R_MEM_H
|