2021-12-29 03:14:16 +00:00
/ / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / /
/ /
/ / WALLY- M M U
/ /
/ / Author : David_ H a r r i s @hmc.edu and Kip Macsai-Goren <kmacsaigoren@g.hmc.edu>
/ /
/ / Created 2 0 2 1 - 0 6 - 1 5
/ /
/ / Copyright ( C ) 2 0 2 1 H a r v e y M u d d C o l l e g e & O k l a h o m a S t a t e U n i v e r s i t y
/ /
/ / Permission i s h e r e b y g r a n t e d , f r e e o f c h a r g e , t o a n y p e r s o n o b t a i n i n g a c o p y o f t h i s s o f t w a r e a n d a s s o c i a t e d d o c u m e n t a t i o n
/ / files ( t h e " S o f t w a r e " ) , t o d e a l i n t h e S o f t w a r e w i t h o u t r e s t r i c t i o n , i n c l u d i n g w i t h o u t l i m i t a t i o n t h e r i g h t s t o u s e , c o p y ,
/ / modify, m e r g e , p u b l i s h , d i s t r i b u t e , s u b l i c e n s e , a n d / o r s e l l c o p i e s o f t h e S o f t w a r e , a n d t o p e r m i t p e r s o n s t o w h o m t h e S o f t w a r e
/ / is f u r n i s h e d t o d o s o , s u b j e c t t o t h e f o l l o w i n g c o n d i t i o n s :
/ /
/ / The a b o v e c o p y r i g h t n o t i c e a n d t h i s p e r m i s s i o n n o t i c e s h a l l b e i n c l u d e d i n a l l c o p i e s o r s u b s t a n t i a l p o r t i o n s o f t h e S o f t w a r e .
/ /
/ / THE S O F T W A R E I S P R O V I D E D " A S I S " , W I T H O U T W A R R A N T Y O F A N Y K I N D , E X P R E S S O R I M P L I E D , I N C L U D I N G B U T N O T L I M I T E D T O T H E W A R R A N T I E S
/ / OF M E R C H A N T A B I L I T Y , 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 A N D N O N I N F R I N G E M E N T . I N N O E V E N T S H A L L T H E A U T H O R S O R C O P Y R I G H T H O L D E R S
/ / BE L I A B L E F O R A N Y C L A I M , D A M A G E S O R O T H E R L I A B I L I T Y , W H E T H E R I N A N A C T I O N O F C O N T R A C T , T O R T O R O T H E R W I S E , A R I S I N G F R O M , O U T
/ / OF O R I N C O N N E C T I O N W I T H T H E S O F T W A R E O R T H E U S E O R O T H E R D E A L I N G S I N T H E S O F T W A R E .
/ / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / /
# include " W A L L Y - T E S T - L I B - 3 2 . S "
/ / Test l i b r a r y i n c l u d e s a n d h a n d l e r f o r e a c h t y p e o f t e s t , a t r a p h a n d l e r , i m p e r a s c o m p l i a n c e i n s t r u c t i o n s
/ / Ideally t h i s s h o u l d m e a n t h a t a t e s t c a n b e w r i t t e n b y s i m p l y a d d i n g . 8 b y t e s t a t e m e n t s a s b e l o w .
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Test C o n t e n t s
#
# Here i s w h e r e t h e a c t u a l t e s t s a r e h e l d , o r r a t h e r , w h a t t h e a c t u a l t e s t s d o .
# each e n t r y c o n s i s t s o f 3 v a l u e s t h a t w i l l b e r e a d i n a s f o l l o w s :
#
# ' .8byte [ x2 8 V a l u e ] , [ x29 V a l u e ] , [ x30 v a l u e ] '
# or
# ' .8byte [ address] , [ v a l u e ] , [ t e s t t y p e ] '
#
# The e n c o d i n g f o r x30 t e s t t y p e v a l u e s c a n b e f o u n d i n t h e t e s t h a n d l e r i n t h e f r a m e w o r k f i l e
#
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# = = = = = = = = = = = test 1 2 . 3 . 1 . 1 P a g e T a b l e T r a n s l a t i o n = = = = = = = = = = =
# test 1 2 . 3 . 1 . 1 . 1 w r i t e p a g e t a b l e s / e n t r i e s t o p h y i s c a l m e m o r y
# sv3 2 P a g e t a b l e ( S e e F i g u r e 1 2 . 1 2 * * * ) :
# Level 1 p a g e t a b l e , s i t u a t e d a t 0 x80 0 0 D 0 0 0
2021-12-30 16:46:19 +00:00
.4byte 0 x8 0 0 0 D 0 0 0 , 0 x20 0 0 4 C 0 1 , 0 x0 # p o i n t s t o l e v e l 0 p a g e t a b l e A
2021-12-29 03:14:16 +00:00
.4byte 0 x8 0 0 0 D 0 0 4 , 0 x20 0 0 0 0 C B , 0 x0 # V a d d r 0x400000 P a d d r 0 x80 0 0 0 0 0 0 : a l i g n e d m e g a p a g e , W =0 , u s e d f o r e x e c u t e t e s t s
2021-12-30 16:46:19 +00:00
.4byte 0 x8 0 0 0 D 0 0 8 , 0 x20 0 0 5 4 2 1 , 0 x0 # p o i n t s t o l e v e l 0 p a g e t a b l e B
2021-12-29 03:14:16 +00:00
.4byte 0 x8 0 0 0 D 0 0 C , 0 x00 0 8 0 0 C 7 , 0 x0 # V a d d r 0xC00000 : m i s a l i g n e d m e g a p a g e
.4byte 0 x8 0 0 0 D 8 0 0 , 0 x20 0 0 0 0 C F , 0 x0 # V a d d r 0x80000000 P a d d r 0 x80 0 0 0 0 0 0 : a l i g n e d m e g a p a g e ( p r o g r a m a n d d a t a m e m o r y )
.4byte 0 x8 0 0 0 D 8 0 4 , 0 x20 0 0 0 0 D F , 0 x0 # V a d d r 0x80400000 P a d d r 0 x80 0 0 0 0 0 0 : a l i g n e d m e g a p a g e , U =1 ( a l i a s e d w i t h p r o g r a m a n d d a t a m e m o r y )
# Level 0 p a g e t a b l e A
2021-12-30 16:46:19 +00:00
.4byte 0 x8 0 0 1 3 0 0 0 , 0 x20 0 0 7 0 1 1 , 0 x0 # V a d d r 0x0000 : b a d P T E p o i n t s t o l e v e l - 1 t a b l e
2021-12-29 03:14:16 +00:00
.4byte 0 x8 0 0 1 3 0 0 4 , 0 x20 2 0 0 0 D F , 0 x0 # V a d d r 0x1000 P a d d r 0 x80 8 0 0 0 0 0 : a l i g n e d k i l o p a g e , U =1
.4byte 0 x8 0 0 1 3 0 0 8 , 0 x20 2 0 1 0 D 5 , 0 x0 # V a d d r 0x2000 : p a d P T E h a s W b u t n o t R
.4byte 0 x8 0 0 1 3 0 0 C , 0 x20 2 0 0 8 1 7 , 0 x0 # V a d d r 0x3000 : A =0 , s h o u l d c a u s e r e a d f a u l t
.4byte 0 x8 0 0 1 3 0 1 0 , 0 x20 2 0 0 C 5 7 , 0 x0 # V a d d r 0x4000 : D =0 , s h o u l d c a u s e w r i t e f a u l t
.4byte 0 x8 0 0 1 3 0 1 4 , 0 x20 2 0 1 4 C 9 , 0 x0 # V a d d r 0x5000 P a d d r 8 0 8 0 5 0 0 0 : a l i g n e d k i l o p a g e , W =R =0
.4byte 0 x8 0 0 1 3 0 1 8 , 0 x0 , 0 x0 # V a d d r 0x6000 : i n v a l i d p a g e
# Level 0 p a g e t a b l e B
.4byte 0 x8 0 0 1 5 F F C , 0 x20 2 0 0 4 C F , 0 x0 # V a d d r 0x00BFF000 P a d d r 0 x80 8 0 1 0 0 0 : a l i g n e d k i l o p a g e
# test 1 2 . 3 . 1 . 1 . 2 w r i t e v a l u e s t o P a d d r s i n e a c h p a g e
# each o f t h e s e v a l u e s i s u s e d f o r 1 2 . 3 . 1 . 1 . 3 a n d s o m e o t h e r t e s t s , s p e c i f i e d i n t h e c o m m e n t s .
# when a t e s t i s s u p p o s e d t o f a u l t , n o t h i n g i s w r i t t e n i n t o w h e r e i t ' l l b e r e a d i n g / e x e c u t i n g s i n c e i t s h o u l d f a u l t b e f o r e g e t t i n g t h e r e .
.4byte 0 x8 0 0 A A A A 8 , 0 x B E E F 0 0 5 5 , 0 x0 # 12.3 . 1 . 1 . 4 m e g a p a g e
.4byte 0 x8 0 0 F F A C 0 , 0 x B E E F 0 0 3 3 , 0 x0 # 12.3 . 1 . 3 . 2
.4byte 0 x8 0 0 E 3 1 3 0 , 0 x B E E F 0 0 7 7 , 0 x0 # 12.3 . 1 . 3 . 2
.4byte 0 x8 0 8 0 1 7 E 0 , 0 x B E E F 0 0 9 9 , 0 x0 # 12.3 . 1 . 1 . 4 k i l o p a g e
.4byte 0 x8 0 8 0 5 E A 0 , 0 x B E E F 0 4 4 0 , 0 x0 # 12.3 . 1 . 3 . 3
.4byte 0 x8 0 8 0 3 A A 0 , 0 x B E E F 0 B B 0 , 0 x0 # 12.3 . 1 . 3 . 7
# test 1 2 . 3 . 1 . 1 . 3 r e a d v a l u e s b a c k f r o m P a d d r s w i t h o u t t r a n s l a t i o n ( t h i s a l s o v e r i f i e s t h e p r e v i o u s t e s t )
.4byte 0 x0 , 0 x0 , 0 x4 # s a t p . M O D E = b a r e m e t a l / n o t r a n s l a t i o n .
.4byte 0 x0 , 0 x0 , 0 x9 # c h a n g e t o S m o d e , 0xb w r i t t e n t o o u t p u t
.4byte 0 x8 0 0 A A A A 8 , 0 x B E E F 0 0 5 5 , 0 x1
.4byte 0 x8 0 0 F F A C 0 , 0 x B E E F 0 0 3 3 , 0 x1
.4byte 0 x8 0 0 E 3 1 3 0 , 0 x B E E F 0 0 7 7 , 0 x1
.4byte 0 x8 0 8 0 1 7 E 0 , 0 x B E E F 0 0 9 9 , 0 x1
.4byte 0 x8 0 8 0 5 E A 0 , 0 x B E E F 0 4 4 0 , 0 x1
.4byte 0 x8 0 8 0 3 A A 0 , 0 x B E E F 0 B B 0 , 0 x1
# test 1 2 . 3 . 1 . 1 . 4 c h e c k t r a n s l a t i o n w o r k s i n s v48 , r e a d t h e s a m e v a l u e s f r o m p r e v i o u s t e s t s , t h i s t i m e w i t h V a d d r s
.4byte 0 x0 , 0 x0 , 0 x5 # s a t p . M O D E = s v 48 , N o t h i n g w r i t t e n t o o u t p u t
.4byte 0 x4 A A A A 8 , 0 x B E E F 0 0 5 5 , 0 x1 # m e g a p a g e a t V a d d r 0x400000 , P a d d r 0 x80 0 0 0 0 0 0
.4byte 0 xBFF7 E 0 , 0 x B E E F 0 0 9 9 , 0 x1 # k i l o p a g e a t V a d d r 0xBFF000 , P a d d r 0 x80 2 0 1 0 0 0
# = = = = = = = = = = = test 1 2 . 3 . 1 . 2 p a g e f a u l t t e s t s = = = = = = = = = = =
# test 1 2 . 3 . 1 . 2 . 1 l o a d p a g e f a u l t i f u p p e r b i t s o f V a d d r a r e n o t t h e s a m e
# Not t e s t e d i n r v32 / s v32
# test 1 2 . 3 . 1 . 2 . 2 l o a d p a g e f a u l t w h e n r e a d i n g a n a d d r e s s w h e r e t h e v a l i d f l a g i s z e r o
.4byte 0 x6 0 0 0 , 0 x0 , 0 x1
# test 1 2 . 3 . 1 . 2 . 3 s t o r e p a g e f a u l t i f P T E h a s W a n d ~ R f l a g s s e t
.4byte 0 x2 0 0 0 , 0 x0 , 0 x0
# test 1 2 . 3 . 1 . 2 . 4 F a u l t i f l a s t l e v e l P T E i s a p o i n t e r
.4byte 0 x0 2 0 0 , 0 x0 , 0 x1
# test 1 2 . 3 . 1 . 2 . 5 l o a d p a g e f a u l t o n m i s a l i g n e d p a g e s
.4byte 0 xC0 0 0 0 0 , 0 x0 , 0 x1 # m i s a l i g n e d m e g a p a g e
# = = = = = = = = = = = test 1 2 . 3 . 1 . 3 P T E P r o t e c t i o n f l a g s = = = = = = = = = = =
/ / * * * 1 6 July 2 0 2 1 : E x e c u t i o n t e s t s c o m m e n t e d o u t b e c a u s e t h e y r e l y o n s o m e m e m o r y t h a t ' s w r i t t e n i n 1 2 . 3 . 1 . 1 . 2 . t h i s m e m o r y i s w r i t t e n b u t s t a y s i n t h e d c a c h e w i t h o u t b e i n g s y n c e d i n t o m e m o r y
/ / Then t h e i f u t r i e s t o f e t c h t h e s a m e a d d r e s s , b u t i t ' s w o r k i n g w i t h t h e u n s y n c e d m e m o r y , N O T t h e v a l u e s t o r e d i n t h e d c a c h e
/ / Until w e h a v e s o m e f e n c e i n s t r u c t i o n s o r a n o t h e r w a y o f m o d i f y i n g t h e c o d e i m p l e m e n t e d , t h e s e t e s t s a r e i g n o r e d .
# test 1 2 . 3 . 1 . 3 . 1 U s e r f l a g = = 0
# * * * reads o n p a g e s w i t h U =0 a l r e a d y t e s t e d i n 1 2 . 3 . 1 . 1 . 4
.4byte 0 x4 0 0 0 0 0 , 0 x1 , 0 x2 # f e t c h s u c c e s s w h e n U = 0 , p r i v =S
.4byte 0 x2 0 1 , 0 x11 , 0 x A # g o t o U m o d e , r e t u r n t o m e g a p a g e V P N a t [ 513 ] w h e r e P T E . U = 1 . 0 x9 w r i t t e n t o o u t p u t
.4byte 0 xBFFC8 0 , 0 x B E E F 0 5 5 0 , 0 x1 # l o a d p a g e f a u l t w h e n U = 0 , p r i v =U
.4byte 0 x4 0 0 0 0 0 , 0 x1 , 0 x2 # i n s t r p a g e f a u l t w h e n U = 0 , p r i v =U
# test 1 2 . 3 . 1 . 3 . 2 U s e r f l a g = = 1
.4byte 0 x8 0 4 F F A C 0 , 0 x B E E F 0 0 3 3 , 0 x1 # r e a d s u c c e s s w h e n U = 1 , p r i v =U
.4byte 0 x2 0 0 , 0 x11 , 0 x9 # g o b a c k t o S m o d e , r e t u r n t o m e g a p a g e V P N a t [ 512 ] w h e r e P T E . U = 0 . 0 x8 w r i t t e n t o o u t p u t
.4byte 0 x0 , 0 x3 , 0 x7 # s e t s s t a t u s . [ M X R , S U M ] = 11
.4byte 0 x8 0 4 E 3 1 3 0 , 0 x B E E F 0 0 7 7 , 0 x1 # r e a d s u c c e s s w h e n U = 1 , p r i v =S , s s t a t u s . S U M =1
.4byte 0 x0 , 0 x40 0 0 0 0 , 0 x10 # p u s h t o s t a c k v i r t u a l a d d r e s s c o r r e s p o n f d i n g t o t h e P T E a b o u t t o b e c h a n g e d .
.4byte 0 x8 0 0 0 D 0 0 4 , 0 x20 0 0 0 0 D B , 0 x F # E d i t e x e c u t i o n P T E s o U = 1
.4byte 0 x4 0 0 0 0 0 , 0 x1 , 0 x2 # i n s t r p a g e f a u l t w h e n U = 1 , p r i v =S ( w i t h a n y s s t a t u s . S U M )
.4byte 0 x0 , 0 x2 , 0 x7 # s e t s s t a t u s . [ M X R , S U M ] = 10 .
.4byte 0 x8 0 4 F F A C 0 , 0 x B E E F 0 0 3 3 , 0 x1 # l o a d p a g e f a u l t w h e n U - 1 , p r i v =S , s s t a t u s . S U M =0
# test 1 2 . 3 . 1 . 3 . 3 R e a d f l a g
# * * * reads o n p a g e s w i t h R =1 a l r e a d y t e s t e d i n 1 2 . 3 . 1 . 1 . 4
.4byte 0 x0 , 0 x1 , 0 x7 # s e t s s t a t u s . [ M X R , S U M ] = 01 .
.4byte 0 x5 E A 0 , 0 x B E E F 0 4 4 0 , 0 x1 # l o a d p a g e f a u l t w h e n R = 0 , s s t a t u s . M X R =0
.4byte 0 x0 , 0 x3 , 0 x7 # s e t s s t a t u s . [ M X R , S U M ] = 11 .
.4byte 0 x5 E A 0 , 0 x B E E F 0 4 4 0 , 0 x1 # r e a d s u c c e s s w h e n R = 0 , M X R =1 , X =1
# test 1 2 . 3 . 1 . 3 . 4 W r i t e f l a g
.4byte 0 xBFF2 9 0 , 0 x B E E F 0 1 1 0 , 0 x0 # w r i t e s u c c e s s w h e n W = 1
.4byte 0 xBFF2 9 0 , 0 x B E E F 0 1 1 0 , 0 x1 # c h e c k w r i t e s u c c e s s b y r e a d i n g
.4byte 0 x5 B 7 8 , 0 x B E E F 0 C C 0 , 0 x0 # s t o r e p a g e f a u l t w h e n W = 0
# test 1 2 . 3 . 1 . 3 . 5 e X e c u t e f l a g
# * * * fetches o n p a g e s w i t h X = 1 a l r e a d y t e s t e d i n 1 2 . 3 . 1 . 3 . 1
.4byte 0 x0 , 0 x40 0 0 0 0 , 0 x10 # p u s h t o s t a c k v i r t u a l a d d r e s s c o r r e s p o n f d i n g t o t h e P T E a b o u t t o b e c h a n g e d .
.4byte 0 x8 0 0 0 D 0 0 4 , 0 x20 0 0 0 0 C 7 , 0 x F # E d i t e x e c u t i o n P T E s o U = 0 , X =0
.4byte 0 x4 0 0 0 0 0 , 0 x0 , 0 x2 # i n s t r p a g e f a u l t w h e n X = 0
# test 1 2 . 3 . 1 . 3 . 6 A c c e s s e d f l a g = = 0
.4byte 0 x3 0 2 0 , 0 x B E E F 0 7 7 0 , 0 x0 # s t o r e p a g e f a u l t w h e n A = 0
.4byte 0 x3 8 0 8 , 0 x B E E F 0 9 9 0 , 0 x1 # l o a d p a g e f a u l t w h e n A = 0
# test 1 2 . 3 . 1 . 3 . 7 D i r t y f l a g = = 0
.4byte 0 x4 6 5 8 , 0 x B E E F 0 A A 0 , 0 x0 # s t o r e p a g e f a u l t w h e n D = 0
.4byte 0 x4 A A 0 , 0 x B E E F 0 B B 0 , 0 x1 # r e a d s u c c e s s w h e n D = 0
# terminate t e s t s
.4byte 0 x0 , 0 x0 , 0 x3 # b r i n g s u s b a c k i n t o m a c h i n e m o d e w i t h a f i n a l e c a l l , w r i t i n g 0x9 t o t h e o u t p u t .