Paul Mackerras | 14cf11a | 2005-09-26 16:04:21 +1000 | [diff] [blame] | 1 | /* |
Mark Nelson | 57dda6e | 2008-08-22 14:39:00 +1000 | [diff] [blame] | 2 | * Copyright (C) 2008 Mark Nelson, IBM Corp. |
Paul Mackerras | 14cf11a | 2005-09-26 16:04:21 +1000 | [diff] [blame] | 3 | * |
| 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 Blanchard | d988f0e | 2011-05-08 21:18:38 +0000 | [diff] [blame] | 9 | #include <asm/page.h> |
Paul Mackerras | 14cf11a | 2005-09-26 16:04:21 +1000 | [diff] [blame] | 10 | #include <asm/processor.h> |
| 11 | #include <asm/ppc_asm.h> |
Mark Nelson | 57dda6e | 2008-08-22 14:39:00 +1000 | [diff] [blame] | 12 | #include <asm/asm-offsets.h> |
| 13 | |
| 14 | .section ".toc","aw" |
| 15 | PPC64_CACHES: |
| 16 | .tc ppc64_caches[TC],ppc64_caches |
| 17 | .section ".text" |
| 18 | |
Anton Blanchard | d988f0e | 2011-05-08 21:18:38 +0000 | [diff] [blame] | 19 | _GLOBAL(copy_page) |
Anton Blanchard | fde6928 | 2012-05-29 19:33:12 +0000 | [diff] [blame] | 20 | BEGIN_FTR_SECTION |
Anton Blanchard | d988f0e | 2011-05-08 21:18:38 +0000 | [diff] [blame] | 21 | lis r5,PAGE_SIZE@h |
Anton Blanchard | fde6928 | 2012-05-29 19:33:12 +0000 | [diff] [blame] | 22 | FTR_SECTION_ELSE |
| 23 | b .copypage_power7 |
| 24 | ALT_FTR_SECTION_END_IFCLR(CPU_FTR_VMX_COPY) |
Anton Blanchard | d988f0e | 2011-05-08 21:18:38 +0000 | [diff] [blame] | 25 | ori r5,r5,PAGE_SIZE@l |
Mark Nelson | 57dda6e | 2008-08-22 14:39:00 +1000 | [diff] [blame] | 26 | BEGIN_FTR_SECTION |
| 27 | ld r10,PPC64_CACHES@toc(r2) |
| 28 | lwz r11,DCACHEL1LOGLINESIZE(r10) /* log2 of cache line size */ |
| 29 | lwz r12,DCACHEL1LINESIZE(r10) /* get cache line size */ |
| 30 | li r9,0 |
| 31 | srd r8,r5,r11 |
| 32 | |
| 33 | mtctr r8 |
Anton Blanchard | 3cd980d | 2009-10-18 01:23:28 +0000 | [diff] [blame] | 34 | .Lsetup: |
Mark Nelson | 57dda6e | 2008-08-22 14:39:00 +1000 | [diff] [blame] | 35 | dcbt r9,r4 |
| 36 | dcbz r9,r3 |
| 37 | add r9,r9,r12 |
Anton Blanchard | 3cd980d | 2009-10-18 01:23:28 +0000 | [diff] [blame] | 38 | bdnz .Lsetup |
Mark Nelson | 57dda6e | 2008-08-22 14:39:00 +1000 | [diff] [blame] | 39 | END_FTR_SECTION_IFSET(CPU_FTR_CP_USE_DCBTZ) |
Paul Mackerras | 14cf11a | 2005-09-26 16:04:21 +1000 | [diff] [blame] | 40 | addi r3,r3,-8 |
Mark Nelson | 57dda6e | 2008-08-22 14:39:00 +1000 | [diff] [blame] | 41 | srdi r8,r5,7 /* page is copied in 128 byte strides */ |
| 42 | addi r8,r8,-1 /* one stride copied outside loop */ |
| 43 | |
| 44 | mtctr r8 |
| 45 | |
| 46 | ld r5,0(r4) |
| 47 | ld r6,8(r4) |
| 48 | ld r7,16(r4) |
| 49 | ldu r8,24(r4) |
| 50 | 1: std r5,8(r3) |
Mark Nelson | 57dda6e | 2008-08-22 14:39:00 +1000 | [diff] [blame] | 51 | std r6,16(r3) |
Anton Blanchard | 63e6c5b | 2010-02-10 18:07:54 +0000 | [diff] [blame] | 52 | ld r9,8(r4) |
Mark Nelson | 57dda6e | 2008-08-22 14:39:00 +1000 | [diff] [blame] | 53 | ld r10,16(r4) |
| 54 | std r7,24(r3) |
Mark Nelson | 57dda6e | 2008-08-22 14:39:00 +1000 | [diff] [blame] | 55 | std r8,32(r3) |
Anton Blanchard | 63e6c5b | 2010-02-10 18:07:54 +0000 | [diff] [blame] | 56 | ld r11,24(r4) |
Mark Nelson | 57dda6e | 2008-08-22 14:39:00 +1000 | [diff] [blame] | 57 | ld r12,32(r4) |
| 58 | std r9,40(r3) |
Mark Nelson | 57dda6e | 2008-08-22 14:39:00 +1000 | [diff] [blame] | 59 | std r10,48(r3) |
Anton Blanchard | 63e6c5b | 2010-02-10 18:07:54 +0000 | [diff] [blame] | 60 | ld r5,40(r4) |
Mark Nelson | 57dda6e | 2008-08-22 14:39:00 +1000 | [diff] [blame] | 61 | ld r6,48(r4) |
| 62 | std r11,56(r3) |
Mark Nelson | 57dda6e | 2008-08-22 14:39:00 +1000 | [diff] [blame] | 63 | std r12,64(r3) |
Anton Blanchard | 63e6c5b | 2010-02-10 18:07:54 +0000 | [diff] [blame] | 64 | ld r7,56(r4) |
Mark Nelson | 57dda6e | 2008-08-22 14:39:00 +1000 | [diff] [blame] | 65 | ld r8,64(r4) |
| 66 | std r5,72(r3) |
Mark Nelson | 57dda6e | 2008-08-22 14:39:00 +1000 | [diff] [blame] | 67 | std r6,80(r3) |
Anton Blanchard | 63e6c5b | 2010-02-10 18:07:54 +0000 | [diff] [blame] | 68 | ld r9,72(r4) |
Mark Nelson | 57dda6e | 2008-08-22 14:39:00 +1000 | [diff] [blame] | 69 | ld r10,80(r4) |
| 70 | std r7,88(r3) |
Mark Nelson | 57dda6e | 2008-08-22 14:39:00 +1000 | [diff] [blame] | 71 | std r8,96(r3) |
Anton Blanchard | 63e6c5b | 2010-02-10 18:07:54 +0000 | [diff] [blame] | 72 | ld r11,88(r4) |
Mark Nelson | 57dda6e | 2008-08-22 14:39:00 +1000 | [diff] [blame] | 73 | ld r12,96(r4) |
| 74 | std r9,104(r3) |
Mark Nelson | 57dda6e | 2008-08-22 14:39:00 +1000 | [diff] [blame] | 75 | std r10,112(r3) |
Anton Blanchard | 63e6c5b | 2010-02-10 18:07:54 +0000 | [diff] [blame] | 76 | ld r5,104(r4) |
Mark Nelson | 57dda6e | 2008-08-22 14:39:00 +1000 | [diff] [blame] | 77 | ld r6,112(r4) |
| 78 | std r11,120(r3) |
Mark Nelson | 57dda6e | 2008-08-22 14:39:00 +1000 | [diff] [blame] | 79 | stdu r12,128(r3) |
Anton Blanchard | 63e6c5b | 2010-02-10 18:07:54 +0000 | [diff] [blame] | 80 | ld r7,120(r4) |
Mark Nelson | 57dda6e | 2008-08-22 14:39:00 +1000 | [diff] [blame] | 81 | ldu r8,128(r4) |
Paul Mackerras | 14cf11a | 2005-09-26 16:04:21 +1000 | [diff] [blame] | 82 | bdnz 1b |
Mark Nelson | 57dda6e | 2008-08-22 14:39:00 +1000 | [diff] [blame] | 83 | |
| 84 | std r5,8(r3) |
Mark Nelson | 57dda6e | 2008-08-22 14:39:00 +1000 | [diff] [blame] | 85 | std r6,16(r3) |
Anton Blanchard | 63e6c5b | 2010-02-10 18:07:54 +0000 | [diff] [blame] | 86 | ld r9,8(r4) |
Mark Nelson | 57dda6e | 2008-08-22 14:39:00 +1000 | [diff] [blame] | 87 | ld r10,16(r4) |
| 88 | std r7,24(r3) |
Mark Nelson | 57dda6e | 2008-08-22 14:39:00 +1000 | [diff] [blame] | 89 | std r8,32(r3) |
Anton Blanchard | 63e6c5b | 2010-02-10 18:07:54 +0000 | [diff] [blame] | 90 | ld r11,24(r4) |
Mark Nelson | 57dda6e | 2008-08-22 14:39:00 +1000 | [diff] [blame] | 91 | ld r12,32(r4) |
| 92 | std r9,40(r3) |
Mark Nelson | 57dda6e | 2008-08-22 14:39:00 +1000 | [diff] [blame] | 93 | std r10,48(r3) |
Anton Blanchard | 63e6c5b | 2010-02-10 18:07:54 +0000 | [diff] [blame] | 94 | ld r5,40(r4) |
Mark Nelson | 57dda6e | 2008-08-22 14:39:00 +1000 | [diff] [blame] | 95 | ld r6,48(r4) |
| 96 | std r11,56(r3) |
Mark Nelson | 57dda6e | 2008-08-22 14:39:00 +1000 | [diff] [blame] | 97 | std r12,64(r3) |
Anton Blanchard | 63e6c5b | 2010-02-10 18:07:54 +0000 | [diff] [blame] | 98 | ld r7,56(r4) |
Mark Nelson | 57dda6e | 2008-08-22 14:39:00 +1000 | [diff] [blame] | 99 | ld r8,64(r4) |
| 100 | std r5,72(r3) |
Mark Nelson | 57dda6e | 2008-08-22 14:39:00 +1000 | [diff] [blame] | 101 | std r6,80(r3) |
Anton Blanchard | 63e6c5b | 2010-02-10 18:07:54 +0000 | [diff] [blame] | 102 | ld r9,72(r4) |
Mark Nelson | 57dda6e | 2008-08-22 14:39:00 +1000 | [diff] [blame] | 103 | ld r10,80(r4) |
| 104 | std r7,88(r3) |
Mark Nelson | 57dda6e | 2008-08-22 14:39:00 +1000 | [diff] [blame] | 105 | std r8,96(r3) |
Anton Blanchard | 63e6c5b | 2010-02-10 18:07:54 +0000 | [diff] [blame] | 106 | ld r11,88(r4) |
Mark Nelson | 57dda6e | 2008-08-22 14:39:00 +1000 | [diff] [blame] | 107 | ld r12,96(r4) |
| 108 | std r9,104(r3) |
| 109 | std r10,112(r3) |
| 110 | std r11,120(r3) |
| 111 | std r12,128(r3) |
Paul Mackerras | 14cf11a | 2005-09-26 16:04:21 +1000 | [diff] [blame] | 112 | blr |