2 * Copyright 2001-2003 Pavel Machek <pavel@suse.cz>
4 * Copyright 2001 Patrick Mochel <mochel@osdl.org>
6 #ifndef _ASM_X86_SUSPEND_64_H
7 #define _ASM_X86_SUSPEND_64_H
10 #include <asm/fpu/api.h>
13 * Image of the saved processor state, used by the low level ACPI suspend to
14 * RAM code and by the low level hibernation code.
16 * If you modify it, check how it is used in arch/x86/kernel/acpi/wakeup_64.S
17 * and make sure that __save/__restore_processor_state(), defined in
18 * arch/x86/power/cpu.c, still work as required.
20 * Because the structure is packed, make sure to avoid unaligned members. For
21 * optimisation purposes but also because tools like kmemleak only search for
22 * pointers that are aligned.
24 struct saved_context {
28 * User CS and SS are saved in current_pt_regs(). The rest of the
29 * segment selectors need to be saved and restored here.
34 * Usermode FSBASE and GSBASE may not match the fs and gs selectors,
35 * so we save them separately. We save the kernelmode GSBASE to
36 * restore percpu access after resume.
38 unsigned long kernelmode_gs_base, usermode_gs_base, fs_base;
40 unsigned long cr0, cr2, cr3, cr4, cr8;
42 struct saved_msrs saved_msrs;
44 u16 gdt_pad; /* Unused */
45 struct desc_ptr gdt_desc;
52 unsigned long return_address;
53 bool misc_enable_saved;
54 } __attribute__((packed));
56 #define loaddebug(thread,register) \
57 set_debugreg((thread)->debugreg##register, register)
59 /* routines for saving/restoring kernel state */
60 extern char core_restore_code[];
61 extern char restore_registers[];
63 #endif /* _ASM_X86_SUSPEND_64_H */