S3 suspend/resume with noexec
A message that is not in the archive (sent off-list or not yet received): [email protected]
Hi!
Quoted 3 lines
This patch is required for S3 suspend-resume to work on noexec capable systems. On these systems, we need to save and restore
MSR_EFERduring suspend-resume.
Hmm, I'm afraid similar patch will be needed for x86-64...
arch/i386/power/cpu.c void __save_processor_state(struct saved · line 70
Quoted 12 lines
arch/i386/power/cpu.c renamed from arch/i386/power/cpu.c.org +4
-0@@ -62,6 +62,10 @@ void __save_processor_state(struct saved asmvolatile ("movl %%cr0, %0" :"=r" (ctxt->cr0)); asmvolatile ("movl %%cr2, %0" :"=r" (ctxt->cr2)); asmvolatile ("movl %%cr3, %0" :"=r" (ctxt->cr3)); +#ifdef CONFIG_X86_PAE +if (cpu_has_pae && cpu_has_nx) +rdmsr (MSR_EFER , ctxt->efer_lo, ctxt->efer_hi); +#endif asmvolatile ("movl %%cr4, %0" :"=r" (ctxt->cr4)); }
Are those #ifdefs good idea?
Quoted 13 lines
arch/i386/kernel/acpi/wakeup.S renamed from arch/i386/kernel/acpi/wakeup.S.org +7
-0@@ -59,6 +59,20 @@ wakeup_code: movl $swapper_pg_dir-__PAGE_OFFSET, %eax movl %eax, %cr3 + testl $1, real_efer_save_restore - wakeup_code + jz 4f + # restore efer setting + pushl %eax + pushl %ecx + pushl %edx + movl real_save_efer_edx - wakeup_code, %edx
arch/i386/kernel/acpi/wakeup.S wakeup_code: · line 78
Quoted 10 lines
arch/i386/kernel/acpi/wakeup.S renamed from arch/i386/kernel/acpi/wakeup.S.org +7
-0+ movl real_save_efer_eax - wakeup_code, %eax + mov $0xc0000080, %ecx + wrmsr + popl %edx + popl %ecx + popl %eax +4: # make sure %cr4 is set correctly (features, etc) movl real_save_cr4 - wakeup_code, %eax movl %eax, %cr4
Please analyse surrounding code a bit more. You certainly do not need to push %eax, because it is scratch register.
Is it neccessary to restore efer this soon, btw? We should be running from swapper_pg_dir. Does that use nx?
Quoted 17 lines
arch/i386/kernel/acpi/wakeup.S renamed from arch/i386/kernel/acpi/wakeup.S.org +13
-0@@ -223,6 +240,26 @@ ENTRY(acpi_copy_wakeup_routine) sldt saved_ldt str saved_tss + movl efer_save_restore, %edx + movl %edx, real_efer_save_restore - wakeup_start (%eax) + testl $1, real_efer_save_restore - wakeup_start (%eax) + jz 2f + # save efer setting + pushl %eax + pushl %ebx + pushl %ecx + pushl %edx + movl %eax, %ebx + mov $0xc0000080, %ecx + rdmsr + movl %edx, real_save_efer_edx - wakeup_start (%ebx)
arch/i386/kernel/acpi/wakeup.S ENTRY(acpi_copy_wakeup_routine) · line 265
Quoted 10 lines
arch/i386/kernel/acpi/wakeup.S renamed from arch/i386/kernel/acpi/wakeup.S.org +7
-0+ movl %eax, real_save_efer_eax - wakeup_start (%ebx) + popl %edx + popl %ecx + popl %ebx + popl %eax +2: + movl %cr3, %edx movl %edx, real_save_cr3 - wakeup_start (%eax) movl %cr4, %edx
Again, no need to push %edx, it is used as a scratch register.
Pavel
Signature · 2 lines
People were complaining that M$ turns users into beta-testers... ...jr ghea gurz vagb qrirybcref, naq gurl frrz gb yvxr vg gung jnl!