vserver 1.9.5.x5
[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 you want to make non-PSE machine work, turn off paging
13            in do_magic. swsusp_pg_dir should have identity mapping, so
14            it could work...  */
15         if (!cpu_has_pse)
16                 return -EPERM;
17         return 0;
18 }
19
20 /* image of the saved processor state */
21 struct saved_context {
22         u16 es, fs, gs, ss;
23         unsigned long cr0, cr2, cr3, cr4;
24         u16 gdt_pad;
25         u16 gdt_limit;
26         unsigned long gdt_base;
27         u16 idt_pad;
28         u16 idt_limit;
29         unsigned long idt_base;
30         u16 ldt;
31         u16 tss;
32         unsigned long tr;
33         unsigned long safety;
34         unsigned long return_address;
35 } __attribute__((packed));
36
37 #define loaddebug(thread,register) \
38                __asm__("movl %0,%%db" #register  \
39                        : /* no output */ \
40                        :"r" ((thread)->debugreg[register]))
41
42 #ifdef CONFIG_ACPI_SLEEP
43 extern unsigned long saved_eip;
44 extern unsigned long saved_esp;
45 extern unsigned long saved_ebp;
46 extern unsigned long saved_ebx;
47 extern unsigned long saved_esi;
48 extern unsigned long saved_edi;
49
50 static inline void acpi_save_register_state(unsigned long return_point)
51 {
52         saved_eip = return_point;
53         asm volatile ("movl %%esp,%0" : "=m" (saved_esp));
54         asm volatile ("movl %%ebp,%0" : "=m" (saved_ebp));
55         asm volatile ("movl %%ebx,%0" : "=m" (saved_ebx));
56         asm volatile ("movl %%edi,%0" : "=m" (saved_edi));
57         asm volatile ("movl %%esi,%0" : "=m" (saved_esi));
58 }
59
60 #define acpi_restore_register_state()  do {} while (0)
61
62 /* routines for saving/restoring kernel state */
63 extern int acpi_save_state_mem(void);
64 extern int acpi_save_state_disk(void);
65 #endif