summaryrefslogtreecommitdiffstats
path: root/arch/x86/realmode
diff options
context:
space:
mode:
authorJarkko Sakkinen <jarkko.sakkinen@intel.com>2012-05-08 21:22:43 +0300
committerH. Peter Anvin <hpa@linux.intel.com>2012-05-08 11:48:45 -0700
commitf37240f16bec91f15ce564515f70a6ca9715ce96 (patch)
treed1e98241650bfed0d87f60e3e71a8ad716782f6d /arch/x86/realmode
parentc4845474a01f699966272536e8416222e3f2d2cb (diff)
downloadop-kernel-dev-f37240f16bec91f15ce564515f70a6ca9715ce96.zip
op-kernel-dev-f37240f16bec91f15ce564515f70a6ca9715ce96.tar.gz
x86, realmode: header for trampoline code
Added header for trampoline code that can be used to supply input data to it. This makes interface between real mode code and kernel cleaner and simpler. Replaced two confusing pointers to level4 pgt in trampoline_64.S with a single pointer to the beginning of the page table. Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@intel.com> Link: http://lkml.kernel.org/r/1336501366-28617-21-git-send-email-jarkko.sakkinen@intel.com Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Diffstat (limited to 'arch/x86/realmode')
-rw-r--r--arch/x86/realmode/rm/header.S35
-rw-r--r--arch/x86/realmode/rm/trampoline_32.S36
-rw-r--r--arch/x86/realmode/rm/trampoline_64.S18
-rw-r--r--arch/x86/realmode/rm/trampoline_common.S23
-rw-r--r--arch/x86/realmode/rm/wakeup_asm.S2
5 files changed, 51 insertions, 63 deletions
diff --git a/arch/x86/realmode/rm/header.S b/arch/x86/realmode/rm/header.S
index c83005c..b4c3263 100644
--- a/arch/x86/realmode/rm/header.S
+++ b/arch/x86/realmode/rm/header.S
@@ -7,28 +7,25 @@
#include <linux/linkage.h>
#include <asm/page_types.h>
- .section ".header", "a"
+ .section ".header", "a"
GLOBAL(real_mode_header)
- .long pa_text_start
- .long pa_ro_end
-#ifdef CONFIG_X86_32
- .long pa_machine_real_restart_asm
-#endif
- /* SMP trampoline */
- .long pa_trampoline_data
- .long pa_trampoline_status
-#ifdef CONFIG_X86_32
- .long pa_startup_32_smp
- .long pa_boot_gdt
-#else
- .long pa_startup_64_smp
- .long pa_level3_ident_pgt
- .long pa_level3_kernel_pgt
+ .long pa_text_start
+ .long pa_ro_end
+ /* SMP trampoline */
+ .long pa_trampoline_start
+ .long pa_trampoline_status
+ .long pa_trampoline_header
+#ifdef CONFIG_X86_64
+ .long pa_trampoline_pgd;
#endif
- /* ACPI sleep */
+ /* ACPI S3 wakeup */
#ifdef CONFIG_ACPI_SLEEP
- .long pa_wakeup_start
- .long pa_wakeup_header
+ .long pa_wakeup_start
+ .long pa_wakeup_header
+#endif
+ /* APM/BIOS reboot */
+#ifdef CONFIG_X86_32
+ .long pa_machine_real_restart_asm
#endif
END(real_mode_header)
diff --git a/arch/x86/realmode/rm/trampoline_32.S b/arch/x86/realmode/rm/trampoline_32.S
index 1ecdbb5..6fc064b 100644
--- a/arch/x86/realmode/rm/trampoline_32.S
+++ b/arch/x86/realmode/rm/trampoline_32.S
@@ -13,16 +13,10 @@
*
* We jump into arch/x86/kernel/head_32.S.
*
- * On entry to trampoline_data, the processor is in real mode
+ * On entry to trampoline_start, the processor is in real mode
* with 16-bit addressing and 16-bit data. CS has some value
* and IP is zero. Thus, we load CS to the physical segment
* of the real mode code before doing anything further.
- *
- * The structure real_mode_header includes entries that need
- * to be set up before executing this code:
- *
- * startup_32_smp
- * boot_gdt
*/
#include <linux/linkage.h>
@@ -35,7 +29,7 @@
.code16
.balign PAGE_SIZE
-ENTRY(trampoline_data)
+ENTRY(trampoline_start)
wbinvd # Needed for NUMA-Q should be harmless for others
LJMPW_RM(1f)
@@ -45,7 +39,7 @@ ENTRY(trampoline_data)
cli # We should be safe anyway
- movl startup_32_smp, %eax # where we need to go
+ movl tr_start, %eax # where we need to go
movl $0xA5A5A5A5, trampoline_status
# write marker for master knows we're running
@@ -56,8 +50,8 @@ ENTRY(trampoline_data)
* operand size is 16bit. Use lgdtl instead to force operand size
* to 32 bit.
*/
- lidtl boot_idt_descr # load idt with 0, 0
- lgdtl boot_gdt_descr # load gdt with whatever is appropriate
+ lidtl tr_idt # load idt with 0, 0
+ lgdtl tr_gdt # load gdt with whatever is appropriate
movw $1, %dx # protected mode (PE) bit
lmsw %dx # into protected mode
@@ -69,22 +63,4 @@ ENTRY(trampoline_data)
ENTRY(startup_32) # note: also used from wakeup_asm.S
jmp *%eax
- .section ".rodata","a"
-
- .balign 4
-boot_idt_descr:
- .word 0 # idt limit = 0
- .long 0 # idt base = 0L
-
- .data
-
-boot_gdt_descr:
- .word __BOOT_DS + 7 # gdt limit
-GLOBAL(boot_gdt)
- .long 0 # gdt base
-
- .bss
-
- .balign 4
-GLOBAL(trampoline_status) .space 4
-GLOBAL(startup_32_smp) .space 4
+#include "trampoline_common.S"
diff --git a/arch/x86/realmode/rm/trampoline_64.S b/arch/x86/realmode/rm/trampoline_64.S
index f71ea08..3f72932 100644
--- a/arch/x86/realmode/rm/trampoline_64.S
+++ b/arch/x86/realmode/rm/trampoline_64.S
@@ -10,7 +10,7 @@
* trampoline page to make our stack and everything else
* is a mystery.
*
- * On entry to trampoline_data, the processor is in real mode
+ * On entry to trampoline_start, the processor is in real mode
* with 16-bit addressing and 16-bit data. CS has some value
* and IP is zero. Thus, data addresses need to be absolute
* (no relocation) and are taken with regard to r_base.
@@ -37,7 +37,7 @@
.balign PAGE_SIZE
.code16
-ENTRY(trampoline_data)
+ENTRY(trampoline_start)
cli # We should be safe anyway
wbinvd
@@ -97,7 +97,7 @@ ENTRY(startup_32)
movl %eax, %cr4 # Enable PAE mode
# Setup trampoline 4 level pagetables
- movl $pa_level3_ident_pgt, %eax
+ movl $pa_trampoline_pgd, %eax
movl %eax, %cr3
movl $MSR_EFER, %ecx
@@ -122,7 +122,7 @@ ENTRY(startup_32)
.balign 4
ENTRY(startup_64)
# Now jump into the kernel using virtual addresses
- jmpq *startup_64_smp(%rip)
+ jmpq *tr_start(%rip)
.section ".rodata","a"
.balign 16
@@ -143,12 +143,4 @@ tgdt:
.quad 0x00cf93000000ffff # __KERNEL_DS
tgdt_end:
- .bss
-
- .balign PAGE_SIZE
-GLOBAL(level3_ident_pgt) .space 511*8
-GLOBAL(level3_kernel_pgt) .space 8
-
- .balign 8
-GLOBAL(startup_64_smp) .space 8
-GLOBAL(trampoline_status) .space 4
+#include "trampoline_common.S"
diff --git a/arch/x86/realmode/rm/trampoline_common.S b/arch/x86/realmode/rm/trampoline_common.S
new file mode 100644
index 0000000..c3f951c
--- /dev/null
+++ b/arch/x86/realmode/rm/trampoline_common.S
@@ -0,0 +1,23 @@
+ .section ".rodata","a"
+
+ .balign 4
+tr_idt: .fill 1, 6, 0
+
+ .bss
+
+ .balign 4
+GLOBAL(trampoline_status) .space 4
+
+GLOBAL(trampoline_header)
+#ifdef CONFIG_X86_32
+ tr_start: .space 4
+ tr_gdt: .space 6
+#else
+ tr_start: .space 8
+#endif
+END(trampoline_header)
+
+#ifdef CONFIG_X86_64
+ .balign PAGE_SIZE
+GLOBAL(trampoline_pgd) .space PAGE_SIZE
+#endif
diff --git a/arch/x86/realmode/rm/wakeup_asm.S b/arch/x86/realmode/rm/wakeup_asm.S
index 8a57c5a..46108f0 100644
--- a/arch/x86/realmode/rm/wakeup_asm.S
+++ b/arch/x86/realmode/rm/wakeup_asm.S
@@ -132,7 +132,7 @@ ENTRY(wakeup_start)
ljmpl $__KERNEL_CS, $pa_startup_32
/* -> jmp *%eax in trampoline_32.S */
#else
- jmp trampoline_data
+ jmp trampoline_start
#endif
bogus_real_magic:
OpenPOWER on IntegriCloud