2007-07-04 03:07:18 +04:00
/ *
* PS3 b o o t w r a p p e r e n t r y .
*
* Copyright ( C ) 2 0 0 7 S o n y C o m p u t e r E n t e r t a i n m e n t I n c .
* Copyright 2 0 0 7 S o n y C o r p .
*
* 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 ; version 2 of the License.
*
* 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
* /
# include " p p c _ a s m . h "
2007-07-21 15:37:49 +04:00
.machine " ppc6 4 "
2007-07-04 03:07:18 +04:00
.text
/ *
* _ _ system_ r e s e t _ o v e r l a y - T h e P S 3 f i r s t s t a g e e n t r y .
*
2008-03-27 23:41:45 +03:00
* The b o o t w r a p e r b u i l d s c r i p t c o p i e s t h e 5 1 2 b y t e s a t s y m b o l
* _ _ system_ r e s e t _ o v e r l a y t o o f f s e t 0 x10 0 o f t h e r o m i m a g e . T h i s s y m b o l
* must o c c u p y 5 1 2 o r l e s s b y t e s .
2007-07-04 03:07:18 +04:00
*
* The P S 3 h a s a s i n g l e p r o c e s s o r w i t h t w o t h r e a d s .
* /
.globl __system_reset_overlay
__system_reset_overlay :
/* Switch to 32-bit mode. */
mfmsr r9
clrldi r9 ,r9 ,1
mtmsrd r9
nop
/* Get thread number in r3 and branch. */
mfspr r3 , 0 x88
cntlzw. r3 , r3
beq 1 f
/* Secondary goes to __secondary_hold in kernel. */
li r4 , 0 x60
mtctr r4
bctr
1 :
2008-03-27 23:41:45 +03:00
/* Primary delays then goes to _zimage_start in wrapper. */
2007-07-04 03:07:18 +04:00
or 3 1 , 3 1 , 3 1 / * d b16 c y c * /
or 3 1 , 3 1 , 3 1 / * d b16 c y c * /
lis r4 , _ z i m a g e _ s t a r t @ha
addi r4 , r4 , _ z i m a g e _ s t a r t @l
mtctr r4
bctr
2008-03-27 23:41:45 +03:00
. = _ _ system_ r e s e t _ o v e r l a y + 5 1 2
2007-07-04 03:07:18 +04:00
/ *
* _ _ system_ r e s e t _ k e r n e l - P l a c e h o l d e r f o r t h e k e r n e l r e s e t v e c t o r .
*
2008-03-27 23:41:45 +03:00
* The b o o t w r a p p e r b u i l d s c r i p t c o p i e s 5 1 2 b y t e s f r o m o f f s e t 0 x10 0
2007-07-04 03:07:18 +04:00
* of t h e r o m i m a g e t o t h e s y m b o l _ _ s y s t e m _ r e s e t _ k e r n e l . A t r u n t i m e
2008-03-27 23:41:45 +03:00
* the b o o t w r a p p e r p r o g r a m c o p i e s t h e 5 1 2 b y t e s a t _ _ s y s t e m _ r e s e t _ k e r n e l
* to r a m a d d r e s s 0 x10 0 . T h i s s y m b o l m u s t o c c u p y 5 1 2 b y t e s .
2007-07-04 03:07:18 +04:00
* /
.globl __system_reset_kernel
__system_reset_kernel :
2008-03-27 23:41:45 +03:00
. = _ _ system_ r e s e t _ k e r n e l + 5 1 2