xref: /freebsd/sys/arm/arm/bcopy_page.S (revision 069ac184)
1/*	$NetBSD: bcopy_page.S,v 1.7 2003/10/13 21:03:13 scw Exp $	*/
2
3/*-
4 * Copyright (c) 1995 Scott Stevens
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 *    notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 *    notice, this list of conditions and the following disclaimer in the
14 *    documentation and/or other materials provided with the distribution.
15 * 3. All advertising materials mentioning features or use of this software
16 *    must display the following acknowledgement:
17 *	This product includes software developed by Scott Stevens.
18 * 4. The name of the author may not be used to endorse or promote products
19 *    derived from this software without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
22 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
23 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
24 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
25 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
26 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
30 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 *
32 * RiscBSD kernel project
33 *
34 * bcopy_page.S
35 *
36 * page optimised bcopy and bzero routines
37 *
38 * Created      : 08/04/95
39 */
40
41#include <machine/asm.h>
42#include "assym.inc"
43
44
45/*
46 * armv5e version of bcopy_page
47 */
48ENTRY(bcopy_page)
49	pld	[r0]
50	stmfd	sp!, {r4, r5}
51	_SAVE({r4, r5})
52	mov	ip, #32
53	ldr	r2, [r0], #0x04		/* 0x00 */
54	ldr	r3, [r0], #0x04		/* 0x04 */
551:	pld	[r0, #0x18]		/* Prefetch 0x20 */
56	ldr	r4, [r0], #0x04		/* 0x08 */
57	ldr	r5, [r0], #0x04		/* 0x0c */
58	strd	r2, [r1], #0x08
59	ldr	r2, [r0], #0x04		/* 0x10 */
60	ldr	r3, [r0], #0x04		/* 0x14 */
61	strd	r4, [r1], #0x08
62	ldr	r4, [r0], #0x04		/* 0x18 */
63	ldr	r5, [r0], #0x04		/* 0x1c */
64	strd	r2, [r1], #0x08
65	ldr	r2, [r0], #0x04		/* 0x20 */
66	ldr	r3, [r0], #0x04		/* 0x24 */
67	pld	[r0, #0x18]		/* Prefetch 0x40 */
68	strd	r4, [r1], #0x08
69	ldr	r4, [r0], #0x04		/* 0x28 */
70	ldr	r5, [r0], #0x04		/* 0x2c */
71	strd	r2, [r1], #0x08
72	ldr	r2, [r0], #0x04		/* 0x30 */
73	ldr	r3, [r0], #0x04		/* 0x34 */
74	strd	r4, [r1], #0x08
75	ldr	r4, [r0], #0x04		/* 0x38 */
76	ldr	r5, [r0], #0x04		/* 0x3c */
77	strd	r2, [r1], #0x08
78	ldr	r2, [r0], #0x04		/* 0x40 */
79	ldr	r3, [r0], #0x04		/* 0x44 */
80	pld	[r0, #0x18]		/* Prefetch 0x60 */
81	strd	r4, [r1], #0x08
82	ldr	r4, [r0], #0x04		/* 0x48 */
83	ldr	r5, [r0], #0x04		/* 0x4c */
84	strd	r2, [r1], #0x08
85	ldr	r2, [r0], #0x04		/* 0x50 */
86	ldr	r3, [r0], #0x04		/* 0x54 */
87	strd	r4, [r1], #0x08
88	ldr	r4, [r0], #0x04		/* 0x58 */
89	ldr	r5, [r0], #0x04		/* 0x5c */
90	strd	r2, [r1], #0x08
91	ldr	r2, [r0], #0x04		/* 0x60 */
92	ldr	r3, [r0], #0x04		/* 0x64 */
93	pld	[r0, #0x18]		/* Prefetch 0x80 */
94	strd	r4, [r1], #0x08
95	ldr	r4, [r0], #0x04		/* 0x68 */
96	ldr	r5, [r0], #0x04		/* 0x6c */
97	strd	r2, [r1], #0x08
98	ldr	r2, [r0], #0x04		/* 0x70 */
99	ldr	r3, [r0], #0x04		/* 0x74 */
100	strd	r4, [r1], #0x08
101	ldr	r4, [r0], #0x04		/* 0x78 */
102	ldr	r5, [r0], #0x04		/* 0x7c */
103	strd	r2, [r1], #0x08
104	subs	ip, ip, #0x01
105	ldrgt	r2, [r0], #0x04		/* 0x80 */
106	ldrgt	r3, [r0], #0x04		/* 0x84 */
107	strd	r4, [r1], #0x08
108	bgt	1b
109	ldmfd	sp!, {r4, r5}
110	RET
111END(bcopy_page)
112
113/*
114 * armv5e version of bzero_page
115 */
116ENTRY(bzero_page)
117	mov	r1, #PAGE_SIZE
118	mov	r2, #0
119	mov	r3, #0
1201:	strd	r2, [r0], #8		/* 32 */
121	strd	r2, [r0], #8
122	strd	r2, [r0], #8
123	strd	r2, [r0], #8
124	strd	r2, [r0], #8		/* 64 */
125	strd	r2, [r0], #8
126	strd	r2, [r0], #8
127	strd	r2, [r0], #8
128	strd	r2, [r0], #8		/* 96 */
129	strd	r2, [r0], #8
130	strd	r2, [r0], #8
131	strd	r2, [r0], #8
132	strd	r2, [r0], #8		/* 128 */
133	strd	r2, [r0], #8
134	strd	r2, [r0], #8
135	strd	r2, [r0], #8
136	subs	r1, r1, #128
137	bne	1b
138	RET
139END(bzero_page)
140