Annotation of sys/arch/m68k/m68k/copypage.s, Revision 1.1.1.1
1.1 nbrk 1: /* $OpenBSD: copypage.s,v 1.4 2005/09/25 22:27:15 miod Exp $ */
2: /* $NetBSD: copypage.s,v 1.4 1997/05/30 01:34:49 jtc Exp $ */
3:
4: /*-
5: * Copyright (c) 1997 The NetBSD Foundation, Inc.
6: * All rights reserved.
7: *
8: * This code is derived from software contributed to The NetBSD Foundation
9: * by J.T. Conklin <jtc@netbsd.org> and
10: * by Hiroshi Horitomo <horimoto@cs-aoi.cs.sist.ac.jp>
11: *
12: * Redistribution and use in source and binary forms, with or without
13: * modification, are permitted provided that the following conditions
14: * are met:
15: * 1. Redistributions of source code must retain the above copyright
16: * notice, this list of conditions and the following disclaimer.
17: * 2. Redistributions in binary form must reproduce the above copyright
18: * notice, this list of conditions and the following disclaimer in the
19: * documentation and/or other materials provided with the distribution.
20: * 3. All advertising materials mentioning features or use of this software
21: * must display the following acknowledgement:
22: * This product includes software developed by the NetBSD
23: * Foundation, Inc. and its contributors.
24: * 4. Neither the name of The NetBSD Foundation nor the names of its
25: * contributors may be used to endorse or promote products derived
26: * from this software without specific prior written permission.
27: *
28: * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
29: * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
30: * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
31: * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
32: * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
33: * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
34: * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
35: * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
36: * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
37: * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
38: * POSSIBILITY OF SUCH DAMAGE.
39: */
40:
41: /*
42: * Optimized functions for copying/clearing a whole page.
43: */
44:
45: #include <machine/asm.h>
46: #include "assym.h"
47:
48: .file "copypage.s"
49: .text
50:
51: /*
52: * copypage040(fromaddr, toaddr)
53: *
54: * Optimized version of bcopy for a single page-aligned NBPG byte copy,
55: * using instructions only available on the mc68040 and later.
56: */
57: #if defined(M68040) || defined(M68060)
58: ENTRY(copypage040)
59: movl sp@(4),a0 | source address
60: movl sp@(8),a1 | destination address
61: movw #NBPG/32-1,d0 | number of 32 byte chunks - 1
62: Lm16loop:
63: .long 0xf6209000 | move16 a0@+,a1@+
64: .long 0xf6209000 | move16 a0@+,a1@+
65: dbf d0,Lm16loop
66: rts
67: #endif /* M68040 || M68060 */
68:
69: /*
70: * copypage(fromaddr, toaddr)
71: *
72: * Optimized version of bcopy for a single page-aligned NBPG byte copy.
73: */
74: ENTRY(copypage)
75: movl sp@(4),a0 | source address
76: movl sp@(8),a1 | destination address
77: movw #NBPG/32-1,d0 | number of 32 byte chunks - 1
78: Lmlloop:
79: movl a0@+,a1@+
80: movl a0@+,a1@+
81: movl a0@+,a1@+
82: movl a0@+,a1@+
83: movl a0@+,a1@+
84: movl a0@+,a1@+
85: movl a0@+,a1@+
86: movl a0@+,a1@+
87: dbf d0,Lmlloop
88: rts
89:
90: /*
91: * zeropage(addr)
92: *
93: * Optimized version of bzero for a single page-aligned NBPG byte zero.
94: */
95: ENTRY(zeropage)
96: movl sp@(4),a0 | dest address
97: movql #NBPG/256-1,d0 | number of 256 byte chunks - 1
98: movml d2-d7,sp@-
99: movql #0,d1
100: movql #0,d2
101: movql #0,d3
102: movql #0,d4
103: movql #0,d5
104: movql #0,d6
105: movql #0,d7
106: movl d1,a1
107: lea a0@(NBPG),a0
108: Lzloop:
109: movml d1-d7/a1,a0@-
110: movml d1-d7/a1,a0@-
111: movml d1-d7/a1,a0@-
112: movml d1-d7/a1,a0@-
113: movml d1-d7/a1,a0@-
114: movml d1-d7/a1,a0@-
115: movml d1-d7/a1,a0@-
116: movml d1-d7/a1,a0@-
117: dbf d0,Lzloop
118: movml sp@+,d2-d7
119: rts
CVSweb