paravirt.h (597473720f4dc69749542bfcfed4a927a43d935e) paravirt.h (55aedddb6149ab71bec9f050846855113977b033)
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef _ASM_X86_PARAVIRT_H
3#define _ASM_X86_PARAVIRT_H
4/* Various instructions on x86 need to be replaced for
5 * para-virtualization: those hooks are defined here. */
6
7#ifdef CONFIG_PARAVIRT
8#include <asm/pgtable_types.h>

--- 102 unchanged lines hidden (view full) ---

111
112static inline void write_cr0(unsigned long x)
113{
114 PVOP_VCALL1(cpu.write_cr0, x);
115}
116
117static inline unsigned long read_cr2(void)
118{
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef _ASM_X86_PARAVIRT_H
3#define _ASM_X86_PARAVIRT_H
4/* Various instructions on x86 need to be replaced for
5 * para-virtualization: those hooks are defined here. */
6
7#ifdef CONFIG_PARAVIRT
8#include <asm/pgtable_types.h>

--- 102 unchanged lines hidden (view full) ---

111
112static inline void write_cr0(unsigned long x)
113{
114 PVOP_VCALL1(cpu.write_cr0, x);
115}
116
117static inline unsigned long read_cr2(void)
118{
119 return PVOP_CALL0(unsigned long, mmu.read_cr2);
119 return PVOP_CALLEE0(unsigned long, mmu.read_cr2);
120}
121
122static inline void write_cr2(unsigned long x)
123{
124 PVOP_VCALL1(mmu.write_cr2, x);
125}
126
127static inline unsigned long __read_cr3(void)

--- 776 unchanged lines hidden (view full) ---

904 * special. Either way, we don't need to save any registers for
905 * it.
906 */
907#define SWAPGS \
908 PARA_SITE(PARA_PATCH(PV_CPU_swapgs), \
909 ANNOTATE_RETPOLINE_SAFE; \
910 call PARA_INDIRECT(pv_ops+PV_CPU_swapgs); \
911 )
120}
121
122static inline void write_cr2(unsigned long x)
123{
124 PVOP_VCALL1(mmu.write_cr2, x);
125}
126
127static inline unsigned long __read_cr3(void)

--- 776 unchanged lines hidden (view full) ---

904 * special. Either way, we don't need to save any registers for
905 * it.
906 */
907#define SWAPGS \
908 PARA_SITE(PARA_PATCH(PV_CPU_swapgs), \
909 ANNOTATE_RETPOLINE_SAFE; \
910 call PARA_INDIRECT(pv_ops+PV_CPU_swapgs); \
911 )
912#endif
913
912
914#define GET_CR2_INTO_RAX \
915 ANNOTATE_RETPOLINE_SAFE; \
916 call PARA_INDIRECT(pv_ops+PV_MMU_read_cr2);
917
918#ifdef CONFIG_PARAVIRT_XXL
919#define USERGS_SYSRET64 \
920 PARA_SITE(PARA_PATCH(PV_CPU_usergs_sysret64), \
921 ANNOTATE_RETPOLINE_SAFE; \
922 jmp PARA_INDIRECT(pv_ops+PV_CPU_usergs_sysret64);)
923
924#ifdef CONFIG_DEBUG_ENTRY
925#define SAVE_FLAGS(clobbers) \
926 PARA_SITE(PARA_PATCH(PV_IRQ_save_fl), \
927 PV_SAVE_REGS(clobbers | CLBR_CALLEE_SAVE); \
928 ANNOTATE_RETPOLINE_SAFE; \
929 call PARA_INDIRECT(pv_ops+PV_IRQ_save_fl); \
930 PV_RESTORE_REGS(clobbers | CLBR_CALLEE_SAVE);)
931#endif
913#define USERGS_SYSRET64 \
914 PARA_SITE(PARA_PATCH(PV_CPU_usergs_sysret64), \
915 ANNOTATE_RETPOLINE_SAFE; \
916 jmp PARA_INDIRECT(pv_ops+PV_CPU_usergs_sysret64);)
917
918#ifdef CONFIG_DEBUG_ENTRY
919#define SAVE_FLAGS(clobbers) \
920 PARA_SITE(PARA_PATCH(PV_IRQ_save_fl), \
921 PV_SAVE_REGS(clobbers | CLBR_CALLEE_SAVE); \
922 ANNOTATE_RETPOLINE_SAFE; \
923 call PARA_INDIRECT(pv_ops+PV_IRQ_save_fl); \
924 PV_RESTORE_REGS(clobbers | CLBR_CALLEE_SAVE);)
925#endif
932#endif
926#endif /* CONFIG_PARAVIRT_XXL */
927#endif /* CONFIG_X86_64 */
933
928
934#endif /* CONFIG_X86_32 */
929#ifdef CONFIG_PARAVIRT_XXL
935
930
931#define GET_CR2_INTO_AX \
932 PARA_SITE(PARA_PATCH(PV_MMU_read_cr2), \
933 ANNOTATE_RETPOLINE_SAFE; \
934 call PARA_INDIRECT(pv_ops+PV_MMU_read_cr2); \
935 )
936
937#endif /* CONFIG_PARAVIRT_XXL */
938
939
936#endif /* __ASSEMBLY__ */
937#else /* CONFIG_PARAVIRT */
938# define default_banner x86_init_noop
939#endif /* !CONFIG_PARAVIRT */
940
941#ifndef __ASSEMBLY__
942#ifndef CONFIG_PARAVIRT_XXL
943static inline void paravirt_arch_dup_mmap(struct mm_struct *oldmm,

--- 12 unchanged lines hidden ---
940#endif /* __ASSEMBLY__ */
941#else /* CONFIG_PARAVIRT */
942# define default_banner x86_init_noop
943#endif /* !CONFIG_PARAVIRT */
944
945#ifndef __ASSEMBLY__
946#ifndef CONFIG_PARAVIRT_XXL
947static inline void paravirt_arch_dup_mmap(struct mm_struct *oldmm,

--- 12 unchanged lines hidden ---