summaryrefslogtreecommitdiff
path: root/lib/libkvm/kvm_sh.c
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2013-03-28 16:27:32 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2013-03-28 16:27:32 +0000
commit259da6eb12f03ddfe324d8469d70fbcdb71a5386 (patch)
tree6feaa5a7772989b39364eac489153e457560f109 /lib/libkvm/kvm_sh.c
parenta719c74a3c72f64adf8b6485acdcbf0284b53bf7 (diff)
Avoid using PAGE_SHIFT, PAGE_SIZE, and PAGE_MASK defines, since we already
know it from the machine. ok miod
Diffstat (limited to 'lib/libkvm/kvm_sh.c')
-rw-r--r--lib/libkvm/kvm_sh.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/libkvm/kvm_sh.c b/lib/libkvm/kvm_sh.c
index 94db3628b48..e24fe0752d0 100644
--- a/lib/libkvm/kvm_sh.c
+++ b/lib/libkvm/kvm_sh.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kvm_sh.c,v 1.5 2013/03/20 14:46:45 deraadt Exp $ */
+/* $OpenBSD: kvm_sh.c,v 1.6 2013/03/28 16:27:31 deraadt Exp $ */
/*
* Copyright (c) 2007 Miodrag Vallat.
@@ -56,9 +56,9 @@ _kvm_initvtop(kvm_t *kd)
#define __PMAP_PTP_N 512 /* # of page table page maps 2GB. */
/* Stolen from sys/arch/sh/sh/pmap.c */
#define __PMAP_PTP_SHIFT 22
-#define __PMAP_PTP_PG_N (PAGE_SIZE / sizeof(pt_entry_t))
+#define __PMAP_PTP_PG_N (kd->nbpg / sizeof(pt_entry_t))
#define __PMAP_PTP_INDEX(va) (((va) >> __PMAP_PTP_SHIFT) & (__PMAP_PTP_N - 1))
-#define __PMAP_PTP_OFSET(va) ((va >> PAGE_SHIFT) & (__PMAP_PTP_PG_N - 1))
+#define __PMAP_PTP_OFSET(va) ((va / kd->nbpg) & (__PMAP_PTP_PG_N - 1))
int
_kvm_kvatop(kvm_t *kd, u_long va, paddr_t *pa)
@@ -128,8 +128,8 @@ _kvm_kvatop(kvm_t *kd, u_long va, paddr_t *pa)
goto bad;
}
- *pa = (l2pte & PG_PPN) | (va & PAGE_MASK);
- return (PAGE_SIZE - (va & PAGE_MASK));
+ *pa = (l2pte & PG_PPN) | (va & (kd->nbpg - 1));
+ return (kd->nbpg - (va & (kd->nbpg - 1)));
}
/*