Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8e029fcd authored by Jarkko Sakkinen's avatar Jarkko Sakkinen Committed by H. Peter Anvin
Browse files

x86, realmode: fix 64-bit wakeup sequence



There were number of issues in wakeup sequence:

- Wakeup stack was placed in hardcoded address.
- NX bit in EFER was not enabled.
- Initialization incorrectly set physical address
of secondary_startup_64.
- Some alignment issues.

This patch fixes these issues and in addition:

- Unifies coding conventions in .S files.
- Sets alignments of code and data right.

Signed-off-by: default avatarJarkko Sakkinen <jarkko.sakkinen@intel.com>
Link: http://lkml.kernel.org/r/1336501366-28617-18-git-send-email-jarkko.sakkinen@intel.com


Originally-by: default avatarH. Peter Anvin <hpa@linux.intel.com>
Cc: Rafael J. Wysocki <rjw@sisk.pl>
Cc: Len Brown <len.brown@intel.com>
Signed-off-by: default avatarH. Peter Anvin <hpa@linux.intel.com>
parent 6feb592d
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -64,7 +64,7 @@ void __init setup_real_mode(void)
	*((u32 *)__va(real_mode_header.boot_gdt)) = __pa(boot_gdt);
#else
	*((u64 *) __va(real_mode_header.startup_64_smp)) =
		(u64) __pa(secondary_startup_64);
		(u64)secondary_startup_64;

	*((u64 *) __va(real_mode_header.level3_ident_pgt)) =
		__pa(level3_ident_pgt) + _KERNPG_TABLE;
+1 −0
Original line number Diff line number Diff line
@@ -13,6 +13,7 @@ always := realmode.bin

realmode-y			+= header.o
realmode-y			+= trampoline_$(BITS).o
realmode-y			+= stack.o
realmode-$(CONFIG_X86_32)	+= reboot_32.o
realmode-$(CONFIG_ACPI_SLEEP)	+= wakeup/wakeup.o

+1 −1
Original line number Diff line number Diff line
@@ -9,7 +9,7 @@

		.section ".header", "a"

ENTRY(real_mode_header)
GLOBAL(real_mode_header)
		.long	pa_text_start
		.long	pa_ro_end
		.long	pa_end
+9 −9
Original line number Diff line number Diff line
@@ -16,10 +16,9 @@
 */
	.section ".text32", "ax"
	.code32
	.globl machine_real_restart_asm

	.balign	16
machine_real_restart_asm:
ENTRY(machine_real_restart_asm)
	/* Set up the IDT for real mode. */
	lidtl	pa_machine_real_restart_idt

@@ -102,15 +101,15 @@ bios:
	ljmpw	$0xf000, $0xfff0

	.section ".rodata", "a"
	.globl	machine_real_restart_idt, machine_real_restart_gdt

	.balign	16
machine_real_restart_idt:
GLOBAL(machine_real_restart_idt)
	.word	0xffff		/* Length - real mode default value */
	.long	0		/* Base - real mode default value */
END(machine_real_restart_idt)

	.balign	16
machine_real_restart_gdt:
GLOBAL(machine_real_restart_gdt)
	/* Self-pointer */
	.word	0xffff		/* Length - real mode default value */
	.long	pa_machine_real_restart_gdt
@@ -130,3 +129,4 @@ machine_real_restart_gdt:
	 * semantics we don't have to reload the segments once CR0.PE = 0.
	 */
	.quad	GDT_ENTRY(0x0093, 0x100, 0xffff)
END(machine_real_restart_gdt)
+19 −0
Original line number Diff line number Diff line
/*
 * Common heap and stack allocations
 */

#include <linux/linkage.h>

	.data
GLOBAL(HEAP)
	.long	rm_heap
GLOBAL(heap_end)
	.long	rm_stack

	.bss
	.balign	16
GLOBAL(rm_heap)
	.space	2048
GLOBAL(rm_stack)
	.space	2048
GLOBAL(rm_stack_end)
Loading