]>
Commit | Line | Data |
---|---|---|
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_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) { | |
35 | if (!broken) | |
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)); | |
39 | *outsize = outsize32; | |
40 | return value; | |
41 | } | |
42 | ||
43 | #define mach_vm_read_overwrite(a, b, c, d, e) \ | |
44 | cy_vm_read_overwrite(broken, a, b, c, d, e) | |
45 | ||
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) { | |
47 | if (!broken) | |
48 | return mach_vm_write(target_task, address, data, dataCnt); | |
49 | return vm_write(target_task, address, data, dataCnt); | |
50 | } | |
51 | ||
52 | #define mach_vm_write(a, b, c, d) \ | |
53 | cy_vm_write(broken, a, b, c, d) | |
54 | ||
55 | #endif//MACH_MEMORY_HPP |