MCPcopy Create free account
hub / github.com/F-Stack/f-stack / useracc

Function useracc

freebsd/vm/vm_glue.c:151–171  ·  view source on GitHub ↗

* MPSAFE * * WARNING! This code calls vm_map_check_protection() which only checks * the associated vm_map_entry range. It does not determine whether the * contents of the memory is actually readable or writable. vmapbuf(), * vm_fault_quick(), or copyin()/copout()/su*()/fu*() functions should be * used in conjunction with this call. */

Source from the content-addressed store, hash-verified

149 * used in conjunction with this call.
150 */
151int
152useracc(void *addr, int len, int rw)
153{
154 boolean_t rv;
155 vm_prot_t prot;
156 vm_map_t map;
157
158 KASSERT((rw & ~VM_PROT_ALL) == 0,
159 ("illegal ``rw'' argument to useracc (%x)\n", rw));
160 prot = rw;
161 map = &curproc->p_vmspace->vm_map;
162 if ((vm_offset_t)addr + len > vm_map_max(map) ||
163 (vm_offset_t)addr + len < (vm_offset_t)addr) {
164 return (FALSE);
165 }
166 vm_map_lock_read(map);
167 rv = vm_map_check_protection(map, trunc_page((vm_offset_t)addr),
168 round_page((vm_offset_t)addr + len), prot);
169 vm_map_unlock_read(map);
170 return (rv == TRUE);
171}
172
173int
174vslock(void *addr, size_t len)

Callers 2

sync_icacheFunction · 0.50

Calls 2

vm_map_maxFunction · 0.85
vm_map_check_protectionFunction · 0.85

Tested by

no test coverage detected