d15967b07cefbcdb1fdaa76f19745dcce1bacdfb
[linux-flexiantxendom0-3.2.10.git] / arch / i386 / kernel / suspend_asm.S
1 .text
2
3 /* Originally gcc generated, modified by hand */
4
5 #include <linux/linkage.h>
6 #include <asm/segment.h>
7 #include <asm/page.h>
8
9         .data
10         .align  4
11         .globl  saved_context_eax, saved_context_ebx
12         .globl  saved_context_ecx, saved_context_edx
13         .globl  saved_context_esp, saved_context_ebp
14         .globl  saved_context_esi, saved_context_edi
15         .globl  saved_context_eflags
16 saved_context_eax:
17         .long   0
18 saved_context_ebx:
19         .long   0
20 saved_context_ecx:
21         .long   0
22 saved_context_edx:
23         .long   0
24 saved_context_esp:
25         .long   0
26 saved_context_ebp:
27         .long   0
28 saved_context_esi:
29         .long   0
30 saved_context_edi:
31         .long   0
32 saved_context_eflags:
33         .long   0
34
35         .text
36
37 ENTRY(do_magic)
38         pushl %ebx
39         cmpl $0,8(%esp)
40         jne .L1450
41         call do_magic_suspend_1
42         call save_processor_state
43
44         movl %esp, saved_context_esp
45         movl %eax, saved_context_eax
46         movl %ebx, saved_context_ebx
47         movl %ecx, saved_context_ecx
48         movl %edx, saved_context_edx
49         movl %ebp, saved_context_ebp
50         movl %esi, saved_context_esi
51         movl %edi, saved_context_edi
52         pushfl ; popl saved_context_eflags
53
54         call do_magic_suspend_2
55         jmp .L1449
56         .p2align 4,,7
57 .L1450:
58         movl $swapper_pg_dir-__PAGE_OFFSET,%ecx
59         movl %ecx,%cr3
60
61         call do_magic_resume_1
62         movl $0,loop
63         cmpl $0,nr_copy_pages
64         je .L1453
65         .p2align 4,,7
66 .L1455:
67         movl $0,loop2
68         .p2align 4,,7
69 .L1459:
70         movl pagedir_nosave,%ecx
71         movl loop,%eax
72         movl loop2,%edx
73         sall $4,%eax
74         movl 4(%ecx,%eax),%ebx
75         movl (%ecx,%eax),%eax
76         movb (%edx,%eax),%al
77         movb %al,(%edx,%ebx)
78         movl %cr3, %eax;              
79         movl %eax, %cr3;  # flush TLB 
80
81         movl loop2,%eax
82         leal 1(%eax),%edx
83         movl %edx,loop2
84         movl %edx,%eax
85         cmpl $4095,%eax
86         jbe .L1459
87         movl loop,%eax
88         leal 1(%eax),%edx
89         movl %edx,loop
90         movl %edx,%eax
91         cmpl nr_copy_pages,%eax
92         jb .L1455
93         .p2align 4,,7
94 .L1453:
95         movl $__USER_DS,%eax
96
97         movw %ax, %ds
98         movw %ax, %es
99         movl saved_context_esp, %esp
100         movl saved_context_ebp, %ebp
101         movl saved_context_eax, %eax
102         movl saved_context_ebx, %ebx
103         movl saved_context_ecx, %ecx
104         movl saved_context_edx, %edx
105         movl saved_context_esi, %esi
106         movl saved_context_edi, %edi
107         call restore_processor_state
108         pushl saved_context_eflags ; popfl
109         call do_magic_resume_2
110 .L1449:
111         popl %ebx
112         ret
113
114        .section .data.nosave
115 loop:
116        .quad 0
117 loop2:
118        .quad 0
119        .previous
120