Commit Graph

29 Commits

Author SHA1 Message Date
jym
f15c6971d1 Import PAE support for kvm(3):
- add kvm_i386pae.c (used for PAE memory translations), and update Makefile
  for libkvm build.
- in pdppaddr: pass a flag to indicate PAE mode. Use a bit ignored
  by the MMU. Mask address with PG_FRAME to avoid side effects.

Tested with vmstat(1)/netstat(1) to debug core files of PAE and !PAE
kernels. Older kernel dumps will default to native i386 (!PAE) mode.

XXX Currently, savecore(8) will fail to dump a PAE kernel in a !PAE
    environment (and reciprocally). So you need to sync and reboot
    with a kernel of the same mode as the one that crashed. Once the dump
    is successful, this does not matter anymore.
2010-10-05 23:48:16 +00:00
jym
962a341df6 Change kvm_pa2off() and kvm_kvatop() prototypes (private to kvm(3)):
-int     _kvm_kvatop(kvm_t *, u_long, u_long *);
-off_t   _kvm_pa2off(kvm_t *, u_long);
+int     _kvm_kvatop(kvm_t *, vaddr_t, paddr_t *);
+off_t   _kvm_pa2off(kvm_t *, paddr_t);

Basically, use vaddr_t for VA and paddr_t for PA. In addition, for variables
representing addresses, use paddr_t or vaddr_t, depending on the context.

For most arches, vaddr_t and paddr_t are equivalent to unsigned long. However,
the change was needed for exotic situations, like i386 PAE, were unsigned long
is not suitable for PA which are 64 bits long. As this required a complete
change of the function prototypes, all arches had to be adapted accordingly.

Core files from before this commit should still work with the new code; I did
not see any direct dependency between core's structure and kvatop/pa2off.

The change was compile tested for all arches, as it impacts all of them.

See also:

http://mail-index.netbsd.org/current-users/2010/09/07/msg014249.html
2010-09-20 23:23:16 +00:00
jym
6dc46b923b Ansify and KNF all functions within kvm(3). No objection on current-users@.
Used as ground for u_long => vaddr_t/paddr_t replacements in kvm(3)
private functions.

Compile tested for all arches. See also:

http://mail-index.netbsd.org/current-users/2010/09/07/msg014249.html
2010-09-19 02:07:00 +00:00
mrg
4e9d08ba3d use <i386/foo.h> in a few places. 2008-10-25 23:59:06 +00:00
ad
a7a2d171df Handle reading from raw disk devices. 2008-01-15 13:57:41 +00:00
jld
1717a7fe75 Add address translation support for 4MB pages, which we use to map the
kernel text.
2008-01-05 06:54:12 +00:00
jld
324e44d74f The address translation routine needs to use the plN_pi macros (for
indexing into the PTP), not the plN_i ones (for indexing into the entire
linear page table); cf. the analogous code for amd64.  Fixes ~everything
to do with kernel core dumps on i386.
2008-01-05 06:22:55 +00:00
yamt
21ac91dd00 sync with kernel after the merge of yamt-x86pmap branch. 2007-10-18 15:30:43 +00:00
thorpej
cf21167821 pdtpaddr -> pdppaddr 2004-08-27 01:13:31 +00:00
agc
eb7c1594f1 Move UCB-licensed code from 4-clause to 3-clause licence.
Patches provided by Joel Baker in PR 22280, verified by myself.
2003-08-07 16:42:00 +00:00
thorpej
c62a74e6d5 Merge the nathanw_sa branch. 2003-01-18 10:32:11 +00:00
matt
cce919e025 Don't include <machine/pmap.h> and <machine/vmparam.h> if _KERNEL isn't
defined.  Include them explicitly in the few kvm_arch.c that need them.
2001-08-05 03:33:15 +00:00
mrg
3b8ac18da2 <vm/vm.h> -> <uvm/uvm_extern.h> 2000-06-29 06:34:22 +00:00
mrg
10a6db97ee remove redundant vm includes 2000-06-26 15:34:55 +00:00
simonb
f68ec00b50 More trailing white space. 1999-07-02 15:28:49 +00:00
christos
cc7ffa0da4 Remove lint 1998-09-27 18:15:58 +00:00
thorpej
55c7ea7c28 Use pread(2) and pwrite(2) rather than lseek(2)/{read,write}(2). 1998-06-30 20:29:39 +00:00
thorpej
9a9b611334 Rewrite _kvm_kvatop() to work with the new crash dump format, and make
the i386 port use libkvm, not libkvm.old.
1998-02-18 01:13:08 +00:00
mikel
b4119f6b37 use <sys/cdefs.h> __RCSID() macro 1997-08-15 02:21:56 +00:00
gwr
7739ce58e3 Add _kvm_mdopen() 1997-08-14 16:05:21 +00:00
thorpej
346e67f879 RCS id police. 1996-03-18 22:33:07 +00:00
mycroft
bd267b1b3c Clean up a bit. 1996-03-08 10:45:16 +00:00
cgd
d8eaa29f0f fix a piece of sloppy coding on my part. gdb -k still doesn't work, though. 1995-06-29 11:41:45 +00:00
cgd
64b09480bb update to match reality. 1995-06-26 13:19:27 +00:00
mycroft
c304971439 Eliminate _kvm_uvatop(), in favor of using the machine-independent VM structures. 1995-01-09 08:59:25 +00:00
mycroft
b2ea31e355 Update to match current pmap. 1994-08-15 15:57:36 +00:00
pk
62b40e28b0 Fix kvm_uvatop(). 1994-05-18 09:31:52 +00:00
cgd
a901a9cb96 just punt for now; don't want to deal with this & don't want it to core 1994-05-09 07:01:14 +00:00
cgd
0215cc7d1f new libkvm 1994-05-09 03:15:36 +00:00