summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2001-05-16 17:40:03 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2001-05-16 17:40:03 +0000
commit509bc5b4ef04d8643f9019e9ba17ab59a6fa19b5 (patch)
treede83b4d1d86a065451ec5034ca8e812f20ebb4cb /sys
parent8ef519c605c6713e9d25630a5dae5cdb2390b0ed (diff)
PMAP_NEW support; thorpej@netbsd.org
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/hp300/hp300/pmap.c115
1 files changed, 110 insertions, 5 deletions
diff --git a/sys/arch/hp300/hp300/pmap.c b/sys/arch/hp300/hp300/pmap.c
index 653666a56e7..1f7bb2da90d 100644
--- a/sys/arch/hp300/hp300/pmap.c
+++ b/sys/arch/hp300/hp300/pmap.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: pmap.c,v 1.20 2001/05/09 15:31:24 art Exp $ */
-/* $NetBSD: pmap.c,v 1.75 1999/06/15 22:18:07 thorpej Exp $ */
+/* $OpenBSD: pmap.c,v 1.21 2001/05/16 17:40:02 millert Exp $ */
+/* $NetBSD: pmap.c,v 1.80 1999/09/16 14:52:06 chs Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -800,6 +800,21 @@ pmap_map(va, spa, epa, prot)
*
* Note: no locking is necessary in this function.
*/
+#ifdef PMAP_NEW
+pmap_t
+pmap_create()
+{
+ pmap_t pmap;
+
+ PMAP_DPRINTF(PDB_FOLLOW|PDB_CREATE,
+ ("pmap_create\n"));
+
+ pmap = pool_get(&pmap_pmap_pool, PR_WAITOK);
+ bzero(pmap, sizeof(*pmap));
+ pmap_pinit(pmap);
+ return (pmap);
+}
+#else
pmap_t
pmap_create(size)
vsize_t size;
@@ -821,6 +836,7 @@ pmap_create(size)
pmap_pinit(pmap);
return (pmap);
}
+#endif
/*
* pmap_pinit:
@@ -882,7 +898,7 @@ pmap_destroy(pmap)
/*
* pmap_release:
*
- * Release the sources held by a pmap.
+ * Release the resources held by a pmap.
*
* Note: THIS FUNCTION SHOULD BE MOVED INTO pmap_destroy().
*/
@@ -1082,10 +1098,18 @@ pmap_remove(pmap, sva, eva)
* the permissions specified.
*/
void
+#ifdef PMAP_NEW
+pmap_page_protect(pg, prot)
+ struct vm_page *pg;
+ vm_prot_t prot;
+{
+ paddr_t pa = VM_PAGE_TO_PHYS(pg);
+#else
pmap_page_protect(pa, prot)
paddr_t pa;
vm_prot_t prot;
{
+#endif
struct pv_entry *pv;
int s;
@@ -1539,10 +1563,45 @@ validate:
#endif
}
+#ifdef PMAP_NEW
+void
+pmap_kenter_pa(va, pa, prot)
+ vaddr_t va;
+ paddr_t pa;
+ vm_prot_t prot;
+{
+ pmap_enter(pmap_kernel(), va, pa, prot, TRUE, 0);
+}
+
+void
+pmap_kenter_pgs(va, pgs, npgs)
+ vaddr_t va;
+ struct vm_page **pgs;
+ int npgs;
+{
+ int i;
+
+ for (i = 0; i < npgs; i++, va += PAGE_SIZE) {
+ pmap_enter(pmap_kernel(), va, VM_PAGE_TO_PHYS(pgs[i]),
+ VM_PROT_READ|VM_PROT_WRITE, TRUE, 0);
+ }
+}
+
+void
+pmap_kremove(va, len)
+ vaddr_t va;
+ vsize_t len;
+{
+ for (len >>= PAGE_SHIFT; len > 0; len--, va += PAGE_SIZE) {
+ pmap_remove(pmap_kernel(), va, va + PAGE_SIZE);
+ }
+}
+#endif
+
/*
- * pmap_unwire: [ INTERFACE]
+ * pmap_unwire: [ INTERFACE]
*
- * Change the wiring attribute for a map/virtual-address pair.
+ * Clear the wired attribute for a map/virtual-address pair.
*
* The mapping must already exist in the pmap.
*/
@@ -1936,6 +1995,21 @@ pmap_copy_page(src, dst)
*
* Clear the modify bits on the specified physical page.
*/
+#ifdef PMAP_NEW
+boolean_t
+pmap_clear_modify(pg)
+ struct vm_page *pg;
+{
+ paddr_t pa = VM_PAGE_TO_PHYS(pg);
+ boolean_t rv;
+
+ PMAP_DPRINTF(PDB_FOLLOW, ("pmap_clear_modify(%lx)\n", pa));
+
+ rv = pmap_testbit(pa, PG_M);
+ pmap_changebit(pa, 0, ~PG_M);
+ return rv;
+}
+#else
void
pmap_clear_modify(pa)
paddr_t pa;
@@ -1945,12 +2019,28 @@ pmap_clear_modify(pa)
pmap_changebit(pa, 0, ~PG_M);
}
+#endif
/*
* pmap_clear_reference: [ INTERFACE ]
*
* Clear the reference bit on the specified physical page.
*/
+#ifdef PMAP_NEW
+boolean_t
+pmap_clear_reference(pg)
+ struct vm_page *pg;
+{
+ paddr_t pa = VM_PAGE_TO_PHYS(pg);
+ boolean_t rv;
+
+ PMAP_DPRINTF(PDB_FOLLOW, ("pmap_clear_reference(%lx)\n", pa));
+
+ rv = pmap_testbit(pa, PG_U);
+ pmap_changebit(pa, 0, ~PG_U);
+ return rv;
+}
+#else
void
pmap_clear_reference(pa)
paddr_t pa;
@@ -1960,6 +2050,7 @@ pmap_clear_reference(pa)
pmap_changebit(pa, 0, ~PG_U);
}
+#endif
/*
* pmap_is_referenced: [ INTERFACE ]
@@ -1968,9 +2059,16 @@ pmap_clear_reference(pa)
* by any physical maps.
*/
boolean_t
+#ifdef PMAP_NEW
+pmap_is_referenced(pg)
+ struct vm_page *pg;
+{
+ paddr_t pa = VM_PAGE_TO_PHYS(pg);
+#else
pmap_is_referenced(pa)
paddr_t pa;
{
+#endif
#ifdef DEBUG
if (pmapdebug & PDB_FOLLOW) {
boolean_t rv = pmap_testbit(pa, PG_U);
@@ -1988,9 +2086,16 @@ pmap_is_referenced(pa)
* by any physical maps.
*/
boolean_t
+#ifdef PMAP_NEW
+pmap_is_modified(pg)
+ struct vm_page *pg;
+{
+ paddr_t pa = VM_PAGE_TO_PHYS(pg);
+#else
pmap_is_modified(pa)
paddr_t pa;
{
+#endif
#ifdef DEBUG
if (pmapdebug & PDB_FOLLOW) {
boolean_t rv = pmap_testbit(pa, PG_M);