2016-01-04 17:42:55 +03:00
/ *
* Copyright ( c ) 2 0 1 5 , L i n a r o L i m i t e d
*
* This s o f t w a r e i s l i c e n s e d 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
* License v e r s i o n 2 , a s 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 , a n d
* may b e c o p i e d , d i s t r i b u t e d , a n d m o d i f i e d u n d e r t h o s e t e r m s .
*
* 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 .
*
* /
# include < l i n u x / l i n k a g e . h >
# include < a s m / o p c o d e s - s e c . h >
# include < a s m / o p c o d e s - v i r t . h >
# include < a s m / u n w i n d . h >
/ *
* Wrap c m a c r o s i n a s m m a c r o s t o d e l a y e x p a n s i o n u n t i l a f t e r t h e
* SMCCC a s m m a c r o i s e x p a n d e d .
* /
.macro SMCCC_SMC
_ _ SMC( 0 )
.endm
.macro SMCCC_HVC
_ _ HVC( 0 )
.endm
.macro SMCCC instr
UNWIND( . f n s t a r t )
mov r12 , s p
push { r4 - r7 }
UNWIND( . s a v e { r4 - r7 } )
ldm r12 , { r4 - r7 }
\ instr
pop { r4 - r7 }
ldr r12 , [ s p , #( 4 * 4 ) ]
stm r12 , { r0 - r3 }
bx l r
UNWIND( . f n e n d )
.endm
/ *
* void s m c c c _ s m c ( u n s i g n e d l o n g a0 , u n s i g n e d l o n g a1 , u n s i g n e d l o n g a2 ,
* unsigned l o n g a3 , u n s i g n e d l o n g a4 , u n s i g n e d l o n g a5 ,
2017-02-01 20:28:27 +03:00
* unsigned l o n g a6 , u n s i g n e d l o n g a7 , s t r u c t a r m _ s m c c c _ r e s * r e s ,
* struct a r m _ s m c c c _ q u i r k * q u i r k )
2016-01-04 17:42:55 +03:00
* /
2017-02-01 20:28:27 +03:00
ENTRY( _ _ a r m _ s m c c c _ s m c )
2016-01-04 17:42:55 +03:00
SMCCC S M C C C _ S M C
2017-02-01 20:28:27 +03:00
ENDPROC( _ _ a r m _ s m c c c _ s m c )
2016-01-04 17:42:55 +03:00
/ *
* void s m c c c _ h v c ( u n s i g n e d l o n g a0 , u n s i g n e d l o n g a1 , u n s i g n e d l o n g a2 ,
* unsigned l o n g a3 , u n s i g n e d l o n g a4 , u n s i g n e d l o n g a5 ,
2017-02-01 20:28:27 +03:00
* unsigned l o n g a6 , u n s i g n e d l o n g a7 , s t r u c t a r m _ s m c c c _ r e s * r e s ,
* struct a r m _ s m c c c _ q u i r k * q u i r k )
2016-01-04 17:42:55 +03:00
* /
2017-02-01 20:28:27 +03:00
ENTRY( _ _ a r m _ s m c c c _ h v c )
2016-01-04 17:42:55 +03:00
SMCCC S M C C C _ H V C
2017-02-01 20:28:27 +03:00
ENDPROC( _ _ a r m _ s m c c c _ h v c )