mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] x86-64: no need to fix up physical addresses if they are correct
@ 2015-02-28 13:34 Alexander Kuleshov
  2015-02-28 13:48 ` Borislav Petkov
  0 siblings, 1 reply; 2+ messages in thread
From: Alexander Kuleshov @ 2015-02-28 13:34 UTC (permalink / raw)
  To: Thomas Gleixner, Ingo Molnar, H. Peter Anvin, Borislav Petkov
  Cc: linux-kernel, Alexander Kuleshov

If kernel doesn't use kASLR and runned on the same address that was
compiled to run, %rbp will be zero and no need to fix physical addresses
in the page tables.

Signed-off-by: Alexander Kuleshov <kuleshovmail@gmail.com>
---
 arch/x86/kernel/head_64.S | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/arch/x86/kernel/head_64.S b/arch/x86/kernel/head_64.S
index 6fd514d9..c0127bc 100644
--- a/arch/x86/kernel/head_64.S
+++ b/arch/x86/kernel/head_64.S
@@ -86,6 +86,14 @@ startup_64:
 	jnz	bad_address
 
 	/*
+	 * We have no need to fixup the physical addresses in the page tables
+	 * if there is no difference between the address where kernel compiled
+	 * to run and the actual address where kernel running at.
+	 */
+	cmpq $0x0, %rbp
+	je 1f
+
+	/*
 	 * Fixup the physical addresses in the page table
 	 */
 	addq	%rbp, early_level4_pgt + (L4_START_KERNEL*8)(%rip)
@@ -95,6 +103,7 @@ startup_64:
 
 	addq	%rbp, level2_fixmap_pgt + (506*8)(%rip)
 
+1:
 	/*
 	 * Set up the identity mapping for the switchover.  These
 	 * entries should *NOT* have the global bit set!  This also
-- 
2.3.1.167.g7f4ba4b


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-02-28 13:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-28 13:34 [PATCH] x86-64: no need to fix up physical addresses if they are correct Alexander Kuleshov
2015-02-28 13:48 ` Borislav Petkov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®