/* 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/kvm_types.h>7#include <linux/linkage.h>8#include <linux/objtool.h>9#include <asm/msr-index.h>10#include <asm/unwind_hints.h>11#include <asm/segment.h>12#include <asm/cache.h>13#include <asm/cpufeatures.h>14#include <asm/nospec-branch.h>1516#include "calling.h"1718.pushsection .noinstr.text, "ax"1920/* Clobbers AX, CX, DX */21SYM_FUNC_START(write_ibpb)22ANNOTATE_NOENDBR23movl $MSR_IA32_PRED_CMD, %ecx24movl _ASM_RIP(x86_pred_cmd), %eax25xorl %edx, %edx26wrmsr2728/* Make sure IBPB clears return stack preductions too. */29FILL_RETURN_BUFFER %rax, RSB_CLEAR_LOOPS, X86_BUG_IBPB_NO_RET30RET31SYM_FUNC_END(write_ibpb)32EXPORT_SYMBOL_FOR_KVM(write_ibpb);3334SYM_FUNC_START(__WARN_trap)35ANNOTATE_NOENDBR36ANNOTATE_REACHABLE37ud1 (%edx), %_ASM_ARG138RET39SYM_FUNC_END(__WARN_trap)40EXPORT_SYMBOL(__WARN_trap)4142.popsection4344/*45* Define the VERW operand that is disguised as entry code so that46* it can be referenced with KPTI enabled. This ensures VERW can be47* used late in exit-to-user path after page tables are switched.48*/49.pushsection .entry.text, "ax"5051.align L1_CACHE_BYTES, 0xcc52SYM_CODE_START_NOALIGN(x86_verw_sel)53UNWIND_HINT_UNDEFINED54ANNOTATE_NOENDBR55.word __KERNEL_DS56.align L1_CACHE_BYTES, 0xcc57SYM_CODE_END(x86_verw_sel);58EXPORT_SYMBOL_FOR_KVM(x86_verw_sel);5960.popsection6162THUNK warn_thunk_thunk, __warn_thunk6364/*65* Clang's implementation of TLS stack cookies requires the variable in66* question to be a TLS variable. If the variable happens to be defined as an67* ordinary variable with external linkage in the same compilation unit (which68* amounts to the whole of vmlinux with LTO enabled), Clang will drop the69* segment register prefix from the references, resulting in broken code. Work70* around this by avoiding the symbol used in -mstack-protector-guard-symbol=71* entirely in the C code, and use an alias emitted by the linker script72* instead.73*/74#if defined(CONFIG_STACKPROTECTOR) && defined(CONFIG_SMP)75EXPORT_SYMBOL(__ref_stack_chk_guard);76#endif777879