xref: /freebsd/share/man/man9/pmap_kextract.9 (revision 4b9d6057)
1.\"
2.\" SPDX-License-Identifier: BSD-2-Clause
3.\"
4.\" Copyright (c) 2023 The FreeBSD Foundation
5.\"
6.\" This manual page was written by Mina Galić <FreeBSD@igalic.co> under
7.\" sponsorship from the FreeBSD Foundation.
8.\"
9.Dd October 16, 2023
10.Dt PMAP_KEXTRACT 9
11.Os
12.Sh NAME
13.Nm pmap_kextract ,
14.Nm vtophys
15.Nd extract a physical address from the kernel page table
16.Sh SYNOPSIS
17.In sys/param.h
18.In vm/vm.h
19.In vm/pmap.h
20.Ft vm_paddr_t
21.Fo pmap_kextract
22.Fa "vm_offset_t va"
23.Fc
24.Ft vm_paddr_t
25.Fo vtophys
26.Fa "vm_offset_t va"
27.Fc
28.Sh DESCRIPTION
29The
30.Fn pmap_kextract
31function retrieves the underlying physical memory address corresponding to the
32given kernel virtual address
33.Fa va .
34The caller is responsible for ensuring that
35.Fa va
36belongs to a valid mapping in the kernel address space.
37The returned physical address is only meaningful as long as the mapping remains
38stable, so the caller must also have some knowledge or guarantee of the
39mapping's lifetime.
40For example, it is invalid to call
41.Fn pmap_kextract
42with the address of a malloc'd object while there is a possibility for that
43object to be freed concurrently.
44.Pp
45Unlike
46.Xr pmap_extract 9 ,
47.Fn pmap_kextract
48is safe to be called from any context; it has no internal locking or sleep.
49.Pp
50.Fn vtophys
51is an alias for
52.Fn pmap_kextract
53and behaves identically.
54.Sh RETURN VALUES
55The
56.Fn pmap_kextract
57function returns the physical address of memory mapped at the kernel
58virtual address
59.Fa va .
60.Pp
61.Fn pmap_kextract
62generally does not fail.
63However, if supplied with an illegitimate value for
64.Fa va ,
65the function may return zero, an invalid non-zero value, or call
66.Xr panic 9 .
67.Sh SEE ALSO
68.Xr pmap 9 ,
69.Xr pmap_extract 9
70.Sh AUTHORS
71.An -nosplit
72This manual page was written by
73.An Mina Galić Aq Mt FreeBSD@igalic.co ,
74based on the
75.Xr pmap_extract 9
76page written by
77.An Bruce M Simpson Aq Mt bms@spc.org .
78