2005-04-17 02:20:36 +04:00
| ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
| MOTOROLA M I C R O P R O C E S S O R & M E M O R Y T E C H N O L O G Y G R O U P
| M6 8 0 0 0 H i - P e r f o r m a n c e M i c r o p r o c e s s o r D i v i s i o n
| M6 8 0 6 0 S o f t w a r e P a c k a g e
| Production R e l e a s e P 1 . 0 0 - - O c t o b e r 1 0 , 1 9 9 4
|
2007-10-20 01:21:04 +04:00
| M6 8 0 6 0 S o f t w a r e P a c k a g e C o p y r i g h t © 1 9 9 3 , 1 9 9 4 M o t o r o l a I n c . A l l r i g h t s r e s e r v e d .
2005-04-17 02:20:36 +04:00
|
| THE S O F T W A R E i s p r o v i d e d o n a n " A S I S " b a s i s a n d w i t h o u t w a r r a n t y .
| To t h e m a x i m u m e x t e n t p e r m i t t e d b y a p p l i c a b l e l a w ,
| MOTOROLA D I S C L A I M S A L L W A R R A N T I E S W H E T H E R E X P R E S S O R I M P L I E D ,
| INCLUDING I M P L I E D W A R R A N T I E S O F M E R C H A N T A B I L I T Y 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
| and a n y w a r r a n t y a g a i n s t i n f r i n g e m e n t w i t h r e g a r d t o t h e S O F T W A R E
| ( INCLUDING A N Y M O D I F I E D V E R S I O N S T H E R E O F ) a n d a n y a c c o m p a n y i n g w r i t t e n m a t e r i a l s .
|
| To t h e m a x i m u m e x t e n t p e r m i t t e d b y a p p l i c a b l e l a w ,
| IN N O E V E N T S H A L L M O T O R O L A B E L I A B L E F O R A N Y D A M A G E S W H A T S O E V E R
| ( INCLUDING W I T H O U T L I M I T A T I O N , D A M A G E S F O R L O S S O F B U S I N E S S P R O F I T S ,
| BUSINESS I N T E R R U P T I O N , L O S S O F B U S I N E S S I N F O R M A T I O N , O R O T H E R P E C U N I A R Y L O S S )
| ARISING O F T H E U S E O R I N A B I L I T Y T O U S E T H E S O F T W A R E .
| Motorola a s s u m e s n o r e s p o n s i b i l i t y f o r t h e m a i n t e n a n c e a n d s u p p o r t o f t h e S O F T W A R E .
|
| You a r e h e r e b y g r a n t e d a c o p y r i g h t l i c e n s e t o u s e , m o d i f y , a n d d i s t r i b u t e t h e S O F T W A R E
| so l o n g a s t h i s e n t i r e n o t i c e i s r e t a i n e d w i t h o u t a l t e r a t i o n i n a n y m o d i f i e d a n d / o r
| redistributed v e r s i o n s , a n d t h a t s u c h m o d i f i e d v e r s i o n s a r e c l e a r l y i d e n t i f i e d a s s u c h .
| No l i c e n s e s a r e g r a n t e d b y i m p l i c a t i o n , e s t o p p e l o r o t h e r w i s e u n d e r a n y p a t e n t s
| or t r a d e m a r k s o f M o t o r o l a , I n c .
| ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
| iskeleton. s
|
| This f i l e c o n t a i n s :
| ( 1 ) example " C a l l - o u t " s
| ( 2 ) example p a c k a g e e n t r y c o d e
| ( 3 ) example " C a l l - o u t " t a b l e
|
# include < l i n u x / l i n k a g e . h >
# include < a s m / e n t r y . h >
2005-09-09 22:57:26 +04:00
# include < a s m / a s m - o f f s e t s . h >
2005-04-17 02:20:36 +04:00
| # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
| ( 1 ) EXAMPLE C A L L - O U T S #
| #
| _ 0 6 0 _ isp_ d o n e ( ) #
| _ 0 6 0 _ real_ c h k ( ) #
| _ 0 6 0 _ real_ d i v b y z e r o ( ) #
| #
| _ 0 6 0 _ real_ c a s ( ) #
| _ 0 6 0 _ real_ c a s2 ( ) #
| _ 0 6 0 _ real_ l o c k _ p a g e ( ) #
| _ 0 6 0 _ real_ u n l o c k _ p a g e ( ) #
| # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
| _ 0 6 0 _ isp_ d o n e ( ) :
|
| This i s a n d e x a m p l e m a i n e x i t p o i n t f o r t h e U n i m p l e m e n t e d I n t e g e r
| Instruction e x c e p t i o n h a n d l e r . F o r a n o r m a l e x i t , t h e
| _ isp_ u n i m p ( ) b r a n c h e s t o h e r e s o t h a t t h e o p e r a t i n g s y s t e m
| can d o a n y c l e a n - u p d e s i r e d . T h e s t a c k f r a m e i s t h e
| Unimplemented I n t e g e r I n s t r u c t i o n s t a c k f r a m e w i t h
| the P C p o i n t i n g t o t h e i n s t r u c t i o n f o l l o w i n g t h e i n s t r u c t i o n
| just e m u l a t e d .
| To s i m p l y c o n t i n u e e x e c u t i o n a t t h e n e x t i n s t r u c t i o n , j u s t
| do a n " r t e " .
|
| Linux/ 6 8 k : I f r e t u r n i n g t o u s e r s p a c e , c h e c k f o r n e e d e d r e s e l e c t i o n s .
.global _060_isp_done
_060_isp_done :
btst #0x5 ,% s p @ | supervisor bit set in saved SR?
beq . L n o t k e r n
rte
.Lnotkern :
SAVE_ A L L _ I N T
GET_ C U R R E N T ( % d0 )
2005-11-14 03:06:59 +03:00
| deliver s i g n a l s , r e s c h e d u l e e t c . .
jra r e t _ f r o m _ e x c e p t i o n
2005-04-17 02:20:36 +04:00
|
| _ 0 6 0 _ real_ c h k ( ) :
|
| This i s a n a l t e r n a t e e x i t p o i n t f o r t h e U n i m p l e m e n t e d I n t e g e r
| Instruction e x c e p t i o n h a n d l e r . I f t h e i n s t r u c t i o n w a s a " c h k 2 "
| and t h e o p e r a n d w a s o u t o f b o u n d s , t h e n _ i s p _ u n i m p ( ) c r e a t e s
| a C H K e x c e p t i o n s t a c k f r a m e f r o m t h e U n i m p l e m e n t e d I n t e g e r I n s t r c u t i o n
| stack f r a m e a n d b r a n c h e s t o t h i s r o u t i n e .
|
| Linux/ 6 8 k : c o m m e n t e d o u t t e s t f o r t r a c i n g
.global _060_real_chk
_060_real_chk :
| tst. b ( % s p ) | i s t r a c i n g e n a b l e d ?
| bpls r e a l _ c h k _ e n d | n o
|
| CHK F R A M E T R A C E F R A M E
| * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
| * Current P C * * C u r r e n t P C *
| * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
| * 0 x2 * 0 x01 8 * * 0 x2 * 0 x02 4 *
| * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
| * Next * * N e x t *
| * PC * * P C *
| * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
| * SR * * S R *
| * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
| move. b #0x24 ,0 x7 ( % s p ) | s e t t r a c e v e c n o
| bral _ 0 6 0 _ r e a l _ t r a c e
real_chk_end :
bral t r a p | j u m p t o t r a p h a n d l e r
|
| _060_real_divbyzero :
|
| This i s a n a l t e r n a t e e x i t p o i n t f o r t h e U n i m p l e m e n t e d I n t e g e r
| Instruction e x c e p t i o n h a n d l e r i s p _ u n i m p ( ) . I f t h e i n s t r u c t i o n i s a 6 4 - b i t
| integer d i v i d e w h e r e t h e s o u r c e o p e r a n d i s a z e r o , t h e n t h e _ i s p _ u n i m p ( )
| creates a D i v i d e - b y - z e r o e x c e p t i o n s t a c k f r a m e f r o m t h e U n i m p l e m e n t e d
| Integer I n s t r u c t i o n s t a c k f r a m e a n d b r a n c h e s t o t h i s r o u t i n e .
|
| Remember t h a t a t r a c e e x c e p t i o n m a y b e p e n d i n g . T h e c o d e b e l o w p e r f o r m s
| no a c t i o n a s s o c i a t e d w i t h t h e " c h k " e x c e p t i o n . I f t r a c i n g i s e n a b l e d ,
| then i t c r e a t e a T r a c e e x c e p t i o n s t a c k f r a m e f r o m t h e " c h k " e x c e p t i o n
| stack f r a m e a n d b r a n c h e s t o t h e _ r e a l _ t r a c e ( ) e n t r y p o i n t .
|
| Linux/ 6 8 k : c o m m e n t e d o u t t e s t f o r t r a c i n g
.global _060_real_divbyzero
_060_real_divbyzero :
| tst. b ( % s p ) | i s t r a c i n g e n a b l e d ?
| bpls r e a l _ d i v b y z e r o _ e n d | n o
|
| DIVBYZERO F R A M E T R A C E F R A M E
| * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
| * Current P C * * C u r r e n t P C *
| * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
| * 0 x2 * 0 x01 4 * * 0 x2 * 0 x02 4 *
| * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
| * Next * * N e x t *
| * PC * * P C *
| * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
| * SR * * S R *
| * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
| move. b #0x24 ,0 x7 ( % s p ) | s e t t r a c e v e c n o
| bral _ 0 6 0 _ r e a l _ t r a c e
real_divbyzero_end :
bral t r a p | j u m p t o t r a p h a n d l e r
| # # # # # # # # # # # # # # # # # # # # # # # # # #
|
| _ 0 6 0 _ real_ c a s ( ) :
|
| Entry p o i n t f o r t h e s e l e c t e d c a s e m u l a t i o n c o d e i m p l e m e n t a t i o n .
| If t h e i m p l e m e n t a t i o n p r o v i d e d b y t h e 6 8 0 6 0 I S P i s s u f f i c i e n t ,
| then t h i s r o u t i n e s i m p l y r e - e n t e r s t h e p a c k a g e t h r o u g h _ i s p _ c a s .
|
.global _060_real_cas
_060_real_cas :
bral _ I _ C A L L _ T O P + 0 x80 + 0 x08
|
| _ 0 6 0 _ real_ c a s2 ( ) :
|
| Entry p o i n t f o r t h e s e l e c t e d c a s2 e m u l a t i o n c o d e i m p l e m e n t a t i o n .
| If t h e i m p l e m e n t a t i o n p r o v i d e d b y t h e 6 8 0 6 0 I S P i s s u f f i c i e n t ,
| then t h i s r o u t i n e s i m p l y r e - e n t e r s t h e p a c k a g e t h r o u g h _ i s p _ c a s2 .
|
.global _060_real_cas2
_060_real_cas2 :
bral _ I _ C A L L _ T O P + 0 x80 + 0 x10
|
| _ 0 6 0 _ lock_ p a g e ( ) :
|
| Entry p o i n t f o r t h e o p e r a t i n g s y s t e m ` s r o u t i n e t o " l o c k " a p a g e
| from b e i n g p a g e d o u t . T h i s r o u t i n e i s n e e d e d b y t h e c a s / c a s2
| algorithms s o t h a t n o p a g e f a u l t s o c c u r w i t h i n t h e " c o r e " c o d e
| region. N o t e : t h e r o u t i n e m u s t l o c k t w o p a g e s i f t h e o p e r a n d
| spans t w o p a g e s .
| NOTE : THE R O U T I N E S H O U L D R E T U R N A N F S L W V A L U E I N D 0 O N F A I L U R E
| SO T H A T T H E 0 6 0 S P C A N C R E A T E A P R O P E R A C C E S S E R R O R F R A M E .
| Arguments :
| a0 = o p e r a n d a d d r e s s
| d0 = ` x x x x x x f f - > s u p e r v i s o r ; `xxxxxx00 -> user
| d1 = ` x x x x x x f f - > l o n g w o r d ; `xxxxxx00 -> word
| Expected o u t p u t s :
| d0 = 0 - > s u c c e s s ; non-zero -> failure
|
| Linux/ m 6 8 k : M a k e s u r e t h e p a g e i s p r o p e r l y p a g e d i n , s o w e u s e
| plpaw a n d h a n d l e a n y e x c e p t i o n h e r e . T h e k e r n e l m u s t n o t b e
| preempted u n t i l _ 0 6 0 _ u n l o c k _ p a g e ( ) , s o t h a t t h e p a g e s t a y s m a p p e d .
|
.global _060_real_lock_page
_060_real_lock_page :
move. l % d2 ,- ( % s p )
| load s f c / d f c
tst. b % d0
jne 1 f
moveq #1 ,% d0
jra 2 f
1 : moveq #5 ,% d0
2 : movec. l % d f c ,% d2
movec. l % d0 ,% d f c
movec. l % d0 ,% s f c
clr. l % d0
| prefetch a d d r e s s
.chip 68060
move. l % a0 ,% a1
1 : plpaw ( % a1 )
addq. w #1 ,% a0
tst. b % d1
jeq 2 f
addq. w #2 ,% a0
2 : plpaw ( % a0 )
3 : .chip 68 k
| restore s f c / d f c
movec. l % d2 ,% d f c
movec. l % d2 ,% s f c
move. l ( % s p ) + ,% d2
rts
.section _ _ ex_ t a b l e ," a "
.align 4
.long 1 b,1 1 f
.long 2 b,2 1 f
.previous
.section .fixup , " ax"
.even
11 : move. l #0x020003c0 ,% d0
or. l % d2 ,% d0
swap % d0
jra 3 b
21 : move. l #0x02000bc0 ,% d0
or. l % d2 ,% d0
swap % d0
jra 3 b
.previous
|
| _ 0 6 0 _ unlock_ p a g e ( ) :
|
| Entry p o i n t f o r t h e o p e r a t i n g s y s t e m ` s r o u t i n e t o " u n l o c k " a
| page t h a t h a s b e e n " l o c k e d " p r e v i o u s l y w i t h _ r e a l _ l o c k _ p a g e .
| Note : the r o u t i n e m u s t u n l o c k t w o p a g e s i f t h e o p e r a n d s p a n s
| two p a g e s .
| Arguments :
| a0 = o p e r a n d a d d r e s s
| d0 = ` x x x x x x f f - > s u p e r v i s o r ; `xxxxxx00 -> user
| d1 = ` x x x x x x f f - > l o n g w o r d ; `xxxxxx00 -> word
|
| Linux/ m 6 8 k : p e r h a p s r e e n a b l e p r e e m p t i o n h e r e . . .
.global _060_real_unlock_page
_060_real_unlock_page :
clr. l % d0
rts
| # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
| # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
| ( 2 ) EXAMPLE P A C K A G E E N T R Y C O D E #
| # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
.global _060_isp_unimp
_060_isp_unimp :
bral _ I _ C A L L _ T O P + 0 x80 + 0 x00
.global _060_isp_cas
_060_isp_cas :
bral _ I _ C A L L _ T O P + 0 x80 + 0 x08
.global _060_isp_cas2
_060_isp_cas2 :
bral _ I _ C A L L _ T O P + 0 x80 + 0 x10
.global _060_isp_cas_finish
_060_isp_cas_finish :
bra. l _ I _ C A L L _ T O P + 0 x80 + 0 x18
.global _060_isp_cas2_finish
_060_isp_cas2_finish :
bral _ I _ C A L L _ T O P + 0 x80 + 0 x20
.global _060_isp_cas_inrange
_060_isp_cas_inrange :
bral _ I _ C A L L _ T O P + 0 x80 + 0 x28
.global _060_isp_cas_terminate
_060_isp_cas_terminate :
bral _ I _ C A L L _ T O P + 0 x80 + 0 x30
.global _060_isp_cas_restart
_060_isp_cas_restart :
bral _ I _ C A L L _ T O P + 0 x80 + 0 x38
| # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
| # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
| ( 3 ) EXAMPLE C A L L - O U T S E C T I O N #
| # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
| The s i z e o f t h i s s e c t i o n M U S T b e 1 2 8 b y t e s ! ! !
_I_CALL_TOP :
.long _060_real_chk - _ I_ C A L L _ T O P
.long _060_real_divbyzero - _ I_ C A L L _ T O P
.long _060_real_trace - _ I_ C A L L _ T O P
.long _060_real_access - _ I_ C A L L _ T O P
.long _060_isp_done - _ I_ C A L L _ T O P
.long _060_real_cas - _ I_ C A L L _ T O P
.long _060_real_cas2 - _ I_ C A L L _ T O P
.long _060_real_lock_page - _ I_ C A L L _ T O P
.long _060_real_unlock_page - _ I_ C A L L _ T O P
.long 0 x0 0 0 0 0 0 0 0 , 0 x00 0 0 0 0 0 0 , 0 x00 0 0 0 0 0 0 , 0 x00 0 0 0 0 0 0
.long 0 x0 0 0 0 0 0 0 0 , 0 x00 0 0 0 0 0 0 , 0 x00 0 0 0 0 0 0
.long _060_imem_read - _ I_ C A L L _ T O P
.long _060_dmem_read - _ I_ C A L L _ T O P
.long _060_dmem_write - _ I_ C A L L _ T O P
.long _060_imem_read_word - _ I_ C A L L _ T O P
.long _060_imem_read_long - _ I_ C A L L _ T O P
.long _060_dmem_read_byte - _ I_ C A L L _ T O P
.long _060_dmem_read_word - _ I_ C A L L _ T O P
.long _060_dmem_read_long - _ I_ C A L L _ T O P
.long _060_dmem_write_byte - _ I_ C A L L _ T O P
.long _060_dmem_write_word - _ I_ C A L L _ T O P
.long _060_dmem_write_long - _ I_ C A L L _ T O P
.long 0x00000000
.long 0 x0 0 0 0 0 0 0 0 , 0 x00 0 0 0 0 0 0 , 0 x00 0 0 0 0 0 0 , 0 x00 0 0 0 0 0 0
| # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
| 0 6 0 INTEGER K E R N E L P A C K A G E M U S T G O H E R E ! ! !
# include " i s p . s a "