2 .\" Copyright (c) 2007 Seccuris Inc.
3 .\" All rights reserved.
5 .\" This documentation was written by Robert N. M. Watson under contract to
8 .\" Redistribution and use in source and binary forms, with or without
9 .\" modification, are permitted provided that the following conditions
11 .\" 1. Redistributions of source code must retain the above copyright
12 .\" notice(s), this list of conditions and the following disclaimer as
13 .\" the first lines of this file unmodified other than the possible
14 .\" addition of one or more copyright notices.
15 .\" 2. Redistributions in binary form must reproduce the above copyright
16 .\" notice(s), this list of conditions and the following disclaimer in the
17 .\" documentation and/or other materials provided with the distribution.
19 .\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
20 .\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21 .\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22 .\" DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
23 .\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24 .\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25 .\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26 .\" CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
38 .Nd manage temporary kernel address space mapping for memory pages
42 .Fn sf_buf_alloc "struct vm_page *m" "int flags"
44 .Fn sf_buf_free "struct sf_buf *sf"
46 .Fn sf_buf_kva "struct sf_buf *sf"
48 .Fn sf_buf_page "struct sf_buf *sf"
52 interface, historically the
54 buffer interface, allows kernel subsystems to manage temporary kernel address
55 space mappings for physical memory pages.
56 On systems with a direct memory map region (allowing all physical pages to be
57 visible in the kernel address space at all times), the
59 will point to an address in the direct map region; on systems without a
60 direct memory map region, the
62 will manage a temporary kernel address space mapping valid for the lifetime
70 for a physical memory page.
72 is not responsible for arranging for the page to be present in physical
73 memory; the caller should already have arranged for the page to be wired,
76 Several flags may be passed to
78 .Bl -tag -width SFB_CPUPRIVATE
84 if a signal is received waiting for a
92 rather than sleeping if a
94 is not immediately available.
98 to only arrange that the temporary mapping be valid on the current CPU,
99 avoiding unnecessary TLB shootdowns for mappings that will only be accessed
100 on a single CPU at a time.
101 The caller must ensure that accesses to the virtual address occur only on the
104 was invoked, perhaps by using
110 to return a kernel mapped address for the page.
114 to return a pointer to the page originally passed into
122 The caller is responsible for releasing any wiring they have previously
123 acquired on the physical page;
125 releases only the temporary kernel address space mapping, not the page
128 Uses of this interface include managing mappings of borrowed pages from user
129 memory, such as in zero-copy socket I/O, or pages of memory from the buffer
130 cache referenced by mbuf external storage for
139 API was designed and implemented by
141 This manual page was written by
142 .An Robert N. M. Watson .