Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 | |
Rafael J. Wysocki | 2d4a34c | 2006-12-06 20:34:29 -0800 | [diff] [blame] | 9 | static inline int arch_prepare_suspend(void) { return 0; } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 10 | |
| 11 | /* image of the saved processor state */ |
| 12 | struct saved_context { |
Joe Perches | cf030eb | 2008-03-23 01:03:35 -0700 | [diff] [blame] | 13 | u16 es, fs, gs, ss; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 14 | unsigned long cr0, cr2, cr3, cr4; |
Glauber de Oliveira Costa | 6b68f01 | 2008-01-30 13:31:12 +0100 | [diff] [blame] | 15 | struct desc_ptr gdt; |
| 16 | struct desc_ptr idt; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17 | u16 ldt; |
| 18 | u16 tss; |
| 19 | unsigned long tr; |
| 20 | unsigned long safety; |
| 21 | unsigned long return_address; |
| 22 | } __attribute__((packed)); |
| 23 | |
Len Brown | e8b2fd0 | 2007-07-24 22:26:33 -0400 | [diff] [blame] | 24 | #ifdef CONFIG_ACPI |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 25 | extern unsigned long saved_eip; |
| 26 | extern unsigned long saved_esp; |
| 27 | extern unsigned long saved_ebp; |
| 28 | extern unsigned long saved_ebx; |
| 29 | extern unsigned long saved_esi; |
| 30 | extern unsigned long saved_edi; |
| 31 | |
| 32 | static inline void acpi_save_register_state(unsigned long return_point) |
| 33 | { |
| 34 | saved_eip = return_point; |
Joe Perches | cf030eb | 2008-03-23 01:03:35 -0700 | [diff] [blame] | 35 | asm volatile("movl %%esp,%0" : "=m" (saved_esp)); |
| 36 | asm volatile("movl %%ebp,%0" : "=m" (saved_ebp)); |
| 37 | asm volatile("movl %%ebx,%0" : "=m" (saved_ebx)); |
| 38 | asm volatile("movl %%edi,%0" : "=m" (saved_edi)); |
| 39 | asm volatile("movl %%esi,%0" : "=m" (saved_esi)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 40 | } |
| 41 | |
| 42 | #define acpi_restore_register_state() do {} while (0) |
| 43 | |
| 44 | /* routines for saving/restoring kernel state */ |
| 45 | extern int acpi_save_state_mem(void); |
| 46 | #endif |