CPUMInternal.h revision 224509fa8d22e75b8db1b6a8b6e2d26cbc1e13e0
/* $Id$ */
/** @file
* CPUM - Internal header file.
*/
/*
* Copyright (C) 2006 InnoTek Systemberatung GmbH
*
* 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 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.
*
* If you received this file as part of a commercial VirtualBox
* distribution, then only the terms of your commercial VirtualBox
* license agreement apply instead of the previous paragraph.
*/
#ifndef __CPUMInternal_h__
#define __CPUMInternal_h__
# error "Not in CPUM! This is an internal header!"
#endif
/** @defgroup grp_cpum_int Internals
* @ingroup grp_cpum
* @internal
* @{
*/
/** Flags and types for CPUM fault handlers
* @{ */
/** Type: Load DS */
#define CPUM_HANDLER_DS 1
/** Type: Load ES */
#define CPUM_HANDLER_ES 2
/** Type: Load FS */
#define CPUM_HANDLER_FS 3
/** Type: Load GS */
#define CPUM_HANDLER_GS 4
/** Type: IRET */
#define CPUM_HANDLER_IRET 5
/** Type mask. */
#define CPUM_HANDLER_TYPEMASK 0xff
/** If set EBP points to the CPUMCTXCORE that's being used. */
/** @} */
/** Use flags (CPUM::fUseFlags).
* (Don't forget to sync this with CPUMInternal.mac!)
* @{ */
/** Used the FPU, SSE or such stuff. */
#define CPUM_USED_FPU BIT(0)
/** Used the FPU, SSE or such stuff since last we were in REM.
* REM syncing is clearing this, lazy FPU is setting it. */
/** Host OS is using SYSENTER and we must NULL the CS. */
/** Host OS is using SYSENTER and we must NULL the CS. */
/** Debug registers are used by host and must be disabled. */
/** Enabled use of debug registers in guest context. */
/** @} */
/**
* The save host CPU state.
*/
typedef struct CPUMHOSTCTX
{
/** FPU state. (16-byte alignment)
* @remark On x86, the format isn't necessarily X86FXSTATE (not important). */
#if HC_ARCH_BITS == 32
/** General purpose register, selectors, flags and more
* @{ */
//uint32_t eax; - scratch
//uint32_t ecx; - scratch
//uint32_t edx; - scratch
/* lss pair */
//uint32_t eip; - scratch
/** @} */
/** Control registers.
* @{ */
//uint32_t cr2; - scratch
/** @} */
/** Debug registers.
* @{ */
/** @} */
/** Global Descriptor Table register. */
/** Interrupt Descriptor Table register. */
/** The task register. */
/** The task register. */
/** The sysenter msr registers.
* This member is not used by the hypervisor context. */
/* padding to get 32byte aligned size */
/** General purpose register ++
* { */
//uint64_t rax; - scratch
//uint64_t rcx; - scratch
//uint64_t rdx; - scratch
//uint64_t r8; - scratch
//uint64_t r9; - scratch
//uint64_t rip; - scratch
/** @} */
/** Selector registers
* @{ */
/** @} */
/** Control registers.
* @{ */
//uint64_t cr2; - scratch
/** @} */
/** Debug registers.
* @{ */
/** @} */
/** Global Descriptor Table register. */
/** Interrupt Descriptor Table register. */
/** The task register. */
/** The task register. */
/** MSRs
* @{ */
/** @} */
/* padding to get 32byte aligned size */
#else
#endif
} CPUMHOSTCTX, *PCPUMHOSTCTX;
/**
* Converts a CPUM pointer into a VM pointer.
* @returns Pointer to the VM structure the CPUM is part of.
* @param pCPUM Pointer to CPUM instance data.
*/
/**
* CPUM Data (part of VM)
*/
#pragma pack(1)
typedef struct CPUM
{
/** Offset to the VM structure. */
/** Pointer to CPU structure in GC. */
/** Pointer to CPU structure in HC. */
/** Force 32byte alignment of the next member. */
/**
* Saved host context. Only valid while inside GC.
* Must be aligned on 16 byte boundrary.
*/
/**
* Hypervisor context.
* Must be aligned on 16 byte boundrary.
*/
/**
* Guest context.
* Must be aligned on 16 byte boundrary.
*/
/** Pointer to the current hypervisor core context - HCPtr. */
/** Pointer to the current hypervisor core context - GCPtr. */
/** Use flags.
* These flags indicates both what is to be used and what have been used.
*/
/** Changed flags.
* These flags indicates to REM (and others) which important guest
* registers which has been changed since last time the flags were cleared.
* See the CPUM_CHANGED_* defines for what we keep track of.
*/
/** Hidden selector registers state.
* Valid (hw accelerated raw mode) or not (normal raw mode)
*/
/** Host CPU Features - ECX */
struct
{
/** edx part */
/** ecx part */
} CPUFeatures;
/** CR4 mask */
struct
{
} CR4;
/** Have we entered rawmode? */
bool fRawEntered;
/** The standard set of CpuId leafs. */
/** The extended set of CpuId leafs. */
/** The default set of CpuId leafs. */
/**
* Guest context on raw mode entry.
* This a debug feature.
*/
#pragma pack()
#ifdef IN_RING3
#endif
/** @} */
#endif