blob: 53dcb6b1b708b666429502067dfe9163a60eb571 [file] [log] [blame]
Paul Mackerras14cf11a2005-09-26 16:04:21 +10001/*
Mark Nelson57dda6e2008-08-22 14:39:00 +10002 * Copyright (C) 2008 Mark Nelson, IBM Corp.
Paul Mackerras14cf11a2005-09-26 16:04:21 +10003 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version
7 * 2 of the License, or (at your option) any later version.
8 */
Anton Blanchardd988f0e2011-05-08 21:18:38 +00009#include <asm/page.h>
Paul Mackerras14cf11a2005-09-26 16:04:21 +100010#include <asm/processor.h>
11#include <asm/ppc_asm.h>
Mark Nelson57dda6e2008-08-22 14:39:00 +100012#include <asm/asm-offsets.h>
13
14 .section ".toc","aw"
15PPC64_CACHES:
16 .tc ppc64_caches[TC],ppc64_caches
17 .section ".text"
18
Anton Blanchardd988f0e2011-05-08 21:18:38 +000019_GLOBAL(copy_page)
20 lis r5,PAGE_SIZE@h
21 ori r5,r5,PAGE_SIZE@l
Mark Nelson57dda6e2008-08-22 14:39:00 +100022BEGIN_FTR_SECTION
23 ld r10,PPC64_CACHES@toc(r2)
24 lwz r11,DCACHEL1LOGLINESIZE(r10) /* log2 of cache line size */
25 lwz r12,DCACHEL1LINESIZE(r10) /* get cache line size */
26 li r9,0
27 srd r8,r5,r11
28
29 mtctr r8
Anton Blanchard3cd980d2009-10-18 01:23:28 +000030.Lsetup:
Mark Nelson57dda6e2008-08-22 14:39:00 +100031 dcbt r9,r4
32 dcbz r9,r3
33 add r9,r9,r12
Anton Blanchard3cd980d2009-10-18 01:23:28 +000034 bdnz .Lsetup
Mark Nelson57dda6e2008-08-22 14:39:00 +100035END_FTR_SECTION_IFSET(CPU_FTR_CP_USE_DCBTZ)
Paul Mackerras14cf11a2005-09-26 16:04:21 +100036 addi r3,r3,-8
Mark Nelson57dda6e2008-08-22 14:39:00 +100037 srdi r8,r5,7 /* page is copied in 128 byte strides */
38 addi r8,r8,-1 /* one stride copied outside loop */
39
40 mtctr r8
41
42 ld r5,0(r4)
43 ld r6,8(r4)
44 ld r7,16(r4)
45 ldu r8,24(r4)
461: std r5,8(r3)
Mark Nelson57dda6e2008-08-22 14:39:00 +100047 std r6,16(r3)
Anton Blanchard63e6c5b2010-02-10 18:07:54 +000048 ld r9,8(r4)
Mark Nelson57dda6e2008-08-22 14:39:00 +100049 ld r10,16(r4)
50 std r7,24(r3)
Mark Nelson57dda6e2008-08-22 14:39:00 +100051 std r8,32(r3)
Anton Blanchard63e6c5b2010-02-10 18:07:54 +000052 ld r11,24(r4)
Mark Nelson57dda6e2008-08-22 14:39:00 +100053 ld r12,32(r4)
54 std r9,40(r3)
Mark Nelson57dda6e2008-08-22 14:39:00 +100055 std r10,48(r3)
Anton Blanchard63e6c5b2010-02-10 18:07:54 +000056 ld r5,40(r4)
Mark Nelson57dda6e2008-08-22 14:39:00 +100057 ld r6,48(r4)
58 std r11,56(r3)
Mark Nelson57dda6e2008-08-22 14:39:00 +100059 std r12,64(r3)
Anton Blanchard63e6c5b2010-02-10 18:07:54 +000060 ld r7,56(r4)
Mark Nelson57dda6e2008-08-22 14:39:00 +100061 ld r8,64(r4)
62 std r5,72(r3)
Mark Nelson57dda6e2008-08-22 14:39:00 +100063 std r6,80(r3)
Anton Blanchard63e6c5b2010-02-10 18:07:54 +000064 ld r9,72(r4)
Mark Nelson57dda6e2008-08-22 14:39:00 +100065 ld r10,80(r4)
66 std r7,88(r3)
Mark Nelson57dda6e2008-08-22 14:39:00 +100067 std r8,96(r3)
Anton Blanchard63e6c5b2010-02-10 18:07:54 +000068 ld r11,88(r4)
Mark Nelson57dda6e2008-08-22 14:39:00 +100069 ld r12,96(r4)
70 std r9,104(r3)
Mark Nelson57dda6e2008-08-22 14:39:00 +100071 std r10,112(r3)
Anton Blanchard63e6c5b2010-02-10 18:07:54 +000072 ld r5,104(r4)
Mark Nelson57dda6e2008-08-22 14:39:00 +100073 ld r6,112(r4)
74 std r11,120(r3)
Mark Nelson57dda6e2008-08-22 14:39:00 +100075 stdu r12,128(r3)
Anton Blanchard63e6c5b2010-02-10 18:07:54 +000076 ld r7,120(r4)
Mark Nelson57dda6e2008-08-22 14:39:00 +100077 ldu r8,128(r4)
Paul Mackerras14cf11a2005-09-26 16:04:21 +100078 bdnz 1b
Mark Nelson57dda6e2008-08-22 14:39:00 +100079
80 std r5,8(r3)
Mark Nelson57dda6e2008-08-22 14:39:00 +100081 std r6,16(r3)
Anton Blanchard63e6c5b2010-02-10 18:07:54 +000082 ld r9,8(r4)
Mark Nelson57dda6e2008-08-22 14:39:00 +100083 ld r10,16(r4)
84 std r7,24(r3)
Mark Nelson57dda6e2008-08-22 14:39:00 +100085 std r8,32(r3)
Anton Blanchard63e6c5b2010-02-10 18:07:54 +000086 ld r11,24(r4)
Mark Nelson57dda6e2008-08-22 14:39:00 +100087 ld r12,32(r4)
88 std r9,40(r3)
Mark Nelson57dda6e2008-08-22 14:39:00 +100089 std r10,48(r3)
Anton Blanchard63e6c5b2010-02-10 18:07:54 +000090 ld r5,40(r4)
Mark Nelson57dda6e2008-08-22 14:39:00 +100091 ld r6,48(r4)
92 std r11,56(r3)
Mark Nelson57dda6e2008-08-22 14:39:00 +100093 std r12,64(r3)
Anton Blanchard63e6c5b2010-02-10 18:07:54 +000094 ld r7,56(r4)
Mark Nelson57dda6e2008-08-22 14:39:00 +100095 ld r8,64(r4)
96 std r5,72(r3)
Mark Nelson57dda6e2008-08-22 14:39:00 +100097 std r6,80(r3)
Anton Blanchard63e6c5b2010-02-10 18:07:54 +000098 ld r9,72(r4)
Mark Nelson57dda6e2008-08-22 14:39:00 +100099 ld r10,80(r4)
100 std r7,88(r3)
Mark Nelson57dda6e2008-08-22 14:39:00 +1000101 std r8,96(r3)
Anton Blanchard63e6c5b2010-02-10 18:07:54 +0000102 ld r11,88(r4)
Mark Nelson57dda6e2008-08-22 14:39:00 +1000103 ld r12,96(r4)
104 std r9,104(r3)
105 std r10,112(r3)
106 std r11,120(r3)
107 std r12,128(r3)
Paul Mackerras14cf11a2005-09-26 16:04:21 +1000108 blr