linux/arch/x86/include/asm/gsseg.h

/* SPDX-License-Identifier: GPL-2.0-only */
#ifndef _ASM_X86_GSSEG_H
#define _ASM_X86_GSSEG_H

#include <linux/types.h>

#include <asm/asm.h>
#include <asm/cpufeature.h>
#include <asm/alternative.h>
#include <asm/processor.h>
#include <asm/nops.h>

#ifdef CONFIG_X86_64

extern asmlinkage void asm_load_gs_index(u16 selector);

/* Replace with "lkgs %di" once binutils support LKGS instruction */
#define LKGS_DI

static inline void native_lkgs(unsigned int selector)
{}

static inline void native_load_gs_index(unsigned int selector)
{}

#endif /* CONFIG_X86_64 */

static inline void __init lkgs_init(void)
{}

#ifndef CONFIG_PARAVIRT_XXL

static inline void load_gs_index(unsigned int selector)
{
#ifdef CONFIG_X86_64
	native_load_gs_index(selector);
#else
	loadsegment(gs, selector);
#endif
}

#endif /* CONFIG_PARAVIRT_XXL */

#endif /* _ASM_X86_GSSEG_H */