lua: Fixed some cross-platform issues for PPC (and probably other architectures)
[openwrt.git] / target / linux / olpc / files-2.6.23 / arch / i386 / kernel / olpc-wakeup.S
1 .text
2 #include <linux/linkage.h>
3 #include <asm/segment.h>
4 #include <asm/page.h>
5
6 ALIGN
7 .align 4096
8
9 wakeup_start:
10 # jmp wakeup_start
11
12 cli
13 cld
14
15 # Clear any dangerous flags
16
17 pushl $0
18 popfl
19
20 # Set up %cr3
21 movl $swsusp_pg_dir - __PAGE_OFFSET, %eax
22 movl %eax, %cr3
23
24 movl saved_cr4, %eax
25 movl %eax, %cr4
26
27 movl saved_cr0, %eax
28 movl %eax, %cr0
29
30 jmp 1f
31 1:
32 ljmpl $__KERNEL_CS,$wakeup_return
33
34
35 .org 0x1000
36
37 wakeup_return:
38 movw $__KERNEL_DS, %ax
39 movw %ax, %ss
40 movw %ax, %ds
41 movw %ax, %es
42 movw %ax, %fs
43 movw %ax, %gs
44
45 lgdt saved_gdt
46 lidt saved_idt
47 lldt saved_ldt
48 ljmp $(__KERNEL_CS),$1f
49 1:
50 movl %cr3, %eax
51 movl %eax, %cr3
52 wbinvd
53
54 # Go back to the return point
55 jmp ret_point
56
57 save_registers:
58 sgdt saved_gdt
59 sidt saved_idt
60 sldt saved_ldt
61
62 pushl %edx
63 movl %cr4, %edx
64 movl %edx, saved_cr4
65
66 movl %cr0, %edx
67 movl %edx, saved_cr0
68
69 popl %edx
70
71
72 movl %ebx, saved_context_ebx
73 movl %ebp, saved_context_ebp
74 movl %esi, saved_context_esi
75 movl %edi, saved_context_edi
76
77 pushfl
78 popl saved_context_eflags
79
80 ret
81
82
83 restore_registers:
84 movl saved_context_ebp, %ebp
85 movl saved_context_ebx, %ebx
86 movl saved_context_esi, %esi
87 movl saved_context_edi, %edi
88
89 pushl saved_context_eflags
90 popfl
91
92 ret
93
94
95 ENTRY(do_olpc_suspend_lowlevel)
96 call save_processor_state
97 call save_registers
98
99 # This is the stack context we want to remember
100 movl %esp, saved_context_esp
101
102 pushl $3
103 call olpc_do_sleep
104
105 jmp wakeup_start
106 .p2align 4,,7
107 ret_point:
108 movl saved_context_esp, %esp
109
110 call restore_registers
111 call restore_processor_state
112 ret
113
114 .data
115 ALIGN
116
117 saved_gdt: .long 0,0
118 saved_idt: .long 0,0
119 saved_ldt: .long 0
120 saved_cr4: .long 0
121 saved_cr0: .long 0
122
This page took 0.048377 seconds and 5 git commands to generate.