1/*
2 * arch/ppc64/lib/copypage.S
3 *
4 * Copyright (C) 2002 Paul Mackerras, IBM Corp.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11#include <asm/processor.h>
12#include <asm/ppc_asm.tmpl>
13
14_GLOBAL(copy_page)
15	std	r31,-8(1)
16	std	r30,-16(1)
17	std	r29,-24(1)
18	std	r28,-32(1)
19	std	r27,-40(1)
20	std	r26,-48(1)
21	std	r25,-56(1)
22	std	r24,-64(1)
23	std	r23,-72(1)
24	std	r22,-80(1)
25	std	r21,-88(1)
26	std	r20,-96(1)
27	li	r5,4096/32 - 1
28	addi	r3,r3,-8
29	li	r12,5
300:	addi	r5,r5,-24
31	mtctr	r12
32	ld	r22,640(4)
33	ld	r21,512(4)
34	ld	r20,384(4)
35	ld	r11,256(4)
36	ld	r9,128(4)
37	ld	r7,0(4)
38	ld	r25,648(4)
39	ld	r24,520(4)
40	ld	r23,392(4)
41	ld	r10,264(4)
42	ld	r8,136(4)
43	ldu	r6,8(4)
44	cmpwi	r5,24
451:	std	r22,648(3)
46	std	r21,520(3)
47	std	r20,392(3)
48	std	r11,264(3)
49	std	r9,136(3)
50	std	r7,8(3)
51	ld	r28,648(4)
52	ld	r27,520(4)
53	ld	r26,392(4)
54	ld	r31,264(4)
55	ld	r30,136(4)
56	ld	r29,8(4)
57	std	r25,656(3)
58	std	r24,528(3)
59	std	r23,400(3)
60	std	r10,272(3)
61	std	r8,144(3)
62	std	r6,16(3)
63	ld	r22,656(4)
64	ld	r21,528(4)
65	ld	r20,400(4)
66	ld	r11,272(4)
67	ld	r9,144(4)
68	ld	r7,16(4)
69	std	r28,664(3)
70	std	r27,536(3)
71	std	r26,408(3)
72	std	r31,280(3)
73	std	r30,152(3)
74	stdu	r29,24(3)
75	ld	r25,664(4)
76	ld	r24,536(4)
77	ld	r23,408(4)
78	ld	r10,280(4)
79	ld	r8,152(4)
80	ldu	r6,24(4)
81	bdnz	1b
82	std	r22,648(3)
83	std	r21,520(3)
84	std	r20,392(3)
85	std	r11,264(3)
86	std	r9,136(3)
87	std	r7,8(3)
88	addi	r4,r4,640
89	addi	r3,r3,648
90	bge	0b
91	mtctr	r5
92	ld	r7,0(4)
93	ld	r8,8(4)
94	ldu	r9,16(4)
953:	ld	r10,8(4)
96	std	r7,8(3)
97	ld	r7,16(4)
98	std	r8,16(3)
99	ld	r8,24(4)
100	std	r9,24(3)
101	ldu	r9,32(4)
102	stdu	r10,32(3)
103	bdnz	3b
1044:	ld	r10,8(4)
105	std	r7,8(3)
106	std	r8,16(3)
107	std	r9,24(3)
108	std	r10,32(3)
1099:	ld	r20,-96(1)
110	ld	r21,-88(1)
111	ld	r22,-80(1)
112	ld	r23,-72(1)
113	ld	r24,-64(1)
114	ld	r25,-56(1)
115	ld	r26,-48(1)
116	ld	r27,-40(1)
117	ld	r28,-32(1)
118	ld	r29,-24(1)
119	ld	r30,-16(1)
120	ld	r31,-8(1)
121	blr
122