1*810ed218Swiz.\" $NetBSD: kvm.3,v 1.13 2011/09/13 08:53:15 wiz Exp $ 2346e67f8Sthorpej.\" 30215cc7dScgd.\" Copyright (c) 1992, 1993 40215cc7dScgd.\" The Regents of the University of California. All rights reserved. 50215cc7dScgd.\" 60215cc7dScgd.\" This code is derived from software developed by the Computer Systems 70215cc7dScgd.\" Engineering group at Lawrence Berkeley Laboratory under DARPA contract 80215cc7dScgd.\" BG 91-66 and contributed to Berkeley. 90215cc7dScgd.\" 100215cc7dScgd.\" Redistribution and use in source and binary forms, with or without 110215cc7dScgd.\" modification, are permitted provided that the following conditions 120215cc7dScgd.\" are met: 130215cc7dScgd.\" 1. Redistributions of source code must retain the above copyright 140215cc7dScgd.\" notice, this list of conditions and the following disclaimer. 150215cc7dScgd.\" 2. Redistributions in binary form must reproduce the above copyright 160215cc7dScgd.\" notice, this list of conditions and the following disclaimer in the 170215cc7dScgd.\" documentation and/or other materials provided with the distribution. 18eb7c1594Sagc.\" 3. Neither the name of the University nor the names of its contributors 190215cc7dScgd.\" may be used to endorse or promote products derived from this software 200215cc7dScgd.\" without specific prior written permission. 210215cc7dScgd.\" 220215cc7dScgd.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 230215cc7dScgd.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 240215cc7dScgd.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 250215cc7dScgd.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 260215cc7dScgd.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 270215cc7dScgd.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 280215cc7dScgd.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 290215cc7dScgd.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 300215cc7dScgd.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 310215cc7dScgd.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 320215cc7dScgd.\" SUCH DAMAGE. 330215cc7dScgd.\" 340215cc7dScgd.\" @(#)kvm.3 8.1 (Berkeley) 6/4/93 350215cc7dScgd.\" 36b8c5a244Schristos.Dd September 14, 2011 370215cc7dScgd.Dt KVM 3 380215cc7dScgd.Os 390215cc7dScgd.Sh NAME 400215cc7dScgd.Nm kvm 410215cc7dScgd.Nd kernel memory interface 426982982fSperry.Sh LIBRARY 436982982fSperry.Lb libkvm 440215cc7dScgd.Sh DESCRIPTION 450215cc7dScgdThe 46e066ad32Swiz.Nm 470215cc7dScgdlibrary provides a uniform interface for accessing kernel virtual memory 480215cc7dScgdimages, including live systems and crash dumps. 490215cc7dScgdAccess to live systems is via 506e0792feSmikel.Pa /dev/mem 510215cc7dScgdwhile crash dumps can be examined via the core file generated by 520215cc7dScgd.Xr savecore 8 . 530215cc7dScgdThe interface behaves identically in both cases. 540215cc7dScgdMemory can be read and written, kernel symbol addresses can be 550215cc7dScgdlooked up efficiently, and information about user processes can 560215cc7dScgdbe gathered. 570215cc7dScgd.Pp 580215cc7dScgd.Fn kvm_open 590215cc7dScgdis first called to obtain a descriptor for all subsequent calls. 60*810ed218Swiz.Sh FILES 61*810ed218Swiz.Bl -tag -width /dev/mem -compact 62*810ed218Swiz.It Pa /dev/mem 63*810ed218Swizinterface to physical memory 64*810ed218Swiz.El 650215cc7dScgd.Sh COMPATIBILITY 66bec910b3SwizThe kvm interface was first introduced in SunOS. 67bec910b3SwizA considerable number of programs have been developed that use this 68bec910b3Swizinterface, making backward compatibility highly desirable. 690215cc7dScgdIn most respects, the Sun kvm interface is consistent and clean. 700215cc7dScgdAccordingly, the generic portion of the interface (i.e., 710215cc7dScgd.Fn kvm_open , 720215cc7dScgd.Fn kvm_close , 730215cc7dScgd.Fn kvm_read , 740215cc7dScgd.Fn kvm_write , 750215cc7dScgdand 760215cc7dScgd.Fn kvm_nlist ) 776982982fSperryhas been incorporated into the 786982982fSperry.Bx 79bec910b3Swizinterface. 80bec910b3SwizIndeed, many kvm applications (i.e., debuggers and statistical monitors) 81bec910b3Swizuse only this subset of the interface. 820215cc7dScgd.Pp 83bec910b3SwizThe process interface was not kept. 84bec910b3SwizThis is not a portability issue since any code that manipulates 85bec910b3Swizprocesses is inherently machine dependent. 860215cc7dScgd.Pp 870215cc7dScgdFinally, the Sun kvm error reporting semantics are poorly defined. 880215cc7dScgdThe library can be configured either to print errors to stderr automatically, 890215cc7dScgdor to print no error messages at all. 900215cc7dScgdIn the latter case, the nature of the error cannot be determined. 916982982fSperryTo overcome this, the 926982982fSperry.Bx 93bec910b3Swizinterface includes a routine, 940215cc7dScgd.Xr kvm_geterr 3 , 95bec910b3Swizto return (not print out) the error message corresponding to the most 96bec910b3Swizrecent error condition on the given descriptor. 970215cc7dScgd.Sh SEE ALSO 980215cc7dScgd.Xr kvm_close 3 , 990215cc7dScgd.Xr kvm_getargv 3 , 1000215cc7dScgd.Xr kvm_getenvv 3 , 1010215cc7dScgd.Xr kvm_geterr 3 , 102b8c5a244Schristos.Xr kvm_getkernelname 3 , 1030215cc7dScgd.Xr kvm_getloadavg 3 , 104c62a74e6Sthorpej.Xr kvm_getlwps 3 , 1050215cc7dScgd.Xr kvm_getprocs 3 , 1060215cc7dScgd.Xr kvm_nlist 3 , 1070215cc7dScgd.Xr kvm_open 3 , 1080215cc7dScgd.Xr kvm_openfiles 3 , 1090215cc7dScgd.Xr kvm_read 3 , 1100215cc7dScgd.Xr kvm_write 3 111