Skip to content

Commit

Permalink
x86, suspend: Correct the restore of CR4, EFER; skip computing EFLAGS.ID
Browse files Browse the repository at this point in the history
The patch:

    73201db 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>
  • Loading branch information
H. Peter Anvin authored and Ingo Molnar committed Oct 2, 2012
1 parent b2cc2a0 commit 1396adc
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 deletions arch/x86/realmode/rm/wakeup_asm.S
Original file line number Diff line number Diff line change
Expand Up @@ -74,18 +74,9 @@ ENTRY(wakeup_start)

lidtl wakeup_idt

/* Clear the EFLAGS but remember if we have EFLAGS.ID */
movl $X86_EFLAGS_ID, %ecx
pushl %ecx
popfl
pushfl
popl %edi
/* Clear the EFLAGS */
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
Expand Down Expand Up @@ -120,12 +111,12 @@ ENTRY(wakeup_start)
movl %eax, %cr3

btl $WAKEUP_BEHAVIOR_RESTORE_CR4, %edi
jz 1f
jnc 1f
movl pmode_cr4, %eax
movl %eax, %cr4
1:
btl $WAKEUP_BEHAVIOR_RESTORE_EFER, %edi
jz 1f
jnc 1f
movl pmode_efer, %eax
movl pmode_efer + 4, %edx
movl $MSR_EFER, %ecx
Expand Down

0 comments on commit 1396adc

Please sign in to comment.