diff options
author | Tom Cosgrove <tom@cvs.openbsd.org> | 2007-02-20 21:15:02 +0000 |
---|---|---|
committer | Tom Cosgrove <tom@cvs.openbsd.org> | 2007-02-20 21:15:02 +0000 |
commit | b5de0662c0ae590547e7ddf1190bad604e2d2d32 (patch) | |
tree | 24d8349b344e6d332fcbcfcb1db55cf1ca3417ee /lib | |
parent | d084ccaa91178ec96027c48218e22002215bedba (diff) |
Revert PAE pmap for now, until the strange bug is found. This stops
the freezes many of us are seeing (especially on amd64 machines running
OpenBSD/i386).
Much testing by nick@ (as always - thanks!), hugh@, ian@, kettenis@
and Sam Smith (s (at) msmith (dot) net).
Requested by, input from, and ok deraadt@ ok art@, kettenis@, miod@
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libkvm/kvm_i386.c | 81 | ||||
-rw-r--r-- | lib/libkvm/shlib_version | 2 |
2 files changed, 26 insertions, 57 deletions
diff --git a/lib/libkvm/kvm_i386.c b/lib/libkvm/kvm_i386.c index e88444fcb71..815417c6c2d 100644 --- a/lib/libkvm/kvm_i386.c +++ b/lib/libkvm/kvm_i386.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kvm_i386.c,v 1.19 2006/06/09 09:46:04 mickey Exp $ */ +/* $OpenBSD: kvm_i386.c,v 1.20 2007/02/20 21:15:00 tom Exp $ */ /* $NetBSD: kvm_i386.c,v 1.9 1996/03/18 22:33:38 thorpej Exp $ */ /*- @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)kvm_hp300.c 8.1 (Berkeley) 6/4/93"; #else -static char *rcsid = "$OpenBSD: kvm_i386.c,v 1.19 2006/06/09 09:46:04 mickey Exp $"; +static char *rcsid = "$OpenBSD: kvm_i386.c,v 1.20 2007/02/20 21:15:00 tom Exp $"; #endif #endif /* LIBC_SCCS and not lint */ @@ -68,21 +68,9 @@ static char *rcsid = "$OpenBSD: kvm_i386.c,v 1.19 2006/06/09 09:46:04 mickey Exp #include <machine/pte.h> struct vmstate { - void *PTD; - paddr_t pg_frame; - paddr_t pt_mask; - int size; - int pte_size; + pd_entry_t *PTD; }; -#define pdei(vm,v) ((v) >> ((vm)->size == NBPG ? 22 : 21)) -#define ptei(vm,v) (((v) & (vm)->pt_mask) >> PGSHIFT) -#define PDE(vm,v) \ - ((vm)->size == NBPG ? ((u_int32_t *)(vm)->PTD)[pdei(vm,v)] : \ - ((u_int64_t *)(vm)->PTD)[pdei(vm,v)]) -#define PG_FRAME(vm) ((vm)->pg_frame) -#define pte_size(vm) ((vm)->pte_size) - void _kvm_freevtop(kvm_t *kd) { @@ -98,10 +86,9 @@ _kvm_freevtop(kvm_t *kd) int _kvm_initvtop(kvm_t *kd) { - struct nlist nl[3]; + struct nlist nl[2]; struct vmstate *vm; - paddr_t pa; - int ps; + u_long pa; vm = (struct vmstate *)_kvm_malloc(kd, sizeof(*vm)); if (vm == NULL) @@ -111,48 +98,31 @@ _kvm_initvtop(kvm_t *kd) vm->PTD = NULL; nl[0].n_name = "_PTDpaddr"; - nl[1].n_name = "_PTDsize"; - nl[2].n_name = NULL; + nl[1].n_name = NULL; if (kvm_nlist(kd, nl) != 0) { _kvm_err(kd, kd->program, "bad namelist"); return (-1); } - if (_kvm_pread(kd, kd->pmfd, &ps, sizeof ps, - _kvm_pa2off(kd, nl[1].n_value - KERNBASE)) != sizeof ps) - return (-1); + if (_kvm_pread(kd, kd->pmfd, &pa, sizeof pa, + (off_t)_kvm_pa2off(kd, nl[0].n_value - KERNBASE)) != sizeof pa) + goto invalid; - pa = 0; - if (ps == NBPG) { - vm->pg_frame = 0xfffff000; - vm->pt_mask = 0x003ff000; - vm->pte_size = 4; - } else if (ps == NBPG * 4) { - vm->pg_frame = 0xffffff000ULL; - vm->pt_mask = 0x001ff000; - vm->pte_size = 8; - } else { - _kvm_err(kd, 0, "PTDsize is invalid"); - return (-1); - } + vm->PTD = (pd_entry_t *)_kvm_malloc(kd, NBPG); - if (_kvm_pread(kd, kd->pmfd, &pa, vm->pte_size, - _kvm_pa2off(kd, nl[0].n_value - KERNBASE)) != vm->pte_size) - return (-1); + if (_kvm_pread(kd, kd->pmfd, vm->PTD, NBPG, + (off_t)_kvm_pa2off(kd, pa)) != NBPG) + goto invalid; - vm->PTD = _kvm_malloc(kd, ps); - if (vm->PTD == NULL) - return (-1); + return (0); - if (_kvm_pread(kd, kd->pmfd, vm->PTD, ps, _kvm_pa2off(kd, pa)) != ps) { +invalid: + if (vm->PTD != NULL) { free(vm->PTD); vm->PTD = NULL; - return (-1); } - - vm->size = ps; - return (0); + return (-1); } /* @@ -161,9 +131,9 @@ _kvm_initvtop(kvm_t *kd) int _kvm_kvatop(kvm_t *kd, u_long va, paddr_t *pa) { - u_long offset; + u_long offset, pte_pa; struct vmstate *vm; - paddr_t pte, pte_pa; + pt_entry_t pte; if (!kd->vmst) { _kvm_err(kd, 0, "vatop called before initvtop"); @@ -186,19 +156,18 @@ _kvm_kvatop(kvm_t *kd, u_long va, paddr_t *pa) *pa = va; return (NBPG - (int)offset); } - if ((PDE(vm, va) & PG_V) == 0) + if ((vm->PTD[pdei(va)] & PG_V) == 0) goto invalid; - pte_pa = (PDE(vm, va) & PG_FRAME(vm)) + - (ptei(vm, va) * pte_size(vm)); + pte_pa = (vm->PTD[pdei(va)] & PG_FRAME) + + (ptei(va) * sizeof(pt_entry_t)); /* XXX READ PHYSICAL XXX */ - pte = 0; - if (_kvm_pread(kd, kd->pmfd, &pte, pte_size(vm), - _kvm_pa2off(kd, pte_pa)) != pte_size(vm)) + if (_kvm_pread(kd, kd->pmfd, &pte, sizeof pte, + (off_t)_kvm_pa2off(kd, pte_pa)) != sizeof pte) goto invalid; - *pa = (pte & PG_FRAME(vm)) + offset; + *pa = (pte & PG_FRAME) + offset; return (NBPG - (int)offset); invalid: diff --git a/lib/libkvm/shlib_version b/lib/libkvm/shlib_version index d0f0988b418..1c5d96eb2aa 100644 --- a/lib/libkvm/shlib_version +++ b/lib/libkvm/shlib_version @@ -1,2 +1,2 @@ -major=8 +major=9 minor=0 |