2006-10-18 17:14:55 +04:00
/ *
* relocate_ k e r n e l . S f o r k e x e c
* Created b y < n s c h i c h a n @corp.free.fr> on Thu Oct 12 17:49:57 2006
*
* This s o u r c e c o d e i s l i c e n s e d u n d e r 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 ,
* Version 2 . S e e t h e f i l e C O P Y I N G f o r m o r e d e t a i l s .
* /
# include < a s m / a s m . h >
# include < a s m / a s m m a c r o . h >
# include < a s m / r e g d e f . h >
# include < a s m / p a g e . h >
# include < a s m / m i p s r e g s . h >
# include < a s m / s t a c k f r a m e . h >
# include < a s m / a d d r s p a c e . h >
2007-07-31 18:17:21 +04:00
LEAF( r e l o c a t e _ n e w _ k e r n e l )
PTR_ L s0 , k e x e c _ i n d i r e c t i o n _ p a g e
PTR_ L s1 , k e x e c _ s t a r t _ a d d r e s s
2006-10-18 17:14:55 +04:00
process_entry :
2007-07-31 18:17:21 +04:00
PTR_ L s2 , ( s0 )
PTR_ A D D s0 , s0 , S Z R E G
2006-10-18 17:14:55 +04:00
/* destination page */
2007-07-31 18:17:21 +04:00
and s3 , s2 , 0 x1
beq s3 , z e r o , 1 f
and s4 , s2 , ~ 0 x1 / * s t o r e d e s t i n a t i o n a d d r i n s4 * /
move a0 , s4
b p r o c e s s _ e n t r y
2006-10-18 17:14:55 +04:00
1 :
/* indirection page, update s0 */
2007-07-31 18:17:21 +04:00
and s3 , s2 , 0 x2
beq s3 , z e r o , 1 f
and s0 , s2 , ~ 0 x2
b p r o c e s s _ e n t r y
2006-10-18 17:14:55 +04:00
1 :
/* done page */
2007-07-31 18:17:21 +04:00
and s3 , s2 , 0 x4
beq s3 , z e r o , 1 f
b d o n e
2006-10-18 17:14:55 +04:00
1 :
/* source page */
2007-07-31 18:17:21 +04:00
and s3 , s2 , 0 x8
beq s3 , z e r o , p r o c e s s _ e n t r y
and s2 , s2 , ~ 0 x8
li s6 , ( 1 < < P A G E _ S H I F T ) / S Z R E G
2006-10-18 17:14:55 +04:00
copy_word :
/* copy page word by word */
2007-07-31 18:17:21 +04:00
REG_ L s5 , ( s2 )
REG_ S s5 , ( s4 )
PTR_ A D D s4 , s4 , S Z R E G
PTR_ A D D s2 , s2 , S Z R E G
LONG_ S U B s6 , s6 , 1
beq s6 , z e r o , p r o c e s s _ e n t r y
b c o p y _ w o r d
b p r o c e s s _ e n t r y
2006-10-18 17:14:55 +04:00
done :
/* jump to kexec_start_address */
2007-07-31 18:17:21 +04:00
j s1
END( r e l o c a t e _ n e w _ k e r n e l )
2006-10-18 17:14:55 +04:00
kexec_start_address :
2007-07-31 18:17:21 +04:00
EXPORT( k e x e c _ s t a r t _ a d d r e s s )
PTR 0 x0
.size kexec_ s t a r t _ a d d r e s s , P T R S I Z E
2006-10-18 17:14:55 +04:00
kexec_indirection_page :
2007-07-31 18:17:21 +04:00
EXPORT( k e x e c _ i n d i r e c t i o n _ p a g e )
PTR 0
.size kexec_ i n d i r e c t i o n _ p a g e , P T R S I Z E
2006-10-18 17:14:55 +04:00
relocate_new_kernel_end :
relocate_new_kernel_size :
2007-07-31 18:17:21 +04:00
EXPORT( r e l o c a t e _ n e w _ k e r n e l _ s i z e )
PTR r e l o c a t e _ n e w _ k e r n e l _ e n d - r e l o c a t e _ n e w _ k e r n e l
.size relocate_ n e w _ k e r n e l _ s i z e , P T R S I Z E