[PATCH v1][CLEANUP] x86: use already defined macros instead of hard-coded values

From: Alexander Kuleshov
Date: Thu Mar 05 2015 - 08:31:20 EST


This patch provides following minor fixes:

* Remove non-used L3_PAGE_OFFSET
* Use already defined L3_START_KERNEL and other macros instead of hard-coded
values
* Fix paths in a comments

Signed-off-by: Alexander Kuleshov <kuleshovmail@xxxxxxxxx>
---
arch/x86/kernel/head_64.S | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/arch/x86/kernel/head_64.S b/arch/x86/kernel/head_64.S
index 6fd514d9..dbc4ef3 100644
--- a/arch/x86/kernel/head_64.S
+++ b/arch/x86/kernel/head_64.S
@@ -1,6 +1,4 @@
/*
- * linux/arch/x86_64/kernel/head.S -- start in 32bit and switch to 64bit
- *
* Copyright (C) 2000 Andrea Arcangeli <andrea@xxxxxxx> SuSE
* Copyright (C) 2000 Pavel Machek <pavel@xxxxxxx>
* Copyright (C) 2000 Karsten Keil <kkeil@xxxxxxx>
@@ -20,6 +18,7 @@
#include <asm/processor-flags.h>
#include <asm/percpu.h>
#include <asm/nops.h>
+#include <asm/cpufeature.h>

#ifdef CONFIG_PARAVIRT
#include <asm/asm-offsets.h>
@@ -38,7 +37,6 @@
#define pud_index(x) (((x) >> PUD_SHIFT) & (PTRS_PER_PUD-1))

L4_PAGE_OFFSET = pgd_index(__PAGE_OFFSET)
-L3_PAGE_OFFSET = pud_index(__PAGE_OFFSET)
L4_START_KERNEL = pgd_index(__START_KERNEL_map)
L3_START_KERNEL = pud_index(__START_KERNEL_map)

@@ -56,7 +54,7 @@ startup_64:
* %rsi holds a physical pointer to real_mode_data.
*
* We come here either directly from a 64bit bootloader, or from
- * arch/x86_64/boot/compressed/head.S.
+ * arch/x86/boot/compressed/head_64.S.
*
* We only come here initially at boot nothing else comes here.
*
@@ -90,8 +88,8 @@ startup_64:
*/
addq %rbp, early_level4_pgt + (L4_START_KERNEL*8)(%rip)

- addq %rbp, level3_kernel_pgt + (510*8)(%rip)
- addq %rbp, level3_kernel_pgt + (511*8)(%rip)
+ addq %rbp, level3_kernel_pgt + (L3_START_KERNEL*8)(%rip)
+ addq %rbp, level3_kernel_pgt + (L3_START_KERNEL*8 + 1)(%rip)

addq %rbp, level2_fixmap_pgt + (506*8)(%rip)

@@ -199,7 +197,7 @@ ENTRY(secondary_startup_64)
movl $MSR_EFER, %ecx
rdmsr
btsl $_EFER_SCE, %eax /* Enable System Call */
- btl $20,%edi /* No Execute supported? */
+ btl $X86_FEATURE_NX, %edi /* No Execute supported? */
jnc 1f
btsl $_EFER_NX, %eax
btsq $_PAGE_BIT_NX,early_pmd_flags(%rip)
@@ -441,7 +439,7 @@ GLOBAL(name)

__INITDATA
NEXT_PAGE(early_level4_pgt)
- .fill 511,8,0
+ .fill L4_START_KERNEL,8,0
.quad level3_kernel_pgt - __START_KERNEL_map + _PAGE_TABLE

NEXT_PAGE(early_dynamic_pgts)
--
2.3.1.167.g7f4ba4b

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/