1 /******************************************************************************
4 * Guest OS interface to x86 Xen.
6 * SPDX-License-Identifier: MIT
8 * Copyright (c) 2004-2006, K A Fraser
13 #ifndef __XEN_PUBLIC_ARCH_X86_XEN_H__
14 #define __XEN_PUBLIC_ARCH_X86_XEN_H__
16 /* Structural guest handles introduced in 0x00030201. */
17 #if __XEN_INTERFACE_VERSION__ >= 0x00030201
18 #define ___DEFINE_XEN_GUEST_HANDLE(name, type) \
19 typedef struct { type *p; } __guest_handle_ ## name
21 #define ___DEFINE_XEN_GUEST_HANDLE(name, type) \
22 typedef type * __guest_handle_ ## name
26 * XEN_GUEST_HANDLE represents a guest pointer, when passed as a field
27 * in a struct in memory.
28 * XEN_GUEST_HANDLE_PARAM represent a guest pointer, when passed as an
30 * XEN_GUEST_HANDLE_PARAM and XEN_GUEST_HANDLE are the same on X86 but
31 * they might not be on other architectures.
33 #define __DEFINE_XEN_GUEST_HANDLE(name, type) \
34 ___DEFINE_XEN_GUEST_HANDLE(name, type); \
35 ___DEFINE_XEN_GUEST_HANDLE(const_##name, const type)
36 #define DEFINE_XEN_GUEST_HANDLE(name) __DEFINE_XEN_GUEST_HANDLE(name, name)
37 #define __XEN_GUEST_HANDLE(name) __guest_handle_ ## name
38 #define XEN_GUEST_HANDLE(name) __XEN_GUEST_HANDLE(name)
39 #define XEN_GUEST_HANDLE_PARAM(name) XEN_GUEST_HANDLE(name)
40 #define set_xen_guest_handle_raw(hnd, val) do { (hnd).p = val; } while (0)
42 #define get_xen_guest_handle(val, hnd) do { val = (hnd).p; } while (0)
44 #define set_xen_guest_handle(hnd, val) set_xen_guest_handle_raw(hnd, val)
46 #if defined (MDE_CPU_IA32)
47 #include "xen-x86_32.h"
48 #elif defined (MDE_CPU_X64)
49 #include "xen-x86_64.h"
53 typedef UINTN xen_pfn_t
;
54 #define PRI_xen_pfn "lx"
57 #define XEN_HAVE_PV_UPCALL_MASK 1
59 /* Maximum number of virtual CPUs in legacy multi-processor guests. */
60 #define XEN_LEGACY_MAX_VCPUS 32
64 typedef UINTN xen_ulong_t
;
65 #define PRI_xen_ulong "lx"
67 typedef UINT64 tsc_timestamp_t
; /* RDTSC timestamp */
72 struct arch_shared_info
{
73 UINTN max_pfn
; /* max pfn that appears in table */
74 /* Frame containing list of mfns containing list of mfns containing p2m. */
75 xen_pfn_t pfn_to_mfn_frame_list_list
;
80 typedef struct arch_shared_info arch_shared_info_t
;
85 #endif /* !__ASSEMBLY__ */
87 #endif /* __XEN_PUBLIC_ARCH_X86_XEN_H__ */
95 * indent-tabs-mode: nil