[tip:x86/trampoline] x86, realmode: Move not-common bits out of trampoline_common.S

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Commit-ID:  51edbe6a2f47c78c6c6e529999ee0a044fe59a89
Gitweb:     http://git.kernel.org/tip/51edbe6a2f47c78c6c6e529999ee0a044fe59a89
Author:     H. Peter Anvin <hpa@xxxxxxxxxxxxxxx>
AuthorDate: Wed, 16 May 2012 13:44:10 -0700
Committer:  H. Peter Anvin <hpa@xxxxxxxxxxxxxxx>
CommitDate: Wed, 16 May 2012 13:44:10 -0700

x86, realmode: Move not-common bits out of trampoline_common.S

Move the bits that aren't actually common out of trampoline_common.S
and into the arch-specific files.  Furthermore, make sure the page
directory is first in the .bss section for trampoline_64.S in order to
not waste an entire page of memory.

Signed-off-by: H. Peter Anvin <hpa@xxxxxxxxxxxxxxx>
Cc: Jarkko Sakkinen <jarkko.sakkinen@xxxxxxxxx>
---
 arch/x86/realmode/rm/trampoline_32.S     |    8 ++++++
 arch/x86/realmode/rm/trampoline_64.S     |   25 +++++++++++++++++++++
 arch/x86/realmode/rm/trampoline_common.S |   35 ------------------------------
 3 files changed, 33 insertions(+), 35 deletions(-)

diff --git a/arch/x86/realmode/rm/trampoline_32.S b/arch/x86/realmode/rm/trampoline_32.S
index 6fc064b..c1b2791 100644
--- a/arch/x86/realmode/rm/trampoline_32.S
+++ b/arch/x86/realmode/rm/trampoline_32.S
@@ -63,4 +63,12 @@ ENTRY(trampoline_start)
 ENTRY(startup_32)			# note: also used from wakeup_asm.S
 	jmp	*%eax
 
+	.bss
+	.balign 8
+GLOBAL(trampoline_header)
+	tr_start:		.space	4
+	tr_gdt_pad:		.space	2
+	tr_gdt:			.space	6
+END(trampoline_header)
+	
 #include "trampoline_common.S"
diff --git a/arch/x86/realmode/rm/trampoline_64.S b/arch/x86/realmode/rm/trampoline_64.S
index 66e26f0..1b9e1bc 100644
--- a/arch/x86/realmode/rm/trampoline_64.S
+++ b/arch/x86/realmode/rm/trampoline_64.S
@@ -125,4 +125,29 @@ ENTRY(startup_64)
 	# Now jump into the kernel using virtual addresses
 	jmpq	*tr_start(%rip)
 
+	.section ".rodata","a"
+	# Duplicate the global descriptor table
+	# so the kernel can live anywhere
+	.balign	16
+	.globl tr_gdt
+tr_gdt:
+	.short	tr_gdt_end - tr_gdt - 1	# gdt limit
+	.long	pa_tr_gdt
+	.short	0
+	.quad	0x00cf9b000000ffff	# __KERNEL32_CS
+	.quad	0x00af9b000000ffff	# __KERNEL_CS
+	.quad	0x00cf93000000ffff	# __KERNEL_DS
+tr_gdt_end:
+
+	.bss
+	.balign	PAGE_SIZE
+GLOBAL(trampoline_pgd)		.space	PAGE_SIZE
+
+	.balign	8
+GLOBAL(trampoline_header)
+	tr_start:		.space	8
+	GLOBAL(tr_cr4)		.space	4
+	GLOBAL(tr_efer)		.space	8
+END(trampoline_header)
+
 #include "trampoline_common.S"
diff --git a/arch/x86/realmode/rm/trampoline_common.S b/arch/x86/realmode/rm/trampoline_common.S
index cac444b..b1ecdb9 100644
--- a/arch/x86/realmode/rm/trampoline_common.S
+++ b/arch/x86/realmode/rm/trampoline_common.S
@@ -1,42 +1,7 @@
 	.section ".rodata","a"
-
-#ifdef CONFIG_X86_64
-	# Duplicate the global descriptor table
-	# so the kernel can live anywhere
 	.balign	16
-	.globl tr_gdt
-tr_gdt:
-	.short	tr_gdt_end - tr_gdt - 1	# gdt limit
-	.long	pa_tr_gdt
-	.short	0
-	.quad	0x00cf9b000000ffff	# __KERNEL32_CS
-	.quad	0x00af9b000000ffff	# __KERNEL_CS
-	.quad	0x00cf93000000ffff	# __KERNEL_DS
-tr_gdt_end:
-#endif
-
-	.balign	4
 tr_idt: .fill 1, 6, 0
 
 	.bss
-
 	.balign	4
 GLOBAL(trampoline_status)	.space	4
-
-	.balign	8
-GLOBAL(trampoline_header)
-#ifdef CONFIG_X86_32
-	tr_start:		.space	4
-	tr_gdt_pad:		.space	2
-	tr_gdt:			.space	6
-#else
-	tr_start:		.space	8
-	GLOBAL(tr_cr4)		.space	4
-	GLOBAL(tr_efer)		.space	8
-#endif
-END(trampoline_header)
-
-#ifdef CONFIG_X86_64
-	.balign	PAGE_SIZE
-GLOBAL(trampoline_pgd)		.space	PAGE_SIZE
-#endif
--
To unsubscribe from this list: send the line "unsubscribe linux-tip-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Stable Commits]     [Linux Stable Kernel]     [Linux Kernel]     [Linux USB Devel]     [Linux Video &Media]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux