Lines Matching +full:linear +full:- +full:mapping +full:- +full:mode
1 /*-
2 * SPDX-License-Identifier: (BSD-3-Clause AND MIT-CMU)
8 * The Mach Operating System project at Carnegie-Mellon University.
35 * Copyright (c) 1987, 1990 Carnegie-Mellon University.
53 * Pittsburgh PA 15213-3890
168 map = &curproc->p_vmspace->vm_map; in useracc()
192 npages = atop(end - start); in vslock()
195 error = vm_map_wire(&curproc->p_vmspace->vm_map, start, end, in vslock()
198 curthread->td_vslock_sz += len; in vslock()
214 MPASS(curthread->td_vslock_sz >= len); in vsunlock()
215 curthread->td_vslock_sz -= len; in vsunlock()
216 (void)vm_map_unwire(&curproc->p_vmspace->vm_map, in vsunlock()
239 * Return a CPU private mapping to the page at the given offset within the
255 * Destroy the given CPU private mapping and unpin the page that it mapped.
272 pmap_sync_icache(map->pmap, va, sz); in vm_sync_icache()
293 if (error == 0 && req->newptr && oldsize != kstack_cache_size) in sysctl_kstack_cache_size()
314 /* Allocate from the kernel arena for non-standard kstack sizes. */ in vm_thread_alloc_kstack_kva()
323 KASSERT(atop(addr - VM_MIN_KERNEL_ADDRESS) % in vm_thread_alloc_kstack_kva()
373 * Kstack VA allocations need to be aligned so that the linear KVA pindex
377 * We import a multiple of KVA_KSTACK_QUANTUM-sized region from the parent
399 rem = atop(*addrp - VM_MIN_KERNEL_ADDRESS) % kpages; in vm_thread_kstack_arena_import()
402 *addrp = *addrp + (kpages - rem) * PAGE_SIZE; in vm_thread_kstack_arena_import()
422 KASSERT((addr - VM_MIN_KERNEL_ADDRESS) % kpages == 0, in vm_thread_kstack_arena_release()
426 * If the address is not KVA_KSTACK_QUANTUM-aligned we have to decrement in vm_thread_kstack_arena_release()
434 addr -= rem; in vm_thread_kstack_arena_release()
454 obj->domain.dr_policy = ds; in vm_thread_stack_create()
470 vm_thread_free_kstack_kva(ks - ptoa(KSTACK_GUARD_PAGES), in vm_thread_stack_create()
475 pmap_qremove(ks - ptoa(KSTACK_GUARD_PAGES), in vm_thread_stack_create()
512 vm_thread_free_kstack_kva(ks - (KSTACK_GUARD_PAGES * PAGE_SIZE), in vm_thread_stack_dispose()
538 * swap-in. in vm_thread_new()
549 td->td_kstack = ks; in vm_thread_new()
550 td->td_kstack_pages = pages; in vm_thread_new()
551 td->td_kstack_domain = ks_domain; in vm_thread_new()
564 pages = td->td_kstack_pages; in vm_thread_dispose()
565 ks = td->td_kstack; in vm_thread_dispose()
566 td->td_kstack = 0; in vm_thread_dispose()
567 td->td_kstack_pages = 0; in vm_thread_dispose()
568 td->td_kstack_domain = MAXMEMDOM; in vm_thread_dispose()
580 * Uses a non-identity mapping if guard pages are
586 vm_pindex_t pindex = atop(ks - VM_MIN_KERNEL_ADDRESS); in vm_kstack_pindex()
592 * Return the linear pindex if guard pages aren't active or if we are in vm_kstack_pindex()
593 * allocating a non-standard kstack size. in vm_kstack_pindex()
601 return (pindex - in vm_kstack_pindex()
626 m = n > 0 ? ma[n - 1] : vm_page_mpred(obj, pindex); in vm_thread_stack_back()
694 atop(VM_MAX_KERNEL_ADDRESS - VM_MIN_KERNEL_ADDRESS)); in kstack_cache_init()
703 atop(VM_MAX_KERNEL_ADDRESS - VM_MIN_KERNEL_ADDRESS)); in kstack_cache_init()
710 kstack_quantum -= (kstack_pages + KSTACK_GUARD_PAGES) * PAGE_SIZE; in kstack_cache_init()
747 * Testing for interrupted kernel mode isn't strictly in intr_prof_stack_use()
754 stack_top = td->td_kstack + td->td_kstack_pages * PAGE_SIZE; in intr_prof_stack_use()
761 if (stack_top <= current || current < td->td_kstack) in intr_prof_stack_use()
764 used = stack_top - current; in intr_prof_stack_use()
779 * machine-dependent layer to fill those in and make the new process
781 * to user mode to avoid stack copying and relocation problems.
787 struct proc *p1 = td->td_proc; in vm_forkproc()
807 p2->p_vmspace = p1->p_vmspace; in vm_forkproc()
808 refcount_acquire(&p1->p_vmspace->vm_refcnt); in vm_forkproc()
810 dset = td2->td_domain.dr_policy; in vm_forkproc()
811 while (vm_page_count_severe_set(&dset->ds_mask)) { in vm_forkproc()
812 vm_wait_doms(&dset->ds_mask, 0); in vm_forkproc()
816 p2->p_vmspace = vm2; in vm_forkproc()
817 if (p1->p_vmspace->vm_shm) in vm_forkproc()
838 vmspace_exitfree(p); /* and clean-out the vmspace */ in vm_waitproc()