kaiser: name that 0x1000 KAISER_SHADOW_PGD_OFFSET
authorHugh Dickins <hughd@google.com>
Sun, 10 Sep 2017 00:31:18 +0000 (17:31 -0700)
committerYves-Alexis Perez <corsac@debian.org>
Thu, 4 Jan 2018 11:12:40 +0000 (11:12 +0000)
There's a 0x1000 in various places, which looks better with a name.

Signed-off-by: Hugh Dickins <hughd@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Gbp-Pq: Topic features/all/kpti
Gbp-Pq: Name kaiser-name-that-0x1000-kaiser_shadow_pgd_offset.patch

arch/x86/entry/entry_64.S
arch/x86/include/asm/kaiser.h

index 2f9eb09210a3fe237444a80809c427b363ad4e66..42ee56eb7d941cc6d06fdf185a918273077e8edf 100644 (file)
@@ -1332,7 +1332,7 @@ ENTRY(nmi)
        movq    %cr3, %rax
        pushq   %rax
 #ifdef CONFIG_KAISER_REAL_SWITCH
-       andq    $(~0x1000), %rax
+       andq    $(~KAISER_SHADOW_PGD_OFFSET), %rax
 #endif
        movq    %rax, %cr3
 #endif
@@ -1575,7 +1575,7 @@ end_repeat_nmi:
        movq    %cr3, %rax
        pushq   %rax
 #ifdef CONFIG_KAISER_REAL_SWITCH
-       andq    $(~0x1000), %rax
+       andq    $(~KAISER_SHADOW_PGD_OFFSET), %rax
 #endif
        movq    %rax, %cr3
 #endif
index 7394ba9f995107070dfbb1fe79ca6721a537d180..051acf678cda3761c893ddc501b46ea3c93801a9 100644 (file)
  * A minimalistic kernel mapping holds the parts needed to be mapped in user
  * mode, such as the entry/exit functions of the user space, or the stacks.
  */
+
+#define KAISER_SHADOW_PGD_OFFSET 0x1000
+
 #ifdef __ASSEMBLY__
 #ifdef CONFIG_KAISER
 
 .macro _SWITCH_TO_KERNEL_CR3 reg
 movq %cr3, \reg
 #ifdef CONFIG_KAISER_REAL_SWITCH
-andq $(~0x1000), \reg
+andq $(~KAISER_SHADOW_PGD_OFFSET), \reg
 #endif
 movq \reg, %cr3
 .endm
@@ -27,7 +30,7 @@ movq \reg, %cr3
 .macro _SWITCH_TO_USER_CR3 reg
 movq %cr3, \reg
 #ifdef CONFIG_KAISER_REAL_SWITCH
-orq $(0x1000), \reg
+orq $(KAISER_SHADOW_PGD_OFFSET), \reg
 #endif
 movq \reg, %cr3
 .endm