xref: /openbmc/linux/arch/x86/entry/entry.S (revision c67ce71d)
1/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * Common place for both 32- and 64-bit entry routines.
4 */
5
6#include <linux/linkage.h>
7#include <asm/export.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>
14
15.pushsection .noinstr.text, "ax"
16
17SYM_FUNC_START(entry_ibpb)
18	movl	$MSR_IA32_PRED_CMD, %ecx
19	movl	$PRED_CMD_IBPB, %eax
20	xorl	%edx, %edx
21	wrmsr
22
23	/* Make sure IBPB clears return stack preductions too. */
24	FILL_RETURN_BUFFER %rax, RSB_CLEAR_LOOPS, X86_BUG_IBPB_NO_RET
25	RET
26SYM_FUNC_END(entry_ibpb)
27/* For KVM */
28EXPORT_SYMBOL_GPL(entry_ibpb);
29
30.popsection
31
32/*
33 * Define the VERW operand that is disguised as entry code so that
34 * it can be referenced with KPTI enabled. This ensure VERW can be
35 * used late in exit-to-user path after page tables are switched.
36 */
37.pushsection .entry.text, "ax"
38
39.align L1_CACHE_BYTES, 0xcc
40SYM_CODE_START_NOALIGN(mds_verw_sel)
41	UNWIND_HINT_UNDEFINED
42	ANNOTATE_NOENDBR
43	.word __KERNEL_DS
44.align L1_CACHE_BYTES, 0xcc
45SYM_CODE_END(mds_verw_sel);
46/* For KVM */
47EXPORT_SYMBOL_GPL(mds_verw_sel);
48
49.popsection
50
51