xref: /freebsd/sys/arm/arm/bcopy_page.S (revision 9768746b)
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
43__FBSDID("$FreeBSD$");
44
45#include "assym.inc"
46
47
48/*
49 * armv5e version of bcopy_page
50 */
51ENTRY(bcopy_page)
52	pld	[r0]
53	stmfd	sp!, {r4, r5}
54	_SAVE({r4, r5})
55	mov	ip, #32
56	ldr	r2, [r0], #0x04		/* 0x00 */
57	ldr	r3, [r0], #0x04		/* 0x04 */
581:	pld	[r0, #0x18]		/* Prefetch 0x20 */
59	ldr	r4, [r0], #0x04		/* 0x08 */
60	ldr	r5, [r0], #0x04		/* 0x0c */
61	strd	r2, [r1], #0x08
62	ldr	r2, [r0], #0x04		/* 0x10 */
63	ldr	r3, [r0], #0x04		/* 0x14 */
64	strd	r4, [r1], #0x08
65	ldr	r4, [r0], #0x04		/* 0x18 */
66	ldr	r5, [r0], #0x04		/* 0x1c */
67	strd	r2, [r1], #0x08
68	ldr	r2, [r0], #0x04		/* 0x20 */
69	ldr	r3, [r0], #0x04		/* 0x24 */
70	pld	[r0, #0x18]		/* Prefetch 0x40 */
71	strd	r4, [r1], #0x08
72	ldr	r4, [r0], #0x04		/* 0x28 */
73	ldr	r5, [r0], #0x04		/* 0x2c */
74	strd	r2, [r1], #0x08
75	ldr	r2, [r0], #0x04		/* 0x30 */
76	ldr	r3, [r0], #0x04		/* 0x34 */
77	strd	r4, [r1], #0x08
78	ldr	r4, [r0], #0x04		/* 0x38 */
79	ldr	r5, [r0], #0x04		/* 0x3c */
80	strd	r2, [r1], #0x08
81	ldr	r2, [r0], #0x04		/* 0x40 */
82	ldr	r3, [r0], #0x04		/* 0x44 */
83	pld	[r0, #0x18]		/* Prefetch 0x60 */
84	strd	r4, [r1], #0x08
85	ldr	r4, [r0], #0x04		/* 0x48 */
86	ldr	r5, [r0], #0x04		/* 0x4c */
87	strd	r2, [r1], #0x08
88	ldr	r2, [r0], #0x04		/* 0x50 */
89	ldr	r3, [r0], #0x04		/* 0x54 */
90	strd	r4, [r1], #0x08
91	ldr	r4, [r0], #0x04		/* 0x58 */
92	ldr	r5, [r0], #0x04		/* 0x5c */
93	strd	r2, [r1], #0x08
94	ldr	r2, [r0], #0x04		/* 0x60 */
95	ldr	r3, [r0], #0x04		/* 0x64 */
96	pld	[r0, #0x18]		/* Prefetch 0x80 */
97	strd	r4, [r1], #0x08
98	ldr	r4, [r0], #0x04		/* 0x68 */
99	ldr	r5, [r0], #0x04		/* 0x6c */
100	strd	r2, [r1], #0x08
101	ldr	r2, [r0], #0x04		/* 0x70 */
102	ldr	r3, [r0], #0x04		/* 0x74 */
103	strd	r4, [r1], #0x08
104	ldr	r4, [r0], #0x04		/* 0x78 */
105	ldr	r5, [r0], #0x04		/* 0x7c */
106	strd	r2, [r1], #0x08
107	subs	ip, ip, #0x01
108	ldrgt	r2, [r0], #0x04		/* 0x80 */
109	ldrgt	r3, [r0], #0x04		/* 0x84 */
110	strd	r4, [r1], #0x08
111	bgt	1b
112	ldmfd	sp!, {r4, r5}
113	RET
114END(bcopy_page)
115
116/*
117 * armv5e version of bzero_page
118 */
119ENTRY(bzero_page)
120	mov	r1, #PAGE_SIZE
121	mov	r2, #0
122	mov	r3, #0
1231:	strd	r2, [r0], #8		/* 32 */
124	strd	r2, [r0], #8
125	strd	r2, [r0], #8
126	strd	r2, [r0], #8
127	strd	r2, [r0], #8		/* 64 */
128	strd	r2, [r0], #8
129	strd	r2, [r0], #8
130	strd	r2, [r0], #8
131	strd	r2, [r0], #8		/* 96 */
132	strd	r2, [r0], #8
133	strd	r2, [r0], #8
134	strd	r2, [r0], #8
135	strd	r2, [r0], #8		/* 128 */
136	strd	r2, [r0], #8
137	strd	r2, [r0], #8
138	strd	r2, [r0], #8
139	subs	r1, r1, #128
140	bne	1b
141	RET
142END(bzero_page)
143