VServer 1.9.2 (patch-2.6.8.1-vs1.9.2.diff)
[linux-2.6.git] / include / asm-i386 / suspend.h
1 /*
2  * Copyright 2001-2002 Pavel Machek <pavel@suse.cz>
3  * Based on code
4  * Copyright 2001 Patrick Mochel <mochel@osdl.org>
5  */
6 #include <asm/desc.h>
7 #include <asm/i387.h>
8
9 static inline int
10 arch_prepare_suspend(void)
11 {
12         if (!cpu_has_pse)
13                 return -EPERM;
14         return 0;
15 }
16
17 /* image of the saved processor state */
18 struct saved_context {
19         u16 es, fs, gs, ss;
20         unsigned long cr0, cr2, cr3, cr4;
21         u16 gdt_pad;
22         u16 gdt_limit;
23         unsigned long gdt_base;
24         u16 idt_pad;
25         u16 idt_limit;
26         unsigned long idt_base;
27         u16 ldt;
28         u16 tss;
29         unsigned long tr;
30         unsigned long safety;
31         unsigned long return_address;
32 } __attribute__((packed));
33
34 #define loaddebug(thread,register) \
35                __asm__("movl %0,%%db" #register  \
36                        : /* no output */ \
37                        :"r" ((thread)->debugreg[register]))
38
39 #ifdef CONFIG_ACPI_SLEEP
40 extern unsigned long saved_eip;
41 extern unsigned long saved_esp;
42 extern unsigned long saved_ebp;
43 extern unsigned long saved_ebx;
44 extern unsigned long saved_esi;
45 extern unsigned long saved_edi;
46
47 static inline void acpi_save_register_state(unsigned long return_point)
48 {
49         saved_eip = return_point;
50         asm volatile ("movl %%esp,%0" : "=m" (saved_esp));
51         asm volatile ("movl %%ebp,%0" : "=m" (saved_ebp));
52         asm volatile ("movl %%ebx,%0" : "=m" (saved_ebx));
53         asm volatile ("movl %%edi,%0" : "=m" (saved_edi));
54         asm volatile ("movl %%esi,%0" : "=m" (saved_esi));
55 }
56
57 #define acpi_restore_register_state()  do {} while (0)
58
59 /* routines for saving/restoring kernel state */
60 extern int acpi_save_state_mem(void);
61 extern int acpi_save_state_disk(void);
62 #endif