merge 32 and 64 realmode wakeup code
Subsystems (3)
PATCH 1/2 merge 32 and 64 realmode wakeup code
- this mean less ifdef in code
- we could remove now unused field in wakeup_header (pmode_*)
---
arch/x86/kernel/acpi/realmode/wakeup.S | 26 -------------------------- arch/x86/kernel/acpi/sleep.c | 25 +++++++++---------------- arch/x86/kernel/trampoline_32.S | 4 ---- 3 files changed, 9 insertions(+), 46 deletions(-)
arch/x86/kernel/acpi/realmode/wakeup.S +0 -0
@@ -93,36 +93,10 @@ wakeup_code:
/* Do any other stuff... */
-#ifndef CONFIG_64BIT
- /* This could also be done in C code... */
- movl pmode_cr3, %eax
- movl %eax, %cr3
-
- movl pmode_cr4, %ecx
- jecxz 1f
- movl %ecx, %cr4
-1:
- movl pmode_efer, %eax
- movl pmode_efer + 4, %edx
- movl %eax, %ecx
- orl %edx, %ecx
- jz 1f
- movl $MSR_EFER, %ecx
- wrmsr
-1:
-
- lgdtl pmode_gdt
-
- /* This really couldn't... */
- movl pmode_cr0, %eax
- movl %eax, %cr0
- jmp pmode_return
-#else
pushw $0 pushw trampoline_segment pushw $0 lret
-#endif
bogus_real_magic:
1:
arch/x86/kernel/acpi/sleep.c +0 -0
@@ -20,7 +20,7 @@
unsigned long acpi_realmode_flags;
-#if defined(CONFIG_SMP) && defined(CONFIG_64BIT)
+#if defined(CONFIG_SMP)
static char temp_stack[4096];
#endif
@@ -67,33 +67,26 @@ int acpi_save_state_mem(void)
header->wakeup_gdt[2] = GDT_ENTRY(0x8093, acpi_wakeup_address, 0xfffff);
-#ifndef CONFIG_64BIT
- store_gdt((struct desc_ptr *)&header->pmode_gdt);
-
- if (rdmsr_safe(MSR_EFER, &header->pmode_efer_low,
- &header->pmode_efer_high))
- header->pmode_efer_low = header->pmode_efer_high = 0;
-#endif /* !CONFIG_64BIT */
-
header->pmode_cr0 = read_cr0(); header->pmode_cr4 = read_cr4_safe(); header->realmode_flags = acpi_realmode_flags; header->real_magic = 0x12345678;
-
-#ifndef CONFIG_64BIT
- header->pmode_entry = (u32)&wakeup_pmode_return;
- header->pmode_cr3 = (u32)__pa(&initial_page_table);
- saved_magic = 0x12345678;
-#else /* CONFIG_64BIT */
header->trampoline_segment = trampoline_address() >> 4; #ifdef CONFIG_SMP stack_start = (unsigned long)temp_stack + sizeof(temp_stack); early_gdt_descr.address = (unsigned long)get_cpu_gdt_table(smp_processor_id()); +#ifdef CONFIG_64BIT initial_gs = per_cpu_offset(smp_processor_id());
#endif
+#endif
+
+#ifndef CONFIG_64BIT
+ initial_code = (unsigned long)&wakeup_pmode_return;
+ saved_magic = 0x12345678;
+#else
initial_code = (unsigned long)wakeup_long64;
- saved_magic = 0x123456789abcdef0L;
+ saved_magic = 0x123456789abcdef0L;
#endif /* CONFIG_64BIT */
return 0;
arch/x86/kernel/trampoline_32.S +0 -0
@@ -32,8 +32,6 @@
#include <asm/segment.h>
#include <asm/page_types.h>
-#ifdef CONFIG_SMP
-
.section ".x86_trampoline","a" .balign PAGE_SIZE .code16
@@ -79,5 +77,3 @@ ENTRY(trampoline_status)
.globl trampoline_endtrampoline_end:
-
-#endif /* CONFIG_SMP */
Signature · 1 line
1.7.4.1
Quoted 56 lines · matthieu castet
- this mean less ifdef in code
- we could remove now unused field inwakeup_header(pmode_*)Signed-off-by Matthieu CASTET <[email protected]>--- arch/x86/kernel/acpi/realmode/wakeup.S | 26 -------------------------- arch/x86/kernel/acpi/sleep.c | 25 +++++++++---------------- arch/x86/kernel/trampoline_32.S | 4 ---- 3 files changed, 9 insertions(+), 46 deletions(-)arch/x86/kernel/acpi/realmode/wakeup.S +0
-26@@ -93,36 +93,10 @@ wakeup_code: /* Do any other stuff... */ -#ifndef CONFIG_64BIT - /* This could also be done in C code... */ - movl pmode_cr3, %eax - movl %eax, %cr3 - - movl pmode_cr4, %ecx - jecxz 1f - movl %ecx, %cr4 -1: - movl pmode_efer, %eax - movl pmode_efer + 4, %edx - movl %eax, %ecx - orl %edx, %ecx - jz 1f - movl $MSR_EFER, %ecx - wrmsr -1: - - lgdtl pmode_gdt - - /* This really couldn't... */ - movl pmode_cr0, %eax - movl %eax, %cr0 - jmp pmode_return -#else pushw $0 pushw trampoline_segment pushw $0 lret -#endif bogus_real_magic: 1:arch/x86/kernel/acpi/sleep.c +0
-0
arch/x86/kernel/acpi/sleep.c line 23
Quoted 5 lines
arch/x86/kernel/acpi/sleep.c +1
-1@@ -20,7 +20,7 @@unsigned long acpi_realmode_flags; -#if defined(CONFIG_SMP ) && defined(CONFIG_64BIT ) +#if defined(CONFIG_SMP )
+#ifdef CONFIG_SMP
please.
Quoted 26 lines
arch/x86/kernel/acpi/sleep.c +0
-14static char temp_stack[4096 ];#endif @@ -67,33 +67,26 @@ int acpi_save_state_mem(void) header->wakeup_gdt[2 ] =GDT_ENTRY (0x8093 , acpi_wakeup_address,0xfffff ); -#ifndef CONFIG_64BIT -store_gdt ((struct desc_ptr *)&header->pmode_gdt); - -if (rdmsr_safe (MSR_EFER , &header->pmode_efer_low, - &header->pmode_efer_high)) - header->pmode_efer_low = header->pmode_efer_high =0 ; -#endif /* !CONFIG_64BIT */ - header->pmode_cr0 =read_cr0 (); header->pmode_cr4 =read_cr4_safe (); header->realmode_flags = acpi_realmode_flags; header->real_magic =0x12345678 ; - -#ifndef CONFIG_64BIT - header->pmode_entry = (u32)&wakeup_pmode_return; - header->pmode_cr3 = (u32 )__pa (&initial_page_table); - saved_magic =0x12345678 ; -#else /* CONFIG_64BIT */ header->trampoline_segment =trampoline_address () >>4 ;
arch/x86/kernel/acpi/sleep.c int acpi_save_state_mem(void) · line 84
Quoted 10 lines
arch/x86/kernel/acpi/sleep.c +4
-0#ifdef CONFIG_SMP stack_start = (unsigned long )temp_stack +sizeof (temp_stack); early_gdt_descr.address = (unsigned long )get_cpu_gdt_table (smp_processor_id ()); +#ifdef CONFIG_64BIT initial_gs =per_cpu_offset (smp_processor_id ());#endif +#endif + +#ifndef CONFIG_64BIT
Please do
+ifdef CONFIG_64BIT
instead and reorder the following code accordingly (IMHO using #ifndef with #else is confusing, unless the option is a "NO_SOMETHING" one).
Quoted 23 lines
arch/x86/kernel/acpi/sleep.c +4
-1+ initial_code = (unsigned long )&wakeup_pmode_return; + saved_magic =0x12345678 ; +#else initial_code = (unsigned long )wakeup_long64; - saved_magic =0x123456789abcdef0L ; + saved_magic =0x123456789abcdef0L ;#endif /* CONFIG_64BIT */ return 0 ;arch/x86/kernel/trampoline_32.S +0
-2@@ -32,8 +32,6 @@ #include <asm/segment.h> #include <asm/page_types.h> -#ifdef CONFIG_SMP - .section ".x86_trampoline","a" .balign PAGE_SIZE .code16
arch/x86/kernel/trampoline_32.S ENTRY(trampoline_status) · line 83
Quoted 5 lines
arch/x86/kernel/trampoline_32.S +0
-2@@ -79,5 +77,3 @@ ENTRY(trampoline_status) .globl trampoline_end trampoline_end: - -#endif /* CONFIG_SMP */
Apart from the remarks above it looks good.
Thanks,
Rafael
H. Peter Anvin
reviewerQuoted 3 lines · Rafael J. Wysocki
Apart from the remarks above it looks good.
Indeed... if I get this quickly we can probably get it into .39.
-hpa
Hi!
Quoted 7 lines
Quoted 7 lines
(quoted diff) +0
-2-#ifdef CONFIG_SMP - .section ".x86_trampoline","a" .balign PAGE_SIZE .code16@@ -79,5 +77,3 @@ ENTRY(trampoline_status)
Quoted 6 lines
Review ENTRY(trampoline_status) · line 83
Quoted 4 lines
(quoted diff) +0
-2.globl trampoline_end trampoline_end: - -#endif /* CONFIG_SMP */Apart from the remarks above it looks good.
Looks ok to me, too...
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html