aboutsummaryrefslogtreecommitdiff
path: root/arch/x86/power/hibernate_32.c
diff options
context:
space:
mode:
authorGravatar Zhimin Gu <kookoo.gu@intel.com> 2018-09-21 14:28:22 +0800
committerGravatar Rafael J. Wysocki <rafael.j.wysocki@intel.com> 2018-10-03 11:56:34 +0200
commit6bae499a0ad437efb67b7c378e6fb4abef1885a1 (patch)
treebf0ee24a15cc82dcabde12b5d9e1a3aba26e3d9c /arch/x86/power/hibernate_32.c
parentx86-32, hibernate: Switch to original page table after resumed (diff)
downloadlinux-6bae499a0ad437efb67b7c378e6fb4abef1885a1.tar.gz
linux-6bae499a0ad437efb67b7c378e6fb4abef1885a1.tar.bz2
linux-6bae499a0ad437efb67b7c378e6fb4abef1885a1.zip
x86-32, hibernate: Switch to relocated restore code during resume on 32bit system
On 64bit system, code should be executed in a safe page during page restoring, as the page where instruction is running during resume might be scribbled and causes issues. Although on 32 bit, we only suspend resuming by same kernel that did the suspend, we'd like to remove that restriction in the future. Porting corresponding code from 64bit system: Allocate a safe page, and copy the restore code to it, then jump to the safe page to run the code. Signed-off-by: Zhimin Gu <kookoo.gu@intel.com> Acked-by: Pavel Machek <pavel@ucw.cz> Signed-off-by: Chen Yu <yu.c.chen@intel.com> Acked-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'arch/x86/power/hibernate_32.c')
-rw-r--r--arch/x86/power/hibernate_32.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/arch/x86/power/hibernate_32.c b/arch/x86/power/hibernate_32.c
index a44bdada4e4e..a9861095fbb8 100644
--- a/arch/x86/power/hibernate_32.c
+++ b/arch/x86/power/hibernate_32.c
@@ -158,6 +158,10 @@ asmlinkage int swsusp_arch_resume(void)
temp_pgt = __pa(resume_pg_dir);
+ error = relocate_restore_code();
+ if (error)
+ return error;
+
/* We have got enough memory and from now on we cannot recover */
restore_image();
return 0;