cpumctx.h revision 0b74a2f80aba476dc8be8bc1c63891fc53945986
/** @file
* CPUM - CPU Monitor(/ Manager), Context Structures.
*/
/*
* Copyright (C) 2006-2010 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*
* The contents of this file may alternatively be used under the terms
* of the Common Development and Distribution License Version 1.0
* (CDDL) only, as it comes in the "COPYING.CDDL" file of the
* VirtualBox OSE distribution, in which case the provisions of the
* CDDL are applicable instead of those of the GPL.
*
* You may elect to license modified versions of this file under the
* terms and conditions of either the GPL or the CDDL or both.
*/
#ifndef ___VBox_vmm_cpumctx_h
#define ___VBox_vmm_cpumctx_h
/** @addgroup grp_cpum_ctx The CPUM Context Structures
* @ingroup grp_cpum
* @{
*/
/**
* Selector hidden registers.
*/
typedef struct CPUMSELREGHID
{
/** Base register.
*
* Long mode remarks:
* - Unused in long mode for CS, DS, ES, SS
* - 32 bits for FS & GS; FS(GS)_BASE msr used for the base address
* - 64 bits for TR & LDTR
*/
/** Limit (expanded). */
/** Flags.
* This is the high 32-bit word of the descriptor entry.
* Only the flags, dpl and type are used. */
/**
* The sysenter register set.
*/
typedef struct CPUMSYSENTER
{
/** Ring 0 cs.
* This value + 8 is the Ring 0 ss.
* This value + 16 is the Ring 3 cs.
* This value + 24 is the Ring 3 ss.
*/
/** Ring 0 eip. */
/** Ring 0 esp. */
} CPUMSYSENTER;
/**
* CPU context core.
*/
#ifndef VBOX_WITHOUT_UNNAMED_UNIONS
#pragma pack(1)
typedef struct CPUMCTXCORE
{
union
{
};
union
{
};
union
{
};
union
{
};
union
{
};
union
{
};
union
{
};
union
{
};
/* Note: lss esp, [] in the switcher needs some space, so we reserve it here instead of relying on the exact esp & ss layout as before. */
union
{
};
union
{
};
/** Hidden selector registers.
* @{ */
/** @} */
} CPUMCTXCORE;
#pragma pack()
#else /* VBOX_WITHOUT_UNNAMED_UNIONS */
typedef struct CPUMCTXCORE CPUMCTXCORE;
#endif /* VBOX_WITHOUT_UNNAMED_UNIONS */
/**
* CPU context.
*/
#ifndef VBOX_WITHOUT_UNNAMED_UNIONS
# pragma pack(1)
typedef struct CPUMCTX
{
/** FPU state. (16-byte alignment)
* @todo This doesn't have to be in X86FXSTATE on CPUs without fxsr - we need a type for the
* actual format or convert it (waste of time). */
/** CPUMCTXCORE Part.
* @{ */
union
{
};
union
{
};
union
{
};
union
{
};
union
{
};
union
{
};
union
{
};
union
{
};
/** @note lss esp, [] in the switcher needs some space, so we reserve it here
* instead of relying on the exact esp & ss layout as before (prevented
* us from using a union with rsp). */
union
{
};
union
{
};
/** Hidden selector registers.
* @{ */
/** @} */
/** @} */
/** Control registers.
* @{ */
/** @} */
/** Debug registers.
* @remarks DR4 and DR5 should not be used since they are aliases for
* DR6 and DR7 respectively on both AMD and Intel CPUs.
* @remarks DR8-15 are currently not supported by AMD or Intel, so
* neither do we.
* @{ */
/** @} */
/** Global Descriptor Table register. */
/** Interrupt Descriptor Table register. */
/** The task register.
* Only the guest context uses all the members. */
/** The task register.
* Only the guest context uses all the members. */
/** The sysenter msr registers.
* This member is not used by the hypervisor context. */
/** System MSRs.
* @{ */
/** @} */
/** Hidden selector registers.
* @{ */
/** @} */
# if 0
/** Padding to align the size on a 64 byte boundary. */
# endif
} CPUMCTX;
# pragma pack()
#else /* VBOX_WITHOUT_UNNAMED_UNIONS */
#endif /* VBOX_WITHOUT_UNNAMED_UNIONS */
/**
* Gets the CPUMCTXCORE part of a CPUMCTX.
*/
/**
* Selector hidden registers, for version 1.6 saved state.
*/
typedef struct CPUMSELREGHID_VER1_6
{
/** Base register. */
/** Limit (expanded). */
/** Flags.
* This is the high 32-bit word of the descriptor entry.
* Only the flags, dpl and type are used. */
/**
* CPU context, for version 1.6 saved state.
* @remarks PATM uses this, which is why it has to be here.
*/
#ifndef VBOX_WITHOUT_UNNAMED_UNIONS
# pragma pack(1)
typedef struct CPUMCTX_VER1_6
{
/** FPU state. (16-byte alignment)
* @todo This doesn't have to be in X86FXSTATE on CPUs without fxsr - we need a type for the
* actual format or convert it (waste of time). */
/** CPUMCTXCORE Part.
* @{ */
union
{
};
union
{
};
union
{
};
union
{
};
union
{
};
union
{
};
union
{
};
/** @note We rely on the exact layout, because we use lss esp, [] in the
* switcher. */
/* Note: no overlap with esp here. */
union
{
};
union
{
};
/** Hidden selector registers.
* @{ */
/** @} */
/** @} */
/** Control registers.
* @{ */
/** @} */
/** Debug registers.
* @{ */
/* DR8-15 are currently not supported */
/** @} */
/** Global Descriptor Table register. */
/** Interrupt Descriptor Table register. */
/** The task register.
* Only the guest context uses all the members. */
/** The task register.
* Only the guest context uses all the members. */
/** The sysenter msr registers.
* This member is not used by the hypervisor context. */
/** System MSRs.
* @{ */
/** @} */
/** Hidden selector registers.
* @{ */
/** @} */
/** padding to get 32byte aligned size. */
#pragma pack()
#else /* VBOX_WITHOUT_UNNAMED_UNIONS */
typedef struct CPUMCTX_VER1_6 CPUMCTX_VER1_6;
#endif /* VBOX_WITHOUT_UNNAMED_UNIONS */
/**
* Guest MSR state.
*
* @note Never change the order here because of saved stated!
*/
typedef union CPUMCTXMSR
{
struct
{
} msr;
} CPUMCTXMSR;
/** Pointer to the guest MSR state. */
typedef CPUMCTXMSR *PCPUMCTXMSR;
/** Pointer to the const guest MSR state. */
typedef const CPUMCTXMSR *PCCPUMCTXMSR;
/**
* The register set returned by a CPUID operation.
*/
typedef struct CPUMCPUID
{
} CPUMCPUID;
/** Pointer to a CPUID leaf. */
typedef CPUMCPUID *PCPUMCPUID;
/** Pointer to a const CPUID leaf. */
typedef const CPUMCPUID *PCCPUMCPUID;
/** @} */
#endif