blob: 8675c6782a7da2754a4b391bab931b920db9a009 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * Copyright 2001-2002 Pavel Machek <pavel@suse.cz>
3 * Based on code
4 * Copyright 2001 Patrick Mochel <mochel@osdl.org>
5 */
Vegard Nossum0db125c2008-06-10 23:45:45 +02006#ifndef __ASM_X86_32_SUSPEND_H
7#define __ASM_X86_32_SUSPEND_H
8
Linus Torvalds1da177e2005-04-16 15:20:36 -07009#include <asm/desc.h>
10#include <asm/i387.h>
11
Rafael J. Wysocki2d4a34c2006-12-06 20:34:29 -080012static inline int arch_prepare_suspend(void) { return 0; }
Linus Torvalds1da177e2005-04-16 15:20:36 -070013
14/* image of the saved processor state */
15struct saved_context {
Joe Perchescf030eb2008-03-23 01:03:35 -070016 u16 es, fs, gs, ss;
Linus Torvalds1da177e2005-04-16 15:20:36 -070017 unsigned long cr0, cr2, cr3, cr4;
Glauber de Oliveira Costa6b68f012008-01-30 13:31:12 +010018 struct desc_ptr gdt;
19 struct desc_ptr idt;
Linus Torvalds1da177e2005-04-16 15:20:36 -070020 u16 ldt;
21 u16 tss;
22 unsigned long tr;
23 unsigned long safety;
24 unsigned long return_address;
25} __attribute__((packed));
26
Len Browne8b2fd02007-07-24 22:26:33 -040027#ifdef CONFIG_ACPI
Linus Torvalds1da177e2005-04-16 15:20:36 -070028extern unsigned long saved_eip;
29extern unsigned long saved_esp;
30extern unsigned long saved_ebp;
31extern unsigned long saved_ebx;
32extern unsigned long saved_esi;
33extern unsigned long saved_edi;
34
35static inline void acpi_save_register_state(unsigned long return_point)
36{
37 saved_eip = return_point;
Joe Perchescf030eb2008-03-23 01:03:35 -070038 asm volatile("movl %%esp,%0" : "=m" (saved_esp));
39 asm volatile("movl %%ebp,%0" : "=m" (saved_ebp));
40 asm volatile("movl %%ebx,%0" : "=m" (saved_ebx));
41 asm volatile("movl %%edi,%0" : "=m" (saved_edi));
42 asm volatile("movl %%esi,%0" : "=m" (saved_esi));
Linus Torvalds1da177e2005-04-16 15:20:36 -070043}
44
45#define acpi_restore_register_state() do {} while (0)
46
47/* routines for saving/restoring kernel state */
48extern int acpi_save_state_mem(void);
49#endif
Vegard Nossum0db125c2008-06-10 23:45:45 +020050
51#endif /* __ASM_X86_32_SUSPEND_H */