Rev 422 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
422 | giacomo | 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 | extern void save_processor_state(void); |
||
40 | extern void restore_processor_state(void); |
||
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 |