summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorjake <jake@FreeBSD.org>2002-08-10 22:14:16 +0000
committerjake <jake@FreeBSD.org>2002-08-10 22:14:16 +0000
commitc154930f1967d6f637c928047218a1acebff7239 (patch)
tree7349581d304c20934c8c25ed2dcc7c74735a7e7e /lib
parent3e2d19afb9bdd2dfa6868b6e843d91fa0a846f9c (diff)
downloadFreeBSD-src-c154930f1967d6f637c928047218a1acebff7239.zip
FreeBSD-src-c154930f1967d6f637c928047218a1acebff7239.tar.gz
Auto size available kernel virtual address space based on phsyical memory
size. This avoids blowing out kva in kmeminit() on large memory machines (4 gigs or more). Reviewed by: tmm
Diffstat (limited to 'lib')
-rw-r--r--lib/libkvm/kvm_sparc64.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/lib/libkvm/kvm_sparc64.c b/lib/libkvm/kvm_sparc64.c
index dffcb24..435eb43 100644
--- a/lib/libkvm/kvm_sparc64.c
+++ b/lib/libkvm/kvm_sparc64.c
@@ -76,6 +76,7 @@ static char sccsid[] = "@(#)kvm_hp300.c 8.1 (Berkeley) 6/4/93";
struct vmstate {
vm_offset_t vm_tsb;
+ vm_size_t vm_tsb_mask;
};
void
@@ -91,7 +92,8 @@ _kvm_initvtop(kvm_t *kd)
{
struct nlist nlist[2];
struct vmstate *vm;
- u_long pa;
+ vm_offset_t pa;
+ vm_size_t mask;
vm = (struct vmstate *)_kvm_malloc(kd, sizeof(*vm));
if (vm == NULL) {
@@ -102,17 +104,21 @@ _kvm_initvtop(kvm_t *kd)
vm->vm_tsb = 0;
nlist[0].n_name = "tsb_kernel_phys";
- nlist[1].n_name = 0;
+ nlist[1].n_name = "tsb_kernel_mask";
+ nlist[2].n_name = 0;
if (kvm_nlist(kd, nlist) != 0) {
_kvm_err(kd, kd->program, "bad namelist");
return (-1);
}
- if (kvm_read(kd, nlist[0].n_value, &pa, sizeof(pa)) != sizeof(pa)) {
+ if (kvm_read(kd, nlist[0].n_value, &pa, sizeof(pa)) != sizeof(pa) ||
+ kvm_read(kd, nlist[1].n_value, &mask, sizeof(mask)) !=
+ sizeof(mask)) {
_kvm_err(kd, kd->program, "cannot read tsb_kernel_phys");
return (-1);
}
vm->vm_tsb = pa;
+ vm->vm_tsb_mask = mask;
return (0);
}
@@ -127,7 +133,8 @@ _kvm_kvatop(kvm_t *kd, u_long va, u_long *pa)
vpn = btop(va);
offset = va & PAGE_MASK;
- tte_pa = kd->vmst->vm_tsb + ((vpn & TSB_KERNEL_MASK) << TTE_SHIFT);
+ tte_pa = kd->vmst->vm_tsb +
+ ((vpn & kd->vmst->vm_tsb_mask) << TTE_SHIFT);
/* XXX This has to be a physical address read, kvm_read is virtual */
if (lseek(kd->pmfd, tte_pa, 0) == -1) {
OpenPOWER on IntegriCloud