/* SPDX-License-Identifier: GPL-2.0 */1/*2* Common place for both 32- and 64-bit entry routines.3*/45#include <linux/export.h>6#include <linux/linkage.h>7#include <linux/objtool.h>8#include <asm/msr-index.h>9#include <asm/unwind_hints.h>10#include <asm/segment.h>11#include <asm/cache.h>12#include <asm/cpufeatures.h>13#include <asm/nospec-branch.h>1415#include "calling.h"1617.pushsection .noinstr.text, "ax"1819/* Clobbers AX, CX, DX */20SYM_FUNC_START(write_ibpb)21ANNOTATE_NOENDBR22movl $MSR_IA32_PRED_CMD, %ecx23movl _ASM_RIP(x86_pred_cmd), %eax24xorl %edx, %edx25wrmsr2627/* Make sure IBPB clears return stack preductions too. */28FILL_RETURN_BUFFER %rax, RSB_CLEAR_LOOPS, X86_BUG_IBPB_NO_RET29RET30SYM_FUNC_END(write_ibpb)31/* For KVM */32EXPORT_SYMBOL_GPL(write_ibpb);3334.popsection3536/*37* Define the VERW operand that is disguised as entry code so that38* it can be referenced with KPTI enabled. This ensures VERW can be39* used late in exit-to-user path after page tables are switched.40*/41.pushsection .entry.text, "ax"4243.align L1_CACHE_BYTES, 0xcc44SYM_CODE_START_NOALIGN(x86_verw_sel)45UNWIND_HINT_UNDEFINED46ANNOTATE_NOENDBR47.word __KERNEL_DS48.align L1_CACHE_BYTES, 0xcc49SYM_CODE_END(x86_verw_sel);50/* For KVM */51EXPORT_SYMBOL_GPL(x86_verw_sel);5253.popsection5455THUNK warn_thunk_thunk, __warn_thunk5657/*58* Clang's implementation of TLS stack cookies requires the variable in59* question to be a TLS variable. If the variable happens to be defined as an60* ordinary variable with external linkage in the same compilation unit (which61* amounts to the whole of vmlinux with LTO enabled), Clang will drop the62* segment register prefix from the references, resulting in broken code. Work63* around this by avoiding the symbol used in -mstack-protector-guard-symbol=64* entirely in the C code, and use an alias emitted by the linker script65* instead.66*/67#if defined(CONFIG_STACKPROTECTOR) && defined(CONFIG_SMP)68EXPORT_SYMBOL(__ref_stack_chk_guard);69#endif707172