blob: 30361526d568db1f2d19ba1ba8decf9e7e843837 [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 */
6#include <asm/desc.h>
7#include <asm/i387.h>
8
9static inline int
10arch_prepare_suspend(void)
11{
12 /* If you want to make non-PSE machine work, turn off paging
13 in swsusp_arch_suspend. swsusp_pg_dir should have identity mapping, so
14 it could work... */
15 if (!cpu_has_pse) {
16 printk(KERN_ERR "PSE is required for swsusp.\n");
17 return -EPERM;
18 }
19 return 0;
20}
21
22/* image of the saved processor state */
23struct saved_context {
24 u16 es, fs, gs, ss;
25 unsigned long cr0, cr2, cr3, cr4;
Rusty Russelld3561b72006-12-07 02:14:07 +010026 struct Xgt_desc_struct gdt;
27 struct Xgt_desc_struct idt;
Linus Torvalds1da177e2005-04-16 15:20:36 -070028 u16 ldt;
29 u16 tss;
30 unsigned long tr;
31 unsigned long safety;
32 unsigned long return_address;
33} __attribute__((packed));
34
Linus Torvalds1da177e2005-04-16 15:20:36 -070035#ifdef CONFIG_ACPI_SLEEP
36extern unsigned long saved_eip;
37extern unsigned long saved_esp;
38extern unsigned long saved_ebp;
39extern unsigned long saved_ebx;
40extern unsigned long saved_esi;
41extern unsigned long saved_edi;
42
43static inline void acpi_save_register_state(unsigned long return_point)
44{
45 saved_eip = return_point;
46 asm volatile ("movl %%esp,%0" : "=m" (saved_esp));
47 asm volatile ("movl %%ebp,%0" : "=m" (saved_ebp));
48 asm volatile ("movl %%ebx,%0" : "=m" (saved_ebx));
49 asm volatile ("movl %%edi,%0" : "=m" (saved_edi));
50 asm volatile ("movl %%esi,%0" : "=m" (saved_esi));
51}
52
53#define acpi_restore_register_state() do {} while (0)
54
55/* routines for saving/restoring kernel state */
56extern int acpi_save_state_mem(void);
57#endif