30 |
/* Map OBJECT at into the address space of TASK. If ANYWHERE_P is |
/* Map OBJECT at into the address space of TASK. If ANYWHERE_P is |
31 |
false we try to map the object at *OFFSETP, otherwise the kernel |
false we try to map the object at *OFFSETP, otherwise the kernel |
32 |
selects the location in the address space. */ |
selects the location in the address space. */ |
|
|
|
33 |
kern_return_t |
kern_return_t |
34 |
vm_map (struct task *task, struct vm_object *object, vm_offset_t *offsetp, |
vm_map (struct task *task, struct vm_object *object, vm_offset_t *offsetp, |
35 |
vm_size_t size, bool anywhere_p, vm_prot_t protection, |
vm_size_t size, bool anywhere_p, vm_prot_t protection, |
45 |
|
|
46 |
/* Allocate SIZE bytes in the address space of TASK. If ANYWHERE_P is |
/* Allocate SIZE bytes in the address space of TASK. If ANYWHERE_P is |
47 |
false, enter new object at *OFFSETP, otherwise use suitable location. */ |
false, enter new object at *OFFSETP, otherwise use suitable location. */ |
|
|
|
48 |
kern_return_t |
kern_return_t |
49 |
vm_allocate (struct task *task, vm_size_t size, vm_offset_t *offsetp, |
vm_allocate (struct task *task, vm_size_t size, vm_offset_t *offsetp, |
50 |
bool anywhere_p) |
bool anywhere_p) |
69 |
return KERN_SUCCESS; |
return KERN_SUCCESS; |
70 |
} |
} |
71 |
|
|
72 |
|
/* Deallocate SIZE bytes at OFFSET in TASK's address space. */ |
73 |
|
kern_return_t |
74 |
|
vm_deallocate (struct task *task, vm_offset_t offset, vm_size_t size) |
75 |
|
{ |
76 |
|
return vm_map_deallocate (task->map, vm_trunc_page (offset), |
77 |
|
vm_round_page (size)); |
78 |
|
} |
79 |
|
|
80 |
|
/* Sets the protection for address region [OFFSET, OFFSET+SIZE) |
81 |
|
in TASK to PROTECTION. If SETMAX_P is specified, the maximum |
82 |
|
protection is to be set; otherwise, only the current protection |
83 |
|
is affected. */ |
84 |
|
kern_return_t |
85 |
|
vm_protect (struct task *task, vm_offset_t offset, vm_size_t size, |
86 |
|
vm_prot_t protection, int setmax_p) |
87 |
|
{ |
88 |
|
return vm_map_protect (task->map, vm_trunc_page (offset), |
89 |
|
vm_round_page (size), protection, setmax_p); |
90 |
|
} |
91 |
|
|
92 |
/* Write into TASKs address space at offset DST_OFFSET, from current |
/* Write into TASKs address space at offset DST_OFFSET, from current |
93 |
tasks address space at SRC_OFFSET. Copy LENGTH bytes. */ |
tasks address space at SRC_OFFSET. Copy LENGTH bytes. */ |
94 |
|
|