170d64ceaSPaul Mackerras/* 270d64ceaSPaul Mackerras * Copyright (C) 2002 Paul Mackerras, IBM Corp. 370d64ceaSPaul Mackerras * 470d64ceaSPaul Mackerras * This program is free software; you can redistribute it and/or 570d64ceaSPaul Mackerras * modify it under the terms of the GNU General Public License 670d64ceaSPaul Mackerras * as published by the Free Software Foundation; either version 770d64ceaSPaul Mackerras * 2 of the License, or (at your option) any later version. 870d64ceaSPaul Mackerras */ 970d64ceaSPaul Mackerras#include <asm/processor.h> 1070d64ceaSPaul Mackerras#include <asm/ppc_asm.h> 1170d64ceaSPaul Mackerras 12*20151169SPaul E. McKenney#ifdef __BIG_ENDIAN__ 13*20151169SPaul E. McKenney#define sLd sld /* Shift towards low-numbered address. */ 14*20151169SPaul E. McKenney#define sHd srd /* Shift towards high-numbered address. */ 15*20151169SPaul E. McKenney#else 16*20151169SPaul E. McKenney#define sLd srd /* Shift towards low-numbered address. */ 17*20151169SPaul E. McKenney#define sHd sld /* Shift towards high-numbered address. */ 18*20151169SPaul E. McKenney#endif 19*20151169SPaul E. McKenney 2070d64ceaSPaul Mackerras .align 7 2170d64ceaSPaul Mackerras_GLOBAL(__copy_tofrom_user) 22a66086b8SAnton BlanchardBEGIN_FTR_SECTION 23a66086b8SAnton Blanchard nop 24a66086b8SAnton BlanchardFTR_SECTION_ELSE 25a66086b8SAnton Blanchard b __copy_tofrom_user_power7 26a66086b8SAnton BlanchardALT_FTR_SECTION_END_IFCLR(CPU_FTR_VMX_COPY) 27a66086b8SAnton Blanchard_GLOBAL(__copy_tofrom_user_base) 2870d64ceaSPaul Mackerras /* first check for a whole page copy on a page boundary */ 2970d64ceaSPaul Mackerras cmpldi cr1,r5,16 3070d64ceaSPaul Mackerras cmpdi cr6,r5,4096 3170d64ceaSPaul Mackerras or r0,r3,r4 3270d64ceaSPaul Mackerras neg r6,r3 /* LS 3 bits = # bytes to 8-byte dest bdry */ 3370d64ceaSPaul Mackerras andi. r0,r0,4095 3470d64ceaSPaul Mackerras std r3,-24(r1) 3570d64ceaSPaul Mackerras crand cr0*4+2,cr0*4+2,cr6*4+2 3670d64ceaSPaul Mackerras std r4,-16(r1) 3770d64ceaSPaul Mackerras std r5,-8(r1) 3870d64ceaSPaul Mackerras dcbt 0,r4 393c726f8dSBenjamin Herrenschmidt beq .Lcopy_page_4K 4070d64ceaSPaul Mackerras andi. r6,r6,7 41694caf02SAnton Blanchard PPC_MTOCRF(0x01,r5) 4270d64ceaSPaul Mackerras blt cr1,.Lshort_copy 43a4e22f02SMark Nelson/* Below we want to nop out the bne if we're on a CPU that has the 44a4e22f02SMark Nelson * CPU_FTR_UNALIGNED_LD_STD bit set and the CPU_FTR_CP_USE_DCBTZ bit 45a4e22f02SMark Nelson * cleared. 46a4e22f02SMark Nelson * At the time of writing the only CPU that has this combination of bits 47a4e22f02SMark Nelson * set is Power6. 48a4e22f02SMark Nelson */ 49a4e22f02SMark NelsonBEGIN_FTR_SECTION 50a4e22f02SMark Nelson nop 51a4e22f02SMark NelsonFTR_SECTION_ELSE 5270d64ceaSPaul Mackerras bne .Ldst_unaligned 53a4e22f02SMark NelsonALT_FTR_SECTION_END(CPU_FTR_UNALIGNED_LD_STD | CPU_FTR_CP_USE_DCBTZ, \ 54a4e22f02SMark Nelson CPU_FTR_UNALIGNED_LD_STD) 5570d64ceaSPaul Mackerras.Ldst_aligned: 5670d64ceaSPaul Mackerras addi r3,r3,-16 57a4e22f02SMark NelsonBEGIN_FTR_SECTION 58a4e22f02SMark Nelson andi. r0,r4,7 5970d64ceaSPaul Mackerras bne .Lsrc_unaligned 60a4e22f02SMark NelsonEND_FTR_SECTION_IFCLR(CPU_FTR_UNALIGNED_LD_STD) 61789c299cSAnton Blanchard blt cr1,.Ldo_tail /* if < 16 bytes to copy */ 62789c299cSAnton Blanchard srdi r0,r5,5 63789c299cSAnton Blanchard cmpdi cr1,r0,0 64789c299cSAnton Blanchard20: ld r7,0(r4) 65789c299cSAnton Blanchard220: ld r6,8(r4) 66789c299cSAnton Blanchard addi r4,r4,16 67789c299cSAnton Blanchard mtctr r0 68789c299cSAnton Blanchard andi. r0,r5,0x10 69789c299cSAnton Blanchard beq 22f 7070d64ceaSPaul Mackerras addi r3,r3,16 71789c299cSAnton Blanchard addi r4,r4,-16 72789c299cSAnton Blanchard mr r9,r7 73789c299cSAnton Blanchard mr r8,r6 74789c299cSAnton Blanchard beq cr1,72f 75789c299cSAnton Blanchard21: ld r7,16(r4) 76789c299cSAnton Blanchard221: ld r6,24(r4) 77789c299cSAnton Blanchard addi r4,r4,32 78789c299cSAnton Blanchard70: std r9,0(r3) 79789c299cSAnton Blanchard270: std r8,8(r3) 80789c299cSAnton Blanchard22: ld r9,0(r4) 81789c299cSAnton Blanchard222: ld r8,8(r4) 82789c299cSAnton Blanchard71: std r7,16(r3) 83789c299cSAnton Blanchard271: std r6,24(r3) 84789c299cSAnton Blanchard addi r3,r3,32 85789c299cSAnton Blanchard bdnz 21b 86789c299cSAnton Blanchard72: std r9,0(r3) 87789c299cSAnton Blanchard272: std r8,8(r3) 88789c299cSAnton Blanchard andi. r5,r5,0xf 89789c299cSAnton Blanchard beq+ 3f 90789c299cSAnton Blanchard addi r4,r4,16 9170d64ceaSPaul Mackerras.Ldo_tail: 92789c299cSAnton Blanchard addi r3,r3,16 93789c299cSAnton Blanchard bf cr7*4+0,246f 94789c299cSAnton Blanchard244: ld r9,0(r4) 95789c299cSAnton Blanchard addi r4,r4,8 96789c299cSAnton Blanchard245: std r9,0(r3) 97789c299cSAnton Blanchard addi r3,r3,8 98789c299cSAnton Blanchard246: bf cr7*4+1,1f 99789c299cSAnton Blanchard23: lwz r9,0(r4) 100f72b728bSMark Nelson addi r4,r4,4 10170d64ceaSPaul Mackerras73: stw r9,0(r3) 10270d64ceaSPaul Mackerras addi r3,r3,4 10370d64ceaSPaul Mackerras1: bf cr7*4+2,2f 104789c299cSAnton Blanchard44: lhz r9,0(r4) 105f72b728bSMark Nelson addi r4,r4,2 10670d64ceaSPaul Mackerras74: sth r9,0(r3) 10770d64ceaSPaul Mackerras addi r3,r3,2 10870d64ceaSPaul Mackerras2: bf cr7*4+3,3f 109789c299cSAnton Blanchard45: lbz r9,0(r4) 11070d64ceaSPaul Mackerras75: stb r9,0(r3) 11170d64ceaSPaul Mackerras3: li r3,0 11270d64ceaSPaul Mackerras blr 11370d64ceaSPaul Mackerras 11470d64ceaSPaul Mackerras.Lsrc_unaligned: 11570d64ceaSPaul Mackerras srdi r6,r5,3 11670d64ceaSPaul Mackerras addi r5,r5,-16 11770d64ceaSPaul Mackerras subf r4,r0,r4 11870d64ceaSPaul Mackerras srdi r7,r5,4 11970d64ceaSPaul Mackerras sldi r10,r0,3 12070d64ceaSPaul Mackerras cmpldi cr6,r6,3 12170d64ceaSPaul Mackerras andi. r5,r5,7 12270d64ceaSPaul Mackerras mtctr r7 12370d64ceaSPaul Mackerras subfic r11,r10,64 12470d64ceaSPaul Mackerras add r5,r5,r0 12570d64ceaSPaul Mackerras bt cr7*4+0,28f 12670d64ceaSPaul Mackerras 12770d64ceaSPaul Mackerras24: ld r9,0(r4) /* 3+2n loads, 2+2n stores */ 12870d64ceaSPaul Mackerras25: ld r0,8(r4) 129*20151169SPaul E. McKenney sLd r6,r9,r10 13070d64ceaSPaul Mackerras26: ldu r9,16(r4) 131*20151169SPaul E. McKenney sHd r7,r0,r11 132*20151169SPaul E. McKenney sLd r8,r0,r10 13370d64ceaSPaul Mackerras or r7,r7,r6 13470d64ceaSPaul Mackerras blt cr6,79f 13570d64ceaSPaul Mackerras27: ld r0,8(r4) 13670d64ceaSPaul Mackerras b 2f 13770d64ceaSPaul Mackerras 13870d64ceaSPaul Mackerras28: ld r0,0(r4) /* 4+2n loads, 3+2n stores */ 13970d64ceaSPaul Mackerras29: ldu r9,8(r4) 140*20151169SPaul E. McKenney sLd r8,r0,r10 14170d64ceaSPaul Mackerras addi r3,r3,-8 14270d64ceaSPaul Mackerras blt cr6,5f 14370d64ceaSPaul Mackerras30: ld r0,8(r4) 144*20151169SPaul E. McKenney sHd r12,r9,r11 145*20151169SPaul E. McKenney sLd r6,r9,r10 14670d64ceaSPaul Mackerras31: ldu r9,16(r4) 14770d64ceaSPaul Mackerras or r12,r8,r12 148*20151169SPaul E. McKenney sHd r7,r0,r11 149*20151169SPaul E. McKenney sLd r8,r0,r10 15070d64ceaSPaul Mackerras addi r3,r3,16 15170d64ceaSPaul Mackerras beq cr6,78f 15270d64ceaSPaul Mackerras 15370d64ceaSPaul Mackerras1: or r7,r7,r6 15470d64ceaSPaul Mackerras32: ld r0,8(r4) 15570d64ceaSPaul Mackerras76: std r12,8(r3) 156*20151169SPaul E. McKenney2: sHd r12,r9,r11 157*20151169SPaul E. McKenney sLd r6,r9,r10 15870d64ceaSPaul Mackerras33: ldu r9,16(r4) 15970d64ceaSPaul Mackerras or r12,r8,r12 16070d64ceaSPaul Mackerras77: stdu r7,16(r3) 161*20151169SPaul E. McKenney sHd r7,r0,r11 162*20151169SPaul E. McKenney sLd r8,r0,r10 16370d64ceaSPaul Mackerras bdnz 1b 16470d64ceaSPaul Mackerras 16570d64ceaSPaul Mackerras78: std r12,8(r3) 16670d64ceaSPaul Mackerras or r7,r7,r6 16770d64ceaSPaul Mackerras79: std r7,16(r3) 168*20151169SPaul E. McKenney5: sHd r12,r9,r11 16970d64ceaSPaul Mackerras or r12,r8,r12 17070d64ceaSPaul Mackerras80: std r12,24(r3) 17170d64ceaSPaul Mackerras bne 6f 17270d64ceaSPaul Mackerras li r3,0 17370d64ceaSPaul Mackerras blr 17470d64ceaSPaul Mackerras6: cmpwi cr1,r5,8 17570d64ceaSPaul Mackerras addi r3,r3,32 176*20151169SPaul E. McKenney sLd r9,r9,r10 177f72b728bSMark Nelson ble cr1,7f 17870d64ceaSPaul Mackerras34: ld r0,8(r4) 179*20151169SPaul E. McKenney sHd r7,r0,r11 18070d64ceaSPaul Mackerras or r9,r7,r9 181f72b728bSMark Nelson7: 182f72b728bSMark Nelson bf cr7*4+1,1f 183*20151169SPaul E. McKenney#ifdef __BIG_ENDIAN__ 184f72b728bSMark Nelson rotldi r9,r9,32 185*20151169SPaul E. McKenney#endif 186f72b728bSMark Nelson94: stw r9,0(r3) 187*20151169SPaul E. McKenney#ifdef __LITTLE_ENDIAN__ 188*20151169SPaul E. McKenney rotrdi r9,r9,32 189*20151169SPaul E. McKenney#endif 190f72b728bSMark Nelson addi r3,r3,4 191f72b728bSMark Nelson1: bf cr7*4+2,2f 192*20151169SPaul E. McKenney#ifdef __BIG_ENDIAN__ 193f72b728bSMark Nelson rotldi r9,r9,16 194*20151169SPaul E. McKenney#endif 195f72b728bSMark Nelson95: sth r9,0(r3) 196*20151169SPaul E. McKenney#ifdef __LITTLE_ENDIAN__ 197*20151169SPaul E. McKenney rotrdi r9,r9,16 198*20151169SPaul E. McKenney#endif 199f72b728bSMark Nelson addi r3,r3,2 200f72b728bSMark Nelson2: bf cr7*4+3,3f 201*20151169SPaul E. McKenney#ifdef __BIG_ENDIAN__ 202f72b728bSMark Nelson rotldi r9,r9,8 203*20151169SPaul E. McKenney#endif 204f72b728bSMark Nelson96: stb r9,0(r3) 205*20151169SPaul E. McKenney#ifdef __LITTLE_ENDIAN__ 206*20151169SPaul E. McKenney rotrdi r9,r9,8 207*20151169SPaul E. McKenney#endif 208f72b728bSMark Nelson3: li r3,0 209f72b728bSMark Nelson blr 21070d64ceaSPaul Mackerras 21170d64ceaSPaul Mackerras.Ldst_unaligned: 212694caf02SAnton Blanchard PPC_MTOCRF(0x01,r6) /* put #bytes to 8B bdry into cr7 */ 21370d64ceaSPaul Mackerras subf r5,r6,r5 21470d64ceaSPaul Mackerras li r7,0 215a4e22f02SMark Nelson cmpldi cr1,r5,16 21670d64ceaSPaul Mackerras bf cr7*4+3,1f 21770d64ceaSPaul Mackerras35: lbz r0,0(r4) 21870d64ceaSPaul Mackerras81: stb r0,0(r3) 21970d64ceaSPaul Mackerras addi r7,r7,1 22070d64ceaSPaul Mackerras1: bf cr7*4+2,2f 22170d64ceaSPaul Mackerras36: lhzx r0,r7,r4 22270d64ceaSPaul Mackerras82: sthx r0,r7,r3 22370d64ceaSPaul Mackerras addi r7,r7,2 22470d64ceaSPaul Mackerras2: bf cr7*4+1,3f 22570d64ceaSPaul Mackerras37: lwzx r0,r7,r4 22670d64ceaSPaul Mackerras83: stwx r0,r7,r3 227694caf02SAnton Blanchard3: PPC_MTOCRF(0x01,r5) 22870d64ceaSPaul Mackerras add r4,r6,r4 22970d64ceaSPaul Mackerras add r3,r6,r3 23070d64ceaSPaul Mackerras b .Ldst_aligned 23170d64ceaSPaul Mackerras 23270d64ceaSPaul Mackerras.Lshort_copy: 23370d64ceaSPaul Mackerras bf cr7*4+0,1f 23470d64ceaSPaul Mackerras38: lwz r0,0(r4) 23570d64ceaSPaul Mackerras39: lwz r9,4(r4) 23670d64ceaSPaul Mackerras addi r4,r4,8 23770d64ceaSPaul Mackerras84: stw r0,0(r3) 23870d64ceaSPaul Mackerras85: stw r9,4(r3) 23970d64ceaSPaul Mackerras addi r3,r3,8 24070d64ceaSPaul Mackerras1: bf cr7*4+1,2f 24170d64ceaSPaul Mackerras40: lwz r0,0(r4) 24270d64ceaSPaul Mackerras addi r4,r4,4 24370d64ceaSPaul Mackerras86: stw r0,0(r3) 24470d64ceaSPaul Mackerras addi r3,r3,4 24570d64ceaSPaul Mackerras2: bf cr7*4+2,3f 24670d64ceaSPaul Mackerras41: lhz r0,0(r4) 24770d64ceaSPaul Mackerras addi r4,r4,2 24870d64ceaSPaul Mackerras87: sth r0,0(r3) 24970d64ceaSPaul Mackerras addi r3,r3,2 25070d64ceaSPaul Mackerras3: bf cr7*4+3,4f 25170d64ceaSPaul Mackerras42: lbz r0,0(r4) 25270d64ceaSPaul Mackerras88: stb r0,0(r3) 25370d64ceaSPaul Mackerras4: li r3,0 25470d64ceaSPaul Mackerras blr 25570d64ceaSPaul Mackerras 25670d64ceaSPaul Mackerras/* 25770d64ceaSPaul Mackerras * exception handlers follow 25870d64ceaSPaul Mackerras * we have to return the number of bytes not copied 25970d64ceaSPaul Mackerras * for an exception on a load, we set the rest of the destination to 0 26070d64ceaSPaul Mackerras */ 26170d64ceaSPaul Mackerras 26270d64ceaSPaul Mackerras136: 26370d64ceaSPaul Mackerras137: 26470d64ceaSPaul Mackerras add r3,r3,r7 26570d64ceaSPaul Mackerras b 1f 26670d64ceaSPaul Mackerras130: 26770d64ceaSPaul Mackerras131: 26870d64ceaSPaul Mackerras addi r3,r3,8 26970d64ceaSPaul Mackerras120: 270789c299cSAnton Blanchard320: 27170d64ceaSPaul Mackerras122: 272789c299cSAnton Blanchard322: 27370d64ceaSPaul Mackerras124: 27470d64ceaSPaul Mackerras125: 27570d64ceaSPaul Mackerras126: 27670d64ceaSPaul Mackerras127: 27770d64ceaSPaul Mackerras128: 27870d64ceaSPaul Mackerras129: 27970d64ceaSPaul Mackerras133: 28070d64ceaSPaul Mackerras addi r3,r3,8 28170d64ceaSPaul Mackerras132: 28270d64ceaSPaul Mackerras addi r3,r3,8 283789c299cSAnton Blanchard121: 284789c299cSAnton Blanchard321: 285789c299cSAnton Blanchard344: 28670d64ceaSPaul Mackerras134: 28770d64ceaSPaul Mackerras135: 28870d64ceaSPaul Mackerras138: 28970d64ceaSPaul Mackerras139: 29070d64ceaSPaul Mackerras140: 29170d64ceaSPaul Mackerras141: 29270d64ceaSPaul Mackerras142: 293f72b728bSMark Nelson123: 294f72b728bSMark Nelson144: 295f72b728bSMark Nelson145: 29670d64ceaSPaul Mackerras 29770d64ceaSPaul Mackerras/* 29870d64ceaSPaul Mackerras * here we have had a fault on a load and r3 points to the first 29970d64ceaSPaul Mackerras * unmodified byte of the destination 30070d64ceaSPaul Mackerras */ 30170d64ceaSPaul Mackerras1: ld r6,-24(r1) 30270d64ceaSPaul Mackerras ld r4,-16(r1) 30370d64ceaSPaul Mackerras ld r5,-8(r1) 30470d64ceaSPaul Mackerras subf r6,r6,r3 30570d64ceaSPaul Mackerras add r4,r4,r6 30670d64ceaSPaul Mackerras subf r5,r6,r5 /* #bytes left to go */ 30770d64ceaSPaul Mackerras 30870d64ceaSPaul Mackerras/* 30970d64ceaSPaul Mackerras * first see if we can copy any more bytes before hitting another exception 31070d64ceaSPaul Mackerras */ 31170d64ceaSPaul Mackerras mtctr r5 31270d64ceaSPaul Mackerras43: lbz r0,0(r4) 31370d64ceaSPaul Mackerras addi r4,r4,1 31470d64ceaSPaul Mackerras89: stb r0,0(r3) 31570d64ceaSPaul Mackerras addi r3,r3,1 31670d64ceaSPaul Mackerras bdnz 43b 31770d64ceaSPaul Mackerras li r3,0 /* huh? all copied successfully this time? */ 31870d64ceaSPaul Mackerras blr 31970d64ceaSPaul Mackerras 32070d64ceaSPaul Mackerras/* 32170d64ceaSPaul Mackerras * here we have trapped again, need to clear ctr bytes starting at r3 32270d64ceaSPaul Mackerras */ 32370d64ceaSPaul Mackerras143: mfctr r5 32470d64ceaSPaul Mackerras li r0,0 32570d64ceaSPaul Mackerras mr r4,r3 32670d64ceaSPaul Mackerras mr r3,r5 /* return the number of bytes not copied */ 32770d64ceaSPaul Mackerras1: andi. r9,r4,7 32870d64ceaSPaul Mackerras beq 3f 32970d64ceaSPaul Mackerras90: stb r0,0(r4) 33070d64ceaSPaul Mackerras addic. r5,r5,-1 33170d64ceaSPaul Mackerras addi r4,r4,1 33270d64ceaSPaul Mackerras bne 1b 33370d64ceaSPaul Mackerras blr 33470d64ceaSPaul Mackerras3: cmpldi cr1,r5,8 33570d64ceaSPaul Mackerras srdi r9,r5,3 33670d64ceaSPaul Mackerras andi. r5,r5,7 33770d64ceaSPaul Mackerras blt cr1,93f 33870d64ceaSPaul Mackerras mtctr r9 33970d64ceaSPaul Mackerras91: std r0,0(r4) 34070d64ceaSPaul Mackerras addi r4,r4,8 34170d64ceaSPaul Mackerras bdnz 91b 34270d64ceaSPaul Mackerras93: beqlr 34370d64ceaSPaul Mackerras mtctr r5 34470d64ceaSPaul Mackerras92: stb r0,0(r4) 34570d64ceaSPaul Mackerras addi r4,r4,1 34670d64ceaSPaul Mackerras bdnz 92b 34770d64ceaSPaul Mackerras blr 34870d64ceaSPaul Mackerras 34970d64ceaSPaul Mackerras/* 35070d64ceaSPaul Mackerras * exception handlers for stores: we just need to work 35170d64ceaSPaul Mackerras * out how many bytes weren't copied 35270d64ceaSPaul Mackerras */ 35370d64ceaSPaul Mackerras182: 35470d64ceaSPaul Mackerras183: 35570d64ceaSPaul Mackerras add r3,r3,r7 35670d64ceaSPaul Mackerras b 1f 357789c299cSAnton Blanchard371: 35870d64ceaSPaul Mackerras180: 35970d64ceaSPaul Mackerras addi r3,r3,8 36070d64ceaSPaul Mackerras171: 36170d64ceaSPaul Mackerras177: 36270d64ceaSPaul Mackerras addi r3,r3,8 363789c299cSAnton Blanchard370: 364789c299cSAnton Blanchard372: 36570d64ceaSPaul Mackerras176: 36670d64ceaSPaul Mackerras178: 36770d64ceaSPaul Mackerras addi r3,r3,4 36870d64ceaSPaul Mackerras185: 36970d64ceaSPaul Mackerras addi r3,r3,4 370789c299cSAnton Blanchard170: 371789c299cSAnton Blanchard172: 372789c299cSAnton Blanchard345: 37370d64ceaSPaul Mackerras173: 37470d64ceaSPaul Mackerras174: 37570d64ceaSPaul Mackerras175: 37670d64ceaSPaul Mackerras179: 37770d64ceaSPaul Mackerras181: 37870d64ceaSPaul Mackerras184: 37970d64ceaSPaul Mackerras186: 38070d64ceaSPaul Mackerras187: 38170d64ceaSPaul Mackerras188: 38270d64ceaSPaul Mackerras189: 383f72b728bSMark Nelson194: 384f72b728bSMark Nelson195: 385f72b728bSMark Nelson196: 38670d64ceaSPaul Mackerras1: 38770d64ceaSPaul Mackerras ld r6,-24(r1) 38870d64ceaSPaul Mackerras ld r5,-8(r1) 38970d64ceaSPaul Mackerras add r6,r6,r5 39070d64ceaSPaul Mackerras subf r3,r3,r6 /* #bytes not copied */ 39170d64ceaSPaul Mackerras190: 39270d64ceaSPaul Mackerras191: 39370d64ceaSPaul Mackerras192: 39470d64ceaSPaul Mackerras blr /* #bytes not copied in r3 */ 39570d64ceaSPaul Mackerras 39670d64ceaSPaul Mackerras .section __ex_table,"a" 39770d64ceaSPaul Mackerras .align 3 39870d64ceaSPaul Mackerras .llong 20b,120b 399789c299cSAnton Blanchard .llong 220b,320b 40070d64ceaSPaul Mackerras .llong 21b,121b 401789c299cSAnton Blanchard .llong 221b,321b 40270d64ceaSPaul Mackerras .llong 70b,170b 403789c299cSAnton Blanchard .llong 270b,370b 40470d64ceaSPaul Mackerras .llong 22b,122b 405789c299cSAnton Blanchard .llong 222b,322b 40670d64ceaSPaul Mackerras .llong 71b,171b 407789c299cSAnton Blanchard .llong 271b,371b 40870d64ceaSPaul Mackerras .llong 72b,172b 409789c299cSAnton Blanchard .llong 272b,372b 410789c299cSAnton Blanchard .llong 244b,344b 411789c299cSAnton Blanchard .llong 245b,345b 41270d64ceaSPaul Mackerras .llong 23b,123b 41370d64ceaSPaul Mackerras .llong 73b,173b 414f72b728bSMark Nelson .llong 44b,144b 41570d64ceaSPaul Mackerras .llong 74b,174b 416f72b728bSMark Nelson .llong 45b,145b 41770d64ceaSPaul Mackerras .llong 75b,175b 41870d64ceaSPaul Mackerras .llong 24b,124b 41970d64ceaSPaul Mackerras .llong 25b,125b 42070d64ceaSPaul Mackerras .llong 26b,126b 42170d64ceaSPaul Mackerras .llong 27b,127b 42270d64ceaSPaul Mackerras .llong 28b,128b 42370d64ceaSPaul Mackerras .llong 29b,129b 42470d64ceaSPaul Mackerras .llong 30b,130b 42570d64ceaSPaul Mackerras .llong 31b,131b 42670d64ceaSPaul Mackerras .llong 32b,132b 42770d64ceaSPaul Mackerras .llong 76b,176b 42870d64ceaSPaul Mackerras .llong 33b,133b 42970d64ceaSPaul Mackerras .llong 77b,177b 43070d64ceaSPaul Mackerras .llong 78b,178b 43170d64ceaSPaul Mackerras .llong 79b,179b 43270d64ceaSPaul Mackerras .llong 80b,180b 43370d64ceaSPaul Mackerras .llong 34b,134b 434f72b728bSMark Nelson .llong 94b,194b 435f72b728bSMark Nelson .llong 95b,195b 436f72b728bSMark Nelson .llong 96b,196b 43770d64ceaSPaul Mackerras .llong 35b,135b 43870d64ceaSPaul Mackerras .llong 81b,181b 43970d64ceaSPaul Mackerras .llong 36b,136b 44070d64ceaSPaul Mackerras .llong 82b,182b 44170d64ceaSPaul Mackerras .llong 37b,137b 44270d64ceaSPaul Mackerras .llong 83b,183b 44370d64ceaSPaul Mackerras .llong 38b,138b 44470d64ceaSPaul Mackerras .llong 39b,139b 44570d64ceaSPaul Mackerras .llong 84b,184b 44670d64ceaSPaul Mackerras .llong 85b,185b 44770d64ceaSPaul Mackerras .llong 40b,140b 44870d64ceaSPaul Mackerras .llong 86b,186b 44970d64ceaSPaul Mackerras .llong 41b,141b 45070d64ceaSPaul Mackerras .llong 87b,187b 45170d64ceaSPaul Mackerras .llong 42b,142b 45270d64ceaSPaul Mackerras .llong 88b,188b 45370d64ceaSPaul Mackerras .llong 43b,143b 45470d64ceaSPaul Mackerras .llong 89b,189b 45570d64ceaSPaul Mackerras .llong 90b,190b 45670d64ceaSPaul Mackerras .llong 91b,191b 45770d64ceaSPaul Mackerras .llong 92b,192b 45870d64ceaSPaul Mackerras 45970d64ceaSPaul Mackerras .text 46070d64ceaSPaul Mackerras 46170d64ceaSPaul Mackerras/* 46270d64ceaSPaul Mackerras * Routine to copy a whole page of data, optimized for POWER4. 46370d64ceaSPaul Mackerras * On POWER4 it is more than 50% faster than the simple loop 46470d64ceaSPaul Mackerras * above (following the .Ldst_aligned label) but it runs slightly 46570d64ceaSPaul Mackerras * slower on POWER3. 46670d64ceaSPaul Mackerras */ 4673c726f8dSBenjamin Herrenschmidt.Lcopy_page_4K: 46870d64ceaSPaul Mackerras std r31,-32(1) 46970d64ceaSPaul Mackerras std r30,-40(1) 47070d64ceaSPaul Mackerras std r29,-48(1) 47170d64ceaSPaul Mackerras std r28,-56(1) 47270d64ceaSPaul Mackerras std r27,-64(1) 47370d64ceaSPaul Mackerras std r26,-72(1) 47470d64ceaSPaul Mackerras std r25,-80(1) 47570d64ceaSPaul Mackerras std r24,-88(1) 47670d64ceaSPaul Mackerras std r23,-96(1) 47770d64ceaSPaul Mackerras std r22,-104(1) 47870d64ceaSPaul Mackerras std r21,-112(1) 47970d64ceaSPaul Mackerras std r20,-120(1) 48070d64ceaSPaul Mackerras li r5,4096/32 - 1 48170d64ceaSPaul Mackerras addi r3,r3,-8 48270d64ceaSPaul Mackerras li r0,5 48370d64ceaSPaul Mackerras0: addi r5,r5,-24 48470d64ceaSPaul Mackerras mtctr r0 48570d64ceaSPaul Mackerras20: ld r22,640(4) 48670d64ceaSPaul Mackerras21: ld r21,512(4) 48770d64ceaSPaul Mackerras22: ld r20,384(4) 48870d64ceaSPaul Mackerras23: ld r11,256(4) 48970d64ceaSPaul Mackerras24: ld r9,128(4) 49070d64ceaSPaul Mackerras25: ld r7,0(4) 49170d64ceaSPaul Mackerras26: ld r25,648(4) 49270d64ceaSPaul Mackerras27: ld r24,520(4) 49370d64ceaSPaul Mackerras28: ld r23,392(4) 49470d64ceaSPaul Mackerras29: ld r10,264(4) 49570d64ceaSPaul Mackerras30: ld r8,136(4) 49670d64ceaSPaul Mackerras31: ldu r6,8(4) 49770d64ceaSPaul Mackerras cmpwi r5,24 49870d64ceaSPaul Mackerras1: 49970d64ceaSPaul Mackerras32: std r22,648(3) 50070d64ceaSPaul Mackerras33: std r21,520(3) 50170d64ceaSPaul Mackerras34: std r20,392(3) 50270d64ceaSPaul Mackerras35: std r11,264(3) 50370d64ceaSPaul Mackerras36: std r9,136(3) 50470d64ceaSPaul Mackerras37: std r7,8(3) 50570d64ceaSPaul Mackerras38: ld r28,648(4) 50670d64ceaSPaul Mackerras39: ld r27,520(4) 50770d64ceaSPaul Mackerras40: ld r26,392(4) 50870d64ceaSPaul Mackerras41: ld r31,264(4) 50970d64ceaSPaul Mackerras42: ld r30,136(4) 51070d64ceaSPaul Mackerras43: ld r29,8(4) 51170d64ceaSPaul Mackerras44: std r25,656(3) 51270d64ceaSPaul Mackerras45: std r24,528(3) 51370d64ceaSPaul Mackerras46: std r23,400(3) 51470d64ceaSPaul Mackerras47: std r10,272(3) 51570d64ceaSPaul Mackerras48: std r8,144(3) 51670d64ceaSPaul Mackerras49: std r6,16(3) 51770d64ceaSPaul Mackerras50: ld r22,656(4) 51870d64ceaSPaul Mackerras51: ld r21,528(4) 51970d64ceaSPaul Mackerras52: ld r20,400(4) 52070d64ceaSPaul Mackerras53: ld r11,272(4) 52170d64ceaSPaul Mackerras54: ld r9,144(4) 52270d64ceaSPaul Mackerras55: ld r7,16(4) 52370d64ceaSPaul Mackerras56: std r28,664(3) 52470d64ceaSPaul Mackerras57: std r27,536(3) 52570d64ceaSPaul Mackerras58: std r26,408(3) 52670d64ceaSPaul Mackerras59: std r31,280(3) 52770d64ceaSPaul Mackerras60: std r30,152(3) 52870d64ceaSPaul Mackerras61: stdu r29,24(3) 52970d64ceaSPaul Mackerras62: ld r25,664(4) 53070d64ceaSPaul Mackerras63: ld r24,536(4) 53170d64ceaSPaul Mackerras64: ld r23,408(4) 53270d64ceaSPaul Mackerras65: ld r10,280(4) 53370d64ceaSPaul Mackerras66: ld r8,152(4) 53470d64ceaSPaul Mackerras67: ldu r6,24(4) 53570d64ceaSPaul Mackerras bdnz 1b 53670d64ceaSPaul Mackerras68: std r22,648(3) 53770d64ceaSPaul Mackerras69: std r21,520(3) 53870d64ceaSPaul Mackerras70: std r20,392(3) 53970d64ceaSPaul Mackerras71: std r11,264(3) 54070d64ceaSPaul Mackerras72: std r9,136(3) 54170d64ceaSPaul Mackerras73: std r7,8(3) 54270d64ceaSPaul Mackerras74: addi r4,r4,640 54370d64ceaSPaul Mackerras75: addi r3,r3,648 54470d64ceaSPaul Mackerras bge 0b 54570d64ceaSPaul Mackerras mtctr r5 54670d64ceaSPaul Mackerras76: ld r7,0(4) 54770d64ceaSPaul Mackerras77: ld r8,8(4) 54870d64ceaSPaul Mackerras78: ldu r9,16(4) 54970d64ceaSPaul Mackerras3: 55070d64ceaSPaul Mackerras79: ld r10,8(4) 55170d64ceaSPaul Mackerras80: std r7,8(3) 55270d64ceaSPaul Mackerras81: ld r7,16(4) 55370d64ceaSPaul Mackerras82: std r8,16(3) 55470d64ceaSPaul Mackerras83: ld r8,24(4) 55570d64ceaSPaul Mackerras84: std r9,24(3) 55670d64ceaSPaul Mackerras85: ldu r9,32(4) 55770d64ceaSPaul Mackerras86: stdu r10,32(3) 55870d64ceaSPaul Mackerras bdnz 3b 55970d64ceaSPaul Mackerras4: 56070d64ceaSPaul Mackerras87: ld r10,8(4) 56170d64ceaSPaul Mackerras88: std r7,8(3) 56270d64ceaSPaul Mackerras89: std r8,16(3) 56370d64ceaSPaul Mackerras90: std r9,24(3) 56470d64ceaSPaul Mackerras91: std r10,32(3) 56570d64ceaSPaul Mackerras9: ld r20,-120(1) 56670d64ceaSPaul Mackerras ld r21,-112(1) 56770d64ceaSPaul Mackerras ld r22,-104(1) 56870d64ceaSPaul Mackerras ld r23,-96(1) 56970d64ceaSPaul Mackerras ld r24,-88(1) 57070d64ceaSPaul Mackerras ld r25,-80(1) 57170d64ceaSPaul Mackerras ld r26,-72(1) 57270d64ceaSPaul Mackerras ld r27,-64(1) 57370d64ceaSPaul Mackerras ld r28,-56(1) 57470d64ceaSPaul Mackerras ld r29,-48(1) 57570d64ceaSPaul Mackerras ld r30,-40(1) 57670d64ceaSPaul Mackerras ld r31,-32(1) 57770d64ceaSPaul Mackerras li r3,0 57870d64ceaSPaul Mackerras blr 57970d64ceaSPaul Mackerras 58070d64ceaSPaul Mackerras/* 58170d64ceaSPaul Mackerras * on an exception, reset to the beginning and jump back into the 58270d64ceaSPaul Mackerras * standard __copy_tofrom_user 58370d64ceaSPaul Mackerras */ 58470d64ceaSPaul Mackerras100: ld r20,-120(1) 58570d64ceaSPaul Mackerras ld r21,-112(1) 58670d64ceaSPaul Mackerras ld r22,-104(1) 58770d64ceaSPaul Mackerras ld r23,-96(1) 58870d64ceaSPaul Mackerras ld r24,-88(1) 58970d64ceaSPaul Mackerras ld r25,-80(1) 59070d64ceaSPaul Mackerras ld r26,-72(1) 59170d64ceaSPaul Mackerras ld r27,-64(1) 59270d64ceaSPaul Mackerras ld r28,-56(1) 59370d64ceaSPaul Mackerras ld r29,-48(1) 59470d64ceaSPaul Mackerras ld r30,-40(1) 59570d64ceaSPaul Mackerras ld r31,-32(1) 59670d64ceaSPaul Mackerras ld r3,-24(r1) 59770d64ceaSPaul Mackerras ld r4,-16(r1) 59870d64ceaSPaul Mackerras li r5,4096 59970d64ceaSPaul Mackerras b .Ldst_aligned 60070d64ceaSPaul Mackerras 60170d64ceaSPaul Mackerras .section __ex_table,"a" 60270d64ceaSPaul Mackerras .align 3 60370d64ceaSPaul Mackerras .llong 20b,100b 60470d64ceaSPaul Mackerras .llong 21b,100b 60570d64ceaSPaul Mackerras .llong 22b,100b 60670d64ceaSPaul Mackerras .llong 23b,100b 60770d64ceaSPaul Mackerras .llong 24b,100b 60870d64ceaSPaul Mackerras .llong 25b,100b 60970d64ceaSPaul Mackerras .llong 26b,100b 61070d64ceaSPaul Mackerras .llong 27b,100b 61170d64ceaSPaul Mackerras .llong 28b,100b 61270d64ceaSPaul Mackerras .llong 29b,100b 61370d64ceaSPaul Mackerras .llong 30b,100b 61470d64ceaSPaul Mackerras .llong 31b,100b 61570d64ceaSPaul Mackerras .llong 32b,100b 61670d64ceaSPaul Mackerras .llong 33b,100b 61770d64ceaSPaul Mackerras .llong 34b,100b 61870d64ceaSPaul Mackerras .llong 35b,100b 61970d64ceaSPaul Mackerras .llong 36b,100b 62070d64ceaSPaul Mackerras .llong 37b,100b 62170d64ceaSPaul Mackerras .llong 38b,100b 62270d64ceaSPaul Mackerras .llong 39b,100b 62370d64ceaSPaul Mackerras .llong 40b,100b 62470d64ceaSPaul Mackerras .llong 41b,100b 62570d64ceaSPaul Mackerras .llong 42b,100b 62670d64ceaSPaul Mackerras .llong 43b,100b 62770d64ceaSPaul Mackerras .llong 44b,100b 62870d64ceaSPaul Mackerras .llong 45b,100b 62970d64ceaSPaul Mackerras .llong 46b,100b 63070d64ceaSPaul Mackerras .llong 47b,100b 63170d64ceaSPaul Mackerras .llong 48b,100b 63270d64ceaSPaul Mackerras .llong 49b,100b 63370d64ceaSPaul Mackerras .llong 50b,100b 63470d64ceaSPaul Mackerras .llong 51b,100b 63570d64ceaSPaul Mackerras .llong 52b,100b 63670d64ceaSPaul Mackerras .llong 53b,100b 63770d64ceaSPaul Mackerras .llong 54b,100b 63870d64ceaSPaul Mackerras .llong 55b,100b 63970d64ceaSPaul Mackerras .llong 56b,100b 64070d64ceaSPaul Mackerras .llong 57b,100b 64170d64ceaSPaul Mackerras .llong 58b,100b 64270d64ceaSPaul Mackerras .llong 59b,100b 64370d64ceaSPaul Mackerras .llong 60b,100b 64470d64ceaSPaul Mackerras .llong 61b,100b 64570d64ceaSPaul Mackerras .llong 62b,100b 64670d64ceaSPaul Mackerras .llong 63b,100b 64770d64ceaSPaul Mackerras .llong 64b,100b 64870d64ceaSPaul Mackerras .llong 65b,100b 64970d64ceaSPaul Mackerras .llong 66b,100b 65070d64ceaSPaul Mackerras .llong 67b,100b 65170d64ceaSPaul Mackerras .llong 68b,100b 65270d64ceaSPaul Mackerras .llong 69b,100b 65370d64ceaSPaul Mackerras .llong 70b,100b 65470d64ceaSPaul Mackerras .llong 71b,100b 65570d64ceaSPaul Mackerras .llong 72b,100b 65670d64ceaSPaul Mackerras .llong 73b,100b 65770d64ceaSPaul Mackerras .llong 74b,100b 65870d64ceaSPaul Mackerras .llong 75b,100b 65970d64ceaSPaul Mackerras .llong 76b,100b 66070d64ceaSPaul Mackerras .llong 77b,100b 66170d64ceaSPaul Mackerras .llong 78b,100b 66270d64ceaSPaul Mackerras .llong 79b,100b 66370d64ceaSPaul Mackerras .llong 80b,100b 66470d64ceaSPaul Mackerras .llong 81b,100b 66570d64ceaSPaul Mackerras .llong 82b,100b 66670d64ceaSPaul Mackerras .llong 83b,100b 66770d64ceaSPaul Mackerras .llong 84b,100b 66870d64ceaSPaul Mackerras .llong 85b,100b 66970d64ceaSPaul Mackerras .llong 86b,100b 67070d64ceaSPaul Mackerras .llong 87b,100b 67170d64ceaSPaul Mackerras .llong 88b,100b 67270d64ceaSPaul Mackerras .llong 89b,100b 67370d64ceaSPaul Mackerras .llong 90b,100b 67470d64ceaSPaul Mackerras .llong 91b,100b 675