linux/arch/x86/include/asm/xen/interface_64.h

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

/*
 * 64-bit segment selectors
 * These flat segments are in the Xen-private section of every GDT. Since these
 * are also present in the initial GDT, many OSes will be able to avoid
 * installing their own GDT.
 */

#define FLAT_RING3_CS32
#define FLAT_RING3_CS64
#define FLAT_RING3_DS32
#define FLAT_RING3_DS64
#define FLAT_RING3_SS32
#define FLAT_RING3_SS64

#define FLAT_KERNEL_DS64
#define FLAT_KERNEL_DS32
#define FLAT_KERNEL_DS
#define FLAT_KERNEL_CS64
#define FLAT_KERNEL_CS32
#define FLAT_KERNEL_CS
#define FLAT_KERNEL_SS64
#define FLAT_KERNEL_SS32
#define FLAT_KERNEL_SS

#define FLAT_USER_DS64
#define FLAT_USER_DS32
#define FLAT_USER_DS
#define FLAT_USER_CS64
#define FLAT_USER_CS32
#define FLAT_USER_CS
#define FLAT_USER_SS64
#define FLAT_USER_SS32
#define FLAT_USER_SS

#define __HYPERVISOR_VIRT_START
#define __HYPERVISOR_VIRT_END
#define __MACH2PHYS_VIRT_START
#define __MACH2PHYS_VIRT_END
#define __MACH2PHYS_SHIFT

/*
 * int HYPERVISOR_set_segment_base(unsigned int which, unsigned long base)
 *  @which == SEGBASE_*  ;  @base == 64-bit base address
 * Returns 0 on success.
 */
#define SEGBASE_FS
#define SEGBASE_GS_USER
#define SEGBASE_GS_KERNEL
#define SEGBASE_GS_USER_SEL

/*
 * int HYPERVISOR_iret(void)
 * All arguments are on the kernel stack, in the following format.
 * Never returns if successful. Current kernel context is lost.
 * The saved CS is mapped as follows:
 *   RING0 -> RING3 kernel mode.
 *   RING1 -> RING3 kernel mode.
 *   RING2 -> RING3 kernel mode.
 *   RING3 -> RING3 user mode.
 * However RING0 indicates that the guest kernel should return to itself
 * directly with
 *      orb   $3,1*8(%rsp)
 *      iretq
 * If flags contains VGCF_in_syscall:
 *   Restore RAX, RIP, RFLAGS, RSP.
 *   Discard R11, RCX, CS, SS.
 * Otherwise:
 *   Restore RAX, R11, RCX, CS:RIP, RFLAGS, SS:RSP.
 * All other registers are saved on hypercall entry and restored to user.
 */
/* Guest exited in SYSCALL context? Return to guest with SYSRET? */
#define _VGCF_in_syscall
#define VGCF_in_syscall
#define VGCF_IN_SYSCALL

#ifndef __ASSEMBLY__

struct iret_context {};

#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
/* Anonymous union includes both 32- and 64-bit names (e.g., eax/rax). */
#define __DECL_REG
#else
/* Non-gcc sources must always use the proper 64-bit name (e.g., rax). */
#define __DECL_REG
#endif

struct cpu_user_regs {};
DEFINE_GUEST_HANDLE_STRUCT();

#undef __DECL_REG

#define xen_pfn_to_cr3(pfn)
#define xen_cr3_to_pfn(cr3)

struct arch_vcpu_info {};

xen_callback_t;

#define XEN_CALLBACK(__cs, __rip)

#endif /* !__ASSEMBLY__ */


#endif /* _ASM_X86_XEN_INTERFACE_64_H */