138cf2a43SLeandro Lupori.\" 238cf2a43SLeandro Lupori.\" Copyright (c) 2020 Leandro Lupori <luporl@FreeBSD.org> 338cf2a43SLeandro Lupori.\" 438cf2a43SLeandro Lupori.\" Redistribution and use in source and binary forms, with or without 538cf2a43SLeandro Lupori.\" modification, are permitted provided that the following conditions 638cf2a43SLeandro Lupori.\" are met: 738cf2a43SLeandro Lupori.\" 1. Redistributions of source code must retain the above copyright 838cf2a43SLeandro Lupori.\" notice, this list of conditions and the following disclaimer. 938cf2a43SLeandro Lupori.\" 2. Redistributions in binary form must reproduce the above copyright 1038cf2a43SLeandro Lupori.\" notice, this list of conditions and the following disclaimer in the 1138cf2a43SLeandro Lupori.\" documentation and/or other materials provided with the distribution. 1238cf2a43SLeandro Lupori.\" 1338cf2a43SLeandro Lupori.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 1438cf2a43SLeandro Lupori.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1538cf2a43SLeandro Lupori.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 1638cf2a43SLeandro Lupori.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 1738cf2a43SLeandro Lupori.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 1838cf2a43SLeandro Lupori.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 1938cf2a43SLeandro Lupori.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2038cf2a43SLeandro Lupori.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2138cf2a43SLeandro Lupori.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2238cf2a43SLeandro Lupori.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2338cf2a43SLeandro Lupori.\" SUCH DAMAGE. 2438cf2a43SLeandro Lupori.\" 2538cf2a43SLeandro Lupori.Dd February 5, 2020 2638cf2a43SLeandro Lupori.Dt KVM_KERNDISP 3 2738cf2a43SLeandro Lupori.Os 2838cf2a43SLeandro Lupori.Sh NAME 2938cf2a43SLeandro Lupori.Nm kvm_kerndisp 3038cf2a43SLeandro Lupori.Nd get kernel displacement 3138cf2a43SLeandro Lupori.Sh LIBRARY 3238cf2a43SLeandro Lupori.Lb libkvm 3338cf2a43SLeandro Lupori.Sh SYNOPSIS 3438cf2a43SLeandro Lupori.In kvm.h 3538cf2a43SLeandro Lupori.Ft kssize_t 3638cf2a43SLeandro Lupori.Fn kvm_kerndisp "kvm_t *kd" 3738cf2a43SLeandro Lupori.Sh DESCRIPTION 3838cf2a43SLeandro Lupori.Fn kvm_kerndisp 3938cf2a43SLeandro Luporireturns the number of bytes by which the kernel referenced by 4038cf2a43SLeandro Lupori.Fa kd 4138cf2a43SLeandro Luporiis displaced. 4238cf2a43SLeandro LuporiThis is the difference between the kernel's base virtual address at run time 4338cf2a43SLeandro Luporiand the kernel base virtual address specified in the kernel image file. 4438cf2a43SLeandro Lupori.Pp 4538cf2a43SLeandro LuporiNote that if the kernel is moved to a lower memory address, 4638cf2a43SLeandro Luporithe displacement will be negative. 4738cf2a43SLeandro Lupori.Sh RETURN VALUES 4838cf2a43SLeandro Lupori.Fn kvm_kerndisp 4938cf2a43SLeandro Luporireturns the number of bytes by which the kernel is displaced. 5038cf2a43SLeandro LuporiIf the kernel is not displaced or if it is not possible to find the 5138cf2a43SLeandro Luporidisplacement then 0 is returned. 5238cf2a43SLeandro Lupori.Sh SEE ALSO 5338cf2a43SLeandro Lupori.Xr kvm 3 , 5438cf2a43SLeandro Lupori.Xr kvm_close 3 , 5538cf2a43SLeandro Lupori.Xr kvm_open 3 56