1 #ifndef MACH_MEMORY_HPP
2 #define MACH_MEMORY_HPP
4 static kern_return_t cy_vm_allocate(bool broken, vm_map_t target, mach_vm_address_t *address, mach_vm_size_t size, int flags) {
6 return mach_vm_allocate(target, address, size, flags);
7 vm_address_t address32(0);
8 kern_return_t value(vm_allocate(target, &address32, size, flags));
13 #define mach_vm_allocate(a, b, c, d) \
14 cy_vm_allocate(broken, a, b, c, d)
16 static kern_return_t cy_vm_deallocate(bool broken, vm_map_t target, mach_vm_address_t address, mach_vm_size_t size) {
18 return mach_vm_deallocate(target, address, size);
19 return vm_deallocate(target, address, size);
22 #define mach_vm_deallocate(a, b, c) \
23 cy_vm_deallocate(broken, a, b, c)
25 static kern_return_t cy_vm_protect(bool broken, vm_map_t target_task, mach_vm_address_t address, mach_vm_size_t size, boolean_t set_maximum, vm_prot_t new_protection) {
27 return mach_vm_protect(target_task, address, size, set_maximum, new_protection);
28 return vm_protect(target_task, address, size, set_maximum, new_protection);
31 #define mach_vm_protect(a, b, c, d, e) \
32 cy_vm_protect(broken, a, b, c, d, e)
34 static kern_return_t cy_vm_read_overwrite(bool broken, vm_map_t target_task, mach_vm_address_t address, mach_vm_size_t size, mach_vm_address_t data, mach_vm_size_t *outsize) {
36 return mach_vm_read_overwrite(target_task, address, size, data, outsize);
37 vm_size_t outsize32(*outsize);
38 kern_return_t value(vm_read_overwrite(target_task, address, data, size, &outsize32));
43 #define mach_vm_read_overwrite(a, b, c, d, e) \
44 cy_vm_read_overwrite(broken, a, b, c, d, e)
46 static kern_return_t cy_vm_write(bool broken, vm_map_t target_task, mach_vm_address_t address, vm_offset_t data, mach_msg_type_number_t dataCnt) {
48 return mach_vm_write(target_task, address, data, dataCnt);
49 return vm_write(target_task, address, data, dataCnt);
52 #define mach_vm_write(a, b, c, d) \
53 cy_vm_write(broken, a, b, c, d)
55 #endif//MACH_MEMORY_HPP