@ -294,11 +294,13 @@ skip_debug_init:
mtspr i v o r7 ,r1 / * F l o a t i n g p o i n t u n a v a i l a b l e * /
li r1 ,0 x0 c00
mtspr i v o r8 ,r1 / * S y s t e m c a l l * /
li r1 ,0 x1 0 0 0
mtspr i v o r10 ,r1 / * D e c r e m e n t e r ( P I T f o r 4 4 0 ) * /
li r1 ,0 x14 0 0
mtspr i v o r13 ,r1 / * D a t a T L B e r r o r * /
li r1 ,0 x0 a0 0
mtspr i v o r9 ,r1 / * A u x i l i a r y P r o c e s s o r u n a v a i l a b l e * /
li r1 ,0 x09 0 0
mtspr i v o r10 ,r1 / * D e c r e m e n t e r * /
li r1 ,0 x13 0 0
mtspr i v o r13 ,r1 / * D a t a T L B e r r o r * /
li r1 ,0 x14 0 0
mtspr i v o r14 ,r1 / * I n s t r T L B e r r o r * /
li r1 ,0 x20 0 0
mtspr i v o r15 ,r1 / * D e b u g * /
@ -503,11 +505,81 @@ version_string:
.ascii " ( " , _ _ DATE_ _ , " - " , _ _ T I M E _ _ , " ) "
.ascii CONFIG_ I D E N T _ S T R I N G , " \ 0 "
/ *
* Maybe t h i s s h o u l d b e m o v e d s o m e w h e r e e l s e b e c a u s e t h e c u r r e n t
* location ( 0 x10 0 ) i s w h e r e t h e C r i t i c a l I n p u t E x e c p t i o n s h o u l d b e .
* /
. = EXC_ O F F _ S Y S _ R E S E T
.globl _start_of_vectors
_start_of_vectors :
/* Critical input. */
CRIT_ E X C E P T I O N ( 0 x10 0 , C r i t c a l I n p u t , U n k n o w n E x c e p t i o n )
# ifdef C O N F I G _ 4 4 0
/* Machine check */
MCK_ E X C E P T I O N ( 0 x20 0 , M a c h i n e C h e c k , M a c h i n e C h e c k E x c e p t i o n )
# else
CRIT_ E X C E P T I O N ( 0 x20 0 , M a c h i n e C h e c k , M a c h i n e C h e c k E x c e p t i o n )
# endif / * C O N F I G _ 4 4 0 * /
/* Data Storage exception. */
STD_ E X C E P T I O N ( 0 x30 0 , D a t a S t o r a g e , U n k n o w n E x c e p t i o n )
/* Instruction Storage exception. */
STD_ E X C E P T I O N ( 0 x40 0 , I n s t S t o r a g e , U n k n o w n E x c e p t i o n )
/* External Interrupt exception. */
STD_ E X C E P T I O N ( 0 x50 0 , E x t I n t e r r u p t , e x t e r n a l _ i n t e r r u p t )
/* Alignment exception. */
. = 0 x6 0 0
Alignment :
EXCEPTION_ P R O L O G ( S R R 0 , S R R 1 )
mfspr r4 ,D A R
stw r4 ,_ D A R ( r21 )
mfspr r5 ,D S I S R
stw r5 ,_ D S I S R ( r21 )
addi r3 ,r1 ,S T A C K _ F R A M E _ O V E R H E A D
li r20 ,M S R _ K E R N E L
rlwimi r20 ,r23 ,0 ,1 6 ,1 6 / * c o p y E E b i t f r o m s a v e d M S R * /
lwz r6 ,G O T ( t r a n s f e r _ t o _ h a n d l e r )
mtlr r6
blrl
.L_Alignment :
.long AlignmentException - _ start + _ S T A R T _ O F F S E T
.long int_return - _ start + _ S T A R T _ O F F S E T
/* Program check exception */
. = 0 x7 0 0
ProgramCheck :
EXCEPTION_ P R O L O G ( S R R 0 , S R R 1 )
addi r3 ,r1 ,S T A C K _ F R A M E _ O V E R H E A D
li r20 ,M S R _ K E R N E L
rlwimi r20 ,r23 ,0 ,1 6 ,1 6 / * c o p y E E b i t f r o m s a v e d M S R * /
lwz r6 ,G O T ( t r a n s f e r _ t o _ h a n d l e r )
mtlr r6
blrl
.L_ProgramCheck :
.long ProgramCheckException - _ start + _ S T A R T _ O F F S E T
.long int_return - _ start + _ S T A R T _ O F F S E T
# ifdef C O N F I G _ 4 4 0
STD_ E X C E P T I O N ( 0 x80 0 , F P U n a v a i l a b l e , U n k n o w n E x c e p t i o n )
STD_ E X C E P T I O N ( 0 x90 0 , D e c r e m e n t e r , D e c r e m e n t e r P I T E x c e p t i o n )
STD_ E X C E P T I O N ( 0 x a00 , A P U , U n k n o w n E x c e p t i o n )
# endif
STD_ E X C E P T I O N ( 0 x c00 , S y s t e m C a l l , U n k n o w n E x c e p t i o n )
# ifdef C O N F I G _ 4 4 0
STD_ E X C E P T I O N ( 0 x13 0 0 , D a t a T L B E r r o r , U n k n o w n E x c e p t i o n )
STD_ E X C E P T I O N ( 0 x14 0 0 , I n s t r u c t i o n T L B E r r o r , U n k n o w n E x c e p t i o n )
# else
STD_ E X C E P T I O N ( 0 x10 0 0 , P I T , D e c r e m e n t e r P I T E x c e p t i o n )
STD_ E X C E P T I O N ( 0 x11 0 0 , I n s t r u c t i o n T L B M i s s , U n k n o w n E x c e p t i o n )
STD_ E X C E P T I O N ( 0 x12 0 0 , D a t a T L B M i s s , U n k n o w n E x c e p t i o n )
# endif
CRIT_ E X C E P T I O N ( 0 x20 0 0 , D e b u g B r e a k p o i n t , D e b u g E x c e p t i o n )
.globl _end_of_vectors
_end_of_vectors :
. = _ START_ O F F S E T
# endif
.globl _start
_start :
@ -1017,107 +1089,6 @@ start_ram:
# ifndef C O N F I G _ N A N D _ S P L
/*****************************************************************************/
.globl _start_of_vectors
_start_of_vectors :
# if 0
/*TODO Fixup _start above so we can do this*/
/* Critical input. */
CRIT_ E X C E P T I O N ( 0 x10 0 , C r i t c a l I n p u t , C r i t c a l I n p u t E x c e p t i o n )
# endif
/* Machine check */
CRIT_ E X C E P T I O N ( 0 x20 0 , M a c h i n e C h e c k , M a c h i n e C h e c k E x c e p t i o n )
/* Data Storage exception. */
STD_ E X C E P T I O N ( 0 x30 0 , D a t a S t o r a g e , U n k n o w n E x c e p t i o n )
/* Instruction Storage exception. */
STD_ E X C E P T I O N ( 0 x40 0 , I n s t S t o r a g e , U n k n o w n E x c e p t i o n )
/* External Interrupt exception. */
STD_ E X C E P T I O N ( 0 x50 0 , E x t I n t e r r u p t , e x t e r n a l _ i n t e r r u p t )
/* Alignment exception. */
. = 0 x6 0 0
Alignment :
EXCEPTION_ P R O L O G
mfspr r4 ,D A R
stw r4 ,_ D A R ( r21 )
mfspr r5 ,D S I S R
stw r5 ,_ D S I S R ( r21 )
addi r3 ,r1 ,S T A C K _ F R A M E _ O V E R H E A D
li r20 ,M S R _ K E R N E L
rlwimi r20 ,r23 ,0 ,1 6 ,1 6 / * c o p y E E b i t f r o m s a v e d M S R * /
lwz r6 ,G O T ( t r a n s f e r _ t o _ h a n d l e r )
mtlr r6
blrl
.L_Alignment :
.long AlignmentException - _ start + E X C _ O F F _ S Y S _ R E S E T
.long int_return - _ start + E X C _ O F F _ S Y S _ R E S E T
/* Program check exception */
. = 0 x7 0 0
ProgramCheck :
EXCEPTION_ P R O L O G
addi r3 ,r1 ,S T A C K _ F R A M E _ O V E R H E A D
li r20 ,M S R _ K E R N E L
rlwimi r20 ,r23 ,0 ,1 6 ,1 6 / * c o p y E E b i t f r o m s a v e d M S R * /
lwz r6 ,G O T ( t r a n s f e r _ t o _ h a n d l e r )
mtlr r6
blrl
.L_ProgramCheck :
.long ProgramCheckException - _ start + E X C _ O F F _ S Y S _ R E S E T
.long int_return - _ start + E X C _ O F F _ S Y S _ R E S E T
/ * No F P U o n M P C 8 x x . T h i s e x c e p t i o n i s n o t s u p p o s e d t o h a p p e n .
* /
STD_ E X C E P T I O N ( 0 x80 0 , F P U n a v a i l a b l e , U n k n o w n E x c e p t i o n )
/ * I g u e s s w e c o u l d i m p l e m e n t d e c r e m e n t e r , a n d m a y h a v e
* to s o m e d a y f o r t i m e k e e p i n g .
* /
STD_ E X C E P T I O N ( 0 x90 0 , D e c r e m e n t e r , t i m e r _ i n t e r r u p t )
STD_ E X C E P T I O N ( 0 x a00 , T r a p _ 0 a , U n k n o w n E x c e p t i o n )
STD_ E X C E P T I O N ( 0 x b00 , T r a p _ 0 b , U n k n o w n E x c e p t i o n )
STD_ E X C E P T I O N ( 0 x c00 , S y s t e m C a l l , U n k n o w n E x c e p t i o n )
STD_ E X C E P T I O N ( 0 x d00 , S i n g l e S t e p , U n k n o w n E x c e p t i o n )
STD_ E X C E P T I O N ( 0 x e 0 0 , T r a p _ 0 e , U n k n o w n E x c e p t i o n )
STD_ E X C E P T I O N ( 0 x f00 , T r a p _ 0 f , U n k n o w n E x c e p t i o n )
/ * On t h e M P C 8 x x , t h i s i s a s o f t w a r e e m u l a t i o n i n t e r r u p t . I t o c c u r s
* for a l l u n i m p l e m e n t e d a n d i l l e g a l i n s t r u c t i o n s .
* /
STD_ E X C E P T I O N ( 0 x10 0 0 , P I T , P I T E x c e p t i o n )
STD_ E X C E P T I O N ( 0 x11 0 0 , I n s t r u c t i o n T L B M i s s , U n k n o w n E x c e p t i o n )
STD_ E X C E P T I O N ( 0 x12 0 0 , D a t a T L B M i s s , U n k n o w n E x c e p t i o n )
STD_ E X C E P T I O N ( 0 x13 0 0 , I n s t r u c t i o n T L B E r r o r , U n k n o w n E x c e p t i o n )
STD_ E X C E P T I O N ( 0 x14 0 0 , D a t a T L B E r r o r , U n k n o w n E x c e p t i o n )
STD_ E X C E P T I O N ( 0 x15 0 0 , R e s e r v e d5 , U n k n o w n E x c e p t i o n )
STD_ E X C E P T I O N ( 0 x16 0 0 , R e s e r v e d6 , U n k n o w n E x c e p t i o n )
STD_ E X C E P T I O N ( 0 x17 0 0 , R e s e r v e d7 , U n k n o w n E x c e p t i o n )
STD_ E X C E P T I O N ( 0 x18 0 0 , R e s e r v e d8 , U n k n o w n E x c e p t i o n )
STD_ E X C E P T I O N ( 0 x19 0 0 , R e s e r v e d9 , U n k n o w n E x c e p t i o n )
STD_ E X C E P T I O N ( 0 x1 a00 , R e s e r v e d A , U n k n o w n E x c e p t i o n )
STD_ E X C E P T I O N ( 0 x1 b00 , R e s e r v e d B , U n k n o w n E x c e p t i o n )
STD_ E X C E P T I O N ( 0 x1 c00 , D a t a B r e a k p o i n t , U n k n o w n E x c e p t i o n )
STD_ E X C E P T I O N ( 0 x1 d00 , I n s t r u c t i o n B r e a k p o i n t , U n k n o w n E x c e p t i o n )
STD_ E X C E P T I O N ( 0 x1 e 0 0 , P e r i p h e r a l B r e a k p o i n t , U n k n o w n E x c e p t i o n )
STD_ E X C E P T I O N ( 0 x1 f00 , D e v P o r t B r e a k p o i n t , U n k n o w n E x c e p t i o n )
CRIT_ E X C E P T I O N ( 0 x20 0 0 , D e b u g B r e a k p o i n t , D e b u g E x c e p t i o n )
.globl _end_of_vectors
_end_of_vectors :
. = 0 x2 1 0 0
/ *
* This c o d e f i n i s h e s s a v i n g t h e r e g i s t e r s t o t h e e x c e p t i o n f r a m e
* and j u m p s t o t h e a p p r o p r i a t e h a n d l e r f o r t h e e x c e p t i o n .
@ -1133,28 +1104,12 @@ transfer_to_handler:
SAVE_ 4 G P R S ( 8 , r21 )
SAVE_ 8 G P R S ( 1 2 , r21 )
SAVE_ 8 G P R S ( 2 4 , r21 )
# if 0
andi. r23 ,r23 ,M S R _ P R
mfspr r23 ,S P R G 3 / * i f f r o m u s e r , f i x u p t s s . r e g s * /
beq 2 f
addi r24 ,r1 ,S T A C K _ F R A M E _ O V E R H E A D
stw r24 ,P T _ R E G S ( r23 )
2 : addi r2 ,r23 ,- T S S / * s e t r2 t o c u r r e n t * /
tovirt( r2 ,r2 ,r23 )
# endif
mflr r23
andi. r24 ,r23 ,0 x3 f00 / * g e t v e c t o r o f f s e t * /
stw r24 ,T R A P ( r21 )
li r22 ,0
stw r22 ,R E S U L T ( r21 )
mtspr S P R G 2 ,r22 / * r1 i s n o w k e r n e l s p * /
# if 0
addi r24 ,r2 ,T A S K _ S T R U C T _ S I Z E / * c h e c k f o r k e r n e l s t a c k o v e r f l o w * /
cmplw 0 ,r1 ,r2
cmplw 1 ,r1 ,r24
crand 1 ,1 ,4
bgt s t a c k _ o v f / * i f r2 < r1 < r2 + T A S K _ S T R U C T _ S I Z E * /
# endif
lwz r24 ,0 ( r23 ) / * v i r t u a l a d d r e s s o f h a n d l e r * /
lwz r23 ,4 ( r23 ) / * w h e r e t o g o w h e n d o n e * /
mtspr S R R 0 ,r24
@ -1215,16 +1170,64 @@ crit_return:
REST_ G P R ( 3 1 , r1 )
lwz r2 ,_ N I P ( r1 ) / * R e s t o r e e n v i r o n m e n t * /
lwz r0 ,_ M S R ( r1 )
mtspr 9 9 0 ,r2 / * S R R 2 * /
mtspr 9 9 1 ,r0 / * S R R 3 * /
mtspr c s r r0 ,r2
mtspr c s r r1 ,r0
lwz r0 ,G P R 0 ( r1 )
lwz r2 ,G P R 2 ( r1 )
lwz r1 ,G P R 1 ( r1 )
SYNC
rfci
/ * Cache f u n c t i o n s .
* /
# ifdef C O N F I G _ 4 4 0
mck_return :
mfmsr r28 / * D i s a b l e i n t e r r u p t s * /
li r4 ,0
ori r4 ,r4 ,M S R _ E E
andc r28 ,r28 ,r4
SYNC / * S o m e c h i p r e v s n e e d t h i s . . . * /
mtmsr r28
SYNC
lwz r2 ,_ C T R ( r1 )
lwz r0 ,_ L I N K ( r1 )
mtctr r2
mtlr r0
lwz r2 ,_ X E R ( r1 )
lwz r0 ,_ C C R ( r1 )
mtspr X E R ,r2
mtcrf 0 x F F ,r0
REST_ 1 0 G P R S ( 3 , r1 )
REST_ 1 0 G P R S ( 1 3 , r1 )
REST_ 8 G P R S ( 2 3 , r1 )
REST_ G P R ( 3 1 , r1 )
lwz r2 ,_ N I P ( r1 ) / * R e s t o r e e n v i r o n m e n t * /
lwz r0 ,_ M S R ( r1 )
mtspr m c s r r0 ,r2
mtspr m c s r r1 ,r0
lwz r0 ,G P R 0 ( r1 )
lwz r2 ,G P R 2 ( r1 )
lwz r1 ,G P R 1 ( r1 )
SYNC
rfmci
# endif / * C O N F I G _ 4 4 0 * /
/ *
* Cache f u n c t i o n s .
*
* NOTE : currently t h e 4 4 0 s r u n w i t h d c a c h e _ d i s a b l e d _ o n c e r e l o c a t e d t o D R A M ,
* although f o r s o m e c a c h e - r a l a t e d c a l l s s t u b s h a v e t o b e p r o v i d e d t o s a t i s f y
* symbols r e s o l u t i o n .
*
* /
# ifdef C O N F I G _ 4 4 0
.globl dcache_disable
dcache_disable :
blr
.globl dcache_status
dcache_status :
blr
# else
flush_dcache :
addis r9 ,r0 ,0 x00 0 2 / * s e t m a s k f o r E E a n d C E m s r b i t s * /
ori r9 ,r9 ,0 x80 0 0
@ -1303,24 +1306,13 @@ dcache_status:
mfdccr r3
srwi r3 , r3 , 3 1 / * > > 3 1 = > s e l e c t b i t 0 * /
blr
# endif
.globl get_pvr
get_pvr :
mfspr r3 , P V R
blr
# if ! d e f i n e d ( C O N F I G _ 4 4 0 )
.globl wr_pit
wr_pit :
mtspr p i t , r3
blr
# endif
.globl wr_tcr
wr_tcr :
mtspr t c r , r3
blr
/*------------------------------------------------------------------------------- */
/* Function: out16 */
/* Description: Output 16 bits */
@ -1518,7 +1510,7 @@ relocate_code:
* initialization, n o w r u n n i n g f r o m R A M .
* /
addi r0 , r10 , i n _ r a m - _ s t a r t + E X C _ O F F _ S Y S _ R E S E T
addi r0 , r10 , i n _ r a m - _ s t a r t + _ S T A R T _ O F F S E T
mtlr r0
blr / * N E V E R R E T U R N S ! * /
@ -1588,7 +1580,7 @@ clear_bss:
* /
.globl trap_init
trap_init :
lwz r7 , G O T ( _ s t a r t )
lwz r7 , G O T ( _ s t a r t _ o f _ v e c t o r s )
lwz r8 , G O T ( _ e n d _ o f _ v e c t o r s )
li r9 , 0 x10 0 / * r e s e t v e c t o r a l w a y s a t 0 x10 0 * /
@ -1608,35 +1600,48 @@ trap_init:
/ *
* relocate ` h d l r ' a n d ` i n t _ r e t u r n ' e n t r i e s
* /
li r7 , . L _ M a c h i n e C h e c k - _ s t a r t + E X C _ O F F _ S Y S _ R E S E T
li r8 , A l i g n m e n t - _ s t a r t + E X C _ O F F _ S Y S _ R E S E T
li r7 , . L _ M a c h i n e C h e c k - _ s t a r t + _ S T A R T _ O F F S E T
li r8 , A l i g n m e n t - _ s t a r t + _ S T A R T _ O F F S E T
2 :
bl t r a p _ r e l o c
addi r7 , r7 , 0 x10 0 / * n e x t e x c e p t i o n v e c t o r * /
addi r7 , r7 , 0 x10 0 / * n e x t e x c e p t i o n v e c t o r * /
cmplw 0 , r7 , r8
blt 2 b
li r7 , . L _ A l i g n m e n t - _ s t a r t + E X C _ O F F _ S Y S _ R E S E T
li r7 , . L _ A l i g n m e n t - _ s t a r t + _ S T A R T _ O F F S E T
bl t r a p _ r e l o c
li r7 , . L _ P r o g r a m C h e c k - _ s t a r t + E X C _ O F F _ S Y S _ R E S E T
li r7 , . L _ P r o g r a m C h e c k - _ s t a r t + _ S T A R T _ O F F S E T
bl t r a p _ r e l o c
li r7 , . L _ F P U n a v a i l a b l e - _ s t a r t + E X C _ O F F _ S Y S _ R E S E T
li r8 , S y s t e m C a l l - _ s t a r t + E X C _ O F F _ S Y S _ R E S E T
3 :
bl t r a p _ r e l o c
addi r7 , r7 , 0 x10 0 / * n e x t e x c e p t i o n v e c t o r * /
cmplw 0 , r7 , r8
blt 3 b
# ifdef C O N F I G _ 4 4 0
li r7 , . L _ F P U n a v a i l a b l e - _ s t a r t + _ S T A R T _ O F F S E T
bl t r a p _ r e l o c
li r7 , . L _ S i n g l e S t e p - _ s t a r t + E X C _ O F F _ S Y S _ R E S E T
li r8 , _ e n d _ o f _ v e c t o r s - _ s t a r t + E X C _ O F F _ S Y S _ R E S E T
4 :
bl t r a p _ r e l o c
addi r7 , r7 , 0 x10 0 / * n e x t e x c e p t i o n v e c t o r * /
cmplw 0 , r7 , r8
blt 4 b
li r7 , . L _ D e c r e m e n t e r - _ s t a r t + _ S T A R T _ O F F S E T
bl t r a p _ r e l o c
li r7 , . L _ A P U - _ s t a r t + _ S T A R T _ O F F S E T
bl t r a p _ r e l o c
li r7 , . L _ I n s t r u c t i o n T L B E r r o r - _ s t a r t + _ S T A R T _ O F F S E T
bl t r a p _ r e l o c
li r7 , . L _ D a t a T L B E r r o r - _ s t a r t + _ S T A R T _ O F F S E T
bl t r a p _ r e l o c
# else / * C O N F I G _ 4 4 0 * /
li r7 , . L _ P I T - _ s t a r t + _ S T A R T _ O F F S E T
bl t r a p _ r e l o c
li r7 , . L _ I n s t r u c t i o n T L B M i s s - _ s t a r t + _ S T A R T _ O F F S E T
bl t r a p _ r e l o c
li r7 , . L _ D a t a T L B M i s s - _ s t a r t + _ S T A R T _ O F F S E T
bl t r a p _ r e l o c
# endif / * C O N F I G _ 4 4 0 * /
li r7 , . L _ D e b u g B r e a k p o i n t - _ s t a r t + _ S T A R T _ O F F S E T
bl t r a p _ r e l o c
# if ! d e f i n e d ( C O N F I G _ 4 4 0 )
addi r7 ,r0 ,0 x10 0 0 / * s e t M E b i t ( M a c h i n e E x c e p t i o n s ) * /