xref: /freebsd/lib/libkvm/kvm_kerndisp.3 (revision fa9896e082a1046ff4fbc75fcba4d18d1f2efc19)
1*38cf2a43SLeandro Lupori.\"
2*38cf2a43SLeandro Lupori.\" Copyright (c) 2020 Leandro Lupori <luporl@FreeBSD.org>
3*38cf2a43SLeandro Lupori.\"
4*38cf2a43SLeandro Lupori.\" Redistribution and use in source and binary forms, with or without
5*38cf2a43SLeandro Lupori.\" modification, are permitted provided that the following conditions
6*38cf2a43SLeandro Lupori.\" are met:
7*38cf2a43SLeandro Lupori.\" 1. Redistributions of source code must retain the above copyright
8*38cf2a43SLeandro Lupori.\"    notice, this list of conditions and the following disclaimer.
9*38cf2a43SLeandro Lupori.\" 2. Redistributions in binary form must reproduce the above copyright
10*38cf2a43SLeandro Lupori.\"    notice, this list of conditions and the following disclaimer in the
11*38cf2a43SLeandro Lupori.\"    documentation and/or other materials provided with the distribution.
12*38cf2a43SLeandro Lupori.\"
13*38cf2a43SLeandro Lupori.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14*38cf2a43SLeandro Lupori.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15*38cf2a43SLeandro Lupori.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16*38cf2a43SLeandro Lupori.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17*38cf2a43SLeandro Lupori.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18*38cf2a43SLeandro Lupori.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19*38cf2a43SLeandro Lupori.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20*38cf2a43SLeandro Lupori.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21*38cf2a43SLeandro Lupori.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22*38cf2a43SLeandro Lupori.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23*38cf2a43SLeandro Lupori.\" SUCH DAMAGE.
24*38cf2a43SLeandro Lupori.\"
25*38cf2a43SLeandro Lupori.Dd February 5, 2020
26*38cf2a43SLeandro Lupori.Dt KVM_KERNDISP 3
27*38cf2a43SLeandro Lupori.Os
28*38cf2a43SLeandro Lupori.Sh NAME
29*38cf2a43SLeandro Lupori.Nm kvm_kerndisp
30*38cf2a43SLeandro Lupori.Nd get kernel displacement
31*38cf2a43SLeandro Lupori.Sh LIBRARY
32*38cf2a43SLeandro Lupori.Lb libkvm
33*38cf2a43SLeandro Lupori.Sh SYNOPSIS
34*38cf2a43SLeandro Lupori.In kvm.h
35*38cf2a43SLeandro Lupori.Ft kssize_t
36*38cf2a43SLeandro Lupori.Fn kvm_kerndisp "kvm_t *kd"
37*38cf2a43SLeandro Lupori.Sh DESCRIPTION
38*38cf2a43SLeandro Lupori.Fn kvm_kerndisp
39*38cf2a43SLeandro Luporireturns the number of bytes by which the kernel referenced by
40*38cf2a43SLeandro Lupori.Fa kd
41*38cf2a43SLeandro Luporiis displaced.
42*38cf2a43SLeandro LuporiThis is the difference between the kernel's base virtual address at run time
43*38cf2a43SLeandro Luporiand the kernel base virtual address specified in the kernel image file.
44*38cf2a43SLeandro Lupori.Pp
45*38cf2a43SLeandro LuporiNote that if the kernel is moved to a lower memory address,
46*38cf2a43SLeandro Luporithe displacement will be negative.
47*38cf2a43SLeandro Lupori.Sh RETURN VALUES
48*38cf2a43SLeandro Lupori.Fn kvm_kerndisp
49*38cf2a43SLeandro Luporireturns the number of bytes by which the kernel is displaced.
50*38cf2a43SLeandro LuporiIf the kernel is not displaced or if it is not possible to find the
51*38cf2a43SLeandro Luporidisplacement then 0 is returned.
52*38cf2a43SLeandro Lupori.Sh SEE ALSO
53*38cf2a43SLeandro Lupori.Xr kvm 3 ,
54*38cf2a43SLeandro Lupori.Xr kvm_close 3 ,
55*38cf2a43SLeandro Lupori.Xr kvm_open 3
56