Debugger memory operations and cache attributes
Kernel entry points for remote memory reads and writes, protection changes, recursive region queries, and machine attributes. mach_vm_write overwrites the target map; mach_vm_machine_attribute delegates cache operations to the VM map layer.
mach_vm_protect source · mach_vm_protect reference
mach_vm_protect -
Sets the protection of the specified range in the
specified map.
kern_return_t mach_vm_protect( vm_map_t map, mach_vm_address_ut start_u, mach_vm_size_ut size_u, boolean_t set_maximum, vm_prot_ut new_protection_u) { if (map == VM_MAP_NULL) { return KERN_INVALID_ARGUMENT; } if (VM_SANITIZE_UNSAFE_IS_ZERO(size_u)) { return KERN_SUCCESS; } return vm_map_protect(map, start_u, vm_sanitize_compute_ut_end(start_u, size_u), set_maximum, new_protection_u); }
mach_vm_machine_attribute source · mach_vm_machine_attribute reference
mach_vm_machine_attributes -
Handle machine-specific attributes for a mapping, such
as cachability, migrability, etc.
kern_return_t mach_vm_machine_attribute( vm_map_t map, mach_vm_address_ut addr_u, mach_vm_size_ut size_u, vm_machine_attribute_t attribute, vm_machine_attribute_val_t *value) /* IN/OUT */ { if (map == VM_MAP_NULL) { return KERN_INVALID_ARGUMENT; } if (VM_SANITIZE_UNSAFE_IS_ZERO(size_u)) { return KERN_SUCCESS; } return vm_map_machine_attribute(map, addr_u, vm_sanitize_compute_ut_end(addr_u, size_u), attribute, value); }
mach_vm_read_overwrite source · mach_vm_read_overwrite reference
mach_vm_read_overwrite -
Overwrite a range of the current map with data from the specified
map/address range.
In making an assumption that the current thread is local, it is
no longer cluster-safe without a fully supportive local proxy
thread/task (but we don't support cluster's anymore so this is moot).
kern_return_t mach_vm_read_overwrite( vm_map_t map, mach_vm_address_ut address, mach_vm_size_ut size, mach_vm_address_ut data, mach_vm_size_ut *data_size) { kern_return_t error; vm_map_copy_t copy; if (map == VM_MAP_NULL) { return KERN_INVALID_ARGUMENT; } error = vm_map_copyin(map, address, size, FALSE, ©); if (KERN_SUCCESS == error) { if (copy) { assert(VM_SANITIZE_UNSAFE_IS_EQUAL(size, copy->size)); } error = vm_map_copy_overwrite(current_thread()->map, data, copy, size, FALSE); if (KERN_SUCCESS == error) { *data_size = size; return error; … more in source
mach_vm_write source · mach_vm_write reference
mach_vm_write -
Overwrite the specified address range with the data provided
(from the current map).
kern_return_t mach_vm_write( vm_map_t map, mach_vm_address_ut address, pointer_ut data_u, mach_msg_type_number_t size) { if (map == VM_MAP_NULL) { return KERN_INVALID_ARGUMENT; } /* * data is created by the kernel's MIG server from a userspace buffer, * so it is safe to unwrap. */ vm_map_copy_t data = (vm_map_copy_t) VM_SANITIZE_UNSAFE_UNWRAP(data_u); return vm_map_copy_overwrite(map, address, data, size, FALSE /* interruptible XXX */); }
mach_vm_region_recurse source · mach_vm_region_recurse reference
vm_region_recurse: A form of vm_region which follows the
submaps in a target map
kern_return_t mach_vm_region_recurse( vm_map_t map, mach_vm_address_ut *address_u, mach_vm_size_ut *size_u, uint32_t *depth, vm_region_recurse_info_t info, mach_msg_type_number_t *infoCnt) { if (VM_MAP_NULL == map) { return KERN_INVALID_ARGUMENT; } return vm_map_region_recurse_64(map, address_u, size_u, depth, (vm_region_submap_info_64_t)info, infoCnt); }