commented early_printk patch because of rejects.
[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         .text
10
11 ENTRY(do_magic)
12         pushl %ebx
13         cmpl $0,8(%esp)
14         jne .L1450
15         call do_magic_suspend_1
16         call save_processor_state
17
18         movl %esp, saved_context_esp
19         movl %eax, saved_context_eax
20         movl %ebx, saved_context_ebx
21         movl %ecx, saved_context_ecx
22         movl %edx, saved_context_edx
23         movl %ebp, saved_context_ebp
24         movl %esi, saved_context_esi
25         movl %edi, saved_context_edi
26         pushfl ; popl saved_context_eflags
27
28         call do_magic_suspend_2
29         jmp .L1449
30         .p2align 4,,7
31 .L1450:
32         movl $swapper_pg_dir-__PAGE_OFFSET,%ecx
33         movl %ecx,%cr3
34
35         call do_magic_resume_1
36         movl $0,loop
37         cmpl $0,nr_copy_pages
38         je .L1453
39         .p2align 4,,7
40 .L1455:
41         movl $0,loop2
42         .p2align 4,,7
43 .L1459:
44         movl pagedir_nosave,%ecx
45         movl loop,%eax
46         movl loop2,%edx
47         sall $4,%eax
48         movl 4(%ecx,%eax),%ebx
49         movl (%ecx,%eax),%eax
50         movb (%edx,%eax),%al
51         movb %al,(%edx,%ebx)
52         movl %cr3, %eax;              
53         movl %eax, %cr3;  # flush TLB 
54
55         movl loop2,%eax
56         leal 1(%eax),%edx
57         movl %edx,loop2
58         movl %edx,%eax
59         cmpl $4095,%eax
60         jbe .L1459
61         movl loop,%eax
62         leal 1(%eax),%edx
63         movl %edx,loop
64         movl %edx,%eax
65         cmpl nr_copy_pages,%eax
66         jb .L1455
67         .p2align 4,,7
68 .L1453:
69         movl $__USER_DS,%eax
70
71         movw %ax, %ds
72         movw %ax, %es
73         movl saved_context_esp, %esp
74         movl saved_context_ebp, %ebp
75         movl saved_context_eax, %eax
76         movl saved_context_ebx, %ebx
77         movl saved_context_ecx, %ecx
78         movl saved_context_edx, %edx
79         movl saved_context_esi, %esi
80         movl saved_context_edi, %edi
81         call restore_processor_state
82         pushl saved_context_eflags ; popfl
83         call do_magic_resume_2
84 .L1449:
85         popl %ebx
86         ret
87
88        .section .data.nosave
89 loop:
90        .quad 0
91 loop2:
92        .quad 0
93        .previous
94