]> bbs.cooldavid.org Git - net-next-2.6.git/blame - arch/x86/kernel/acpi/wakeup_32.S
Merge branch 'perf-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
[net-next-2.6.git] / arch / x86 / kernel / acpi / wakeup_32.S
CommitLineData
819d6762 1 .section .text..page_aligned
1da177e4
LT
2#include <linux/linkage.h>
3#include <asm/segment.h>
0341c14d 4#include <asm/page_types.h>
1da177e4 5
e44b7b75 6# Copyright 2003, 2008 Pavel Machek <pavel@suse.cz>, distribute under GPLv2
1da177e4 7
1da177e4
LT
8 .code32
9 ALIGN
10
e44b7b75 11ENTRY(wakeup_pmode_return)
1da177e4
LT
12wakeup_pmode_return:
13 movw $__KERNEL_DS, %ax
14 movw %ax, %ss
15 movw %ax, %ds
16 movw %ax, %es
17 movw %ax, %fs
18 movw %ax, %gs
1da177e4
LT
19
20 # reload the gdt, as we need the full 32 bit address
21 lgdt saved_gdt
22 lidt saved_idt
23 lldt saved_ldt
e44b7b75 24 ljmp $(__KERNEL_CS), $1f
1da177e4
LT
251:
26 movl %cr3, %eax
27 movl %eax, %cr3
28 wbinvd
29
30 # and restore the stack ... but you need gdt for this to work
31 movl saved_context_esp, %esp
32
33 movl %cs:saved_magic, %eax
34 cmpl $0x12345678, %eax
35 jne bogus_magic
36
37 # jump to place where we left off
e44b7b75 38 movl saved_eip, %eax
1da177e4
LT
39 jmp *%eax
40
41bogus_magic:
1da177e4
LT
42 jmp bogus_magic
43
44
1da177e4 45
e44b7b75 46save_registers:
1da177e4
LT
47 sgdt saved_gdt
48 sidt saved_idt
49 sldt saved_ldt
50 str saved_tss
51
1da177e4
LT
52 leal 4(%esp), %eax
53 movl %eax, saved_context_esp
e44b7b75
PM
54 movl %ebx, saved_context_ebx
55 movl %ebp, saved_context_ebp
56 movl %esi, saved_context_esi
57 movl %edi, saved_context_edi
58 pushfl
59 popl saved_context_eflags
60
61 movl $ret_point, saved_eip
1da177e4
LT
62 ret
63
64
65restore_registers:
e44b7b75
PM
66 movl saved_context_ebp, %ebp
67 movl saved_context_ebx, %ebx
68 movl saved_context_esi, %esi
69 movl saved_context_edi, %edi
70 pushl saved_context_eflags
71 popfl
72 ret
1da177e4
LT
73
74ENTRY(do_suspend_lowlevel)
75 call save_processor_state
76 call save_registers
77 pushl $3
78 call acpi_enter_sleep_state
79 addl $4, %esp
4e6e6504
WM
80
81# In case of S3 failure, we'll emerge here. Jump
82# to ret_point to recover
83 jmp ret_point
1da177e4
LT
84 .p2align 4,,7
85ret_point:
86 call restore_registers
87 call restore_processor_state
88 ret
89
daacf8bc 90.data
1da177e4 91ALIGN
daacf8bc
SL
92ENTRY(saved_magic) .long 0
93ENTRY(saved_eip) .long 0
94
1da177e4
LT
95# saved registers
96saved_gdt: .long 0,0
97saved_idt: .long 0,0
98saved_ldt: .long 0
99saved_tss: .long 0
100