SELMInternal.h revision 2af0dd14e6c1c9297537694bd8ff24ae5838620c
/* $Id$ */
/** @file
* SELM - Internal header file.
*/
/*
* Copyright (C) 2006-2007 Sun Microsystems, Inc.
*
* 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.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
* Clara, CA 95054 USA or visit http://www.sun.com if you need
* additional information or have any questions.
*/
#ifndef ___SELMInternal_h
#define ___SELMInternal_h
/** @defgroup grp_selm_int Internals
* @ingroup grp_selm
* @internal
* @{
*/
/** The number of GDTS allocated for our GDT. (full size) */
#define SELM_GDT_ELEMENTS 8192
/** aHyperSel index to retrieve hypervisor selectors */
/** The Flat CS selector used by the VMM inside the GC. */
#define SELM_HYPER_SEL_CS 0
/** The Flat DS selector used by the VMM inside the GC. */
#define SELM_HYPER_SEL_DS 1
/** The 64-bit mode CS selector used by the VMM inside the GC. */
#define SELM_HYPER_SEL_CS64 2
/** The TSS selector used by the VMM inside the GC. */
#define SELM_HYPER_SEL_TSS 3
/** The TSS selector for taking trap 08 (\#DF). */
#define SELM_HYPER_SEL_TSS_TRAP08 4
/** Number of GDTs we need for internal use */
/** Default GDT selectors we use for the hypervisor. */
/** The lowest value default we use. */
/**
* Converts a SELM pointer into a VM pointer.
* @returns Pointer to the VM structure the SELM is part of.
* @param pSELM Pointer to SELM instance data.
*/
/**
* SELM Data (part of VM)
*/
typedef struct SELM
{
/** Offset to the VM structure.
* See SELM2VM(). */
/** Flat CS, DS, 64 bit mode CS, TSS & trap 8 TSS. */
/** Pointer to the GCs - R3 Ptr.
* This size is governed by SELM_GDT_ELEMENTS. */
/** Pointer to the GCs - RC Ptr.
* This is not initialized until the first relocation because it's used to
* check if the shadow GDT virtual handler requires deregistration. */
/** Current (last) Guest's GDTR.
* The pGdt member is set to RTRCPTR_MAX if we're not monitoring the guest GDT. */
/** The current (last) effective Guest GDT size. */
/** R3 pointer to the LDT shadow area in HMA. */
/** RC pointer to the LDT shadow area in HMA. */
#if GC_ARCH_BITS == 64
#endif
/** The address of the guest LDT.
* RTRCPTR_MAX if not monitored. */
/** Current LDT limit, both Guest and Shadow. */
#endif
/** TSS. (This is 16 byte aligned!)
* @todo I/O bitmap & interrupt redirection table? */
/** TSS for trap 08 (\#DF). */
/** Monitored shadow TSS address. */
RCPTRTYPE(void *) pvMonShwTssRC;
#if GC_ARCH_BITS == 64
#endif
/** GC Pointer to the current Guest's TSS.
* RTRCPTR_MAX if not monitored. */
/** The size of the guest TSS. */
/** Set if it's a 32-bit TSS. */
bool fGuestTss32Bit;
/** The size of the Guest's TSS part we're monitoring. */
/** The guest TSS selector at last sync (part of monitoring).
* Contains RTSEL_MAX if not set. */
/** The last known offset of the I/O bitmap.
* This is only used if we monitor the bitmap. */
/** Indicates that the Guest GDT access handler have been registered. */
bool fGDTRangeRegistered;
bool fDisableMonitoring;
/** Indicates whether the TSS stack selector & base address need to be refreshed. */
bool fSyncTSSRing0Stack;
/** SELMR3UpdateFromCPUM() profiling. */
/** SELMR3SyncTSS() profiling. */
/** GC: The number of handled writes to the Guest's GDT. */
/** GC: The number of unhandled write to the Guest's GDT. */
/** GC: The number of times writes to Guest's LDT was detected. */
/** GC: The number of handled writes to the Guest's TSS. */
/** GC: The number of handled writes to the Guest's TSS where we detected a change. */
/** GC: The number of handled redir writes to the Guest's TSS where we detected a change. */
/** GC: The number of unhandled writes to the Guest's TSS. */
/** The number of times we had to relocate our hypervisor selectors. */
/** The number of times we had find free hypervisor selectors. */
VMMRCDECL(int) selmRCGuestGDTWriteHandler(PVM pVM, RTGCUINT uErrorCode, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault, RTGCPTR pvRange, uintptr_t offRange);
VMMRCDECL(int) selmRCGuestLDTWriteHandler(PVM pVM, RTGCUINT uErrorCode, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault, RTGCPTR pvRange, uintptr_t offRange);
VMMRCDECL(int) selmRCGuestTSSWriteHandler(PVM pVM, RTGCUINT uErrorCode, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault, RTGCPTR pvRange, uintptr_t offRange);
VMMRCDECL(int) selmRCShadowGDTWriteHandler(PVM pVM, RTGCUINT uErrorCode, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault, RTGCPTR pvRange, uintptr_t offRange);
VMMRCDECL(int) selmRCShadowLDTWriteHandler(PVM pVM, RTGCUINT uErrorCode, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault, RTGCPTR pvRange, uintptr_t offRange);
VMMRCDECL(int) selmRCShadowTSSWriteHandler(PVM pVM, RTGCUINT uErrorCode, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault, RTGCPTR pvRange, uintptr_t offRange);
/** @} */
#endif