@ -11,6 +11,7 @@
# include < a s m - o f f s e t s . h >
# include < c o n f i g . h >
# include < l i n u x / l i n k a g e . h >
# include < a s m / m a c r o . h >
/ *
* void r e l o c a t e _ c o d e ( a d d r _ m o n i )
@ -19,6 +20,9 @@
* x0 h o l d s t h e d e s t i n a t i o n a d d r e s s .
* /
ENTRY( r e l o c a t e _ c o d e )
stp x29 , x30 , [ s p , #- 32 ] ! / * c r e a t e a s t a c k f r a m e * /
mov x29 , s p
str x0 , [ s p , #16 ]
/ *
* Copy u - b o o t f r o m f l a s h t o R A M
* /
@ -32,6 +36,7 @@ copy_loop:
stp x10 , x11 , [ x0 ] , #16 / * c o p y t o t a r g e t a d d r e s s [ x0 ] * /
cmp x1 , x2 / * u n t i l s o u r c e e n d a d d r e s s [ x2 ] * /
b. l o c o p y _ l o o p
str x0 , [ s p , #24 ]
/ *
* Fix . r e l a . d y n r e l o c a t i o n s
@ -54,5 +59,19 @@ fixnext:
b. l o f i x l o o p
relocate_done :
switch_ e l x1 , 3 f , 2 f , 1 f
bl h a n g
3 : mrs x0 , s c t l r _ e l 3
b 0 f
2 : mrs x0 , s c t l r _ e l 2
b 0 f
1 : mrs x0 , s c t l r _ e l 1
0 : tbz w0 , #2 , 5 f / * s k i p f l u s h i n g c a c h e i f d i s a b l e d * /
tbz w0 , #12 , 4 f / * i n v a l i d e i - c a c h e i s e n a b l e d * /
ic i a l l u / * i - c a c h e i n v a l i d a t e a l l * /
isb s y
4 : ldp x0 , x1 , [ s p , #16 ]
bl _ _ a s m _ f l u s h _ d c a c h e _ r a n g e
5 : ldp x29 , x30 , [ s p ] ,#16
ret
ENDPROC( r e l o c a t e _ c o d e )