.endm
  
  #define THIS_CPU_user_pcid_flush_mask   \
 -      PER_CPU_VAR(cpu_tlbstate) + TLB_STATE_user_pcid_flush_mask
 +      PER_CPU_VAR(cpu_tlbstate + TLB_STATE_user_pcid_flush_mask)
  
- .macro SWITCH_TO_USER_CR3_NOSTACK scratch_reg:req scratch_reg2:req
-       ALTERNATIVE "jmp .Lend_\@", "", X86_FEATURE_PTI
+ .macro SWITCH_TO_USER_CR3 scratch_reg:req scratch_reg2:req
        mov     %cr3, \scratch_reg
  
        ALTERNATIVE "jmp .Lwrcr3_\@", "", X86_FEATURE_PCID
 
  
  #else /* ...!ASSEMBLY */
  
- #include <linux/kernel.h>
 +#include <linux/build_bug.h>
  #include <linux/stringify.h>
+ #include <asm/asm.h>
  
  #ifdef CONFIG_SMP
 +
 +#ifdef CONFIG_CC_HAS_NAMED_AS
 +
 +#ifdef __CHECKER__
 +#define __seg_gs              __attribute__((address_space(__seg_gs)))
 +#define __seg_fs              __attribute__((address_space(__seg_fs)))
 +#endif
 +
 +#ifdef CONFIG_X86_64
 +#define __percpu_seg_override __seg_gs
 +#else
 +#define __percpu_seg_override __seg_fs
 +#endif
 +
 +#define __percpu_prefix               ""
 +
 +#else /* CONFIG_CC_HAS_NAMED_AS */
 +
 +#define __percpu_seg_override
  #define __percpu_prefix               "%%"__stringify(__percpu_seg)":"
 +
 +#endif /* CONFIG_CC_HAS_NAMED_AS */
 +
 +#define __force_percpu_prefix "%%"__stringify(__percpu_seg)":"
  #define __my_cpu_offset               this_cpu_read(this_cpu_off)
  
 +#ifdef CONFIG_USE_X86_SEG_SUPPORT
 +/*
 + * Efficient implementation for cases in which the compiler supports
 + * named address spaces.  Allows the compiler to perform additional
 + * optimizations that can save more instructions.
 + */
 +#define arch_raw_cpu_ptr(ptr)                                 \
 +({                                                            \
 +      unsigned long tcp_ptr__;                                \
 +      tcp_ptr__ = __raw_cpu_read(, this_cpu_off);             \
 +                                                              \
 +      tcp_ptr__ += (unsigned long)(ptr);                      \
 +      (typeof(*(ptr)) __kernel __force *)tcp_ptr__;           \
 +})
 +#else /* CONFIG_USE_X86_SEG_SUPPORT */
  /*
   * Compared to the generic __my_cpu_offset version, the following
   * saves one instruction and avoids clobbering a temp register.
 
  
  extern void text_poke_early(void *addr, const void *opcode, size_t len);
  
++extern void apply_relocation(u8 *buf, size_t len, u8 *dest, u8 *src, size_t src_len);
++
  /*
   * Clear and restore the kernel write-protection flag on the local CPU.
   * Allows the kernel to edit read-only pages.