18019c643SBruce M Simpson.\" 28019c643SBruce M Simpson.\" Copyright (c) 2003 Bruce M Simpson <bms@spc.org> 3*3834f923SKonstantin Belousov.\" Copyright (c) 2014 The FreeBSD Foundation 48019c643SBruce M Simpson.\" All rights reserved. 58019c643SBruce M Simpson.\" 68019c643SBruce M Simpson.\" Redistribution and use in source and binary forms, with or without 78019c643SBruce M Simpson.\" modification, are permitted provided that the following conditions 88019c643SBruce M Simpson.\" are met: 98019c643SBruce M Simpson.\" 1. Redistributions of source code must retain the above copyright 108019c643SBruce M Simpson.\" notice, this list of conditions and the following disclaimer. 118019c643SBruce M Simpson.\" 2. Redistributions in binary form must reproduce the above copyright 128019c643SBruce M Simpson.\" notice, this list of conditions and the following disclaimer in the 138019c643SBruce M Simpson.\" documentation and/or other materials provided with the distribution. 148019c643SBruce M Simpson.\" 158019c643SBruce M Simpson.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 168019c643SBruce M Simpson.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 178019c643SBruce M Simpson.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 188019c643SBruce M Simpson.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 198019c643SBruce M Simpson.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 208019c643SBruce M Simpson.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 218019c643SBruce M Simpson.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 228019c643SBruce M Simpson.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 238019c643SBruce M Simpson.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 248019c643SBruce M Simpson.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 258019c643SBruce M Simpson.\" SUCH DAMAGE. 268019c643SBruce M Simpson.\" 278019c643SBruce M Simpson.\" $FreeBSD$ 288019c643SBruce M Simpson.\" 29*3834f923SKonstantin Belousov.Dd January 27, 2015 308019c643SBruce M Simpson.Dt PMAP_ENTER 9 31b4ca3754SRuslan Ermilov.Os 328019c643SBruce M Simpson.Sh NAME 338019c643SBruce M Simpson.Nm pmap_enter 348019c643SBruce M Simpson.Nd insert a virtual page into a physical map 358019c643SBruce M Simpson.Sh SYNOPSIS 368019c643SBruce M Simpson.In sys/param.h 378019c643SBruce M Simpson.In vm/vm.h 388019c643SBruce M Simpson.In vm/pmap.h 39*3834f923SKonstantin Belousov.Ft int 401772ac3fSRuslan Ermilov.Fo pmap_enter 41*3834f923SKonstantin Belousov.Fa "pmap_t pmap" "vm_offset_t va" "vm_page_t m" "vm_prot_t prot" 42*3834f923SKonstantin Belousov.Fa "u_int flags" "int8_t psind" 431772ac3fSRuslan Ermilov.Fc 448019c643SBruce M Simpson.Sh DESCRIPTION 458019c643SBruce M SimpsonThe 468019c643SBruce M Simpson.Fn pmap_enter 47*3834f923SKonstantin Belousovfunction creates a mapping in the physical map 48*3834f923SKonstantin Belousov.Fa pmap 49*3834f923SKonstantin Belousovfrom the virtual address 50*3834f923SKonstantin Belousov.Fa va 51*3834f923SKonstantin Belousovto the physical page 52*3834f923SKonstantin Belousov.Fa m 538019c643SBruce M Simpsonwith the protection 548019c643SBruce M Simpson.Fa prot . 55*3834f923SKonstantin BelousovAny previous mapping at the virtual address 56*3834f923SKonstantin Belousov.Fa va 57*3834f923SKonstantin Belousovis destroyed. 58*3834f923SKonstantin Belousov.Pp 59*3834f923SKonstantin BelousovThe 60*3834f923SKonstantin Belousov.Fa flags 61*3834f923SKonstantin Belousovargument may have the following values: 62*3834f923SKonstantin Belousov.Bl -tag -width ".Dv PMAP_ENTER_NOSLEEP" 63*3834f923SKonstantin Belousov.It Dv VM_PROT_READ 64*3834f923SKonstantin BelousovA read access to the given virtual address triggered the call. 65*3834f923SKonstantin Belousov.It Dv VM_PROT_WRITE 66*3834f923SKonstantin BelousovA write access to the given virtual address triggered the call. 67*3834f923SKonstantin Belousov.It Dv VM_PROT_EXECUTE 68*3834f923SKonstantin BelousovAn execute access to the given virtual address triggered the call. 69*3834f923SKonstantin Belousov.It Dv PMAP_ENTER_WIRED 70*3834f923SKonstantin BelousovThe mapping should be marked as wired. 71*3834f923SKonstantin Belousov.It Dv PMAP_ENTER_NOSLEEP 72*3834f923SKonstantin BelousovThis function may not sleep during creation of the mapping. 73*3834f923SKonstantin BelousovIf the mapping cannot be created without sleeping, an appropriate 74*3834f923SKonstantin BelousovMach VM error is returned. 75*3834f923SKonstantin Belousov.El 76*3834f923SKonstantin BelousovIf the 77*3834f923SKonstantin Belousov.Dv PMAP_ENTER_NOSLEEP 78*3834f923SKonstantin Belousovflag is not specified, this function must create the requested mapping 79*3834f923SKonstantin Belousovbefore returning. 80*3834f923SKonstantin BelousovIt may not fail. 81*3834f923SKonstantin BelousovIn order to create the requested mapping, this function may destroy 82*3834f923SKonstantin Belousovany non-wired mapping in any pmap. 83*3834f923SKonstantin Belousov.Pp 84*3834f923SKonstantin BelousovThe 85*3834f923SKonstantin Belousov.Fa psind 86*3834f923SKonstantin Belousovparameter specifies the page size that should be used by the mapping. 87*3834f923SKonstantin BelousovThe supported page sizes are described by the global array 88*3834f923SKonstantin Belousov.Dv pagesizes[] . 89*3834f923SKonstantin BelousovThe desired page size is specified by passing the index of the array 90*3834f923SKonstantin Belousovelement that equals the desired page size. 91*3834f923SKonstantin Belousov.Pp 92*3834f923SKonstantin BelousovWhen the 93*3834f923SKonstantin Belousov.Fn pmap_enter 94*3834f923SKonstantin Belousovfunction destroys or updates a managed mapping, including an existing 95*3834f923SKonstantin Belousovmapping at virtual address 96*3834f923SKonstantin Belousov.Fa va , 97*3834f923SKonstantin Belousovit updates the 98*3834f923SKonstantin Belousov.Ft vm_page 99*3834f923SKonstantin Belousovstructure corresponding to the previously mapped physical page. 100*3834f923SKonstantin BelousovIf the physical page was accessed through the managed mapping, 101*3834f923SKonstantin Belousovthen the 102*3834f923SKonstantin Belousov.Ft vm_page 103*3834f923SKonstantin Belousovstructure's 104*3834f923SKonstantin Belousov.Dv PGA_REFERENCED 105*3834f923SKonstantin Belousovaflag is set. 106*3834f923SKonstantin BelousovIf the physical page was modified through the managed mapping, then the 107*3834f923SKonstantin Belousov.Fn vm_page_dirty 108*3834f923SKonstantin Belousovfunction is called on the 109*3834f923SKonstantin Belousov.Ft vm_page 110*3834f923SKonstantin Belousovstructure. 111*3834f923SKonstantin Belousov.Pp 112*3834f923SKonstantin BelousovThe 113*3834f923SKonstantin Belousov.Dv PGA_WRITEABLE 114*3834f923SKonstantin Belousovaflag must be set for the page 115*3834f923SKonstantin Belousov.Fa m 116*3834f923SKonstantin Belousovif the new mapping is managed and writeable. 117*3834f923SKonstantin BelousovIt is advised to clear 118*3834f923SKonstantin Belousov.Dv PGA_WRITEABLE 119*3834f923SKonstantin Belousovfor destroyed mappings if the implementation can ensure 120*3834f923SKonstantin Belousovthat no other writeable managed mappings for the previously 121*3834f923SKonstantin Belousovmapped pages exist. 122*3834f923SKonstantin Belousov.Pp 123*3834f923SKonstantin BelousovIf the page 124*3834f923SKonstantin Belousov.Fa m 125*3834f923SKonstantin Belousovis managed, the page must be busied by the caller 126*3834f923SKonstantin Belousovor the owning object must be locked. 127*3834f923SKonstantin BelousovIn the later case, the 128*3834f923SKonstantin Belousov.Dv PMAP_ENTER_NOSLEEP 129*3834f923SKonstantin Belousovmust be specified by the caller. 130*3834f923SKonstantin Belousov.Pp 131*3834f923SKonstantin BelousovThe 132*3834f923SKonstantin Belousov.Fn pmap_enter 133*3834f923SKonstantin Belousovfunction must handle the multiprocessor TLB consistency for the 134*3834f923SKonstantin Belousovgiven address. 135*3834f923SKonstantin Belousov.Sh NOTES 136*3834f923SKonstantin BelousovOn amd64, arm and i386 architectures the existing implementation 137*3834f923SKonstantin Belousovof the 138*3834f923SKonstantin Belousov.Nm 139*3834f923SKonstantin Belousovfunction is incomplete, only value 0 for 140*3834f923SKonstantin Belousov.Fa psind 141*3834f923SKonstantin Belousovis supported. 142*3834f923SKonstantin BelousovOther supported architectures have 143*3834f923SKonstantin Belousov.Dv pagesizes[] 144*3834f923SKonstantin Belousovarray of size 1. 145*3834f923SKonstantin Belousov.Sh RETURN VALUES 146*3834f923SKonstantin BelousovIf successful, the 147*3834f923SKonstantin Belousov.Fn pmap_enter 148*3834f923SKonstantin Belousovfunction returns 149*3834f923SKonstantin Belousov.Er KERN_SUCCESS . 150*3834f923SKonstantin BelousovIf the 151*3834f923SKonstantin Belousov.Dv PMAP_ENTER_NOSLEEP 152*3834f923SKonstantin Belousovflag was specified and the resources required for the mapping cannot 153*3834f923SKonstantin Belousovbe acquired without sleeping, 154*3834f923SKonstantin Belousov.Dv KERN_RESOURCE_SHORTAGE 155*3834f923SKonstantin Belousovis returned. 1568019c643SBruce M Simpson.Sh SEE ALSO 1578019c643SBruce M Simpson.Xr pmap 9 1588019c643SBruce M Simpson.Sh AUTHORS 159*3834f923SKonstantin BelousovThis manual page was first written by 160*3834f923SKonstantin Belousov.An Bruce M Simpson Aq Mt bms@spc.org 161*3834f923SKonstantin Belousovand then rewritten by 162*3834f923SKonstantin Belousov.An Alan Cox Aq Mt alc@FreeBSD.org 163*3834f923SKonstantin Belousovand 164*3834f923SKonstantin Belousov.An Konstantin Belousov Aq Mt kib@FreeBSD.org . 165