xen.h revision 349b53dd4e695e3d833b5380540385145b2d3ae8
/******************************************************************************
*
* Guest OS interface to x86 Xen.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
* deal in the Software without restriction, including without limitation the
* sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
* Copyright (c) 2004-2006, K A Fraser
*/
#include "../xen.h"
#ifndef __XEN_PUBLIC_ARCH_X86_XEN_H__
#define __XEN_PUBLIC_ARCH_X86_XEN_H__
/* Structural guest handles introduced in 0x00030201. */
#if __XEN_INTERFACE_VERSION__ >= 0x00030201
#else
#endif
#ifdef __XEN_TOOLS__
#endif
#if defined(__i386__)
#include "xen-x86_32.h"
#elif defined(__x86_64__)
#include "xen-x86_64.h"
#endif
#ifndef __ASSEMBLY__
typedef unsigned long xen_pfn_t;
#define PRI_xen_pfn "lx"
#endif
/*
* SEGMENT DESCRIPTOR TABLES
*/
/*
* A number of GDT entries are reserved by Xen. These are not situated at the
* start of the GDT because some stupid OSes export hard-coded selector values
* in their ABI. These hard-coded values are always near the start of the GDT,
* so Xen places itself out of the way, at the far end of the GDT.
*/
#define FIRST_RESERVED_GDT_PAGE 14
/* Maximum number of virtual CPUs in multi-processor guests. */
#define MAX_VIRT_CPUS 32
/* Machine check support */
#include "xen-mca.h"
#ifndef __ASSEMBLY__
typedef unsigned long xen_ulong_t;
/*
* Send an array of these to HYPERVISOR_set_trap_table().
* The privilege level specifies which modes may enter a trap via a software
* interrupt. On x86/64, since rings 1 and 2 are unavailable, we allocate
* privilege levels as follows:
* Level == 0: Noone may enter
* Level == 1: Kernel may enter
* Level == 2: Kernel may enter
* Level == 3: Everyone may enter
*/
struct trap_info {
unsigned long address; /* code offset */
};
typedef struct trap_info trap_info_t;
/*
* The following is all CPU context. Note that the fpu_ctxt block is filled
* in by FXSAVE if the CPU has feature FXSR; otherwise FSAVE is used.
*/
struct vcpu_guest_context {
#define VGCF_I387_VALID (1<<0)
#define _VGCF_i387_valid 0
#define _VGCF_in_kernel 2
#define _VGCF_failsafe_disables_events 3
#define _VGCF_syscall_disables_events 4
#define _VGCF_online 5
unsigned long flags; /* VGCF_* flags */
/* NB. User pagetable on x86/64 is placed in ctrlreg[1]. */
#ifdef __i386__
unsigned long event_callback_cs; /* CS:EIP of event callback */
unsigned long event_callback_eip;
unsigned long failsafe_callback_cs; /* CS:EIP of failsafe callback */
unsigned long failsafe_callback_eip;
#else
unsigned long event_callback_eip;
unsigned long failsafe_callback_eip;
#ifdef __XEN__
union {
unsigned long syscall_callback_eip;
struct {
unsigned int event_callback_cs; /* compat CS of event cb */
unsigned int failsafe_callback_cs; /* compat CS of failsafe cb */
};
};
#else
unsigned long syscall_callback_eip;
#endif
#endif
unsigned long vm_assist; /* VMASST_TYPE_* bitmap */
#ifdef __x86_64__
/* Segment base addresses. */
#endif
};
typedef struct vcpu_guest_context vcpu_guest_context_t;
struct arch_shared_info {
unsigned long max_pfn; /* max pfn that appears in table */
/* Frame containing list of mfns containing list of mfns containing p2m. */
unsigned long nmi_reason;
};
typedef struct arch_shared_info arch_shared_info_t;
#define MCA_PANICDATA_VERS 1
typedef struct xpv_mca_panic_data {
int mpd_fwdptr_offset;
int mpd_revptr_offset;
int mpd_dataptr_offset;
void *mpd_urgent_processing;
void *mpd_urgent_dangling;
void *mpd_urgent_committed;
void *mpd_nonurgent_processing;
void *mpd_nonurgent_dangling;
void *mpd_nonurgent_committed;
typedef struct panic_regs panic_regs_t;
struct panic_info {
int pi_version; /* panic_info format version */
void *pi_apic; /* local APIC address */
char *pi_panicstr; /* panic message */
void *pi_ram_start; /* Start of all-RAM mapping region */
void *pi_ram_end; /* End of all-RAM mapping region */
void *pi_xen_start; /* Start of Xen's text/heap */
void *pi_xen_end; /* End of Xen's text/heap */
void *pi_stktop; /* Top of current Xen stack */
int pi_dom0cpu; /* cpu number - if a dom0 panic */
};
struct panic_frame {
unsigned long pf_fp;
unsigned long pf_pc;
};
#define PANIC_INFO_VERSION 3
#endif /* !__ASSEMBLY__ */
/*
* Prefix forces emulation of some non-trapping instructions.
* Currently only CPUID.
*/
#ifdef __ASSEMBLY__
#else
#define XEN_EMULATE_PREFIX ".byte 0x0f,0x0b,0x78,0x65,0x6e ; "
#endif
#endif /* __XEN_PUBLIC_ARCH_X86_XEN_H__ */
/*
* Local variables:
* mode: C
* c-set-style: "BSD"
* c-basic-offset: 4
* tab-width: 4
* indent-tabs-mode: nil
* End:
*/