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>
This commit is contained in:
Zhimin Gu
2018-09-21 14:28:22 +08:00
committed by Rafael J. Wysocki
parent 32aa276437
commit 6bae499a0a
3 changed files with 11 additions and 2 deletions

View File

@@ -39,6 +39,13 @@ ENTRY(restore_image)
movl restore_cr3, %ebp
movl mmu_cr4_features, %ecx
/* jump to relocated restore code */
movl relocated_restore_code, %eax
jmpl *%eax
/* code below has been relocated to a safe page */
ENTRY(core_restore_code)
movl temp_pgt, %eax
movl %eax, %cr3