SELMInternal.h revision 37eb780874007e6c73f493edcfd7a1e498a6a2ef
/* $Id$ */
/** @file
* SELM - 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 __SELMInternal_h__
#define __SELMInternal_h__
# error "Not in SELM! This is an internal header!"
#endif
/** @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 - HC Ptr.
* This size is governed by SELM_GDT_ELEMENTS. */
/** Pointer to the GCs - GC 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 current (last) effective Guest GDT size. */
/** HC Pointer to the LDT shadow area placed in Hypervisor memory arena. */
/** GC Pointer to the LDT shadow area placed in Hypervisor memory arena. */
/** GC Pointer to the current Guest's LDT. */
/** Current LDT limit, both Guest and Shadow. */
/** Current LDT offset relative to pvLdt*. */
#if HC_ARCH_BITS == 32
/** TSS alignment padding. */
#endif
/** TSS. (This is 16 byte aligned!)
* @todo I/O bitmap & interrupt redirection table? */
/** TSS for trap 08 (\#DF). */
/** GC Pointer to the TSS shadow area (Tss) placed in Hypervisor memory arena. */
/** GC Pointer to the current Guest's TSS. */
/** 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. */
/** GC shadow TSS selector */
/** 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;
/** alignment . */
/** SELMR3UpdateFromCPUM() profiling. */
/** SELMR3SyncTSS() profiling. */
/** GC: The number of handled write to the Guest's GDT. */
/** GC: The number of unhandled write to the Guest's GDT. */
/** GC: The number of times write to Guest's LDT was detected. */
/** GC: The number of handled write to the Guest's TSS. */
/** GC: The number of handled write to the Guest's TSS where we detected a change. */
/** GC: The number of unhandled write 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. */
SELMGCDECL(int) selmgcGuestGDTWriteHandler(PVM pVM, RTGCUINT uErrorCode, PCPUMCTXCORE pRegFrame, void *pvFault, void *pvRange, uintptr_t offRange);
SELMGCDECL(int) selmgcGuestLDTWriteHandler(PVM pVM, RTGCUINT uErrorCode, PCPUMCTXCORE pRegFrame, void *pvFault, void *pvRange, uintptr_t offRange);
SELMGCDECL(int) selmgcGuestTSSWriteHandler(PVM pVM, RTGCUINT uErrorCode, PCPUMCTXCORE pRegFrame, void *pvFault, void *pvRange, uintptr_t offRange);
SELMGCDECL(int) selmgcShadowGDTWriteHandler(PVM pVM, RTGCUINT uErrorCode, PCPUMCTXCORE pRegFrame, void *pvFault, void *pvRange, uintptr_t offRange);
SELMGCDECL(int) selmgcShadowLDTWriteHandler(PVM pVM, RTGCUINT uErrorCode, PCPUMCTXCORE pRegFrame, void *pvFault, void *pvRange, uintptr_t offRange);
SELMGCDECL(int) selmgcShadowTSSWriteHandler(PVM pVM, RTGCUINT uErrorCode, PCPUMCTXCORE pRegFrame, void *pvFault, void *pvRange, uintptr_t offRange);
#ifdef IN_RING3
#endif
/** @} */
#endif