summaryrefslogtreecommitdiff
path: root/sys/arch/m88k
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2011-01-05 22:16:17 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2011-01-05 22:16:17 +0000
commitd9466819f4714a779ba66b488ffcdbae665468fe (patch)
tree5976fe9fd47b575652b2274eb3c5287ba69c4ffe /sys/arch/m88k
parent15d1c78e7d8d7ba9be2ff6a7e241e008c8787752 (diff)
Make copypage() and zeropage() per-cpu function pointers, and use a
different version on 88110, which does load allocate of to-be-completely-overwritten cache lines.
Diffstat (limited to 'sys/arch/m88k')
-rw-r--r--sys/arch/m88k/include/cpu.h8
-rw-r--r--sys/arch/m88k/m88k/m8820x_machdep.c8
-rw-r--r--sys/arch/m88k/m88k/pmap.c8
-rw-r--r--sys/arch/m88k/m88k/subr.S59
4 files changed, 73 insertions, 10 deletions
diff --git a/sys/arch/m88k/include/cpu.h b/sys/arch/m88k/include/cpu.h
index aecac92f45b..e14afe7f851 100644
--- a/sys/arch/m88k/include/cpu.h
+++ b/sys/arch/m88k/include/cpu.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpu.h,v 1.51 2010/12/23 20:05:08 miod Exp $ */
+/* $OpenBSD: cpu.h,v 1.52 2011/01/05 22:16:14 miod Exp $ */
/*
* Copyright (c) 1996 Nivas Madhur
* Copyright (c) 1992, 1993
@@ -106,6 +106,12 @@ struct cpu_info {
(uint32_t psr, __cpu_simple_lock_t *lock, uint csr);
/*
+ * Other processor-dependent routines
+ */
+ void (*ci_zeropage)(vaddr_t);
+ void (*ci_copypage)(vaddr_t, vaddr_t);
+
+ /*
* The following fields are used differently depending on
* the processor type. Think of them as an anonymous union
* of two anonymous structs.
diff --git a/sys/arch/m88k/m88k/m8820x_machdep.c b/sys/arch/m88k/m88k/m8820x_machdep.c
index a7e6a6fe082..7e8f58a925d 100644
--- a/sys/arch/m88k/m88k/m8820x_machdep.c
+++ b/sys/arch/m88k/m88k/m8820x_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: m8820x_machdep.c,v 1.46 2011/01/05 22:14:29 miod Exp $ */
+/* $OpenBSD: m8820x_machdep.c,v 1.47 2011/01/05 22:16:16 miod Exp $ */
/*
* Copyright (c) 2004, 2007, 2010, 2011, Miodrag Vallat.
*
@@ -84,6 +84,9 @@
#include <machine/m8820x.h>
#include <machine/psl.h>
+extern void m8820x_zeropage(vaddr_t);
+extern void m8820x_copypage(vaddr_t, vaddr_t);
+
cpuid_t m8820x_init(void);
void m8820x_cpu_configuration_print(int);
void m8820x_shutdown(void);
@@ -481,6 +484,9 @@ m8820x_initialize_cpu(cpuid_t cpu)
*/
apr &= ~CACHE_INH;
m8820x_cmmu_set_reg(CMMU_SAPR, apr, MODE_VAL, cpu, INST_CMMU);
+
+ ci->ci_zeropage = m8820x_zeropage;
+ ci->ci_copypage = m8820x_copypage;
}
/*
diff --git a/sys/arch/m88k/m88k/pmap.c b/sys/arch/m88k/m88k/pmap.c
index f5990b034c2..927ae6fb2b9 100644
--- a/sys/arch/m88k/m88k/pmap.c
+++ b/sys/arch/m88k/m88k/pmap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pmap.c,v 1.60 2011/01/05 22:14:29 miod Exp $ */
+/* $OpenBSD: pmap.c,v 1.61 2011/01/05 22:16:16 miod Exp $ */
/*
* Copyright (c) 2001-2004, 2010, Miodrag Vallat.
@@ -1417,7 +1417,6 @@ pmap_copy_page(struct vm_page *srcpg, struct vm_page *dstpg)
{
paddr_t src = VM_PAGE_TO_PHYS(srcpg);
paddr_t dst = VM_PAGE_TO_PHYS(dstpg);
- extern void copypage(vaddr_t, vaddr_t);
DPRINTF(CD_COPY, ("pmap_copy_page(%p,%p) pa %p %p\n",
srcpg, dstpg, src, dst));
@@ -1426,7 +1425,7 @@ pmap_copy_page(struct vm_page *srcpg, struct vm_page *dstpg)
kernel_apr_cmode != userland_apr_cmode)
cmmu_dcache_wb(cpu_number(), src, PAGE_SIZE);
#endif
- copypage((vaddr_t)src, (vaddr_t)dst);
+ curcpu()->ci_copypage((vaddr_t)src, (vaddr_t)dst);
}
/*
@@ -1437,10 +1436,9 @@ void
pmap_zero_page(struct vm_page *pg)
{
paddr_t pa = VM_PAGE_TO_PHYS(pg);
- extern void zeropage(vaddr_t);
DPRINTF(CD_ZERO, ("pmap_zero_page(%p) pa %p\n", pg, pa));
- zeropage((vaddr_t)pa);
+ curcpu()->ci_zeropage((vaddr_t)pa);
}
/*
diff --git a/sys/arch/m88k/m88k/subr.S b/sys/arch/m88k/m88k/subr.S
index 98c5733911b..bca43ad73a5 100644
--- a/sys/arch/m88k/m88k/subr.S
+++ b/sys/arch/m88k/m88k/subr.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: subr.S,v 1.19 2010/12/23 20:05:08 miod Exp $ */
+/* $OpenBSD: subr.S,v 1.20 2011/01/05 22:16:16 miod Exp $ */
/*
* Mach Operating System
* Copyright (c) 1993-1992 Carnegie Mellon University
@@ -1103,12 +1103,15 @@ GLOBAL(esigcode)
/*
* Helper functions for pmap_copy_page() and pmap_zero_page().
*/
+
+#ifdef M88100
+
/*
* void copypage(vaddr_t src, vaddr_t dst);
*
* This copies PAGE_SIZE bytes from src to dst in 32 byte chunks.
*/
-ENTRY(copypage)
+ENTRY(m8820x_copypage)
addu r12, r2, PAGE_SIZE
1:
ld.d r4, r2, 0x00
@@ -1130,7 +1133,7 @@ ENTRY(copypage)
*
* This zeroes PAGE_SIZE bytes from src to dst in 64 byte chunks.
*/
-ENTRY(zeropage)
+ENTRY(m8820x_zeropage)
addu r12, r2, PAGE_SIZE
or r3, r1, r0
or r1, r0, r0
@@ -1148,6 +1151,56 @@ ENTRY(zeropage)
bb1 ne, r4, 1b
jmp r3
+#endif /* M88100 */
+
+#ifdef M88110
+
+/*
+ * void copypage(vaddr_t src, vaddr_t dst);
+ *
+ * This copies PAGE_SIZE bytes from src to dst in 32 byte chunks (one
+ * cache line).
+ */
+ENTRY(m88110_copypage)
+ addu r12, r2, PAGE_SIZE
+1:
+ ld.h r0, r2, 0x00 # load allocate
+ ld.d r4, r2, 0x00
+ ld.d r6, r2, 0x08
+ st.d r4, r3, 0x00
+ ld.d r8, r2, 0x10
+ st.d r6, r3, 0x08
+ ld.d r10, r2, 0x18
+ st.d r8, r3, 0x10
+ addu r2, r2, 0x20
+ st.d r10, r3, 0x18
+ cmp r4, r2, r12
+ addu r3, r3, 0x20
+ bb1 ne, r4, 1b
+ jmp r1
+
+/*
+ * void zeropage(vaddr_t dst);
+ *
+ * This zeroes PAGE_SIZE bytes from src to dst in 32 byte chunks.
+ */
+ENTRY(m88110_zeropage)
+ addu r12, r2, PAGE_SIZE
+ or r3, r1, r0
+ or r1, r0, r0
+1:
+ ld.h r0, r2, 0x00 # load allocate
+ st.d r0, r2, 0x00
+ st.d r0, r2, 0x08
+ st.d r0, r2, 0x10
+ st.d r0, r2, 0x18
+ addu r2, r2, 0x20
+ cmp r4, r2, r12
+ bb1 ne, r4, 1b
+ jmp r3
+
+#endif /* M88110 */
+
/*
* PSR initialization code, invoked from locore on every processor startup.
*/