mirror of
https://github.com/freebsd/freebsd-src
synced 2024-09-06 17:18:32 +00:00
![Leandro Lupori](/assets/img/avatar_default.png)
This change adds a new libkvm function, kvm_kerndisp(), that can be used to retrieve the kernel displacement, that is the difference between the kernel's base virtual address at run time and the kernel base virtual address specified in the kernel image file. This will be used by kgdb, to properly relocate kernel symbols, when needed. Reviewed by: jhb Differential Revision: https://reviews.freebsd.org/D23285
58 lines
2.1 KiB
Groff
58 lines
2.1 KiB
Groff
.\"
|
|
.\" Copyright (c) 2020 Leandro Lupori <luporl@FreeBSD.org>
|
|
.\"
|
|
.\" Redistribution and use in source and binary forms, with or without
|
|
.\" modification, are permitted provided that the following conditions
|
|
.\" are met:
|
|
.\" 1. Redistributions of source code must retain the above copyright
|
|
.\" notice, this list of conditions and the following disclaimer.
|
|
.\" 2. Redistributions in binary form must reproduce the above copyright
|
|
.\" notice, this list of conditions and the following disclaimer in the
|
|
.\" documentation and/or other materials provided with the distribution.
|
|
.\"
|
|
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
|
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
|
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
.\" SUCH DAMAGE.
|
|
.\"
|
|
.\" $FreeBSD$
|
|
.\"
|
|
.Dd February 5, 2020
|
|
.Dt KVM_KERNDISP 3
|
|
.Os
|
|
.Sh NAME
|
|
.Nm kvm_kerndisp
|
|
.Nd get kernel displacement
|
|
.Sh LIBRARY
|
|
.Lb libkvm
|
|
.Sh SYNOPSIS
|
|
.In kvm.h
|
|
.Ft kssize_t
|
|
.Fn kvm_kerndisp "kvm_t *kd"
|
|
.Sh DESCRIPTION
|
|
.Fn kvm_kerndisp
|
|
returns the number of bytes by which the kernel referenced by
|
|
.Fa kd
|
|
is displaced.
|
|
This is the difference between the kernel's base virtual address at run time
|
|
and the kernel base virtual address specified in the kernel image file.
|
|
.Pp
|
|
Note that if the kernel is moved to a lower memory address,
|
|
the displacement will be negative.
|
|
.Sh RETURN VALUES
|
|
.Fn kvm_kerndisp
|
|
returns the number of bytes by which the kernel is displaced.
|
|
If the kernel is not displaced or if it is not possible to find the
|
|
displacement then 0 is returned.
|
|
.Sh SEE ALSO
|
|
.Xr kvm 3 ,
|
|
.Xr kvm_close 3 ,
|
|
.Xr kvm_open 3
|