Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752366AbbB1Nee (ORCPT ); Sat, 28 Feb 2015 08:34:34 -0500 Received: from mail-lb0-f170.google.com ([209.85.217.170]:45218 "EHLO mail-lb0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751959AbbB1Neb (ORCPT ); Sat, 28 Feb 2015 08:34:31 -0500 From: Alexander Kuleshov To: Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , Borislav Petkov Cc: linux-kernel@vger.kernel.org, Alexander Kuleshov Subject: [PATCH] x86-64: no need to fix up physical addresses if they are correct Date: Sat, 28 Feb 2015 19:34:20 +0600 Message-Id: <1425130460-29807-1-git-send-email-kuleshovmail@gmail.com> X-Mailer: git-send-email 2.3.1.167.g7f4ba4b Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1360 Lines: 44 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 --- 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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/