Merge git://git.kernel.org/pub/scm/linux/kernel/git/steve/gfs2-2.6-nmw
[pandora-kernel.git] / arch / x86 / kernel / acpi / wakeup_64.S
1 .text
2 #include <linux/linkage.h>
3 #include <asm/segment.h>
4 #include <asm/pgtable.h>
5 #include <asm/page.h>
6 #include <asm/msr.h>
7 #include <asm/asm-offsets.h>
8
9 # Copyright 2003 Pavel Machek <pavel@suse.cz>, distribute under GPLv2
10
11 .code64
12         /*
13          * Hooray, we are in Long 64-bit mode (but still running in low memory)
14          */
15 ENTRY(wakeup_long64)
16 wakeup_long64:
17         movq    saved_magic, %rax
18         movq    $0x123456789abcdef0, %rdx
19         cmpq    %rdx, %rax
20         jne     bogus_64_magic
21
22         movw    $__KERNEL_DS, %ax
23         movw    %ax, %ss        
24         movw    %ax, %ds
25         movw    %ax, %es
26         movw    %ax, %fs
27         movw    %ax, %gs
28         movq    saved_rsp, %rsp
29
30         movq    saved_rbx, %rbx
31         movq    saved_rdi, %rdi
32         movq    saved_rsi, %rsi
33         movq    saved_rbp, %rbp
34
35         movq    saved_rip, %rax
36         jmp     *%rax
37
38 bogus_64_magic:
39         jmp     bogus_64_magic
40
41         .align 2
42         .p2align 4,,15
43 .globl do_suspend_lowlevel
44         .type   do_suspend_lowlevel,@function
45 do_suspend_lowlevel:
46 .LFB5:
47         subq    $8, %rsp
48         xorl    %eax, %eax
49         call    save_processor_state
50
51         movq    $saved_context, %rax
52         movq    %rsp, pt_regs_sp(%rax)
53         movq    %rbp, pt_regs_bp(%rax)
54         movq    %rsi, pt_regs_si(%rax)
55         movq    %rdi, pt_regs_di(%rax)
56         movq    %rbx, pt_regs_bx(%rax)
57         movq    %rcx, pt_regs_cx(%rax)
58         movq    %rdx, pt_regs_dx(%rax)
59         movq    %r8, pt_regs_r8(%rax)
60         movq    %r9, pt_regs_r9(%rax)
61         movq    %r10, pt_regs_r10(%rax)
62         movq    %r11, pt_regs_r11(%rax)
63         movq    %r12, pt_regs_r12(%rax)
64         movq    %r13, pt_regs_r13(%rax)
65         movq    %r14, pt_regs_r14(%rax)
66         movq    %r15, pt_regs_r15(%rax)
67         pushfq
68         popq    pt_regs_flags(%rax)
69
70         movq    $.L97, saved_rip(%rip)
71
72         movq    %rsp, saved_rsp
73         movq    %rbp, saved_rbp
74         movq    %rbx, saved_rbx
75         movq    %rdi, saved_rdi
76         movq    %rsi, saved_rsi
77
78         addq    $8, %rsp
79         movl    $3, %edi
80         xorl    %eax, %eax
81         jmp     acpi_enter_sleep_state
82 .L97:
83         .p2align 4,,7
84 .L99:
85         .align 4
86         movl    $24, %eax
87         movw    %ax, %ds
88
89         /* We don't restore %rax, it must be 0 anyway */
90         movq    $saved_context, %rax
91         movq    saved_context_cr4(%rax), %rbx
92         movq    %rbx, %cr4
93         movq    saved_context_cr3(%rax), %rbx
94         movq    %rbx, %cr3
95         movq    saved_context_cr2(%rax), %rbx
96         movq    %rbx, %cr2
97         movq    saved_context_cr0(%rax), %rbx
98         movq    %rbx, %cr0
99         pushq   pt_regs_flags(%rax)
100         popfq
101         movq    pt_regs_sp(%rax), %rsp
102         movq    pt_regs_bp(%rax), %rbp
103         movq    pt_regs_si(%rax), %rsi
104         movq    pt_regs_di(%rax), %rdi
105         movq    pt_regs_bx(%rax), %rbx
106         movq    pt_regs_cx(%rax), %rcx
107         movq    pt_regs_dx(%rax), %rdx
108         movq    pt_regs_r8(%rax), %r8
109         movq    pt_regs_r9(%rax), %r9
110         movq    pt_regs_r10(%rax), %r10
111         movq    pt_regs_r11(%rax), %r11
112         movq    pt_regs_r12(%rax), %r12
113         movq    pt_regs_r13(%rax), %r13
114         movq    pt_regs_r14(%rax), %r14
115         movq    pt_regs_r15(%rax), %r15
116
117         xorl    %eax, %eax
118         addq    $8, %rsp
119         jmp     restore_processor_state
120 .LFE5:
121 .Lfe5:
122         .size   do_suspend_lowlevel, .Lfe5-do_suspend_lowlevel
123         
124 .data
125 ALIGN
126 ENTRY(saved_rbp)        .quad   0
127 ENTRY(saved_rsi)        .quad   0
128 ENTRY(saved_rdi)        .quad   0
129 ENTRY(saved_rbx)        .quad   0
130
131 ENTRY(saved_rip)        .quad   0
132 ENTRY(saved_rsp)        .quad   0
133
134 ENTRY(saved_magic)      .quad   0