2006-06-28 11:55:49 +10:00
/ *
* This f i l e c o n t a i n s m i s c e l l a n e o u s l o w - l e v e l f u n c t i o n s .
* Copyright ( C ) 1 9 9 5 - 1 9 9 6 G a r y T h o m a s ( g d t @linuxppc.org)
*
* Largely r e w r i t t e n b y C o r t D o u g a n ( c o r t @cs.nmt.edu)
* and P a u l M a c k e r r a s .
*
* PPC6 4 u p d a t e s b y D a v e E n g e b r e t s e n ( e n g e b r e t @us.ibm.com)
*
2008-01-18 15:50:30 +11:00
* setjmp/ l o n g j m p c o d e b y P a u l M a c k e r r a s .
*
2006-06-28 11:55:49 +10: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 i t 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
* as p u b l i s h e d b y t h e 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 t h e L i c e n s e , o r ( a t 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 .
* /
# include < a s m / p p c _ a s m . h >
2007-11-28 11:13:02 +11:00
# include < a s m / u n i s t d . h >
2008-01-18 15:50:30 +11:00
# include < a s m / a s m - c o m p a t . h >
# include < a s m / a s m - o f f s e t s . h >
2006-06-28 11:55:49 +10:00
.text
/ *
* Returns ( a d d r e s s w e a r e r u n n i n g a t ) - ( a d d r e s s w e w e r e l i n k e d a t )
* for u s e b e f o r e t h e t e x t a n d d a t a a r e m a p p e d t o K E R N E L B A S E .
* /
_ GLOBAL( r e l o c _ o f f s e t )
mflr r0
bl 1 f
1 : mflr r3
2008-08-30 11:41:12 +10:00
PPC_ L L r4 ,( 2 f - 1 b ) ( r3 )
2006-06-28 11:55:49 +10:00
subf r3 ,r4 ,r3
mtlr r0
blr
2008-08-30 11:41:12 +10:00
.align 3
2 : PPC_ L O N G 1 b
2006-06-28 11:55:49 +10:00
/ *
* add_ r e l o c _ o f f s e t ( x ) r e t u r n s x + r e l o c _ o f f s e t ( ) .
* /
_ GLOBAL( a d d _ r e l o c _ o f f s e t )
mflr r0
bl 1 f
1 : mflr r5
2008-08-30 11:41:12 +10:00
PPC_ L L r4 ,( 2 f - 1 b ) ( r5 )
2006-06-28 11:55:49 +10:00
subf r5 ,r4 ,r5
add r3 ,r3 ,r5
mtlr r0
blr
2007-11-28 11:13:02 +11:00
2008-08-30 11:41:12 +10:00
.align 3
2 : PPC_ L O N G 1 b
2008-01-18 15:50:30 +11:00
_ GLOBAL( s e t j m p )
mflr r0
PPC_ S T L r0 ,0 ( r3 )
PPC_ S T L r1 ,S Z L ( r3 )
PPC_ S T L r2 ,2 * S Z L ( r3 )
mfcr r0
PPC_ S T L r0 ,3 * S Z L ( r3 )
PPC_ S T L r13 ,4 * S Z L ( r3 )
PPC_ S T L r14 ,5 * S Z L ( r3 )
PPC_ S T L r15 ,6 * S Z L ( r3 )
PPC_ S T L r16 ,7 * S Z L ( r3 )
PPC_ S T L r17 ,8 * S Z L ( r3 )
PPC_ S T L r18 ,9 * S Z L ( r3 )
PPC_ S T L r19 ,1 0 * S Z L ( r3 )
PPC_ S T L r20 ,1 1 * S Z L ( r3 )
PPC_ S T L r21 ,1 2 * S Z L ( r3 )
PPC_ S T L r22 ,1 3 * S Z L ( r3 )
PPC_ S T L r23 ,1 4 * S Z L ( r3 )
PPC_ S T L r24 ,1 5 * S Z L ( r3 )
PPC_ S T L r25 ,1 6 * S Z L ( r3 )
PPC_ S T L r26 ,1 7 * S Z L ( r3 )
PPC_ S T L r27 ,1 8 * S Z L ( r3 )
PPC_ S T L r28 ,1 9 * S Z L ( r3 )
PPC_ S T L r29 ,2 0 * S Z L ( r3 )
PPC_ S T L r30 ,2 1 * S Z L ( r3 )
PPC_ S T L r31 ,2 2 * S Z L ( r3 )
li r3 ,0
blr
_ GLOBAL( l o n g j m p )
PPC_ L C M P I r4 ,0
bne 1 f
li r4 ,1
1 : PPC_ L L r13 ,4 * S Z L ( r3 )
PPC_ L L r14 ,5 * S Z L ( r3 )
PPC_ L L r15 ,6 * S Z L ( r3 )
PPC_ L L r16 ,7 * S Z L ( r3 )
PPC_ L L r17 ,8 * S Z L ( r3 )
PPC_ L L r18 ,9 * S Z L ( r3 )
PPC_ L L r19 ,1 0 * S Z L ( r3 )
PPC_ L L r20 ,1 1 * S Z L ( r3 )
PPC_ L L r21 ,1 2 * S Z L ( r3 )
PPC_ L L r22 ,1 3 * S Z L ( r3 )
PPC_ L L r23 ,1 4 * S Z L ( r3 )
PPC_ L L r24 ,1 5 * S Z L ( r3 )
PPC_ L L r25 ,1 6 * S Z L ( r3 )
PPC_ L L r26 ,1 7 * S Z L ( r3 )
PPC_ L L r27 ,1 8 * S Z L ( r3 )
PPC_ L L r28 ,1 9 * S Z L ( r3 )
PPC_ L L r29 ,2 0 * S Z L ( r3 )
PPC_ L L r30 ,2 1 * S Z L ( r3 )
PPC_ L L r31 ,2 2 * S Z L ( r3 )
PPC_ L L r0 ,3 * S Z L ( r3 )
mtcrf 0 x38 ,r0
PPC_ L L r0 ,0 ( r3 )
PPC_ L L r1 ,S Z L ( r3 )
PPC_ L L r2 ,2 * S Z L ( r3 )
mtlr r0
mr r3 ,r4
blr