43 bool has_unixthread =
false;
44 bool has_negative_vaddr =
false;
45 bool has_kext =
false;
47 ut32 cursor =
sizeof(
struct MACH0_(mach_header));
48 for (
size_t i = 0;
i < ncmds && cursor <
length;
i++) {
65 has_unixthread =
true;
72 if (has_negative_vaddr) {
80 st64 vmaddr = convert_to_two_complement_64(
tmp);
82 has_negative_vaddr =
true;
90 return has_kext || (has_unixthread && has_negative_vaddr);
95 ut64 cursor = start_offset;
105 bool carry_on = func(cursor, decorated_addr, user_data);
111 ut64 delta = ((decorated_addr >> 51) & 0x7ff) * multiplier;
130 for (;
i <
info->n_ranges;
i++) {
143 info->ranges[
i].size = 0;
224 if ((decorated_addr & 0x4000000000000000LL) == 0 && obj->
rebase_info) {
225 if (decorated_addr & 0x8000000000000000LL) {
228 ptr->
address = ((decorated_addr << 13) & 0xFF00000000000000LL) | (decorated_addr & 0x7ffffffffffLL);
229 if (decorated_addr & 0x40000000000LL) {
230 ptr->
address |= 0xfffc0000000000LL;
250 ctx->obj = (
void *)user;
269 if (
r <= 0 || !
len) {
273 if (cache->mach0->chained_starts) {
318 return obj->
rebase_info || obj->mach0->chained_starts;
RzBinInfo * info(RzBinFile *bf)
RzList * sections(RzBinFile *bf)
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
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 static offset struct stat static buf void long static basep static whence static length const void static len static semflg const void static shmflg const struct timespec struct timespec static rem const char static group const void start
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 static offset struct stat static buf void long static basep static whence static length const void static len static semflg const void static shmflg const struct timespec struct timespec static rem const char static group const void length
RZ_API void Ht_() free(HtName_(Ht) *ht)
static ut8 * buf_get_whole_buf(RzBuffer *b, ut64 *sz)
static ut64 rebase_offset_to_paddr(RzXNUKernelCacheObj *obj, struct section_t *sections, ut64 offset)
static ut64 buf_get_size(RzBuffer *b)
static void rebase_buffer(RzXNUKernelCacheObj *obj, ut64 off, ut8 *buf, ut64 count)
static void rebase_info_populate(RzXNUKernelCacheRebaseInfo *info, RzXNUKernelCacheObj *obj)
static st64 buf_seek(RzBuffer *b, st64 addr, int whence)
static st64 buf_write(RzBuffer *b, const ut8 *buf, ut64 len)
RZ_API RzBuffer * rz_xnu_kernelcache_new_rebasing_buf(RzXNUKernelCacheObj *obj)
static st64 buf_read(RzBuffer *b, ut8 *buf, ut64 len)
RZ_API bool rz_xnu_kernelcache_needs_rebasing(RzXNUKernelCacheObj *obj)
static bool buf_fini(RzBuffer *b)
RZ_API bool rz_xnu_kernelcache_parse_pointer(RzXNUKernelCacheParsedPointer *ptr, ut64 decorated_addr, RzXNUKernelCacheObj *obj)
static const RzBufferMethods buf_methods
static bool on_rebase_pointer(ut64 offset, ut64 decorated_addr, void *user)
static ut64 iterate_rebase_list(RzBuffer *cache_buf, ut64 multiplier, ut64 start_offset, OnRebaseFunc func, void *user_data)
static bool buf_resize(RzBuffer *b, ut64 newsize)
static bool buf_init(RzBuffer *b, const void *user)
bool(* OnRebaseFunc)(ut64 offset, ut64 decorated_addr, void *user_data)
RZ_API bool rz_xnu_kernelcache_buf_is_kernelcache(RzBuffer *b)
struct section_t *MACH0_() get_sections(struct MACH0_(obj_t) *bin)
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.
#define rz_buf_read_le32_at(b, addr, result)
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.
#define rz_buf_read_le64_at(b, addr, result)
static ut64 rz_read_le64(const void *src)
static void rz_write_le64(void *dest, ut64 val)
static struct sockaddr static addrlen static backlog const void static flags void flags
RzXNUKernelCacheObj * obj
RzXNUKernelCacheObj * obj
RzXNUKernelCacheRebaseInfo * rebase_info
bool rebase_info_populated
RzXNUKernelCacheFileRange * ranges
ut64(WINAPI *w32_GetEnabledXStateFeatures)()