14 ut64 entry_index = page_offset / 32;
15 ut64 offset_in_entry = (page_offset % 32) / 4;
30 if (
b & (1 << offset_in_entry)) {
62 if (first_rebase_off >= page_offset && first_rebase_off < page_offset +
count) {
65 ut64 position =
in_buf + first_rebase_off - page_offset;
66 if (position >=
count) {
71 if (position >= start_of_write) {
75 new_value += rebase_info->
slide;
79 first_rebase_off +=
delta;
89 #define RZ_IS_PTR_AUTHENTICATED(x) B_IS_SET(x, 63)
109 if (first_rebase_off >= page_offset && first_rebase_off < page_offset +
count) {
111 ut64 position =
in_buf + first_rebase_off - page_offset;
112 if (position >=
count) {
117 if (position >= start_of_write) {
120 new_value = (raw_value & 0xFFFFFFFFULL) + rebase_info->
auth_value_add;
123 new_value = ((raw_value << 13) & 0xFF00000000000000ULL) | (raw_value & 0x7ffffffffffULL);
124 new_value &= 0x00FFFFFFFFFFFFFFULL;
126 if (new_value != 0) {
127 new_value += rebase_info->
slide;
131 first_rebase_off +=
delta;
143 int imax = infos->
length - 1;
145 while (imin < imax) {
146 imid = (imin + imax) / 2;
157 return minEntry->
info;
163 if (!rebase_info || !
buf) {
167 if (rebase_info->
version == 3) {
169 }
else if (rebase_info->
version == 2 || rebase_info->
version == 4) {
171 }
else if (rebase_info->
version == 1) {
186 ctx->cache = (
void *)user;
205 if (
r <= 0 || !
len) {
221 int rounded_count = internal_end - internal_offset;
224 if (rounded_count > rebase_info->
page_size) {
225 internal_buf =
malloc(rounded_count);
227 RZ_LOG_ERROR(
"Cannot allocate memory for 'internal_buf'\n");
233 if (internal_result >= page_offset +
len) {
234 rebase_bytes(rebase_info, internal_buf, internal_offset, internal_result, page_offset);
236 memcpy(
buf, internal_buf + page_offset, result);
static io_buf in_buf
Input and output buffers.
static static sync static getppid static getegid const char static filename char static len const char char static bufsiz static mask static vfork const void static prot static getpgrp const char static swapflags static arg static fd static protocol static who struct sockaddr static addrlen static backlog struct timeval struct timezone static tz const struct iovec static count static mode const void const struct sockaddr static tolen const char static pathname void count
RZ_API ut64 rz_dyldcache_get_slide(RzDyldCache *cache)
static ut8 * buf_get_whole_buf(RzBuffer *b, ut64 *sz)
static void rebase_bytes_v1(RzDyldRebaseInfo1 *rebase_info, ut8 *buf, ut64 offset, int count, ut64 start_of_write)
static ut64 buf_get_size(RzBuffer *b)
static RzDyldRebaseInfo * rebase_info_by_range(RzDyldRebaseInfos *infos, ut64 offset, ut64 count)
RZ_API RzBuffer * rz_dyldcache_new_rebasing_buf(RzDyldCache *cache)
static st64 buf_seek(RzBuffer *b, st64 addr, int whence)
static void rebase_bytes(RzDyldRebaseInfo *rebase_info, ut8 *buf, ut64 offset, int count, ut64 start_of_write)
RZ_API bool rz_dyldcache_needs_rebasing(RzDyldCache *cache)
static st64 buf_write(RzBuffer *b, const ut8 *buf, ut64 len)
static st64 buf_read(RzBuffer *b, ut8 *buf, ut64 len)
static bool buf_fini(RzBuffer *b)
static void rebase_bytes_v2(RzDyldRebaseInfo2 *rebase_info, ut8 *buf, ut64 offset, int count, ut64 start_of_write)
#define RZ_IS_PTR_AUTHENTICATED(x)
static const RzBufferMethods buf_methods
RZ_API bool rz_dyldcache_range_needs_rebasing(RzDyldCache *cache, ut64 paddr, ut64 size)
static bool buf_resize(RzBuffer *b, ut64 newsize)
static bool buf_init(RzBuffer *b, const void *user)
static void rebase_bytes_v3(RzDyldRebaseInfo3 *rebase_info, ut8 *buf, ut64 offset, int count, ut64 start_of_write)
RZ_API void Ht_() free(HtName_(Ht) *ht)
memcpy(mem, inblock.get(), min(CONTAINING_RECORD(inblock.get(), MEMBLOCK, data) ->size, size))
static const char * page_index
void * malloc(size_t size)
#define DYLD_CACHE_SLIDE_V3_PAGE_ATTR_NO_REBASE
#define DYLD_CACHE_SLIDE_PAGE_ATTR_NO_REBASE
#define DYLD_CACHE_SLIDE_PAGE_ATTR_EXTRA
#define rz_return_val_if_fail(expr, val)
RZ_API RZ_OWN RzBuffer * rz_buf_new_with_methods(RZ_NONNULL const RzBufferMethods *methods, void *init_user)
Creates a new buffer with a specific back end.
RZ_API bool rz_buf_resize(RZ_NONNULL RzBuffer *b, ut64 newsize)
Resize the buffer size.
static ut64 rz_seek_offset(ut64 cur, ut64 length, st64 addr, int whence)
change cur according to addr and whence (RZ_BUF_SET/RZ_BUF_CUR/RZ_BUF_END)
RZ_API st64 rz_buf_write_at(RZ_NONNULL RzBuffer *b, ut64 addr, RZ_NONNULL const ut8 *buf, ut64 len)
Write len bytes of the buffer at the specified address.
RZ_API st64 rz_buf_read_at(RZ_NONNULL RzBuffer *b, ut64 addr, RZ_NONNULL RZ_OUT ut8 *buf, ut64 len)
Read len bytes of the buffer at the specified address.
RZ_DEPRECATE RZ_API RZ_BORROW ut8 * rz_buf_data(RZ_NONNULL RzBuffer *b, RZ_NONNULL RZ_OUT ut64 *size)
Return a borrowed array of bytes representing the buffer data.
RZ_API ut64 rz_buf_size(RZ_NONNULL RzBuffer *b)
Return the size of the buffer.
static ut64 rz_read_le64(const void *src)
static void rz_write_le64(void *dest, ut64 val)
#define RZ_LOG_ERROR(fmtstr,...)
RzDyldRebaseInfosEntry * entries
RzDyldRebaseInfos * rebase_infos
ut64(WINAPI *w32_GetEnabledXStateFeatures)()