PMAP_KEXTRACT(9)       FreeBSD Kernel Developer's Manual      PMAP_KEXTRACT(9)

NAME

     pmap_kextract, vtophys - extract a physical address from the kernel page
     table

SYNOPSIS

     #include <sys/param.h>
     #include <vm/vm.h>
     #include <vm/pmap.h>

     vm_paddr_t
     pmap_kextract(vm_offset_t va);

     vm_paddr_t
     vtophys(vm_offset_t va);

DESCRIPTION

     The pmap_kextract() function retrieves the underlying physical memory
     address corresponding to the given kernel virtual address va.  The caller
     is responsible for ensuring that va belongs to a valid mapping in the
     kernel address space.  The returned physical address is only meaningful
     as long as the mapping remains stable, so the caller must also have some
     knowledge or guarantee of the mapping's lifetime.  For example, it is
     invalid to call pmap_kextract() with the address of a malloc'd object
     while there is a possibility for that object to be freed concurrently.

     Unlike pmap_extract(9), pmap_kextract() is safe to be called from any
     context; it has no internal locking or sleep.

     vtophys() is an alias for pmap_kextract() and behaves identically.

RETURN VALUES

     The pmap_kextract() function returns the physical address of memory
     mapped at the kernel virtual address va.

     pmap_kextract() generally does not fail.  However, if supplied with an
     illegitimate value for va, the function may return zero, an invalid non-
     zero value, or call panic(9).

SEE ALSO

     pmap(9), pmap_extract(9)

AUTHORS

     This manual page was written by Mina Galic <FreeBSD@igalic.co>, based on
     the pmap_extract(9) page written by Bruce M Simpson <bms@spc.org>.

FreeBSD 15.1-STABLE-HBSD       October 16, 2023               PMAP_KEXTRACT(9)