From 6eb290c167c4a5f9543379bf27e0960d0a22f85f Mon Sep 17 00:00:00 2001 From: Miod Vallat Date: Thu, 30 Dec 2004 21:28:49 +0000 Subject: If we are running on a 68040 or a 68060 processor, overwrite the copypage() code with the faster copypage040() before the kernel text is mapped read-only. --- sys/arch/hp300/hp300/locore.s | 20 +++++++++++++++++++- sys/arch/mac68k/mac68k/locore.s | 21 ++++++++++++++++++++- sys/arch/mvme68k/mvme68k/locore.s | 19 ++++++++++++++++++- 3 files changed, 57 insertions(+), 3 deletions(-) (limited to 'sys') diff --git a/sys/arch/hp300/hp300/locore.s b/sys/arch/hp300/hp300/locore.s index c8820504608..7b3d01ae55b 100644 --- a/sys/arch/hp300/hp300/locore.s +++ b/sys/arch/hp300/hp300/locore.s @@ -1,4 +1,4 @@ -/* $OpenBSD: locore.s,v 1.44 2004/12/30 21:26:14 miod Exp $ */ +/* $OpenBSD: locore.s,v 1.45 2004/12/30 21:28:47 miod Exp $ */ /* $NetBSD: locore.s,v 1.91 1998/11/11 06:41:25 thorpej Exp $ */ /* @@ -433,6 +433,23 @@ Lstart3: jbsr a0@ | pmap_bootstrap(firstpa, nextpa) addql #8,sp +/* + * While still running physical, override copypage() with the 68040 + * optimized version, copypage040(), if possible. + * This relies upon the fact that copypage() immediately follows + * copypage040() in memory. + */ + RELOC(mmutype, a0) + cmpl #MMU_68040,a0@ + jgt Lmmu_enable + RELOC(copypage040, a0) + RELOC(copypage, a1) + movl a1, a2 +1: + movw a0@+, a2@+ + cmpl a0, a1 + jgt 1b + /* * Prepare to enable MMU. * Since the kernel is not mapped logical == physical we must insure @@ -443,6 +460,7 @@ Lstart3: * * Is this all really necessary, or am I paranoid?? */ +Lmmu_enable: RELOC(Sysseg, a0) | system segment table addr movl a0@,d1 | read value (a KVA) addl a5,d1 | convert to PA diff --git a/sys/arch/mac68k/mac68k/locore.s b/sys/arch/mac68k/mac68k/locore.s index d87a17cb9dd..077b7929657 100644 --- a/sys/arch/mac68k/mac68k/locore.s +++ b/sys/arch/mac68k/mac68k/locore.s @@ -1,4 +1,4 @@ -/* $OpenBSD: locore.s,v 1.43 2004/12/26 22:36:34 miod Exp $ */ +/* $OpenBSD: locore.s,v 1.44 2004/12/30 21:28:48 miod Exp $ */ /* $NetBSD: locore.s,v 1.103 1998/07/09 06:02:50 scottr Exp $ */ /* @@ -254,6 +254,25 @@ Lstart3: movl #_C_LABEL(vectab),d0 | set Vector Base Register movc d0,vbr +/* + * We might not be running physical, but we don't have read-only mappings + * yet either. It's time to override copypage() with the 68040 + * optimized version, copypage040(), if possible. + * This relies upon the fact that copypage() immediately follows + * copypage040() in memory. + */ + movl #_C_LABEL(mmutype),a0 + cmpl #MMU_68040,a0@ + jgt Lmmu_enable + movl #_C_LABEL(copypage040),a0 + movl #_C_LABEL(copypage),a1 + movl a1, a2 +1: + movw a0@+, a2@+ + cmpl a0, a1 + jgt 1b + +Lmmu_enable: movl _C_LABEL(Sysseg),a1 | system segment table addr addl _C_LABEL(load_addr),a1 | Make it physical addr cmpl #MMU_68040,_C_LABEL(mmutype) diff --git a/sys/arch/mvme68k/mvme68k/locore.s b/sys/arch/mvme68k/mvme68k/locore.s index 09b3f9168df..6e41e389a2e 100644 --- a/sys/arch/mvme68k/mvme68k/locore.s +++ b/sys/arch/mvme68k/mvme68k/locore.s @@ -1,4 +1,4 @@ -/* $OpenBSD: locore.s,v 1.46 2004/12/24 22:50:30 miod Exp $ */ +/* $OpenBSD: locore.s,v 1.47 2004/12/30 21:28:48 miod Exp $ */ /* * Copyright (c) 1995 Theo de Raadt @@ -448,6 +448,23 @@ Lstart2: jbsr a0@ | pmap_bootstrap(firstpa, nextpa) addql #8,sp +/* + * While still running physical, override copypage() with the 68040 + * optimized version, copypage040(), if possible. + * This relies upon the fact that copypage() immediately follows + * copypage040() in memory. + */ + RELOC(mmutype, a0) + cmpl #MMU_68040,a0@ + jgt Lmmu_enable + RELOC(copypage040, a0) + RELOC(copypage, a1) + movl a1, a2 +1: + movw a0@+, a2@+ + cmpl a0, a1 + jgt 1b + /* * Enable the MMU. * Since the kernel is mapped logical == physical, we just turn it on. -- cgit v1.2.3