]> git.saurik.com Git - cycript.git/blob - Mach/Memory.hpp
Port and package (a Cydia release) for iOS 7 ARM64.
[cycript.git] / Mach / Memory.hpp
1 #ifndef MACH_MEMORY_HPP
2 #define MACH_MEMORY_HPP
3
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) {
5 if (!broken)
6 return mach_vm_allocate(target, address, size, flags);
7 vm_address_t address32;
8 kern_return_t value(vm_allocate(target, &address32, size, flags));
9 *address = address32;
10 return value;
11 }
12
13 #define mach_vm_allocate(a, b, c, d) \
14 cy_vm_allocate(broken, a, b, c, d)
15
16 static kern_return_t cy_vm_deallocate(bool broken, vm_map_t target, mach_vm_address_t address, mach_vm_size_t size) {
17 if (!broken)
18 return mach_vm_deallocate(target, address, size);
19 return vm_deallocate(target, address, size);
20 }
21
22 #define mach_vm_deallocate(a, b, c) \
23 cy_vm_deallocate(broken, a, b, c)
24
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) {
26 if (!broken)
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);
29 }
30
31 #define mach_vm_protect(a, b, c, d, e) \
32 cy_vm_protect(broken, a, b, c, d, e)
33
34 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) {
35 if (!broken)
36 return mach_vm_write(target_task, address, data, dataCnt);
37 return vm_write(target_task, address, data, dataCnt);
38 }
39
40 #define mach_vm_write(a, b, c, d) \
41 cy_vm_write(broken, a, b, c, d)
42
43 #endif//MACH_MEMORY_HPP