summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorArtur Grabowski <art@cvs.openbsd.org>1999-12-08 10:44:50 +0000
committerArtur Grabowski <art@cvs.openbsd.org>1999-12-08 10:44:50 +0000
commit537d1ee919934fbadce2b00f722966fc4ed91c84 (patch)
tree53b7240c449f304756efd414f93bfd0af9c14729 /sys/arch
parent8714d23212bcebe28ed8d4b387da23605bb44ee2 (diff)
Dumb implementation of PMAP_NEW, it works but without any gains yet.
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/sparc/include/pmap.h59
-rw-r--r--sys/arch/sparc/sparc/pmap.c217
2 files changed, 274 insertions, 2 deletions
diff --git a/sys/arch/sparc/include/pmap.h b/sys/arch/sparc/include/pmap.h
index afa47beedda..f3bd9b09faa 100644
--- a/sys/arch/sparc/include/pmap.h
+++ b/sys/arch/sparc/include/pmap.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: pmap.h,v 1.12 1999/11/11 12:30:35 art Exp $ */
+/* $OpenBSD: pmap.h,v 1.13 1999/12/08 10:44:48 art Exp $ */
/* $NetBSD: pmap.h,v 1.30 1997/08/04 20:00:47 pk Exp $ */
/*
@@ -286,7 +286,11 @@ void *pmap_bootstrap_alloc __P((int));
void pmap_change_wiring __P((pmap_t, vaddr_t, boolean_t));
void pmap_collect __P((pmap_t));
void pmap_copy __P((pmap_t, pmap_t, vaddr_t, vsize_t, vaddr_t));
+#ifdef PMAP_NEW
+pmap_t pmap_create __P((void));
+#else
pmap_t pmap_create __P((vsize_t));
+#endif
void pmap_destroy __P((pmap_t));
void pmap_init __P((void));
vaddr_t pmap_map __P((vaddr_t, paddr_t, paddr_t, int));
@@ -310,15 +314,29 @@ void pmap_writetext __P((unsigned char *, int));
/* SUN4/SUN4C SPECIFIC DECLARATIONS */
#if defined(SUN4) || defined(SUN4C)
+#ifdef PMAP_NEW
+boolean_t pmap_clear_modify4_4c __P((struct vm_page *));
+boolean_t pmap_clear_reference4_4c __P((struct vm_page *));
+#else
void pmap_clear_modify4_4c __P((paddr_t pa));
void pmap_clear_reference4_4c __P((paddr_t pa));
+#endif
void pmap_copy_page4_4c __P((paddr_t, paddr_t));
void pmap_enter4_4c __P((pmap_t, vaddr_t, paddr_t, vm_prot_t,
boolean_t, vm_prot_t));
paddr_t pmap_extract4_4c __P((pmap_t, vaddr_t));
+#ifdef PMAP_NEW
+boolean_t pmap_is_modified4_4c __P((struct vm_page *));
+boolean_t pmap_is_referenced4_4c __P((struct vm_page *));
+void pmap_kenter_pa4_4c __P((vaddr_t, paddr_t, vm_prot_t));
+void pmap_kenter_pgs4_4c __P((vaddr_t, struct vm_page **, int));
+void pmap_kremove4_4c __P((vaddr_t, vsize_t));
+void pmap_page_protect4_4c __P((struct vm_page *, vm_prot_t));
+#else
boolean_t pmap_is_modified4_4c __P((paddr_t pa));
boolean_t pmap_is_referenced4_4c __P((paddr_t pa));
void pmap_page_protect4_4c __P((paddr_t, vm_prot_t));
+#endif
void pmap_protect4_4c __P((pmap_t, vaddr_t, vaddr_t, vm_prot_t));
void pmap_zero_page4_4c __P((paddr_t));
void pmap_changeprot4_4c __P((pmap_t, vaddr_t, vm_prot_t, int));
@@ -327,15 +345,29 @@ void pmap_changeprot4_4c __P((pmap_t, vaddr_t, vm_prot_t, int));
/* SIMILAR DECLARATIONS FOR SUN4M MODULE */
#if defined(SUN4M)
+#ifdef PMAP_NEW
+boolean_t pmap_clear_modify4m __P((struct vm_page *));
+boolean_t pmap_clear_reference4m __P((struct vm_page *));
+#else
void pmap_clear_modify4m __P((paddr_t pa));
void pmap_clear_reference4m __P((paddr_t pa));
+#endif
void pmap_copy_page4m __P((paddr_t, paddr_t));
void pmap_enter4m __P((pmap_t, vaddr_t, paddr_t, vm_prot_t,
boolean_t, vm_prot_t));
paddr_t pmap_extract4m __P((pmap_t, vaddr_t));
+#ifdef PMAP_NEW
+boolean_t pmap_is_modified4m __P((struct vm_page *));
+boolean_t pmap_is_referenced4m __P((struct vm_page *));
+void pmap_kenter_pa4m __P((vaddr_t, paddr_t, vm_prot_t));
+void pmap_kenter_pgs4m __P((vaddr_t, struct vm_page **, int));
+void pmap_kremove4m __P((vaddr_t, vsize_t));
+void pmap_page_protect4m __P((struct vm_page *, vm_prot_t));
+#else
boolean_t pmap_is_modified4m __P((paddr_t pa));
boolean_t pmap_is_referenced4m __P((paddr_t pa));
void pmap_page_protect4m __P((paddr_t, vm_prot_t));
+#endif
void pmap_protect4m __P((pmap_t, vaddr_t, vaddr_t, vm_prot_t));
void pmap_zero_page4m __P((paddr_t));
void pmap_changeprot4m __P((pmap_t, vaddr_t, vm_prot_t, int));
@@ -350,6 +382,9 @@ void pmap_changeprot4m __P((pmap_t, vaddr_t, vm_prot_t, int));
#define pmap_extract pmap_extract4_4c
#define pmap_is_modified pmap_is_modified4_4c
#define pmap_is_referenced pmap_is_referenced4_4c
+#define pmap_kenter_pa pmap_kenter_pa4_4c
+#define pmap_kenter_pgs pmap_kenter_pgs4_4c
+#define pmap_kremove pmap_kremove4_4c
#define pmap_page_protect pmap_page_protect4_4c
#define pmap_protect pmap_protect4_4c
#define pmap_zero_page pmap_zero_page4_4c
@@ -364,6 +399,9 @@ void pmap_changeprot4m __P((pmap_t, vaddr_t, vm_prot_t, int));
#define pmap_extract pmap_extract4m
#define pmap_is_modified pmap_is_modified4m
#define pmap_is_referenced pmap_is_referenced4m
+#define pmap_kenter_pa pmap_kenter_pa4m
+#define pmap_kenter_pgs pmap_kenter_pgs4m
+#define pmap_kremove pmap_kremove4m
#define pmap_page_protect pmap_page_protect4m
#define pmap_protect pmap_protect4m
#define pmap_zero_page pmap_zero_page4m
@@ -371,15 +409,31 @@ void pmap_changeprot4m __P((pmap_t, vaddr_t, vm_prot_t, int));
#else /* must use function pointers */
+#ifdef PMAP_NEW
+extern boolean_t (*pmap_clear_modify_p) __P((struct vm_page *));
+extern boolean_t (*pmap_clear_reference_p) __P((struct vm_page *));
+#else
extern void (*pmap_clear_modify_p) __P((paddr_t pa));
extern void (*pmap_clear_reference_p) __P((paddr_t pa));
+#endif
extern void (*pmap_copy_page_p) __P((paddr_t, paddr_t));
extern void (*pmap_enter_p) __P((pmap_t, vaddr_t, paddr_t,
vm_prot_t, boolean_t, vm_prot_t));
extern paddr_t (*pmap_extract_p) __P((pmap_t, vaddr_t));
+#ifdef PMAP_NEW
+extern boolean_t (*pmap_is_modified_p) __P((struct vm_page *));
+extern boolean_t (*pmap_is_referenced_p) __P((struct vm_page *));
+extern void (*pmap_kenter_pa_p) __P((vaddr_t, paddr_t, vm_prot_t));
+extern void (*pmap_kenter_pgs_p) __P((vaddr_t, struct vm_page **,
+ int));
+extern void (*pmap_kremove_p) __P((vaddr_t, vsize_t));
+extern void (*pmap_page_protect_p) __P((struct vm_page *,
+ vm_prot_t));
+#else
extern boolean_t (*pmap_is_modified_p) __P((paddr_t pa));
extern boolean_t (*pmap_is_referenced_p) __P((paddr_t pa));
extern void (*pmap_page_protect_p) __P((paddr_t, vm_prot_t));
+#endif
extern void (*pmap_protect_p) __P((pmap_t, vaddr_t, vaddr_t,
vm_prot_t));
extern void (*pmap_zero_page_p) __P((paddr_t));
@@ -393,6 +447,9 @@ extern void (*pmap_changeprot_p) __P((pmap_t, vaddr_t,
#define pmap_extract (*pmap_extract_p)
#define pmap_is_modified (*pmap_is_modified_p)
#define pmap_is_referenced (*pmap_is_referenced_p)
+#define pmap_kenter_pa (*pmap_kenter_pa_p)
+#define pmap_kenter_pgs (*pmap_kenter_pgs_p)
+#define pmap_kremove (*pmap_kremove_p)
#define pmap_page_protect (*pmap_page_protect_p)
#define pmap_protect (*pmap_protect_p)
#define pmap_zero_page (*pmap_zero_page_p)
diff --git a/sys/arch/sparc/sparc/pmap.c b/sys/arch/sparc/sparc/pmap.c
index e57381cde82..e81c97cfdea 100644
--- a/sys/arch/sparc/sparc/pmap.c
+++ b/sys/arch/sparc/sparc/pmap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pmap.c,v 1.46 1999/12/07 15:32:30 art Exp $ */
+/* $OpenBSD: pmap.c,v 1.47 1999/12/08 10:44:49 art Exp $ */
/* $NetBSD: pmap.c,v 1.118 1998/05/19 19:00:18 thorpej Exp $ */
/*
@@ -597,15 +597,29 @@ static void mmu_setup4m_L3 __P((int, struct segmap *));
/* function pointer declarations */
/* from pmap.h: */
+#ifdef PMAP_NEW
+boolean_t (*pmap_clear_modify_p) __P((struct vm_page *));
+boolean_t (*pmap_clear_reference_p) __P((struct vm_page *));
+#else
void (*pmap_clear_modify_p) __P((paddr_t pa));
void (*pmap_clear_reference_p) __P((paddr_t pa));
+#endif
void (*pmap_copy_page_p) __P((paddr_t, paddr_t));
void (*pmap_enter_p) __P((pmap_t, vaddr_t, paddr_t, vm_prot_t,
boolean_t, vm_prot_t));
paddr_t (*pmap_extract_p) __P((pmap_t, vaddr_t));
+#ifdef PMAP_NEW
+boolean_t (*pmap_is_modified_p) __P((struct vm_page *));
+boolean_t (*pmap_is_referenced_p) __P((struct vm_page *));
+void (*pmap_kenter_pa_p) __P((vaddr_t, paddr_t, vm_prot_t));
+void (*pmap_kenter_pgs_p) __P((vaddr_t, struct vm_page **, int));
+void (*pmap_kremove_p) __P((vaddr_t, vsize_t));
+void (*pmap_page_protect_p) __P((struct vm_page *, vm_prot_t));
+#else
boolean_t (*pmap_is_modified_p) __P((paddr_t pa));
boolean_t (*pmap_is_referenced_p) __P((paddr_t pa));
void (*pmap_page_protect_p) __P((paddr_t, vm_prot_t));
+#endif
void (*pmap_protect_p) __P((pmap_t, vaddr_t, vaddr_t, vm_prot_t));
void (*pmap_zero_page_p) __P((paddr_t));
void (*pmap_changeprot_p) __P((pmap_t, vaddr_t, vm_prot_t, int));
@@ -2779,6 +2793,11 @@ pmap_bootstrap4_4c(nctx, nregion, nsegment)
pmap_extract_p = pmap_extract4_4c;
pmap_is_modified_p = pmap_is_modified4_4c;
pmap_is_referenced_p = pmap_is_referenced4_4c;
+#ifdef PMAP_NEW
+ pmap_kenter_pa_p = pmap_kenter_pa4_4c;
+ pmap_kenter_pgs_p = pmap_kenter_pgs4_4c;
+ pmap_kremove_p = pmap_kremove4_4c;
+#endif
pmap_page_protect_p = pmap_page_protect4_4c;
pmap_protect_p = pmap_protect4_4c;
pmap_zero_page_p = pmap_zero_page4_4c;
@@ -3091,6 +3110,11 @@ pmap_bootstrap4m(void)
pmap_extract_p = pmap_extract4m;
pmap_is_modified_p = pmap_is_modified4m;
pmap_is_referenced_p = pmap_is_referenced4m;
+#ifdef PMAP_NEW
+ pmap_kenter_pa_p = pmap_kenter_pa4m;
+ pmap_kenter_pgs_p = pmap_kenter_pgs4m;
+ pmap_kremove_p = pmap_kremove4m;
+#endif
pmap_page_protect_p = pmap_page_protect4m;
pmap_protect_p = pmap_protect4m;
pmap_zero_page_p = pmap_zero_page4m;
@@ -3527,13 +3551,19 @@ pmap_map(va, pa, endpa, prot)
* If size is nonzero, the map is useless. (ick)
*/
struct pmap *
+#ifdef PMAP_NEW
+pmap_create()
+#else
pmap_create(size)
vsize_t size;
+#endif
{
struct pmap *pm;
+#ifndef PMAP_NEW
if (size)
return (NULL);
+#endif
pm = (struct pmap *)malloc(sizeof *pm, M_VMPMAP, M_WAITOK);
#ifdef DEBUG
if (pmapdebug & PDB_CREATE)
@@ -4296,8 +4326,13 @@ pmap_rmu4m(pm, va, endva, vr, vs)
#if defined(SUN4) || defined(SUN4C)
void
+#ifdef PMAP_NEW
+pmap_page_protect4_4c(pg, prot)
+ struct vm_page *pg;
+#else
pmap_page_protect4_4c(pa, prot)
paddr_t pa;
+#endif
vm_prot_t prot;
{
struct pvlist *pv, *pv0, *npv;
@@ -4306,6 +4341,9 @@ pmap_page_protect4_4c(pa, prot)
int flags, nleft, i, s, ctx;
struct regmap *rp;
struct segmap *sp;
+#ifdef PMAP_NEW
+ paddr_t pa = VM_PAGE_TO_PHYS(pg);
+#endif
#ifdef DEBUG
if (!pmap_pa_exists(pa))
@@ -4694,8 +4732,13 @@ useless:
* to read-only (in which case pv_changepte does the trick).
*/
void
+#ifdef PMAP_NEW
+pmap_page_protect4m(pg, prot)
+ struct vm_page *pg;
+#else
pmap_page_protect4m(pa, prot)
paddr_t pa;
+#endif
vm_prot_t prot;
{
struct pvlist *pv, *pv0, *npv;
@@ -4704,6 +4747,9 @@ pmap_page_protect4m(pa, prot)
int flags, nleft, s, ctx;
struct regmap *rp;
struct segmap *sp;
+#ifdef PMAP_NEW
+ paddr_t pa = VM_PAGE_TO_PHYS(pg);
+#endif
#ifdef DEBUG
if (!pmap_pa_exists(pa))
@@ -5334,6 +5380,41 @@ printf("%s[%d]: pmap_enu: changing existing va(0x%x)=>pa entry\n",
splx(s);
}
+#ifdef PMAP_NEW
+void
+pmap_kenter_pa4_4c(va, pa, prot)
+ vaddr_t va;
+ paddr_t pa;
+ vm_prot_t prot;
+{
+ pmap_enter4_4c(pmap_kernel(), va, pa, prot, TRUE, 0);
+}
+
+void
+pmap_kenter_pgs4_4c(va, pgs, npgs)
+ vaddr_t va;
+ struct vm_page **pgs;
+ int npgs;
+{
+ int i;
+
+ for (i = 0; i < npgs; i++, va += PAGE_SIZE) {
+ pmap_enter4_4c(pmap_kernel(), va, VM_PAGE_TO_PHYS(pgs[i]),
+ VM_PROT_READ|VM_PROT_WRITE, TRUE, 0);
+ }
+}
+
+void
+pmap_kremove4_4c(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
+
#endif /*sun4,4c*/
#if defined(SUN4M) /* Sun4M versions of enter routines */
@@ -5649,6 +5730,42 @@ printf("%s[%d]: pmap_enu: changing existing va(0x%x)=>pa(pte=0x%x) entry\n",
splx(s);
}
+
+#ifdef PMAP_NEW
+void
+pmap_kenter_pa4m(va, pa, prot)
+ vaddr_t va;
+ paddr_t pa;
+ vm_prot_t prot;
+{
+ pmap_enter4m(pmap_kernel(), va, pa, prot, TRUE, 0);
+}
+
+void
+pmap_kenter_pgs4m(va, pgs, npgs)
+ vaddr_t va;
+ struct vm_page **pgs;
+ int npgs;
+{
+ int i;
+
+ for (i = 0; i < npgs; i++, va += PAGE_SIZE) {
+ pmap_enter4m(pmap_kernel(), va, VM_PAGE_TO_PHYS(pgs[i]),
+ VM_PROT_READ|VM_PROT_WRITE, TRUE, 0);
+ }
+}
+
+void
+pmap_kremove4m(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_NEW */
+
#endif /* sun4m */
/*
@@ -5904,27 +6021,52 @@ pmap_collect(pm)
/*
* Clear the modify bit for the given physical page.
*/
+#ifdef PMAP_NEW
+boolean_t
+pmap_clear_modify4_4c(pg)
+ struct vm_page *pg;
+#else
void
pmap_clear_modify4_4c(pa)
paddr_t pa;
+#endif
{
struct pvlist *pv;
+#ifdef PMAP_NEW
+ paddr_t pa;
+ boolean_t ret = 0;
+#endif
pv = pvhead(atop(pa));
if ((pa & (PMAP_TNC_4 & ~PMAP_NC)) == 0 && pv) {
(void) pv_syncflags4_4c(pv);
+#ifdef PMAP_NEW
+ ret = pv->pv_flags & PV_MOD;
+#endif
pv->pv_flags &= ~PV_MOD;
}
+#ifdef PMAP_NEW
+ return ret;
+#endif
}
/*
* Tell whether the given physical page has been modified.
*/
+#ifdef PMAP_NEW
+boolean_t
+pmap_is_modified4_4c(pg)
+ struct vm_page *pg;
+#else
int
pmap_is_modified4_4c(pa)
paddr_t pa;
+#endif
{
struct pvlist *pv;
+#ifdef PMAP_NEW
+ paddr_t pa = VM_PAGE_TO_PHYS(pg);
+#endif
pv = pvhead(atop(pa));
if ((pa & (PMAP_TNC_4 & ~PMAP_NC)) == 0 && pv) {
@@ -5937,27 +6079,52 @@ pmap_is_modified4_4c(pa)
/*
* Clear the reference bit for the given physical page.
*/
+#ifdef PMAP_NEW
+boolean_t
+pmap_clear_reference4_4c(pg)
+ struct vm_page *pg;
+#else
void
pmap_clear_reference4_4c(pa)
paddr_t pa;
+#endif
{
struct pvlist *pv;
+#ifdef PMAP_NEW
+ paddr_t pa = VM_PAGE_TO_PHYS(pg);
+ boolean_t ret = 0;
+#endif
pv = pvhead(atop(pa));
if ((pa & (PMAP_TNC_4 & ~PMAP_NC)) == 0 && pv) {
(void) pv_syncflags4_4c(pv);
+#ifdef PMAP_NEW
+ ret = pv->pv_flags & PV_REF;
+#endif
pv->pv_flags &= ~PV_REF;
}
+#ifdef PMAP_NEW
+ return ret;
+#endif
}
/*
* Tell whether the given physical page has been referenced.
*/
+#ifdef PMAP_NEW
+boolean_t
+pmap_is_referenced4_4c(pg)
+ struct vm_page *pg;
+#else
int
pmap_is_referenced4_4c(pa)
paddr_t pa;
+#endif
{
struct pvlist *pv;
+#ifdef PMAP_NEW
+ paddr_t pa = VM_PAGE_TO_PHYS(pg);
+#endif
pv = pvhead(atop(pa));
if ((pa & (PMAP_TNC_4 & ~PMAP_NC)) == 0 && pv) {
@@ -5982,27 +6149,52 @@ pmap_is_referenced4_4c(pa)
/*
* Clear the modify bit for the given physical page.
*/
+#ifdef PMAP_NEW
+boolean_t
+pmap_clear_modify4m(pg)
+ struct vm_page *pg;
+#else
void
pmap_clear_modify4m(pa) /* XXX %%%: Should service from swpagetbl for 4m */
paddr_t pa;
+#endif
{
struct pvlist *pv;
+#ifdef PMAP_NEW
+ paddr_t pa = VM_PAGE_TO_PHYS(pg);
+ boolean_t ret = 0;
+#endif
pv = pvhead(atop(pa));
if ((pa & (PMAP_TNC_SRMMU & ~PMAP_NC)) == 0 && pv) {
(void) pv_syncflags4m(pv);
+#ifdef PMAP_NEW
+ ret = pv->pv_flags & PV_MOD4M;
+#endif
pv->pv_flags &= ~PV_MOD4M;
}
+#ifdef PMAP_NEW
+ return ret;
+#endif
}
/*
* Tell whether the given physical page has been modified.
*/
+#ifdef PMAP_NEW
+boolean_t
+pmap_is_modified4m(pg)
+ struct vm_page *pg;
+#else
int
pmap_is_modified4m(pa) /* Test performance with SUN4M && SUN4/4C. XXX */
paddr_t pa;
+#endif
{
struct pvlist *pv;
+#ifdef PMAP_NEW
+ paddr_t pa = VM_PAGE_TO_PHYS(pg);
+#endif
pv = pvhead(atop(pa));
if ((pa & (PMAP_TNC_SRMMU & ~PMAP_NC)) == 0 && pv) {
@@ -6015,27 +6207,50 @@ pmap_is_modified4m(pa) /* Test performance with SUN4M && SUN4/4C. XXX */
/*
* Clear the reference bit for the given physical page.
*/
+#ifdef PMAP_NEW
+boolean_t
+pmap_clear_reference4m(pg)
+ struct vm_page *pg;
+#else
void
pmap_clear_reference4m(pa)
paddr_t pa;
+#endif
{
struct pvlist *pv;
+#ifdef PMAP_NEW
+ paddr_t pa = VM_PAGE_TO_PHYS(pg);
+ boolean_t ret = 0;
+#endif
pv = pvhead(atop(pa));
if ((pa & (PMAP_TNC_SRMMU & ~PMAP_NC)) == 0 && pv) {
(void) pv_syncflags4m(pv);
+#ifdef PMAP_NEW
+ ret = pv->pv_flags & PV_REF4M;
+#endif
pv->pv_flags &= ~PV_REF4M;
}
+ return ret;
}
/*
* Tell whether the given physical page has been referenced.
*/
+#ifdef PMAP_NEW
+boolean_t
+pmap_is_referenced4m(pg)
+ struct vm_page *pg;
+#else
int
pmap_is_referenced4m(pa)
paddr_t pa;
+#endif
{
struct pvlist *pv;
+#ifdef PMAP_NEW
+ paddr_t pa = VM_PAGE_TO_PHYS(pg);
+#endif
pv = pvhead(atop(pa));
if ((pa & (PMAP_TNC_SRMMU & ~PMAP_NC)) == 0 && pv) {