8 mach_vm_address_t *address,
10 natural_t *nesting_depth,
11 vm_region_recurse_info_t
info,
12 mach_msg_type_number_t *infoCnt);
16 case VM_INHERIT_SHARE:
return "share";
17 case VM_INHERIT_COPY:
return "copy";
18 case VM_INHERIT_NONE:
return "none";
19 default:
return "???";
25 #define HEADER_SIZE 0x1000
26 #define IMAGE_OFFSET 0x2000
27 #define KERNEL_LOWER 0xffffff8000000000
30 #define HEADER_SIZE 0x1000
31 #define IMAGE_OFFSET 0x201000
32 #define KERNEL_LOWER 0x80000000
38 vm_region_submap_info_data_64_t
info;
40 mach_msg_type_number_t info_count = VM_REGION_SUBMAP_INFO_COUNT_64;
41 unsigned int depth = 0;
45 ret = task_for_pid(mach_task_self(), 0, &task);
46 if (ret != KERN_SUCCESS)
49 eprintf(
"%d vs %d\n", task, ___task);
53 ret = vm_region_recurse_64(task, (vm_address_t *)&naddr, (vm_size_t *)&
size,
54 &depth, (vm_region_info_t)&
info, &info_count);
55 if (ret != KERN_SUCCESS)
66 if (
size > 1024 * 1024 * 1024) {
71 return (vm_address_t)0;
77 bool contiguous =
false;
80 mach_vm_address_t address = MACH_VM_MIN_ADDRESS;
81 mach_vm_size_t
size = (mach_vm_size_t)0;
82 mach_vm_size_t osize = (mach_vm_size_t)0;
88 #if __arm64__ || __aarch64__
103 struct vm_region_submap_info_64
info;
104 mach_msg_type_number_t info_count;
106 depth = VM_REGION_BASIC_INFO_64;
107 info_count = VM_REGION_SUBMAP_INFO_COUNT_64;
110 (vm_region_recurse_info_t)&
info, &info_count);
111 if (kr != KERN_SUCCESS) {
120 if (address ==
mr->addr +
mr->size) {
121 if (oldprot !=
UT32_MAX && oldprot ==
info.protection) {
133 oldprot =
info.protection;
134 if (
info.max_protection != 0 && !contiguous) {
135 char module_name[1024];
139 module_name,
sizeof(module_name));
141 #warning TODO: support proc_regionfilename on old OSX (ppc)
144 module_name[ret] = 0;
145 #define xwrz_testwx(x) ((x & 1) << 2) | (x & 2) | ((x & 4) >> 2)
150 info.user_tag ?
" user" :
"",
151 info.is_submap ?
" sub" :
"",
152 info.inheritance ?
" inherit" :
"",
153 info.is_submap ?
" submap" :
"",
161 eprintf(
"Cannot create rz_debug_map_new\n");
183 vm_region_basic_info_data_64_t
info, prev_info;
184 mach_vm_address_t prev_address;
185 mach_vm_size_t
size, prev_size;
186 mach_port_t object_name;
187 mach_msg_type_number_t
count;
204 #if __arm64__ || __aarch64__
209 memset (&prev_info, 0,
sizeof (prev_info));
210 prev_address = address;
217 address = prev_address + prev_size;
227 count = VM_REGION_BASIC_INFO_COUNT_64;
228 kret = mach_vm_region (task, (mach_vm_address_t *)&address,
229 &
size, VM_REGION_BASIC_INFO_64,
230 (vm_region_info_t) &
info, &
count, &object_name);
231 if (kret != KERN_SUCCESS) {
237 if (address != prev_address + prev_size)
240 if ((
info.protection != prev_info.protection)
241 || (
info.max_protection != prev_info.max_protection)
242 || (
info.inheritance != prev_info.inheritance)
243 || (
info.shared != prev_info.reserved)
244 || (
info.reserved != prev_info.reserved))
249 char module_name[1024];
252 module_name[ret] = 0;
254 #define xwrz_testwx(x) ((x & 1) << 2) | (x & 2) | ((x & 4) >> 2)
255 if (print &&
size>0 && prev_info.inheritance != VM_INHERIT_SHARE) {
259 prev_info.shared ?
"shar" :
"priv",
260 prev_info.reserved ?
"reserved" :
"not-reserved",
267 eprintf (
"Cannot create rz_debug_map_new\n");
278 if (num_printed == 0)
279 fprintf(stderr,
"Region ");
280 else fprintf(stderr,
" ... ");
281 fprintf(stderr,
" 0x%08llx - 0x%08llx %s (%s) %s, %s, %s",
283 unparse_protection (prev_info.protection),
284 unparse_protection (prev_info.max_protection),
286 prev_info.shared ?
"shared" :
" private",
287 prev_info.reserved ?
"reserved" :
"not-reserved");
290 fprintf(stderr,
" (%d sub-regions)", nsubregions);
292 fprintf(stderr,
"\n");
294 prev_address = address;
296 memcpy (&prev_info, &
info,
sizeof (vm_region_basic_info_data_64_t));
306 prev_address = address;
308 memcpy (&prev_info, &
info,
sizeof (vm_region_basic_info_data_64_t));
321 return ios_dbg_maps(
dbg);
324 if (osname && !strcmp (osname,
"ios")) {
325 return ios_dbg_maps (
dbg);
327 return osx_dbg_maps (
dbg);
RzBinInfo * info(RzBinFile *bf)
static int mr(RzAnalysisEsil *esil, ut64 addr, ut8 *buf, int len)
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 RzDebugMap * rz_debug_map_new(char *name, ut64 addr, ut64 addr_end, int perm, int user)
return memset(p, 0, total)
memcpy(mem, inblock.get(), min(CONTAINING_RECORD(inblock.get(), MEMBLOCK, data) ->size, size))
static void list(RzEgg *egg)
RZ_API RZ_OWN RzList * rz_list_new(void)
Returns a new initialized RzList pointer (free method is not initialized)
RZ_API RZ_BORROW RzListIter * rz_list_append(RZ_NONNULL RzList *list, void *data)
Appends at the end of the list a new element.
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 pid
return strdup("=SP r13\n" "=LR r14\n" "=PC r15\n" "=A0 r0\n" "=A1 r1\n" "=A2 r2\n" "=A3 r3\n" "=ZF zf\n" "=SF nf\n" "=OF vf\n" "=CF cf\n" "=SN or0\n" "gpr lr .32 56 0\n" "gpr pc .32 60 0\n" "gpr cpsr .32 64 0 ____tfiae_________________qvczn\n" "gpr or0 .32 68 0\n" "gpr tf .1 64.5 0 thumb\n" "gpr ef .1 64.9 0 endian\n" "gpr jf .1 64.24 0 java\n" "gpr qf .1 64.27 0 sticky_overflow\n" "gpr vf .1 64.28 0 overflow\n" "gpr cf .1 64.29 0 carry\n" "gpr zf .1 64.30 0 zero\n" "gpr nf .1 64.31 0 negative\n" "gpr itc .4 64.10 0 if_then_count\n" "gpr gef .4 64.16 0 great_or_equal\n" "gpr r0 .32 0 0\n" "gpr r1 .32 4 0\n" "gpr r2 .32 8 0\n" "gpr r3 .32 12 0\n" "gpr r4 .32 16 0\n" "gpr r5 .32 20 0\n" "gpr r6 .32 24 0\n" "gpr r7 .32 28 0\n" "gpr r8 .32 32 0\n" "gpr r9 .32 36 0\n" "gpr r10 .32 40 0\n" "gpr r11 .32 44 0\n" "gpr r12 .32 48 0\n" "gpr r13 .32 52 0\n" "gpr r14 .32 56 0\n" "gpr r15 .32 60 0\n" "gpr r16 .32 64 0\n" "gpr r17 .32 68 0\n")
RZ_API const char * rz_str_rwx_i(int rwx)
ut64(WINAPI *w32_GetEnabledXStateFeatures)()
static const char * unparse_inheritance(vm_inherit_t i)
int proc_regionfilename(int pid, uint64_t address, void *buffer, uint32_t buffersize)
kern_return_t mach_vm_region_recurse(vm_map_t target_task, mach_vm_address_t *address, mach_vm_size_t *size, natural_t *nesting_depth, vm_region_recurse_info_t info, mach_msg_type_number_t *infoCnt)
vm_address_t get_kernel_base(task_t ___task)
task_t pid_to_task(int pid)