Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

x86, suspend: Correct the restore of CR4, EFER; skip computing EFLAGS.ID

The patch:

73201dbe x86, suspend: On wakeup always initialize cr4 and EFER

... was incorrectly committed in an intermediate (unfinished) form.

- We need to test CF, not ZF, for a bit test with btl.
- We don't actually need to compute the existence of EFLAGS.ID,
since we set a flag at suspend time if CR4 should be restored.

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
Signed-off-by: Ingo Molnar <mingo@kernel.org>

authored by

H. Peter Anvin and committed by
Ingo Molnar
1396adc3 b2cc2a07

+3 -12
+3 -12
arch/x86/realmode/rm/wakeup_asm.S
··· 74 74 75 75 lidtl wakeup_idt 76 76 77 - /* Clear the EFLAGS but remember if we have EFLAGS.ID */ 78 - movl $X86_EFLAGS_ID, %ecx 79 - pushl %ecx 80 - popfl 81 - pushfl 82 - popl %edi 77 + /* Clear the EFLAGS */ 83 78 pushl $0 84 79 popfl 85 - pushfl 86 - popl %edx 87 - xorl %edx, %edi 88 - andl %ecx, %edi /* %edi is zero iff CPUID & %cr4 are missing */ 89 80 90 81 /* Check header signature... */ 91 82 movl signature, %eax ··· 111 120 movl %eax, %cr3 112 121 113 122 btl $WAKEUP_BEHAVIOR_RESTORE_CR4, %edi 114 - jz 1f 123 + jnc 1f 115 124 movl pmode_cr4, %eax 116 125 movl %eax, %cr4 117 126 1: 118 127 btl $WAKEUP_BEHAVIOR_RESTORE_EFER, %edi 119 - jz 1f 128 + jnc 1f 120 129 movl pmode_efer, %eax 121 130 movl pmode_efer + 4, %edx 122 131 movl $MSR_EFER, %ecx