843e19887f64dde75055cf8842fc4db2171eff45johnlev/******************************************************************************
843e19887f64dde75055cf8842fc4db2171eff45johnlev * Guest OS interface to x86 32-bit Xen.
843e19887f64dde75055cf8842fc4db2171eff45johnlev * Permission is hereby granted, free of charge, to any person obtaining a copy
843e19887f64dde75055cf8842fc4db2171eff45johnlev * of this software and associated documentation files (the "Software"), to
843e19887f64dde75055cf8842fc4db2171eff45johnlev * deal in the Software without restriction, including without limitation the
843e19887f64dde75055cf8842fc4db2171eff45johnlev * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
843e19887f64dde75055cf8842fc4db2171eff45johnlev * sell copies of the Software, and to permit persons to whom the Software is
843e19887f64dde75055cf8842fc4db2171eff45johnlev * furnished to do so, subject to the following conditions:
843e19887f64dde75055cf8842fc4db2171eff45johnlev * The above copyright notice and this permission notice shall be included in
843e19887f64dde75055cf8842fc4db2171eff45johnlev * all copies or substantial portions of the Software.
843e19887f64dde75055cf8842fc4db2171eff45johnlev * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
843e19887f64dde75055cf8842fc4db2171eff45johnlev * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
843e19887f64dde75055cf8842fc4db2171eff45johnlev * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
843e19887f64dde75055cf8842fc4db2171eff45johnlev * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
843e19887f64dde75055cf8842fc4db2171eff45johnlev * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
843e19887f64dde75055cf8842fc4db2171eff45johnlev * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
843e19887f64dde75055cf8842fc4db2171eff45johnlev * DEALINGS IN THE SOFTWARE.
a576ab5b6e08c47732b3dedca9eaa8a8cbb85720rab * Copyright (c) 2004-2007, K A Fraser
843e19887f64dde75055cf8842fc4db2171eff45johnlev * Hypercall interface:
843e19887f64dde75055cf8842fc4db2171eff45johnlev * Input: %ebx, %ecx, %edx, %esi, %edi (arguments 1-5)
843e19887f64dde75055cf8842fc4db2171eff45johnlev * Output: %eax
843e19887f64dde75055cf8842fc4db2171eff45johnlev * Access is via hypercall page (set up by guest loader or via a Xen MSR):
843e19887f64dde75055cf8842fc4db2171eff45johnlev * call hypercall_page + hypercall-number * 32
843e19887f64dde75055cf8842fc4db2171eff45johnlev * Clobbered: Argument registers (e.g., 2-arg hypercall clobbers %ebx,%ecx)
349b53dd4e695e3d833b5380540385145b2d3ae8Stuart Maybee * Direct hypercall interface:
843e19887f64dde75055cf8842fc4db2171eff45johnlev * As above, except the entry sequence to the hypervisor is:
843e19887f64dde75055cf8842fc4db2171eff45johnlev * mov $hypercall-number*32,%eax ; int $0x82
843e19887f64dde75055cf8842fc4db2171eff45johnlev#if !defined(_ASM)
843e19887f64dde75055cf8842fc4db2171eff45johnlev * These flat segments are in the Xen-private section of every GDT. Since these
843e19887f64dde75055cf8842fc4db2171eff45johnlev * are also present in the initial GDT, many OSes will be able to avoid
843e19887f64dde75055cf8842fc4db2171eff45johnlev * installing their own GDT.
349b53dd4e695e3d833b5380540385145b2d3ae8Stuart Maybee/* Non-PAE bounds are obsolete. */
843e19887f64dde75055cf8842fc4db2171eff45johnlev#define __HYPERVISOR_VIRT_START __HYPERVISOR_VIRT_START_PAE
843e19887f64dde75055cf8842fc4db2171eff45johnlev#define __MACH2PHYS_VIRT_START __MACH2PHYS_VIRT_START_PAE
843e19887f64dde75055cf8842fc4db2171eff45johnlev#define __MACH2PHYS_VIRT_END __MACH2PHYS_VIRT_END_PAE
843e19887f64dde75055cf8842fc4db2171eff45johnlev#define HYPERVISOR_VIRT_START mk_unsigned_long(__HYPERVISOR_VIRT_START)
843e19887f64dde75055cf8842fc4db2171eff45johnlev#define MACH2PHYS_VIRT_START mk_unsigned_long(__MACH2PHYS_VIRT_START)
843e19887f64dde75055cf8842fc4db2171eff45johnlev#define MACH2PHYS_VIRT_END mk_unsigned_long(__MACH2PHYS_VIRT_END)
843e19887f64dde75055cf8842fc4db2171eff45johnlev#define MACH2PHYS_NR_ENTRIES ((MACH2PHYS_VIRT_END-MACH2PHYS_VIRT_START)>>2)
843e19887f64dde75055cf8842fc4db2171eff45johnlev#define machine_to_phys_mapping ((unsigned long *)MACH2PHYS_VIRT_START)
a576ab5b6e08c47732b3dedca9eaa8a8cbb85720rab/* 32-/64-bit invariability for control interfaces (domctl/sysctl). */
349b53dd4e695e3d833b5380540385145b2d3ae8Stuart Maybee#define ___DEFINE_XEN_GUEST_HANDLE(name, type) \
a576ab5b6e08c47732b3dedca9eaa8a8cbb85720rab typedef struct { type *p; } \
a576ab5b6e08c47732b3dedca9eaa8a8cbb85720rab typedef struct { union { type *p; uint64_aligned_t q; }; } \
349b53dd4e695e3d833b5380540385145b2d3ae8Stuart Maybee#else /* __GNUC__ */
349b53dd4e695e3d833b5380540385145b2d3ae8Stuart Maybee * Workaround for 6671857.
349b53dd4e695e3d833b5380540385145b2d3ae8Stuart Maybee#define ___DEFINE_XEN_GUEST_HANDLE(name, type) \
a576ab5b6e08c47732b3dedca9eaa8a8cbb85720rab typedef struct { type *p; } \
349b53dd4e695e3d833b5380540385145b2d3ae8Stuart Maybee typedef struct { union { type *p; uint64_aligned_t q; } u; }\
349b53dd4e695e3d833b5380540385145b2d3ae8Stuart Maybee#endif /* __GNUC__ */
a576ab5b6e08c47732b3dedca9eaa8a8cbb85720rab } while ( 0 )
349b53dd4e695e3d833b5380540385145b2d3ae8Stuart Maybee#define uint64_aligned_t uint64_t __attribute__((aligned(8)))
349b53dd4e695e3d833b5380540385145b2d3ae8Stuart Maybee#define __XEN_GUEST_HANDLE_64(name) __guest_handle_64_ ## name
349b53dd4e695e3d833b5380540385145b2d3ae8Stuart Maybee#define XEN_GUEST_HANDLE_64(name) __XEN_GUEST_HANDLE_64(name)
843e19887f64dde75055cf8842fc4db2171eff45johnlev uint32_t eflags; /* eflags.IF == !saved_upcall_mask */
843e19887f64dde75055cf8842fc4db2171eff45johnlev * Page-directory addresses above 4GB do not fit into architectural %cr3.
843e19887f64dde75055cf8842fc4db2171eff45johnlev * When accessing %cr3, or equivalent field in vcpu_guest_context, guests
843e19887f64dde75055cf8842fc4db2171eff45johnlev * must use the following accessor macros to pack/unpack valid MFNs.
843e19887f64dde75055cf8842fc4db2171eff45johnlev#define xen_pfn_to_cr3(pfn) (((unsigned)(pfn) << 12) | ((unsigned)(pfn) >> 20))
843e19887f64dde75055cf8842fc4db2171eff45johnlev#define xen_cr3_to_pfn(cr3) (((unsigned)(cr3) >> 12) | ((unsigned)(cr3) << 20))
843e19887f64dde75055cf8842fc4db2171eff45johnlev unsigned long pad[5]; /* sizeof(vcpu_info_t) == 64 */
843e19887f64dde75055cf8842fc4db2171eff45johnlev * Structure used to capture the register state at panic time. This struct
843e19887f64dde75055cf8842fc4db2171eff45johnlev * is built to mimic a similar structure in Solaris. If there is interest
843e19887f64dde75055cf8842fc4db2171eff45johnlev * in making this panic implementation an official part of Xen, this should
843e19887f64dde75055cf8842fc4db2171eff45johnlev * be made more platform-neutral.
843e19887f64dde75055cf8842fc4db2171eff45johnlev#endif /* !__ASSEMBLY__ */
843e19887f64dde75055cf8842fc4db2171eff45johnlev/* Offsets of each field in the xen_panic_regs structure. */
843e19887f64dde75055cf8842fc4db2171eff45johnlev#endif /* __XEN_PUBLIC_ARCH_X86_XEN_X86_32_H__ */
843e19887f64dde75055cf8842fc4db2171eff45johnlev * Local variables:
843e19887f64dde75055cf8842fc4db2171eff45johnlev * c-set-style: "BSD"
843e19887f64dde75055cf8842fc4db2171eff45johnlev * c-basic-offset: 4
843e19887f64dde75055cf8842fc4db2171eff45johnlev * tab-width: 4
843e19887f64dde75055cf8842fc4db2171eff45johnlev * indent-tabs-mode: nil