* Allocate a vmspace structure, including a vm_map and pmap, * and initialize those structures. The refcnt is set to 1. */
| 322 | * and initialize those structures. The refcnt is set to 1. |
| 323 | */ |
| 324 | struct vmspace * |
| 325 | vmspace_alloc(vm_offset_t min, vm_offset_t max, pmap_pinit_t pinit) |
| 326 | { |
| 327 | struct vmspace *vm; |
| 328 | |
| 329 | vm = uma_zalloc(vmspace_zone, M_WAITOK); |
| 330 | KASSERT(vm->vm_map.pmap == NULL, ("vm_map.pmap must be NULL")); |
| 331 | if (!pinit(vmspace_pmap(vm))) { |
| 332 | uma_zfree(vmspace_zone, vm); |
| 333 | return (NULL); |
| 334 | } |
| 335 | CTR1(KTR_VM, "vmspace_alloc: %p", vm); |
| 336 | _vm_map_init(&vm->vm_map, vmspace_pmap(vm), min, max); |
| 337 | refcount_init(&vm->vm_refcnt, 1); |
| 338 | vm->vm_shm = NULL; |
| 339 | vm->vm_swrss = 0; |
| 340 | vm->vm_tsize = 0; |
| 341 | vm->vm_dsize = 0; |
| 342 | vm->vm_ssize = 0; |
| 343 | vm->vm_taddr = 0; |
| 344 | vm->vm_daddr = 0; |
| 345 | vm->vm_maxsaddr = 0; |
| 346 | return (vm); |
| 347 | } |
| 348 | |
| 349 | #ifdef RACCT |
| 350 | static void |
no test coverage detected