1/*
2 *  linux/arch/m32r/mm/page.S
3 *
4 *  Clear/Copy page with CPU
5 *
6 *  Copyright (C) 2004  The Free Software Initiative of Japan
7 *
8 *  Written by Niibe Yutaka
9 *
10 * This file is subject to the terms and conditions of the GNU General Public
11 * License.  See the file "COPYING" in the main directory of this archive
12 * for more details.
13 *
14 */
15	.text
16	.global	copy_page
17	/*
18	 * copy_page (to, from)
19	 *
20	 * PAGE_SIZE = 4096-byte
21	 * Cache line = 16-byte
22	 * 16 * 256
23	 */
24	.align	4
25copy_page:
26	ldi	r2, #255
27	ld	r3, @r0		/* cache line allocate */
28	ld	r4, @r1+
29	ld	r5, @r1+
30	ld	r6, @r1+
31	ld	r7, @r1+
32	.fillinsn
330:
34	st	r4, @r0
35	st	r5, @+r0
36	st	r6, @+r0
37	st	r7, @+r0
38	ld	r4, @r1+
39	addi	r0, #4
40	ld	r5, @r1+
41	ld	r6, @r1+
42	ld	r7, @r1+
43	ld	r3, @r0		/* cache line allocate */
44	addi	r2, #-1
45	bnez	r2, 0b
46
47	st	r4, @r0
48	st	r5, @+r0
49	st	r6, @+r0
50	st	r7, @+r0
51	jmp	r14
52
53	.text
54	.global	clear_page
55	/*
56	 * clear_page (to)
57	 *
58	 * PAGE_SIZE = 4096-byte
59	 * Cache line = 16-byte
60	 * 16 * 256
61	 */
62	.align	4
63clear_page:
64	ldi	r2, #255
65	ldi	r4, #0
66	ld	r3, @r0		/* cache line allocate */
67	.fillinsn
680:
69	st	r4, @r0
70	st	r4, @+r0
71	st	r4, @+r0
72	st	r4, @+r0
73	addi	r0, #4
74	ld	r3, @r0		/* cache line allocate */
75	addi	r2, #-1
76	bnez	r2, 0b
77
78	st	r4, @r0
79	st	r4, @+r0
80	st	r4, @+r0
81	st	r4, @+r0
82	jmp	r14
83