linux/arch/x86/kernel/static_call.c

// SPDX-License-Identifier: GPL-2.0
#include <linux/static_call.h>
#include <linux/memory.h>
#include <linux/bug.h>
#include <asm/text-patching.h>

enum insn_type {};

/*
 * ud1 %esp, %ecx - a 3 byte #UD that is unique to trampolines, chosen such
 * that there is no false-positive trampoline identification while also being a
 * speculation stop.
 */
static const u8 tramp_ud[] =;

/*
 * cs cs cs xorl %eax, %eax - a single 5 byte instruction that clears %[er]ax
 */
static const u8 xor5rax[] =;

static const u8 retinsn[] =;

static u8 __is_Jcc(u8 *insn) /* Jcc.d32 */
{}

extern void __static_call_return(void);

asm;

static void __ref __static_call_transform(void *insn, enum insn_type type,
					  void *func, bool modinit)
{}

static void __static_call_validate(u8 *insn, bool tail, bool tramp)
{}

static inline enum insn_type __sc_insn(bool null, bool tail)
{}

void arch_static_call_transform(void *site, void *tramp, void *func, bool tail)
{}
EXPORT_SYMBOL_GPL();

#ifdef CONFIG_MITIGATION_RETHUNK
/*
 * This is called by apply_returns() to fix up static call trampolines,
 * specifically ARCH_DEFINE_STATIC_CALL_NULL_TRAMP which is recorded as
 * having a return trampoline.
 *
 * The problem is that static_call() is available before determining
 * X86_FEATURE_RETHUNK and, by implication, running alternatives.
 *
 * This means that __static_call_transform() above can have overwritten the
 * return trampoline and we now need to fix things up to be consistent.
 */
bool __static_call_fixup(void *tramp, u8 op, void *dest)
{}
#endif