summaryrefslogtreecommitdiff
path: root/lib/libkvm/kvm_amd64.c
Commit message (Collapse)AuthorAgeFilesLines
* Use __SCCSID for SCCS IDs in libkvm sources.John Baldwin2018-05-221-6/+1
| | | | | | | | | | | | | | Rather than using #ifdef's around a static char array, use the existing helper macro from <sys/cdefs.h> for SCCS IDs. To preserve existing behavior, add -DNO__SCCSID to CFLAGS to not include SCCS IDs in the built library by default. Reviewed by: brooks, dab (older version) Reviewed by: rgrimes Differential Revision: https://reviews.freebsd.org/D15459 Notes: svn path=/head/; revision=334053
* General further adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-201-0/+2
| | | | | | | | | | | | | | | | | Mainly focus on files that use BSD 3-Clause license. The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts. Special thanks to Wind River for providing access to "The Duke of Highlander" tool: an older (2014) run over FreeBSD tree was useful as a starting point. Notes: svn path=/head/; revision=326025
* libkvm: fix build failuresWill Andrews2017-11-121-0/+1
| | | | Notes: svn path=/head/; revision=325732
* libkvm: fix warning issues post-r291406Enji Cooper2017-03-221-2/+2
| | | | | | | | | | | | | | | | | - Fix -Wunused warnings with *_native detection handlers by marking `kd` __unused, except with arm/mips, where a slightly more complicated scheme is required to handle the native case vs the non-native case. - Fix -Wmissing-variable-declarations warnings by marking struct kvm_arch objects static. Differential Revision: D10071 MFC after: 1 week Reviewed by: vangyzen Tested with: WIP test code (D10024) // kgdb7121 (i386 crash/kernel on amd64) Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=315697
* Renumber copyright clause 4Warner Losh2017-02-281-1/+1
| | | | | | | | | | | | Renumber cluase 4 to 3, per what everybody else did when BSD granted them permission to remove clause 3. My insistance on keeping the same numbering for legal reasons is too pedantic, so give up on that point. Submitted by: Jan Schaumann <jschauma@stevens.edu> Pull Request: https://github.com/freebsd/freebsd/pull/96 Notes: svn path=/head/; revision=314436
* Don't leak PML4 in _amd64_initvtop(..) if kvm_read2(..) failsEnji Cooper2016-04-301-0/+1
| | | | | | | | | | MFC after: 1 week Reported by: Coverity CID: 1341474 Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=298842
* Fix up pointer issues with lib/libkvmEnji Cooper2016-04-221-2/+6
| | | | | | | | | | | | | | | | | | | In particular, - avoid dereferencing NULL pointers - test pointers against NULL, not 0 - test for errout == NULL in the top-level functions (kvm_open, kvm_openfiles, kvm_open2, etc) - Replace a realloc and free on failure with reallocf Found with: devel/cocchinelle Differential Revision: https://reviews.freebsd.org/D5954 MFC after: 1 week Reviewed by: jhb Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=298485
* Fix parsing of a 1GB page table entry.John Baldwin2016-03-281-1/+1
| | | | | | | | | | | Use 'pdpe' to extract the PA of the 1GB page instead of 'pde' (which was a copy and paste bug from the 2MB page case further down). CID: 1341467 Reported by: pfg Notes: svn path=/head/; revision=297359
* Add support to libkvm for reading vmcores from other architectures.John Baldwin2015-11-271-157/+133
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Add a kvaddr_type to represent kernel virtual addresses instead of unsigned long. - Add a struct kvm_nlist which is a stripped down version of struct nlist that uses kvaddr_t for n_value. - Add a kvm_native() routine that returns true if an open kvm descriptor is for a native kernel and memory image. - Add a kvm_open2() function similar to kvm_openfiles(). It drops the unused 'swapfile' argument and adds a new function pointer argument for a symbol resolving function. Native kernels still use _fdnlist() from libc to resolve symbols if a resolver function is not supplied, but cross kernels require a resolver. - Add a kvm_nlist2() function similar to kvm_nlist() except that it uses struct kvm_nlist instead of struct nlist. - Add a kvm_read2() function similar to kvm_read() except that it uses kvaddr_t instead of unsigned long for the kernel virtual address. - Add a new kvm_arch switch of routines needed by a vmcore backend. Each backend is responsible for implementing kvm_read2() for a given vmcore format. - Use libelf to read headers from ELF kernels and cores (except for powerpc cores). - Add internal helper routines for the common page offset hash table used by the minidump backends. - Port all of the existing kvm backends to implement a kvm_arch switch and to be cross-friendly by using private constants instead of ones that vary by platform (e.g. PAGE_SIZE). Static assertions are present when a given backend is compiled natively to ensure the private constants match the real ones. - Enable all of the existing vmcore backends on all platforms. This means that libkvm on any platform should be able to perform KVA translation and read data from a vmcore of any platform. Tested on: amd64, i386, sparc64 (marius) Differential Revision: https://reviews.freebsd.org/D3341 Notes: svn path=/head/; revision=291406
* Remove ia64.Marcel Moolenaar2014-07-071-2/+1
| | | | | | | | | | | | | | | | | | | | This includes: o All directories named *ia64* o All files named *ia64* o All ia64-specific code guarded by __ia64__ o All ia64-specific makefile logic o Mention of ia64 in comments and documentation This excludes: o Everything under contrib/ o Everything under crypto/ o sys/xen/interface o sys/sys/elf_common.h Discussed at: BSDcan Notes: svn path=/head/; revision=268351
* libkvm code janitoringUlrich Spörlein2011-01-231-10/+9
| | | | | | | | | | | | | | | - make WARNS=6 clean for archs w/o strict alignment requirments - add const, ANSIfy, remove unused vars, cast types for comparison - thanks to differing definitions of VM_MIN_ADDRESS across our archs, we need to trick the compiler to not complain about signedness. We could either fix VM_MIN_ADDRESS to always be a simple integer or make the check conditional on $ARCH. Closes PRs: kern/42386, kern/83364 Reviewed by: bde Notes: svn path=/head/; revision=217744
* Fix missing includes of <string.h>, to silence some compiler warnings.Ed Schouten2009-06-141-0/+1
| | | | | | | Submitted by: Pawel Worach Notes: svn path=/head/; revision=194186
* Re-enable raw dump format support on i386 and amd64 for /dev/fwmem.Hidetoshi Shimokawa2007-06-151-9/+18
| | | | Notes: svn path=/head/; revision=170772
* Remove the advertising clause. UCB did this some time ago, but theseWarner Losh2007-01-081-4/+0
| | | | | | | | | files were never updated to reflect that. MFC After: 2 days Notes: svn path=/head/; revision=165888
* Teach libkvm how to read minidumps. It turns out that minidumps arePeter Wemm2006-04-211-0/+11
| | | | | | | | | | | | | | | | | far more convenient for libkvm to work with because of the page table block at the beginning. As a result, the MD code is smaller. libkvm will automatically detect old vs mini dumps on i386 and amd64. libkvm will handle i386 PAE and non-PAE modes. There is a PAE flag in the i386 minidump header to signal the width of the entries in the page table block. Other convenient values are also present, such as kernbase and the direct map addresses on amd64. Notes: svn path=/head/; revision=157911
* Fix a well duplicated fencepost error that stopped crashdumps beingPeter Wemm2005-10-201-3/+3
| | | | | | | | | | | readable on certain random memory configurations. If the libkvm consumer tried to read something that was in the very last pdpe, pde or pte slot, it would bogusly fail. This is broken in RELENG_6 too. Notes: svn path=/head/; revision=151492
* Support crash dumps > 4GB in size on 32 bit platforms. _kvm_kvatop()Peter Wemm2005-06-291-39/+137
| | | | | | | | | | | | | | | | | | | | | | | | returned an lseek offset in a "u_long *" value, which can't express >4GB offsets on 32 bit machines (eg: PAE). Change to "off_t *" for all. Support ELF crashdumps on i386 and amd64. Support PAE crashdumps on i386. This is done by auto-detecting the presence of the IdlePDPT which means that PAE is active. I used Marcel's _kvm_pa2off strategy and ELF header reader for ELF support on amd64. Paul Saab ported the amd64 changes to i386 and we implemented the PAE support from there. Note that gdb6 in the src tree uses whatever libkvm supports. If you want to debug an old crash dump, you might want to keep an old libkvm.so handy and use LD_PRELOAD or the like. This does not detect the old raw dump format. Approved by: re Notes: svn path=/head/; revision=147672
* Implement crashdump decoding for AMD64 as well, now that I have finallyPeter Wemm2004-05-191-28/+63
| | | | | | | got a sample to test against. Notes: svn path=/head/; revision=129452
* AMD64 support; repocopied from i386Peter Wemm2003-04-301-3/+3
| | | | Notes: svn path=/head/; revision=114330
* Compensate for "Compensate for header dethreading" by backing it out.Bruce Evans2001-10-101-2/+0
| | | | Notes: svn path=/head/; revision=84768
* Implement __FBSDID()Matthew Dillon2001-09-161-3/+3
| | | | Notes: svn path=/head/; revision=83551
* Dynamically adjust to the value of KERNBASE in a crashdump, withPeter Wemm2001-08-241-2/+12
| | | | | | | a fallback for old kernels without the "kernbase" symbol. Notes: svn path=/head/; revision=82263
* Compensate for header dethreading.Mark Murray2001-05-011-0/+2
| | | | Notes: svn path=/head/; revision=76176
* Use kldsym(2) to lookup symbol values. This avoids the kvm_mkdb jugglingPeter Wemm1999-12-271-1/+5
| | | | | | | | | and is module aware. Yes, this means that kvm_nlist(3) will find symbols in loaded modules. The emulation of the nlist struct is pretty crude but seems to work well enough for all the users in the tree that I found. Notes: svn path=/head/; revision=55127
* Copy code from gnu/usr.bin/gdb/gdb/kvm-fbsd.c to deal with 4 MB pages.Tor Egge1997-08-171-0/+13
| | | | Notes: svn path=/head/; revision=28318
* Implement virtual-to-physical address mapping for the kvm library onPeter Wemm1996-10-071-20/+65
| | | | | | | | | | | | | | | dead kernel debugging. The previous code was a "do nothing". The most obvious side effect of this is that you can now do things like this and reasonably expect them to work: dmesg -M /var/crash/vmcore.3 -N /var/crash/kernel.3 ps -axl -M /var/crash/vmcore.3 -N /var/crash/kernel.3 A good deal of this was lifted from the gdb code to do this, as well as from NetBSD's libkvm (which has completely different VM macros) Notes: svn path=/head/; revision=18798
* General -Wall warning cleanup, part I.Jordan K. Hubbard1996-07-121-0/+1
| | | | | | | Submitted-By: Kent Vander Velden <graphix@iastate.edu> Notes: svn path=/head/; revision=17141
* NBPG -> PAGE_SIZEPoul-Henning Kamp1996-05-021-1/+1
| | | | Notes: svn path=/head/; revision=15533
* Remove trailing whitespace.Rodney W. Grimes1995-05-301-1/+1
| | | | Notes: svn path=/head/; revision=8870
* A semicolon was lost.Poul-Henning Kamp1994-11-071-1/+1
| | | | Notes: svn path=/head/; revision=4241
* From: "gj%pcs.dec.com@inet-gw-1.pa.dec.com" <garyj@rks32.pcs.dec.com>Jordan K. Hubbard1994-11-071-0/+1
| | | | | | | | | | | | | | Given the right circumstances, a call to kvm_open can result in a core dump. The diff belows fixes this (note that this change is already in the NetBSD code). Could somebody apply this? Gary J. Submitted by: gj Notes: svn path=/head/; revision=4231
* Made kvm routines use procfs to get out process data such as argumentDavid Greenman1994-08-111-13/+0
| | | | | | | strings. Notes: svn path=/head/; revision=2029
* Fix kvm_i386.c just enough to make it compile and return lots of errorsRodney W. Grimes1994-05-281-173/+34
| | | | | | | | when called. Noop out swapread in kvm_proc.c as our vm system is different. Notes: svn path=/head/; revision=1603
* This is a COPY of kvm_hp300.c, soon to be patched to sorta work withRodney W. Grimes1994-05-281-0/+286
the i386 port. Notes: svn path=/head/; revision=1602