diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2007-12-02 21:22:20 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2007-12-02 21:22:20 +0000 |
commit | eb4d0a6bad9ae2aae1adced957ff32a94aebbddb (patch) | |
tree | 48859524669507361afe29cb66347599e09ab650 /sys/arch | |
parent | 1650e61219b0f085938ffd3529b18f122e371efd (diff) |
Provide faster bcopy() and bzero() routines for pmap_copy_page() and
pmap_zero_page().
Diffstat (limited to 'sys/arch')
-rw-r--r-- | sys/arch/m88k/m88k/pmap.c | 10 | ||||
-rw-r--r-- | sys/arch/m88k/m88k/subr.S | 53 |
2 files changed, 57 insertions, 6 deletions
diff --git a/sys/arch/m88k/m88k/pmap.c b/sys/arch/m88k/m88k/pmap.c index 9b2fd26d6f2..4347aa3cb80 100644 --- a/sys/arch/m88k/m88k/pmap.c +++ b/sys/arch/m88k/m88k/pmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.c,v 1.40 2007/11/24 11:13:56 miod Exp $ */ +/* $OpenBSD: pmap.c,v 1.41 2007/12/02 21:22:19 miod Exp $ */ /* * Copyright (c) 2001-2004, Miodrag Vallat * Copyright (c) 1998-2001 Steve Murphree, Jr. @@ -794,6 +794,7 @@ pmap_zero_page(struct vm_page *pg) int spl; int cpu = cpu_number(); pt_entry_t *pte; + extern void zeropage(vaddr_t); #ifdef PMAPDEBUG if (pmap_debug & CD_ZERO) @@ -813,9 +814,7 @@ pmap_zero_page(struct vm_page *pg) * bound to only one cpu. */ cmmu_flush_tlb(cpu, TRUE, va, 1); - - bzero((void *)va, PAGE_SIZE); - + zeropage(va); splx(spl); } @@ -2054,6 +2053,7 @@ pmap_copy_page(struct vm_page *srcpg, struct vm_page *dstpg) int spl; pt_entry_t *dstpte, *srcpte; int cpu = cpu_number(); + extern void copypage(vaddr_t, vaddr_t); #ifdef PMAPDEBUG if (pmap_debug & CD_COPY) @@ -2078,7 +2078,7 @@ pmap_copy_page(struct vm_page *srcpg, struct vm_page *dstpg) * bound to only one cpu. */ cmmu_flush_tlb(cpu, TRUE, dstva, 2); - bcopy((const void *)srcva, (void *)dstva, PAGE_SIZE); + copypage(srcva, dstva); splx(spl); } diff --git a/sys/arch/m88k/m88k/subr.S b/sys/arch/m88k/m88k/subr.S index 6487667d7c0..f11dfd63d57 100644 --- a/sys/arch/m88k/m88k/subr.S +++ b/sys/arch/m88k/m88k/subr.S @@ -1,4 +1,4 @@ -/* $OpenBSD: subr.S,v 1.14 2006/11/18 22:48:44 miod Exp $ */ +/* $OpenBSD: subr.S,v 1.15 2007/12/02 21:22:19 miod Exp $ */ /* * Mach Operating System * Copyright (c) 1993-1992 Carnegie Mellon University @@ -32,6 +32,7 @@ #include <sys/errno.h> +#include <machine/param.h> #include <machine/asm.h> #include <machine/trap.h> @@ -1017,6 +1018,7 @@ ASLOCAL(kr_strat) word _ASM_LABEL(kr_byte_copy) word _ASM_LABEL(kr_3byte_word_copy) +#ifdef DDB /* * non-local goto * int setjmp(label_t *); @@ -1067,6 +1069,7 @@ ENTRY(longjmp) ld r31,r2,18*4 jmp.n r1 or r2,r0,1 +#endif /* * Signal trampoline code. @@ -1090,3 +1093,51 @@ GLOBAL(sigcode) /* r31 points to sigframe */ NOP NOP GLOBAL(esigcode) + +/* + * Helper functions for pmap_copy_page() and pmap_zero_page(). + */ +/* + * void copypage(vaddr_t src, vaddr_t dst); + * + * This copies PAGE_SIZE bytes from src to dst in 32 byte chunks. + */ +GLOBAL(copypage) + addu r12, r2, PAGE_SIZE +1: + 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 + bb1.n ne, r4, 1b + addu r3, r3, 0x20 + jmp r1 + +/* + * void zeropage(vaddr_t dst); + * + * This zeroes PAGE_SIZE bytes from src to dst in 64 byte chunks. + */ +GLOBAL(zeropage) + addu r12, r2, PAGE_SIZE + or r3, r1, r0 + or r1, r0, r0 +1: + st.d r0, r2, 0x00 + st.d r0, r2, 0x08 + st.d r0, r2, 0x10 + st.d r0, r2, 0x18 + st.d r0, r2, 0x20 + st.d r0, r2, 0x28 + st.d r0, r2, 0x30 + st.d r0, r2, 0x38 + addu r2, r2, 0x40 + cmp r4, r2, r12 + bb1 ne, r4, 1b + jmp r3 |