Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 254701
b: refs/heads/master
c: 7a31366
h: refs/heads/master
i:
  254699: 3e7a8a9
v: v3
  • Loading branch information
Kees Cook authored and H. Peter Anvin committed Jul 7, 2011
1 parent ef9ccd8 commit 55801fa
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: b49c78d4827be8d7e67e5b94adac6b30a4a9ad14
refs/heads/master: 7a3136666bc0f0419f7aaa7b1fabb4b0e0a7fb76
14 changes: 14 additions & 0 deletions trunk/arch/x86/kernel/acpi/realmode/wakeup.S
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ pmode_cr3: .long 0 /* Saved %cr3 */
pmode_cr4: .long 0 /* Saved %cr4 */
pmode_efer: .quad 0 /* Saved EFER */
pmode_gdt: .quad 0
pmode_misc_en: .quad 0 /* Saved MISC_ENABLE MSR */
pmode_behavior: .long 0 /* Wakeup behavior flags */
realmode_flags: .long 0
real_magic: .long 0
trampoline_segment: .word 0
Expand Down Expand Up @@ -91,6 +93,18 @@ wakeup_code:
/* Call the C code */
calll main

/* 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
jnc 1f

movl pmode_misc_en, %eax
movl pmode_misc_en + 4, %edx
movl $MSR_IA32_MISC_ENABLE, %ecx
wrmsr
1:

/* Do any other stuff... */

#ifndef CONFIG_64BIT
Expand Down
6 changes: 6 additions & 0 deletions trunk/arch/x86/kernel/acpi/realmode/wakeup.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ struct wakeup_header {
u32 pmode_efer_low; /* Protected mode EFER */
u32 pmode_efer_high;
u64 pmode_gdt;
u32 pmode_misc_en_low; /* Protected mode MISC_ENABLE */
u32 pmode_misc_en_high;
u32 pmode_behavior; /* Wakeup routine behavior flags */
u32 realmode_flags;
u32 real_magic;
u16 trampoline_segment; /* segment with trampoline code, 64-bit only */
Expand All @@ -39,4 +42,7 @@ extern struct wakeup_header wakeup_header;
#define WAKEUP_HEADER_SIGNATURE 0x51ee1111
#define WAKEUP_END_SIGNATURE 0x65a22c82

/* Wakeup behavior bits */
#define WAKEUP_BEHAVIOR_RESTORE_MISC_ENABLE 0

#endif /* ARCH_X86_KERNEL_ACPI_RM_WAKEUP_H */
6 changes: 6 additions & 0 deletions trunk/arch/x86/kernel/acpi/sleep.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,12 @@ int acpi_suspend_lowlevel(void)

header->pmode_cr0 = read_cr0();
header->pmode_cr4 = read_cr4_safe();
header->pmode_behavior = 0;
if (!rdmsr_safe(MSR_IA32_MISC_ENABLE,
&header->pmode_misc_en_low,
&header->pmode_misc_en_high))
header->pmode_behavior |=
(1 << WAKEUP_BEHAVIOR_RESTORE_MISC_ENABLE);
header->realmode_flags = acpi_realmode_flags;
header->real_magic = 0x12345678;

Expand Down

0 comments on commit 55801fa

Please sign in to comment.