summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Downs <downsj@cvs.openbsd.org>1997-02-10 11:13:35 +0000
committerJason Downs <downsj@cvs.openbsd.org>1997-02-10 11:13:35 +0000
commitfa95ed58cc33877b3d80a7622f353d42f9347a42 (patch)
tree3a9cd338fff55eed5e75b3a11b331470a7e1f182
parent625d2c4a2749d270601a648f3e61d18f134d4ffe (diff)
hp300 portion of the copypage/zeropage/mappedcopy changes from NetBSD.
-rw-r--r--sys/arch/hp300/hp300/locore.s34
-rw-r--r--sys/arch/hp300/hp300/machdep.c17
-rw-r--r--sys/arch/hp300/hp300/mem.c16
-rw-r--r--sys/arch/hp300/hp300/pmap.c8
-rw-r--r--sys/arch/hp300/hp300/vm_machdep.c93
5 files changed, 22 insertions, 146 deletions
diff --git a/sys/arch/hp300/hp300/locore.s b/sys/arch/hp300/hp300/locore.s
index 28ce12e5e2a..2b445ae9e97 100644
--- a/sys/arch/hp300/hp300/locore.s
+++ b/sys/arch/hp300/hp300/locore.s
@@ -1,4 +1,4 @@
-/* $OpenBSD: locore.s,v 1.10 1997/02/05 17:30:23 downsj Exp $ */
+/* $OpenBSD: locore.s,v 1.11 1997/02/10 11:13:28 downsj Exp $ */
/* $NetBSD: locore.s,v 1.63 1997/02/02 07:55:52 thorpej Exp $ */
/*
@@ -1177,38 +1177,6 @@ _esigcode:
#include <machine/asm.h>
/*
- * copypage(fromaddr, toaddr)
- *
- * Optimized version of bcopy for a single page-aligned NBPG byte copy.
- */
-ENTRY(copypage)
- movl sp@(4),a0 | source address
- movl sp@(8),a1 | destination address
- movl #NBPG/32,d0 | number of 32 byte chunks
-#if defined(M68040)
- cmpl #MMU_68040,_mmutype | 68040?
- jne Lmlloop | no, use movl
-Lm16loop:
- .long 0xf6209000 | move16 a0@+,a1@+
- .long 0xf6209000 | move16 a0@+,a1@+
- subql #1,d0
- jne Lm16loop
- rts
-#endif
-Lmlloop:
- movl a0@+,a1@+
- movl a0@+,a1@+
- movl a0@+,a1@+
- movl a0@+,a1@+
- movl a0@+,a1@+
- movl a0@+,a1@+
- movl a0@+,a1@+
- movl a0@+,a1@+
- subql #1,d0
- jne Lmlloop
- rts
-
-/*
* non-local gotos
*/
ENTRY(setjmp)
diff --git a/sys/arch/hp300/hp300/machdep.c b/sys/arch/hp300/hp300/machdep.c
index f4e2d74c49e..db97744d548 100644
--- a/sys/arch/hp300/hp300/machdep.c
+++ b/sys/arch/hp300/hp300/machdep.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: machdep.c,v 1.17 1997/02/05 17:33:00 downsj Exp $ */
-/* $NetBSD: machdep.c,v 1.77 1996/12/11 16:49:23 thorpej Exp $ */
+/* $OpenBSD: machdep.c,v 1.18 1997/02/10 11:13:30 downsj Exp $ */
+/* $NetBSD: machdep.c,v 1.80 1997/02/02 07:58:49 thorpej Exp $ */
/*
* Copyright (c) 1997 Theo de Raadt
@@ -1337,20 +1337,17 @@ dumpsys()
void
initcpu()
{
-#ifdef MAPPEDCOPY
- extern u_int mappedcopysize;
+#ifdef MAPPEDCOPY
/*
* Initialize lower bound for doing copyin/copyout using
* page mapping (if not already set). We don't do this on
* VAC machines as it loses big time.
*/
- if (mappedcopysize == 0) {
- if (ectype == EC_VIRT)
- mappedcopysize = (u_int) -1;
- else
- mappedcopysize = NBPG;
- }
+ if (ectype == EC_VIRT)
+ mappedcopysize = -1; /* in case it was patched */
+ else
+ mappedcopysize = NBPG;
#endif
parityenable();
#ifdef USELEDS
diff --git a/sys/arch/hp300/hp300/mem.c b/sys/arch/hp300/hp300/mem.c
index 9c976a692ab..05a49d51cee 100644
--- a/sys/arch/hp300/hp300/mem.c
+++ b/sys/arch/hp300/hp300/mem.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: mem.c,v 1.2 1997/01/12 15:13:24 downsj Exp $ */
-/* $NetBSD: mem.c,v 1.13 1995/04/10 13:10:51 mycroft Exp $ */
+/* $OpenBSD: mem.c,v 1.3 1997/02/10 11:13:31 downsj Exp $ */
+/* $NetBSD: mem.c,v 1.14 1997/02/02 07:59:41 thorpej Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@@ -57,7 +57,7 @@
#include <vm/vm.h>
extern u_int lowram;
-caddr_t zeropage;
+static caddr_t devzeropage;
/*ARGSUSED*/
int
@@ -163,18 +163,18 @@ mmrw(dev, uio, flags)
* XXX on the hp300 we already know where there
* is a global zeroed page, the null segment table.
*/
- if (zeropage == NULL) {
+ if (devzeropage == NULL) {
#if CLBYTES == NBPG
extern caddr_t Segtabzero;
- zeropage = Segtabzero;
+ devzeropage = Segtabzero;
#else
- zeropage = (caddr_t)
+ devzeropage = (caddr_t)
malloc(CLBYTES, M_TEMP, M_WAITOK);
- bzero(zeropage, CLBYTES);
+ bzero(devzeropage, CLBYTES);
#endif
}
c = min(iov->iov_len, CLBYTES);
- error = uiomove(zeropage, c, uio);
+ error = uiomove(devzeropage, c, uio);
continue;
default:
diff --git a/sys/arch/hp300/hp300/pmap.c b/sys/arch/hp300/hp300/pmap.c
index 2c30c432451..2d604f4993c 100644
--- a/sys/arch/hp300/hp300/pmap.c
+++ b/sys/arch/hp300/hp300/pmap.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: pmap.c,v 1.3 1997/01/12 15:13:25 downsj Exp $ */
-/* $NetBSD: pmap.c,v 1.27 1996/10/13 03:14:32 christos Exp $ */
+/* $OpenBSD: pmap.c,v 1.4 1997/02/10 11:13:32 downsj Exp $ */
+/* $NetBSD: pmap.c,v 1.28 1997/02/02 08:01:32 thorpej Exp $ */
/*
* Copyright (c) 1991, 1993
@@ -1716,7 +1716,7 @@ pmap_zero_page(phys)
#endif
kva = (vm_offset_t) CADDR1;
pmap_enter(pmap_kernel(), kva, phys, VM_PROT_READ|VM_PROT_WRITE, TRUE);
- bzero((caddr_t)kva, NBPG);
+ zeropage((caddr_t)kva);
pmap_remove_mapping(pmap_kernel(), kva, PT_ENTRY_NULL,
PRM_TFLUSH|PRM_CFLUSH);
}
@@ -1751,7 +1751,7 @@ pmap_copy_page(src, dst)
pmap_enter(pmap_kernel(), dkva, dst, VM_PROT_READ|VM_PROT_WRITE, TRUE);
copypage((caddr_t)skva, (caddr_t)dkva);
/* CADDR1 and CADDR2 are virtually contiguous */
- pmap_remove(pmap_kernel(), skva, skva+2*NBPG);
+ pmap_remove(pmap_kernel(), skva, skva + (2 * NBPG));
}
/*
diff --git a/sys/arch/hp300/hp300/vm_machdep.c b/sys/arch/hp300/hp300/vm_machdep.c
index b0a6ad9e39f..3c82ed9c088 100644
--- a/sys/arch/hp300/hp300/vm_machdep.c
+++ b/sys/arch/hp300/hp300/vm_machdep.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: vm_machdep.c,v 1.6 1997/01/12 15:13:29 downsj Exp $ */
-/* $NetBSD: vm_machdep.c,v 1.30 1996/05/09 21:26:08 scottr Exp $ */
+/* $OpenBSD: vm_machdep.c,v 1.7 1997/02/10 11:13:34 downsj Exp $ */
+/* $NetBSD: vm_machdep.c,v 1.31 1997/02/02 08:03:06 thorpej Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@@ -361,92 +361,3 @@ vunmapbuf(bp, sz)
bp->b_data = bp->b_saveaddr;
bp->b_saveaddr = NULL;
}
-
-#ifdef MAPPEDCOPY
-u_int mappedcopysize = 4096;
-
-mappedcopyin(fromp, top, count)
- register char *fromp, *top;
- register int count;
-{
- register vm_offset_t kva, upa;
- register int off, len;
- int alignable;
- pmap_t upmap;
- extern caddr_t CADDR1;
-
- kva = (vm_offset_t) CADDR1;
- off = (vm_offset_t)fromp & PAGE_MASK;
- alignable = (off == ((vm_offset_t)top & PAGE_MASK));
- upmap = vm_map_pmap(&curproc->p_vmspace->vm_map);
- while (count > 0) {
- /*
- * First access of a page, use fubyte to make sure
- * page is faulted in and read access allowed.
- */
- if (fubyte(fromp) == -1)
- return (EFAULT);
- /*
- * Map in the page and bcopy data in from it
- */
- upa = pmap_extract(upmap, trunc_page(fromp));
- if (upa == 0)
- panic("mappedcopyin");
- len = min(count, PAGE_SIZE-off);
- pmap_enter(pmap_kernel(), kva, upa, VM_PROT_READ, TRUE);
- if (len == PAGE_SIZE && alignable && off == 0)
- copypage(kva, top);
- else
- bcopy((caddr_t)(kva+off), top, len);
- fromp += len;
- top += len;
- count -= len;
- off = 0;
- }
- pmap_remove(pmap_kernel(), kva, kva+PAGE_SIZE);
- return (0);
-}
-
-mappedcopyout(fromp, top, count)
- register char *fromp, *top;
- register int count;
-{
- register vm_offset_t kva, upa;
- register int off, len;
- int alignable;
- pmap_t upmap;
- extern caddr_t CADDR2;
-
- kva = (vm_offset_t) CADDR2;
- off = (vm_offset_t)top & PAGE_MASK;
- alignable = (off == ((vm_offset_t)fromp & PAGE_MASK));
- upmap = vm_map_pmap(&curproc->p_vmspace->vm_map);
- while (count > 0) {
- /*
- * First access of a page, use subyte to make sure
- * page is faulted in and write access allowed.
- */
- if (subyte(top, *fromp) == -1)
- return (EFAULT);
- /*
- * Map in the page and bcopy data out to it
- */
- upa = pmap_extract(upmap, trunc_page(top));
- if (upa == 0)
- panic("mappedcopyout");
- len = min(count, PAGE_SIZE-off);
- pmap_enter(pmap_kernel(), kva, upa,
- VM_PROT_READ|VM_PROT_WRITE, TRUE);
- if (len == PAGE_SIZE && alignable && off == 0)
- copypage(fromp, kva);
- else
- bcopy(fromp, (caddr_t)(kva+off), len);
- fromp += len;
- top += len;
- count -= len;
- off = 0;
- }
- pmap_remove(pmap_kernel(), kva, kva+PAGE_SIZE);
- return (0);
-}
-#endif