2012-05-29 19:33:12 +00:00
/ *
* This p r o g r a m i s f r e e s o f t w a r e ; you can redistribute it and/or modify
* it u n d e r t h e t e r m s o f t h e G N U G e n e r a l P u b l i c L i c e n s e a s p u b l i s h e d b y
* the F r e e S o f t w a r e F o u n d a t i o n ; either version 2 of the License, or
* ( at y o u r o p t i o n ) a n y l a t e r v e r s i o n .
*
* This p r o g r a m i s d i s t r i b u t e d i n t h e h o p e t h a t i t w i l l b e u s e f u l ,
* but W I T H O U T A N Y W A R R A N T Y ; without even the implied warranty of
* MERCHANTABILITY o r F I T N E S S F O R A P A R T I C U L A R P U R P O S E . S e e t h e
* GNU G e n e r a l P u b l i c L i c e n s e f o r m o r e d e t a i l s .
*
* You s h o u l d h a v e r e c e i v e d a c o p y o f t h e G N U G e n e r a l P u b l i c L i c e n s e
* along w i t h t h i s p r o g r a m ; if not, write to the Free Software
* Foundation, I n c . , 5 9 T e m p l e P l a c e - S u i t e 3 3 0 , B o s t o n , M A 0 2 1 1 1 - 1 3 0 7 , U S A .
*
* Copyright ( C ) I B M C o r p o r a t i o n , 2 0 1 2
*
* Author : Anton B l a n c h a r d < a n t o n @au.ibm.com>
* /
# include < a s m / p a g e . h >
# include < a s m / p p c _ a s m . h >
_ GLOBAL( c o p y p a g e _ p o w e r7 )
/ *
* We p r e f e t c h b o t h t h e s o u r c e a n d d e s t i n a t i o n u s i n g e n h a n c e d t o u c h
* instructions. W e u s e a s t r e a m I D o f 0 f o r t h e l o a d s i d e a n d
* 1 for t h e s t o r e s i d e . S i n c e s o u r c e a n d d e s t i n a t i o n a r e p a g e
* aligned w e d o n ' t n e e d t o c l e a r t h e b o t t o m 7 b i t s o f e i t h e r
* address.
* /
2013-05-29 19:34:29 +00:00
ori r9 ,r3 ,1 / * s t r e a m =1 = > t o * /
2012-05-29 19:33:12 +00:00
# ifdef C O N F I G _ P P C _ 6 4 K _ P A G E S
2013-05-29 19:34:29 +00:00
lis r7 ,0 x0 E 0 1 / * d e p t h =7
* units/ c a c h e l i n e s =512 * /
2012-05-29 19:33:12 +00:00
# else
lis r7 ,0 x0 E 0 0 / * d e p t h =7 * /
2013-05-29 19:34:29 +00:00
ori r7 ,r7 ,0 x10 0 0 / * u n i t s / c a c h e l i n e s =32 * /
2012-05-29 19:33:12 +00:00
# endif
ori r10 ,r7 ,1 / * s t r e a m =1 * /
lis r8 ,0 x80 0 0 / * G O =1 * /
clrldi r8 ,r8 ,3 2
.machine push
.machine " power4 "
2013-05-29 19:34:29 +00:00
/* setup read stream 0 */
dcbt r0 ,r4 ,0 b01 0 0 0 / * a d d r f r o m * /
dcbt r0 ,r7 ,0 b01 0 1 0 / * l e n g t h a n d d e p t h f r o m * /
/* setup write stream 1 */
dcbtst r0 ,r9 ,0 b01 0 0 0 / * a d d r t o * /
dcbtst r0 ,r10 ,0 b01 0 1 0 / * l e n g t h a n d d e p t h t o * /
2012-05-29 19:33:12 +00:00
eieio
2013-05-29 19:34:29 +00:00
dcbt r0 ,r8 ,0 b01 0 1 0 / * a l l s t r e a m s G O * /
2012-05-29 19:33:12 +00:00
.machine pop
# ifdef C O N F I G _ A L T I V E C
mflr r0
2014-02-14 19:21:03 +01:00
std r3 ,- S T A C K F R A M E S I Z E + S T K _ R E G ( R 3 1 ) ( r1 )
std r4 ,- S T A C K F R A M E S I Z E + S T K _ R E G ( R 3 0 ) ( r1 )
2012-05-29 19:33:12 +00:00
std r0 ,1 6 ( r1 )
stdu r1 ,- S T A C K F R A M E S I Z E ( r1 )
2014-02-04 16:04:35 +11:00
bl e n t e r _ v m x _ c o p y
2012-05-29 19:33:12 +00:00
cmpwi r3 ,0
ld r0 ,S T A C K F R A M E S I Z E + 1 6 ( r1 )
2014-02-14 19:21:03 +01:00
ld r3 ,S T K _ R E G ( R 3 1 ) ( r1 )
ld r4 ,S T K _ R E G ( R 3 0 ) ( r1 )
2012-05-29 19:33:12 +00:00
mtlr r0
li r0 ,( P A G E _ S I Z E / 1 2 8 )
mtctr r0
beq . L n o n v m x _ c o p y
addi r1 ,r1 ,S T A C K F R A M E S I Z E
li r6 ,1 6
li r7 ,3 2
li r8 ,4 8
li r9 ,6 4
li r10 ,8 0
li r11 ,9 6
li r12 ,1 1 2
.align 5
2015-02-10 09:51:22 +11:00
1 : lvx v7 ,r0 ,r4
lvx v6 ,r4 ,r6
lvx v5 ,r4 ,r7
lvx v4 ,r4 ,r8
lvx v3 ,r4 ,r9
lvx v2 ,r4 ,r10
lvx v1 ,r4 ,r11
lvx v0 ,r4 ,r12
2012-05-29 19:33:12 +00:00
addi r4 ,r4 ,1 2 8
2015-02-10 09:51:22 +11:00
stvx v7 ,r0 ,r3
stvx v6 ,r3 ,r6
stvx v5 ,r3 ,r7
stvx v4 ,r3 ,r8
stvx v3 ,r3 ,r9
stvx v2 ,r3 ,r10
stvx v1 ,r3 ,r11
stvx v0 ,r3 ,r12
2012-05-29 19:33:12 +00:00
addi r3 ,r3 ,1 2 8
bdnz 1 b
2014-02-04 16:04:35 +11:00
b e x i t _ v m x _ c o p y / * t a i l c a l l o p t i m i s e * /
2012-05-29 19:33:12 +00:00
# else
li r0 ,( P A G E _ S I Z E / 1 2 8 )
mtctr r0
stdu r1 ,- S T A C K F R A M E S I Z E ( r1 )
# endif
.Lnonvmx_copy :
2012-06-25 13:33:10 +00:00
std r14 ,S T K _ R E G ( R 1 4 ) ( r1 )
std r15 ,S T K _ R E G ( R 1 5 ) ( r1 )
std r16 ,S T K _ R E G ( R 1 6 ) ( r1 )
std r17 ,S T K _ R E G ( R 1 7 ) ( r1 )
std r18 ,S T K _ R E G ( R 1 8 ) ( r1 )
std r19 ,S T K _ R E G ( R 1 9 ) ( r1 )
std r20 ,S T K _ R E G ( R 2 0 ) ( r1 )
2012-05-29 19:33:12 +00:00
1 : ld r0 ,0 ( r4 )
ld r5 ,8 ( r4 )
ld r6 ,1 6 ( r4 )
ld r7 ,2 4 ( r4 )
ld r8 ,3 2 ( r4 )
ld r9 ,4 0 ( r4 )
ld r10 ,4 8 ( r4 )
ld r11 ,5 6 ( r4 )
ld r12 ,6 4 ( r4 )
ld r14 ,7 2 ( r4 )
ld r15 ,8 0 ( r4 )
ld r16 ,8 8 ( r4 )
ld r17 ,9 6 ( r4 )
ld r18 ,1 0 4 ( r4 )
ld r19 ,1 1 2 ( r4 )
ld r20 ,1 2 0 ( r4 )
addi r4 ,r4 ,1 2 8
std r0 ,0 ( r3 )
std r5 ,8 ( r3 )
std r6 ,1 6 ( r3 )
std r7 ,2 4 ( r3 )
std r8 ,3 2 ( r3 )
std r9 ,4 0 ( r3 )
std r10 ,4 8 ( r3 )
std r11 ,5 6 ( r3 )
std r12 ,6 4 ( r3 )
std r14 ,7 2 ( r3 )
std r15 ,8 0 ( r3 )
std r16 ,8 8 ( r3 )
std r17 ,9 6 ( r3 )
std r18 ,1 0 4 ( r3 )
std r19 ,1 1 2 ( r3 )
std r20 ,1 2 0 ( r3 )
addi r3 ,r3 ,1 2 8
bdnz 1 b
2012-06-25 13:33:10 +00:00
ld r14 ,S T K _ R E G ( R 1 4 ) ( r1 )
ld r15 ,S T K _ R E G ( R 1 5 ) ( r1 )
ld r16 ,S T K _ R E G ( R 1 6 ) ( r1 )
ld r17 ,S T K _ R E G ( R 1 7 ) ( r1 )
ld r18 ,S T K _ R E G ( R 1 8 ) ( r1 )
ld r19 ,S T K _ R E G ( R 1 9 ) ( r1 )
ld r20 ,S T K _ R E G ( R 2 0 ) ( r1 )
2012-05-29 19:33:12 +00:00
addi r1 ,r1 ,S T A C K F R A M E S I Z E
blr