2005-04-16 15:20:36 -07:00
.text
# include < l i n u x / l i n k a g e . h >
# include < a s m / s e g m e n t . h >
2007-05-02 19:27:07 +02:00
# include < a s m / p g t a b l e . h >
2005-04-16 15:20:36 -07:00
# include < a s m / p a g e . h >
# include < a s m / m s r . h >
2007-10-23 22:37:24 +02:00
# include < a s m / a s m - o f f s e t s . h >
2005-04-16 15:20:36 -07:00
# Copyright 2 0 0 3 P a v e l M a c h e k < p a v e l @suse.cz>, distribute under GPLv2
.code64
/ *
2008-04-10 23:28:10 +02:00
* Hooray, w e a r e i n L o n g 6 4 - b i t m o d e ( b u t s t i l l r u n n i n g i n l o w m e m o r y )
2005-04-16 15:20:36 -07:00
* /
2008-04-10 23:28:10 +02:00
ENTRY( w a k e u p _ l o n g 6 4 )
wakeup_long64 :
movq s a v e d _ m a g i c , % r a x
movq $ 0 x12 3 4 5 6 7 8 9 a b c d e f0 , % r d x
cmpq % r d x , % r a x
jne b o g u s _ 6 4 _ m a g i c
2007-05-02 19:27:07 +02:00
2005-04-16 15:20:36 -07:00
movw $ _ _ K E R N E L _ D S , % a x
movw % a x , % s s
movw % a x , % d s
movw % a x , % e s
movw % a x , % f s
movw % a x , % g s
2007-05-02 19:27:07 +02:00
movq s a v e d _ r s p , % r s p
2005-04-16 15:20:36 -07:00
2007-05-02 19:27:07 +02:00
movq s a v e d _ r b x , % r b x
movq s a v e d _ r d i , % r d i
movq s a v e d _ r s i , % r s i
movq s a v e d _ r b p , % r b p
2005-04-16 15:20:36 -07:00
2007-05-02 19:27:07 +02:00
movq s a v e d _ r i p , % r a x
2005-04-16 15:20:36 -07:00
jmp * % r a x
2007-05-02 19:27:07 +02:00
bogus_64_magic :
2008-04-10 23:28:10 +02:00
jmp b o g u s _ 6 4 _ m a g i c
2005-04-16 15:20:36 -07:00
.align 2
.p2align 4 , , 1 5
.globl do_suspend_lowlevel
.type do_ s u s p e n d _ l o w l e v e l ,@function
do_suspend_lowlevel :
.LFB5 :
subq $ 8 , % r s p
xorl % e a x , % e a x
call s a v e _ p r o c e s s o r _ s t a t e
2007-10-23 22:37:24 +02:00
movq $ s a v e d _ c o n t e x t , % r a x
2008-01-30 13:30:56 +01:00
movq % r s p , p t _ r e g s _ s p ( % r a x )
movq % r b p , p t _ r e g s _ b p ( % r a x )
movq % r s i , p t _ r e g s _ s i ( % r a x )
movq % r d i , p t _ r e g s _ d i ( % r a x )
movq % r b x , p t _ r e g s _ b x ( % r a x )
movq % r c x , p t _ r e g s _ c x ( % r a x )
movq % r d x , p t _ r e g s _ d x ( % r a x )
2007-10-23 22:37:24 +02:00
movq % r8 , p t _ r e g s _ r8 ( % r a x )
movq % r9 , p t _ r e g s _ r9 ( % r a x )
movq % r10 , p t _ r e g s _ r10 ( % r a x )
movq % r11 , p t _ r e g s _ r11 ( % r a x )
movq % r12 , p t _ r e g s _ r12 ( % r a x )
movq % r13 , p t _ r e g s _ r13 ( % r a x )
movq % r14 , p t _ r e g s _ r14 ( % r a x )
movq % r15 , p t _ r e g s _ r15 ( % r a x )
pushfq
2008-01-30 13:30:56 +01:00
popq p t _ r e g s _ f l a g s ( % r a x )
2005-04-16 15:20:36 -07:00
2007-05-02 19:27:07 +02:00
movq $ . L 9 7 , s a v e d _ r i p ( % r i p )
2005-04-16 15:20:36 -07:00
2007-10-23 22:37:24 +02:00
movq % r s p , s a v e d _ r s p
movq % r b p , s a v e d _ r b p
movq % r b x , s a v e d _ r b x
movq % r d i , s a v e d _ r d i
movq % r s i , s a v e d _ r s i
2005-04-16 15:20:36 -07:00
addq $ 8 , % r s p
movl $ 3 , % e d i
xorl % e a x , % e a x
jmp a c p i _ e n t e r _ s l e e p _ s t a t e
.L97 :
.p2align 4 , , 7
.L99 :
.align 4
movl $ 2 4 , % e a x
2007-10-23 22:37:24 +02:00
movw % a x , % d s
/* We don't restore %rax, it must be 0 anyway */
movq $ s a v e d _ c o n t e x t , % r a x
movq s a v e d _ c o n t e x t _ c r4 ( % r a x ) , % r b x
movq % r b x , % c r4
movq s a v e d _ c o n t e x t _ c r3 ( % r a x ) , % r b x
movq % r b x , % c r3
movq s a v e d _ c o n t e x t _ c r2 ( % r a x ) , % r b x
movq % r b x , % c r2
movq s a v e d _ c o n t e x t _ c r0 ( % r a x ) , % r b x
movq % r b x , % c r0
2008-01-30 13:30:56 +01:00
pushq p t _ r e g s _ f l a g s ( % r a x )
2007-10-23 22:37:24 +02:00
popfq
2008-01-30 13:30:56 +01:00
movq p t _ r e g s _ s p ( % r a x ) , % r s p
movq p t _ r e g s _ b p ( % r a x ) , % r b p
movq p t _ r e g s _ s i ( % r a x ) , % r s i
movq p t _ r e g s _ d i ( % r a x ) , % r d i
movq p t _ r e g s _ b x ( % r a x ) , % r b x
movq p t _ r e g s _ c x ( % r a x ) , % r c x
movq p t _ r e g s _ d x ( % r a x ) , % r d x
2007-10-23 22:37:24 +02:00
movq p t _ r e g s _ r8 ( % r a x ) , % r8
movq p t _ r e g s _ r9 ( % r a x ) , % r9
movq p t _ r e g s _ r10 ( % r a x ) , % r10
movq p t _ r e g s _ r11 ( % r a x ) , % r11
movq p t _ r e g s _ r12 ( % r a x ) , % r12
movq p t _ r e g s _ r13 ( % r a x ) , % r13
movq p t _ r e g s _ r14 ( % r a x ) , % r14
movq p t _ r e g s _ r15 ( % r a x ) , % r15
2005-04-16 15:20:36 -07:00
xorl % e a x , % e a x
addq $ 8 , % r s p
jmp r e s t o r e _ p r o c e s s o r _ s t a t e
.LFE5 :
.Lfe5 :
2008-04-10 23:28:10 +02:00
.size do_ s u s p e n d _ l o w l e v e l , . L f e 5 - d o _ s u s p e n d _ l o w l e v e l
2005-04-16 15:20:36 -07:00
.data
ALIGN
2007-05-02 19:27:07 +02:00
ENTRY( s a v e d _ r b p ) . q u a d 0
ENTRY( s a v e d _ r s i ) . q u a d 0
ENTRY( s a v e d _ r d i ) . q u a d 0
ENTRY( s a v e d _ r b x ) . q u a d 0
2005-04-16 15:20:36 -07:00
2007-05-02 19:27:07 +02:00
ENTRY( s a v e d _ r i p ) . q u a d 0
ENTRY( s a v e d _ r s p ) . q u a d 0
2005-04-16 15:20:36 -07:00
ENTRY( s a v e d _ m a g i c ) . q u a d 0