8AB8=3  3 2 . 7 .   5@52>4  ?@>F5AA>@0  2  6 4 - @07@O4=K9  @568<
 
 
 
 / / $ F r e e B S D :   / r e p o m a n / r / n c v s / s r c / s y s / b o o t / i 3 8 6 / l i b i 3 8 6 / a m d 6 4 _ t r a m p . S , v   1 . 4   2 0 0 4 / 0 5 / 1 4   
 
 	 	 
 
 / * 	 	 
 
   *   Q u i c k   a n d   d i r t y   t r a m p o l i n e   t o   g e t   i n t o   6 4   b i t   ( l o n g )   m o d e   a n d   r u n n i n g 
 
   *   w i t h   p a g i n g   e n a b l e d   s o   t h a t   w e   e n t e r   t h e   k e r n e l   a t   i t s   l i n k e d   a d d r e s s . 
 
   *   ( KAB@K9,   =>  =5  A>2A5<  :>@@5:B=K9  ?5@5E>4  2  6 4 - @07@O4=K9  ( 4;8==K9)   @568<
 
   *   A  0:B82878@>20==>9  ?>4:0G:>9,   ?>72>;ONI89  2>9B8  2  O4@>  ?>  53>  A2O70==><C  04@5AC. 
 
   * / 	 	 
 
 # d e f i n e 	 M S R _ E F E R 	 0 x c 0 0 0 0 0 8 0 
 
 # d e f i n e 	 E F E R _ L M E 	 0 x 0 0 0 0 0 1 0 0 
 
 # d e f i n e 	 C R 4 _ P A E 	 0 x 0 0 0 0 0 0 2 0 
 
 # d e f i n e 	 C R 4 _ P S E 	 0 x 0 0 0 0 0 0 1 0 
 
 # d e f i n e 	 C R 0 _ P G 	 0 x 8 0 0 0 0 0 0 0 
 
 	 	 
 
 / *   G R R R .   D e a l   w i t h   B T X   t h a t   l i n k s   u s   f o r   a   n o n - z e r o   l o c a t i o n   * / 	 
 
 / *   ( 8<55<  45;>  A  8=AB@C:F859  B T X ,   AAK;0NI59AO  =0  =5=C;52>9  04@5A) 
 
 # d e f i n e 	 V P B A S E 	 0 x a 0 0 0 
 
 # d e f i n e 	 V T O P ( x ) 	 ( ( x )   +   V P B A S E ) 
 
 	 	 
 
 	 . d a t a 	 
 
 	 	 
 
 	 . p 2 a l i g n   1 2 , 0 x 4 0 	 
 
 	 	 
 
 	 . g l o b l 	 P T 4 
 
 P T 4 : 	 	 
 
 	 . s p a c e 	 0 x 1 0 0 0 
 
 	 . g l o b l 	 P T 3 
 
 P T 3 : 	 	 
 
 	 . s p a c e 	 0 x 1 0 0 0 
 
 	 . g l o b l 	 P T 2 
 
 P T 2 : 	 	 
 
 	 . s p a c e 	 0 x 1 0 0 0 
 
 	 	 
 
 g d t d e s c : 	 	 
 
 	 . w o r d 	 g d t e n d   -   g d t 
 
 	 . l o n g 	 V T O P ( g d t ) 
 
 	 . l o n g 	 0 
 
 	 	 
 
 g d t : 	 	 
 
 	 . l o n g 	 0 
 
 	 . l o n g 	 0 
 
 	 . l o n g 	 0 x 0 0 0 0 0 0 0 0 
 
 	 . l o n g 	 0 x 0 0 2 0 9 8 0 0 
 
 	 . l o n g 	 0 x 0 0 0 0 0 0 0 0 
 
 	 . l o n g 	 0 x 0 0 0 0 8 0 0 0 
 
 g d t e n d : 	 	 
 
 	 	 
 
 	 . t e x t 	 
 
 	 . c o d e 3 2 	 
 
 	 	 
 
 	 . g l o b l 	 a m d 6 4 _ t r a m p 
 
 a m d 6 4 _ t r a m p : 	 	 
 
 	 / *   B e   s u r e   t h a t   i n t e r r u p t s   a r e   d i s a b l e d   * / 	 
 
 	 / *   ( #156405<AO,   GB>  ?@5@K20=8O  1;>:8@>20=K)   * / 	 
 
 	 c l i 	 
 
 	 	 
 
 	 / *   T u r n   o n   E F E R . L M E   * / 
 
 	 / *   ( :;NG05<  E F E R . L M E )   * / 
 
 	 m o v l 	 $ M S R _ E F E R ,   % e c x 
 
 	 r d m s r 	 
 
 	 o r l 	 $ E F E R _ L M E ,   % e a x 
 
 	 w r m s r 	 
 
 	 	 
 
 	 / *   T u r n   o n   P A E   * / 
 
 	 / *   :B82878@C5<  @0AH8@5=85  D878G5A:8E  04@5A>2  ( P h y s i c a l   A d d r e s s   
 
 	 *   E x t e n s i o n ,   P A E )   * / 
 
 	 m o v l 	 % c r 4 ,   % e a x 
 
 	 o r l 	 $ ( C R 4 _ P A E   |   C R 4 _ P S E ) ,   % e a x 
 
 	 m o v l 	 % e a x ,   % c r 4 
 
 	 	 
 
 	 / *   S e t   % c r 3   f o r   P T 4   * / 	 
 
 	 / *   #AB0=02;8205<  % c r 3   =0  P T 4   * / 	 
 
 	 m o v l 	 $ V T O P ( P T 4 ) ,   % e a x 
 
 	 m o v l 	 % e a x ,   % c r 3 
 
 	 	 
 
 	 / *   T u r n   o n   p a g i n g   ( i m p l i c i t l y   s e t s   E F E R . L M A )   * / 	 
 
 	 / *   :B82878@C5<  ?>4:0G:C  ( =5O2=>  CAB0=02;8205BAO  E F E R . L M A )   * / 	 
 
 	 m o v l 	 % c r 0 ,   % e a x 
 
 	 o r l 	 $ C R 0 _ P G ,   % e a x 
 
 	 m o v l 	 % e a x ,   % c r 0 
 
 	 	 
 
 	 / *   N o w   w e ' r e   i n   c o m p a t a b i l i t y   m o d e .   s e t   % c s   f o r   l o n g   m o d e   * / 	 
 
 	 / *   5@5H;8  2  @568<  A>2<5AB8<>AB8.   #AB0=02;8205<  % c s   =0  4;8==K9  @568<  * / 
 
 	 m o v l 	 $ V T O P ( g d t d e s c ) ,   % e a x 
 
 	 m o v l 	 V T O P ( e n t r y _ h i ) ,   % e s i 
 
 	 m o v l 	 V T O P ( e n t r y _ l o ) ,   % e d i 
 
 	 l g d t 	 ( % e a x ) 
 
 	 l j m p 	 $ 0 x 8 ,   $ V T O P ( l o n g m o d e ) 
 
 	 	 
 
 	 . c o d e 6 4 	 
 
 l o n g m o d e : 	 	 
 
 	 / *   W e ' r e   s t i l l   r u n n i n g   V = P ,   j u m p   t o   e n t r y   p o i n t   * / 	 
 
 	 / *   A5  5I5  8A?>;=O5<  V = P ,   ?5@5E>4  :  B>G:5  2E>40  * / 	 
 
 	 m o v l 	 % e s i ,   % e a x 
 
 	 s a l q 	 $ 3 2 ,   % r a x 
 
 	 o r q 	 % r d i ,   % r a x 
 
 	 p u s h q 	 % r a x 
 
 	 r e t 	 
 
 