do_suspend_lowlevel() behaves as a function call, even when the trampoline
jumps back into the middle of it. Discuss this property, while renaming the
far-too-generic __ret_point to s3_resume.
Optimise the calling logic for acpi_enter_sleep_state(). $3 doesn't require a
64bit write, and the function isn't variadic so doesn't need to specify zero
FPU registers in use.
In the case of an acpi_enter_sleep_state() error, we didn't actually lose
state so don't need to restore it. Jump straight to the end.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
call save_rest_processor_state
- mov $3, %rdi
- xor %eax, %eax
-
/* enter sleep state physically */
+ mov $3, %edi
call acpi_enter_sleep_state
- jmp __ret_point
-
-ENTRY(__ret_point)
+ /* It seems we didn't suspend. Get out of here. */
+ jmp .Lsuspend_err
+
+ /*
+ * do_suspend_lowlevel() is arranged to behave as a regular function
+ * call, even if hardware actually goes to sleep in the middle.
+ *
+ * The trampoline re-intercepts here. State is:
+ * - 64bit mode
+ *
+ * Everything else, including the stack, needs restoring.
+ */
+ENTRY(s3_resume)
lgdt boot_gdtr(%rip)
/* mmu_cr4_features contains latest cr4 setting */
LOAD_GREG(13)
LOAD_GREG(14)
LOAD_GREG(15)
- ret
+.Lsuspend_err:
+ ret
.data
.align 16
.code64
wakeup_64:
/* Jump to high mappings and the higher-level wakeup code. */
- movabs $__ret_point, %rbx
+ movabs $s3_resume, %rbx
jmp *%rbx
bogus_saved_magic: