x86, suspend: On wakeup always initialize cr4 and EFER

We already have a flag word to indicate the existence of MISC_ENABLES,
so use the same flag word to indicate existence of cr4 and EFER, and
always restore them if they exist.  That way if something passes a
nonzero value when the value *should* be zero, we will still
initialize it.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Cc: Rafael J. Wysocki <rjw@sisk.pl>
Link: http://lkml.kernel.org/r/1348529239-17943-1-git-send-email-hpa@linux.intel.com
This commit is contained in:
H. Peter Anvin
2012-09-26 15:02:34 -07:00
szülő 5a5a51db78
commit 73201dbec6
3 fájl változott, egészen pontosan 31 új sor hozzáadva és 15 régi sor törölve

Fájl megtekintése

@@ -74,9 +74,18 @@ ENTRY(wakeup_start)
lidtl wakeup_idt
/* Clear the EFLAGS */
pushl $0
/* Clear the EFLAGS but remember if we have EFLAGS.ID */
movl $X86_EFLAGS_ID, %ecx
pushl %ecx
popfl
pushfl
popl %edi
pushl $0
popfl
pushfl
popl %edx
xorl %edx, %edi
andl %ecx, %edi /* %edi is zero iff CPUID & %cr4 are missing */
/* Check header signature... */
movl signature, %eax
@@ -93,8 +102,8 @@ ENTRY(wakeup_start)
/* Restore MISC_ENABLE before entering protected mode, in case
BIOS decided to clear XD_DISABLE during S3. */
movl pmode_behavior, %eax
btl $WAKEUP_BEHAVIOR_RESTORE_MISC_ENABLE, %eax
movl pmode_behavior, %edi
btl $WAKEUP_BEHAVIOR_RESTORE_MISC_ENABLE, %edi
jnc 1f
movl pmode_misc_en, %eax
@@ -110,15 +119,15 @@ ENTRY(wakeup_start)
movl pmode_cr3, %eax
movl %eax, %cr3
movl pmode_cr4, %ecx
jecxz 1f
movl %ecx, %cr4
btl $WAKEUP_BEHAVIOR_RESTORE_CR4, %edi
jz 1f
movl pmode_cr4, %eax
movl %eax, %cr4
1:
btl $WAKEUP_BEHAVIOR_RESTORE_EFER, %edi
jz 1f
movl pmode_efer, %eax
movl pmode_efer + 4, %edx
movl %eax, %ecx
orl %edx, %ecx
jz 1f
movl $MSR_EFER, %ecx
wrmsr
1: