aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/x86/kernel/suspend_64.c20
-rw-r--r--include/asm-x86/suspend_64.h9
2 files changed, 28 insertions, 1 deletions
diff --git a/arch/x86/kernel/suspend_64.c b/arch/x86/kernel/suspend_64.c
index 2e5efaaf8800..569f1b540e36 100644
--- a/arch/x86/kernel/suspend_64.c
+++ b/arch/x86/kernel/suspend_64.c
@@ -19,6 +19,21 @@ extern const void __nosave_begin, __nosave_end;
19 19
20struct saved_context saved_context; 20struct saved_context saved_context;
21 21
22/**
23 * __save_processor_state - save CPU registers before creating a
24 * hibernation image and before restoring the memory state from it
25 * @ctxt - structure to store the registers contents in
26 *
27 * NOTE: If there is a CPU register the modification of which by the
28 * boot kernel (ie. the kernel used for loading the hibernation image)
29 * might affect the operations of the restored target kernel (ie. the one
30 * saved in the hibernation image), then its contents must be saved by this
31 * function. In other words, if kernel A is hibernated and different
32 * kernel B is used for loading the hibernation image into memory, the
33 * kernel A's __save_processor_state() function must save all registers
34 * needed by kernel A, so that it can operate correctly after the resume
35 * regardless of what kernel B does in the meantime.
36 */
22void __save_processor_state(struct saved_context *ctxt) 37void __save_processor_state(struct saved_context *ctxt)
23{ 38{
24 kernel_fpu_begin(); 39 kernel_fpu_begin();
@@ -69,6 +84,11 @@ static void do_fpu_end(void)
69 kernel_fpu_end(); 84 kernel_fpu_end();
70} 85}
71 86
87/**
88 * __restore_processor_state - restore the contents of CPU registers saved
89 * by __save_processor_state()
90 * @ctxt - structure to load the registers contents from
91 */
72void __restore_processor_state(struct saved_context *ctxt) 92void __restore_processor_state(struct saved_context *ctxt)
73{ 93{
74 /* 94 /*
diff --git a/include/asm-x86/suspend_64.h b/include/asm-x86/suspend_64.h
index c505a76bcf6e..4404668f9aa4 100644
--- a/include/asm-x86/suspend_64.h
+++ b/include/asm-x86/suspend_64.h
@@ -15,7 +15,14 @@ arch_prepare_suspend(void)
15 return 0; 15 return 0;
16} 16}
17 17
18/* Image of the saved processor state. If you touch this, fix acpi/wakeup.S. */ 18/*
19 * Image of the saved processor state, used by the low level ACPI suspend to
20 * RAM code and by the low level hibernation code.
21 *
22 * If you modify it, fix arch/x86/kernel/acpi/wakeup_64.S and make sure that
23 * __save/__restore_processor_state(), defined in arch/x86/kernel/suspend_64.c,
24 * still work as required.
25 */
19struct saved_context { 26struct saved_context {
20 struct pt_regs regs; 27 struct pt_regs regs;
21 u16 ds, es, fs, gs, ss; 28 u16 ds, es, fs, gs, ss;