8322 nl: misleading-indentation
[unleashed/tickless.git] / usr / src / uts / i86pc / os / ppage.c
blob584eaad1b4ae7be419ab38ff285e5629bce41f8a
1 /*
2 * CDDL HEADER START
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
7 * with the License.
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
20 * CDDL HEADER END
23 * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 #pragma ident "%Z%%M% %I% %E% SMI"
29 #include <sys/t_lock.h>
30 #include <sys/vmem.h>
31 #include <sys/mman.h>
32 #include <sys/vm.h>
33 #include <sys/cpuvar.h>
34 #include <sys/systm.h>
35 #include <vm/as.h>
36 #include <vm/hat.h>
37 #include <vm/page.h>
38 #include <vm/seg.h>
39 #include <vm/seg_kmem.h>
40 #include <sys/kmem.h>
41 #include <sys/cmn_err.h>
42 #include <sys/debug.h>
45 * ppcopy() and pagezero() have moved to i86/vm/vm_machdep.c
49 * Architecures with a vac use this routine to quickly make
50 * a vac-aligned mapping. We don't have a vac, so we don't
51 * care about that - just make this simple.
53 /* ARGSUSED2 */
54 caddr_t
55 ppmapin(page_t *pp, uint_t vprot, caddr_t avoid)
57 caddr_t va;
59 va = vmem_alloc(heap_arena, PAGESIZE, VM_SLEEP);
60 hat_memload(kas.a_hat, va, pp, vprot | HAT_NOSYNC, HAT_LOAD_LOCK);
61 return (va);
64 void
65 ppmapout(caddr_t va)
67 hat_unload(kas.a_hat, va, PAGESIZE, HAT_UNLOAD_UNLOCK);
68 vmem_free(heap_arena, va, PAGESIZE);
73 * Map the page pointed to by pp into the kernel virtual address space.
74 * This routine is used by the rootnexus.
76 void
77 i86_pp_map(page_t *pp, caddr_t kaddr)
79 hat_devload(kas.a_hat, kaddr, MMU_PAGESIZE, page_pptonum(pp),
80 HAT_STORECACHING_OK | PROT_READ | PROT_WRITE | HAT_NOSYNC,
81 HAT_LOAD_LOCK);
85 * Map the page containing the virtual address into the kernel virtual address
86 * space. This routine is used by the rootnexus.
88 void
89 i86_va_map(caddr_t vaddr, struct as *asp, caddr_t kaddr)
91 pfn_t pfnum;
93 pfnum = hat_getpfnum(asp->a_hat, vaddr);
94 hat_devload(kas.a_hat, kaddr, MMU_PAGESIZE, pfnum,
95 HAT_STORECACHING_OK | PROT_READ | PROT_WRITE | HAT_NOSYNC,
96 HAT_LOAD_LOCK);