]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - share/man/man9/pmap_quick_enter_page.9
bhnd_erom(9): Fix a few mandoc related issues
[FreeBSD/FreeBSD.git] / share / man / man9 / pmap_quick_enter_page.9
1 .\"
2 .\" Copyright (c) 2015 Jason A. Harmening <jah@FreeBSD.org>
3 .\" All rights reserved.
4 .\"
5 .\" Redistribution and use in source and binary forms, with or without
6 .\" modification, are permitted provided that the following conditions
7 .\" are met:
8 .\" 1. Redistributions of source code must retain the above copyright
9 .\"    notice, this list of conditions and the following disclaimer.
10 .\" 2. Redistributions in binary form must reproduce the above copyright
11 .\"    notice, this list of conditions and the following disclaimer in the
12 .\"    documentation and/or other materials provided with the distribution.
13 .\"
14 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 .\" SUCH DAMAGE.
25 .\"
26 .\" $FreeBSD$
27 .\"
28 .Dd August 6, 2015
29 .Dt PMAP_QUICK_ENTER_PAGE 9
30 .Os
31 .Sh NAME
32 .Nm pmap_quick_enter_page ,
33 .Nm pmap_quick_remove_page
34 .Nd manage fast, single-page kernel address space mappings
35 .Sh SYNOPSIS
36 .In sys/param.h
37 .In vm/vm.h
38 .In vm/pmap.h
39 .Ft vm_offset_t
40 .Fn pmap_quick_enter_page "vm_page_t m"
41 .Ft void
42 .Fn pmap_quick_remove_page "vm_offset_t kva"
43 .Sh DESCRIPTION
44 The
45 .Fn pmap_quick_enter_page
46 function accepts a single page
47 .Fa m ,
48 and enters this page into a preallocated address in kernel virtual
49 address (KVA) space.
50 This function is intended for temporary mappings that will only
51 be used for a very short period, for example a copy operation on
52 the page contents.
53 .Pp
54 The
55 .Fn pmap_quick_remove_page
56 function removes a mapping previously created by
57 .Fn pmap_quick_enter_page
58 at
59 .Fa kva ,
60 making the KVA frame used by
61 .Fn pmap_quick_enter_page
62 available for reuse.
63 .Pp
64 On many architectures,
65 .Fn pmap_quick_enter_page
66 uses a per-CPU pageframe.
67 In those cases, it must disable preemption on the local CPU.
68 The corresponding call to
69 .Fn pmap_quick_remove_page
70 then re-enables preemption.
71 It is therefore not safe for machine-independent code to sleep
72 or perform locking operations while holding these mappings.
73 Current implementations only guarantee the availability of a single
74 page for the calling thread, so calls to
75 .Fn pmap_quick_enter_page
76 must not be nested.
77 .Pp
78 .Fn pmap_quick_enter_page
79 and
80 .Fn pmap_quick_remove_page
81 do not sleep, and
82 .Fn pmap_quick_enter_page
83 always returns a valid address.
84 It is safe to use these functions under all types of locks except spin mutexes.
85 It is also safe to use them in all thread contexts except primary interrupt
86 context.
87 .Pp
88 The page
89 .Em must
90 not be swapped or otherwise reused while the mapping is active.
91 It must be either wired or held, or it must belong to an unmanaged
92 region such as I/O device memory.
93 .Sh RETURN VALUES
94 The
95 .Fn pmap_quick_enter_page
96 function returns the kernel virtual address
97 that is mapped to the page
98 .Fa m .
99 .Sh SEE ALSO
100 .Xr pmap 9
101 .Sh AUTHORS
102 This manual page was written by
103 .An Jason A Harmening Aq Mt jah@FreeBSD.org .