selm.h revision 19964cb6303141f460ac94ae46782cdb3df48d9a
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync/** @file
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * SELM - The Selector Monitor(/Manager).
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync/*
17d67aeb3722c094c6493a3e9a9d0cdfb9453ecdvboxsync * Copyright (C) 2006-2007 Sun Microsystems, Inc.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync *
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * available from http://www.virtualbox.org. This file is free software;
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * you can redistribute it and/or modify it under the terms of the GNU
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * General Public License (GPL) as published by the Free Software
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync *
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * The contents of this file may alternatively be used under the terms
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * of the Common Development and Distribution License Version 1.0
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * VirtualBox OSE distribution, in which case the provisions of the
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * CDDL are applicable instead of those of the GPL.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync *
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * You may elect to license modified versions of this file under the
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * terms and conditions of either the GPL or the CDDL or both.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync *
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
88350256a6c78b8631aba5aa5ce249d90a8514a2vboxsync * Clara, CA 95054 USA or visit http://www.sun.com if you need
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * additional information or have any questions.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#ifndef ___VBox_selm_h
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define ___VBox_selm_h
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#include <VBox/cdefs.h>
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#include <VBox/types.h>
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#include <VBox/x86.h>
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#include <VBox/dis.h>
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync__BEGIN_DECLS
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync/** @defgroup grp_selm The Selector Monitor(/Manager) API
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * @{
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync/**
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * Returns Hypervisor's Trap 08 (\#DF) selector.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync *
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * @returns Hypervisor's Trap 08 (\#DF) selector.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * @param pVM VM Handle.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsyncSELMDECL(RTSEL) SELMGetTrap8Selector(PVM pVM);
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync/**
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * Sets EIP of Hypervisor's Trap 08 (\#DF) TSS.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync *
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * @param pVM VM Handle.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * @param u32EIP EIP of Trap 08 handler.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsyncSELMDECL(void) SELMSetTrap8EIP(PVM pVM, uint32_t u32EIP);
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync/**
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * Sets ss:esp for ring1 in main Hypervisor's TSS.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync *
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * @param pVM VM Handle.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * @param ss Ring1 SS register value.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * @param esp Ring1 ESP register value.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsyncSELMDECL(void) SELMSetRing1Stack(PVM pVM, uint32_t ss, RTGCPTR32 esp);
c6adb272ec43d5eaadb1493cb2bf45f2f8adf588vboxsync
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync/**
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * Gets ss:esp for ring1 in main Hypervisor's TSS.
58b7773f17a933ab8d53f450bed0afcf2f003508vboxsync *
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * @returns VBox status code.
c48c4d769ded37e2496f97dddbbd36dc62f244b1vboxsync * @param pVM VM Handle.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * @param pSS Ring1 SS register value.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * @param pEsp Ring1 ESP register value.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsyncSELMDECL(int) SELMGetRing1Stack(PVM pVM, uint32_t *pSS, PRTGCPTR32 pEsp);
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync/**
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * Returns Guest TSS pointer
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync *
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * @param pVM VM Handle.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsyncSELMDECL(RTGCPTR) SELMGetGuestTSS(PVM pVM);
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync/**
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * Gets the hypervisor code selector (CS).
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * @returns CS selector.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * @param pVM The VM handle.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsyncSELMDECL(RTSEL) SELMGetHyperCS(PVM pVM);
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync/**
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * Gets the 64-mode hypervisor code selector (CS64).
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * @returns CS selector.
c6adb272ec43d5eaadb1493cb2bf45f2f8adf588vboxsync * @param pVM The VM handle.
c48c4d769ded37e2496f97dddbbd36dc62f244b1vboxsync */
c48c4d769ded37e2496f97dddbbd36dc62f244b1vboxsyncSELMDECL(RTSEL) SELMGetHyperCS64(PVM pVM);
24a8dd4360c4b4588fd2c340dd7687379a45e02evboxsync
1d17a5f9688f3622ffe088b664588629b1e95801vboxsync/**
c48c4d769ded37e2496f97dddbbd36dc62f244b1vboxsync * Gets the hypervisor data selector (DS).
c48c4d769ded37e2496f97dddbbd36dc62f244b1vboxsync * @returns DS selector.
c48c4d769ded37e2496f97dddbbd36dc62f244b1vboxsync * @param pVM The VM handle.
c48c4d769ded37e2496f97dddbbd36dc62f244b1vboxsync */
1d17a5f9688f3622ffe088b664588629b1e95801vboxsyncSELMDECL(RTSEL) SELMGetHyperDS(PVM pVM);
17d67aeb3722c094c6493a3e9a9d0cdfb9453ecdvboxsync
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync/**
81d1b221c2dfff6900e970e273dbb4e81ef6b5d9vboxsync * Gets the hypervisor TSS selector.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * @returns TSS selector.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * @param pVM The VM handle.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsyncSELMDECL(RTSEL) SELMGetHyperTSS(PVM pVM);
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync
254365851c06fac7efeae0a0bf727ed6c6940611vboxsync/**
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * Gets the hypervisor TSS Trap 8 selector.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * @returns TSS Trap 8 selector.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * @param pVM The VM handle.
254365851c06fac7efeae0a0bf727ed6c6940611vboxsync */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsyncSELMDECL(RTSEL) SELMGetHyperTSSTrap08(PVM pVM);
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync/**
254365851c06fac7efeae0a0bf727ed6c6940611vboxsync * Gets the address for the hypervisor GDT.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync *
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * @returns The GDT address.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * @param pVM The VM handle.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * @remark This is intended only for very special use, like in the world
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * switchers. Don't exploit this API!
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsyncSELMDECL(RTGCPTR) SELMGetHyperGDT(PVM pVM);
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync/**
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * Gets info about the current TSS.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync *
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * @returns VBox status code.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * @retval VINF_SUCCESS if we've got a TSS loaded.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * @retval VERR_SELM_NO_TSS if we haven't got a TSS (rather unlikely).
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync *
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * @param pVM The VM handle.
17d67aeb3722c094c6493a3e9a9d0cdfb9453ecdvboxsync * @param pGCPtrTss Where to store the TSS address.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * @param pcbTss Where to store the TSS size limit.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * @param pfCanHaveIOBitmap Where to store the can-have-I/O-bitmap indicator. (optional)
17d67aeb3722c094c6493a3e9a9d0cdfb9453ecdvboxsync */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsyncSELMDECL(int) SELMGetTSSInfo(PVM pVM, PRTGCUINTPTR pGCPtrTss, PRTGCUINTPTR pcbTss, bool *pfCanHaveIOBitmap);
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync/**
58b7773f17a933ab8d53f450bed0afcf2f003508vboxsync * Converts a GC selector based address to a flat address.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync *
58b7773f17a933ab8d53f450bed0afcf2f003508vboxsync * No limit checks are done. Use the SELMToFlat*() or SELMValidate*() functions
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * for that.
58b7773f17a933ab8d53f450bed0afcf2f003508vboxsync *
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * @returns Flat address.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * @param pVM VM Handle.
58b7773f17a933ab8d53f450bed0afcf2f003508vboxsync * @param SelReg Selector register
17d67aeb3722c094c6493a3e9a9d0cdfb9453ecdvboxsync * @param pCtxCore CPU context
17d67aeb3722c094c6493a3e9a9d0cdfb9453ecdvboxsync * @param Addr Address part.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync */
7eaaa8a4480370b82ef3735994f986f338fb4df2vboxsyncSELMDECL(RTGCPTR) SELMToFlat(PVM pVM, DIS_SELREG SelReg, PCPUMCTXCORE pCtxCore, RTGCPTR Addr);
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync/**
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * Converts a GC selector based address to a flat address.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync *
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * No limit checks are done. Use the SELMToFlat*() or SELMValidate*() functions
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * for that.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync *
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * Note: obsolete; DO NOT USE!
0c587d7af645db20acefebcfc15b6f46c440ba4avboxsync *
cf5af7fccfec4bef83f4ec21662d6a6e6cbe3835vboxsync * @returns Flat address.
cf5af7fccfec4bef83f4ec21662d6a6e6cbe3835vboxsync * @param pVM VM Handle.
0c587d7af645db20acefebcfc15b6f46c440ba4avboxsync * @param Sel Selector part.
17d67aeb3722c094c6493a3e9a9d0cdfb9453ecdvboxsync * @param Addr Address part.
17d67aeb3722c094c6493a3e9a9d0cdfb9453ecdvboxsync */
17d67aeb3722c094c6493a3e9a9d0cdfb9453ecdvboxsyncSELMDECL(RTGCPTR) SELMToFlatBySel(PVM pVM, RTSEL Sel, RTGCPTR Addr);
17d67aeb3722c094c6493a3e9a9d0cdfb9453ecdvboxsync
0c587d7af645db20acefebcfc15b6f46c440ba4avboxsync/** Flags for SELMToFlatEx().
0c587d7af645db20acefebcfc15b6f46c440ba4avboxsync * @{ */
0c587d7af645db20acefebcfc15b6f46c440ba4avboxsync/** Don't check the RPL,DPL or CPL. */
0c587d7af645db20acefebcfc15b6f46c440ba4avboxsync#define SELMTOFLAT_FLAGS_NO_PL RT_BIT(8)
17d67aeb3722c094c6493a3e9a9d0cdfb9453ecdvboxsync/** Flags contains CPL information. */
17d67aeb3722c094c6493a3e9a9d0cdfb9453ecdvboxsync#define SELMTOFLAT_FLAGS_HAVE_CPL RT_BIT(9)
cf5af7fccfec4bef83f4ec21662d6a6e6cbe3835vboxsync/** CPL is 3. */
cf5af7fccfec4bef83f4ec21662d6a6e6cbe3835vboxsync#define SELMTOFLAT_FLAGS_CPL3 3
0c587d7af645db20acefebcfc15b6f46c440ba4avboxsync/** CPL is 2. */
0c587d7af645db20acefebcfc15b6f46c440ba4avboxsync#define SELMTOFLAT_FLAGS_CPL2 2
0c587d7af645db20acefebcfc15b6f46c440ba4avboxsync/** CPL is 1. */
cf5af7fccfec4bef83f4ec21662d6a6e6cbe3835vboxsync#define SELMTOFLAT_FLAGS_CPL1 1
cf5af7fccfec4bef83f4ec21662d6a6e6cbe3835vboxsync/** CPL is 0. */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define SELMTOFLAT_FLAGS_CPL0 0
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync/** Get the CPL from the flags. */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define SELMTOFLAT_FLAGS_CPL(fFlags) ((fFlags) & X86_SEL_RPL)
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync/** Allow converting using Hypervisor GDT entries. */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define SELMTOFLAT_FLAGS_HYPER RT_BIT(10)
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync/** @} */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync/**
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * Converts a GC selector based address to a flat address.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync *
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * Some basic checking is done, but not all kinds yet.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync *
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * @returns VBox status
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * @param pVM VM Handle.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * @param SelReg Selector register
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * @param pCtxCore CPU context
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * @param Addr Address part.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * @param fFlags SELMTOFLAT_FLAGS_*
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * GDT entires are valid.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * @param ppvGC Where to store the GC flat address.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsyncSELMDECL(int) SELMToFlatEx(PVM pVM, DIS_SELREG SelReg, PCCPUMCTXCORE pCtxCore, RTGCPTR Addr, unsigned fFlags, PRTGCPTR ppvGC);
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync/**
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * Converts a GC selector based address to a flat address.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync *
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * Some basic checking is done, but not all kinds yet.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync *
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * Note: Obsolete: DO NOT USE
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync *
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * @returns VBox status
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * @param pVM VM Handle.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * @param eflags Current eflags
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * @param Sel Selector part.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * @param Addr Address part.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * @param pHiddenSel Hidden selector register (can be NULL)
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * @param fFlags SELMTOFLAT_FLAGS_*
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * GDT entires are valid.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * @param ppvGC Where to store the GC flat address.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * @param pcb Where to store the bytes from *ppvGC which can be accessed according to
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * the selector. NULL is allowed.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsyncSELMDECL(int) SELMToFlatBySelEx(PVM pVM, X86EFLAGS eflags, RTSEL Sel, RTGCPTR Addr, CPUMSELREGHID *pHiddenSel, unsigned fFlags, PRTGCPTR ppvGC, uint32_t *pcb);
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync/**
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * Validates and converts a GC selector based code address to a flat address.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync *
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * @returns VBox status code.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * @param pVM VM Handle.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * @param eflags Current eflags
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * @param SelCPL Current privilege level. Get this from SS - CS might be conforming!
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * A full selector can be passed, we'll only use the RPL part.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * @param SelCS Selector part.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * @param pHiddenSel The hidden CS selector register.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * @param Addr Address part.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * @param ppvFlat Where to store the flat address.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsyncSELMDECL(int) SELMValidateAndConvertCSAddr(PVM pVM, X86EFLAGS eflags, RTSEL SelCPL, RTSEL SelCS, PCPUMSELREGHID pHiddenCSSel, RTGCPTR Addr, PRTGCPTR ppvFlat);
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync
c6adb272ec43d5eaadb1493cb2bf45f2f8adf588vboxsync/**
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * Validates and converts a GC selector based code address to a flat address.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync *
9671051adb2703364fe12ed9927291639a0f1c35vboxsync * This is like SELMValidateAndConvertCSAddr + SELMIsSelector32Bit but with
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * invalid hidden CS data. It's customized for dealing efficiently with CS
9671051adb2703364fe12ed9927291639a0f1c35vboxsync * at GC trap time.
c6adb272ec43d5eaadb1493cb2bf45f2f8adf588vboxsync *
9671051adb2703364fe12ed9927291639a0f1c35vboxsync * @returns VBox status code.
c6adb272ec43d5eaadb1493cb2bf45f2f8adf588vboxsync * @param pVM VM Handle.
9671051adb2703364fe12ed9927291639a0f1c35vboxsync * @param eflags Current eflags
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * @param SelCPL Current privilege level. Get this from SS - CS might be conforming!
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * A full selector can be passed, we'll only use the RPL part.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * @param SelCS Selector part.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * @param Addr Address part.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * @param ppvFlat Where to store the flat address.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * @param pcBits Where to store the 64-bit/32-bit/16-bit indicator.
c6adb272ec43d5eaadb1493cb2bf45f2f8adf588vboxsync */
c6adb272ec43d5eaadb1493cb2bf45f2f8adf588vboxsyncSELMDECL(int) SELMValidateAndConvertCSAddrGCTrap(PVM pVM, X86EFLAGS eflags, RTSEL SelCPL, RTSEL SelCS, RTGCPTR Addr, PRTGCPTR ppvFlat, uint32_t *pcBits);
c6adb272ec43d5eaadb1493cb2bf45f2f8adf588vboxsync
c6adb272ec43d5eaadb1493cb2bf45f2f8adf588vboxsync/**
c6adb272ec43d5eaadb1493cb2bf45f2f8adf588vboxsync * Return the cpu mode corresponding to the (CS) selector
c6adb272ec43d5eaadb1493cb2bf45f2f8adf588vboxsync *
c6adb272ec43d5eaadb1493cb2bf45f2f8adf588vboxsync * @returns DISCPUMODE according to the selector type (16, 32 or 64 bits)
c6adb272ec43d5eaadb1493cb2bf45f2f8adf588vboxsync * @param pVM VM Handle.
c6adb272ec43d5eaadb1493cb2bf45f2f8adf588vboxsync * @param eflags Current eflags register
c6adb272ec43d5eaadb1493cb2bf45f2f8adf588vboxsync * @param Sel The selector.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * @param pHiddenSel The hidden selector register.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsyncSELMDECL(DISCPUMODE) SELMGetCpuModeFromSelector(PVM pVM, X86EFLAGS eflags, RTSEL Sel, CPUMSELREGHID *pHiddenSel);
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync/**
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * Returns flat address and limit of LDT by LDT selector.
b8908d384db2324f04a2f68a13e67ea32ebf609avboxsync *
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * Fully validate selector.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync *
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * @returns VBox status.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * @param pVM VM Handle.
e00d701bbdc8f27f25cc232d9e507622a731b390vboxsync * @param SelLdt LDT selector.
17d67aeb3722c094c6493a3e9a9d0cdfb9453ecdvboxsync * @param ppvLdt Where to store the flat address of LDT.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * @param pcbLimit Where to store LDT limit.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsyncSELMDECL(int) SELMGetLDTFromSel(PVM pVM, RTSEL SelLdt, PRTGCPTR ppvLdt, unsigned *pcbLimit);
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync/**
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * Selector information structure.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsynctypedef struct SELMSELINFO
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync{
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync /** The base address. */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync RTGCPTR GCPtrBase;
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync /** The limit (-1). */
17d67aeb3722c094c6493a3e9a9d0cdfb9453ecdvboxsync RTGCUINTPTR cbLimit;
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync /** The raw descriptor. */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync VBOXDESC Raw;
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync /** The selector. */
17d67aeb3722c094c6493a3e9a9d0cdfb9453ecdvboxsync RTSEL Sel;
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync /** Set if the selector is used by the hypervisor. */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync bool fHyper;
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync /** Set if the selector is a real mode segment. */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync bool fRealMode;
17d67aeb3722c094c6493a3e9a9d0cdfb9453ecdvboxsync} SELMSELINFO;
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync/** Pointer to a SELM selector information struct. */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsynctypedef SELMSELINFO *PSELMSELINFO;
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync/** Pointer to a const SELM selector information struct. */
c48c4d769ded37e2496f97dddbbd36dc62f244b1vboxsynctypedef const SELMSELINFO *PCSELMSELINFO;
47eb60db91f50291b3bd9b72b64d36341972a155vboxsync
c48c4d769ded37e2496f97dddbbd36dc62f244b1vboxsync/**
c48c4d769ded37e2496f97dddbbd36dc62f244b1vboxsync * Validates a CS selector.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync *
7eaaa8a4480370b82ef3735994f986f338fb4df2vboxsync * @returns VBox status code.
7eaaa8a4480370b82ef3735994f986f338fb4df2vboxsync * @param pSelInfo Pointer to the selector information for the CS selector.
f5ab5688c35373443d953e2a9fa8a054defdece8vboxsync * @param SelCPL The selector defining the CPL (SS).
f5ab5688c35373443d953e2a9fa8a054defdece8vboxsync */
f5ab5688c35373443d953e2a9fa8a054defdece8vboxsyncSELMDECL(int) SELMSelInfoValidateCS(PCSELMSELINFO pSelInfo, RTSEL SelCPL);
f5ab5688c35373443d953e2a9fa8a054defdece8vboxsync
f5ab5688c35373443d953e2a9fa8a054defdece8vboxsync/** @def SELMSelInfoIsExpandDown
f5ab5688c35373443d953e2a9fa8a054defdece8vboxsync * Tests whether the selector info describes an expand-down selector or now.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync *
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * @returns true / false.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * @param pSelInfo The selector info.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync *
f5ab5688c35373443d953e2a9fa8a054defdece8vboxsync * @remark Realized as a macro for reasons of speed/lazyness and to avoid
f5ab5688c35373443d953e2a9fa8a054defdece8vboxsync * dragging in VBox/x86.h for now.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define SELMSelInfoIsExpandDown(pSelInfo) \
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync ( (pSelInfo)->Raw.Gen.u1DescType \
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync && ((pSelInfo)->Raw.Gen.u4Type & (X86_SEL_TYPE_DOWN | X86_SEL_TYPE_CODE)) == X86_SEL_TYPE_DOWN)
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync
7eaaa8a4480370b82ef3735994f986f338fb4df2vboxsync#ifdef IN_RING3
7eaaa8a4480370b82ef3735994f986f338fb4df2vboxsync/** @defgroup grp_selm_r3 The Selector Monitor(/Manager) API
7eaaa8a4480370b82ef3735994f986f338fb4df2vboxsync * @ingroup grp_selm
0c587d7af645db20acefebcfc15b6f46c440ba4avboxsync * @{
0c587d7af645db20acefebcfc15b6f46c440ba4avboxsync */
0c587d7af645db20acefebcfc15b6f46c440ba4avboxsync
f5ab5688c35373443d953e2a9fa8a054defdece8vboxsync/**
f5ab5688c35373443d953e2a9fa8a054defdece8vboxsync * Initializes the SELM.
f5ab5688c35373443d953e2a9fa8a054defdece8vboxsync *
f5ab5688c35373443d953e2a9fa8a054defdece8vboxsync * @returns VBox status code.
f5ab5688c35373443d953e2a9fa8a054defdece8vboxsync * @param pVM The VM to operate on.
f5ab5688c35373443d953e2a9fa8a054defdece8vboxsync */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsyncSELMR3DECL(int) SELMR3Init(PVM pVM);
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync
17d67aeb3722c094c6493a3e9a9d0cdfb9453ecdvboxsync/**
7eaaa8a4480370b82ef3735994f986f338fb4df2vboxsync * Finalizes HMA page attributes.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync *
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * @returns VBox status code.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * @param pVM The VM handle.
0c587d7af645db20acefebcfc15b6f46c440ba4avboxsync */
0c587d7af645db20acefebcfc15b6f46c440ba4avboxsyncSELMR3DECL(int) SELMR3InitFinalize(PVM pVM);
0c587d7af645db20acefebcfc15b6f46c440ba4avboxsync
aca7a56d52c58d8b388343450503c22822fd6620vboxsync/**
17d67aeb3722c094c6493a3e9a9d0cdfb9453ecdvboxsync * Applies relocations to data and code managed by this
aca7a56d52c58d8b388343450503c22822fd6620vboxsync * component. This function will be called at init and
aca7a56d52c58d8b388343450503c22822fd6620vboxsync * whenever the VMM need to relocate it self inside the GC.
aca7a56d52c58d8b388343450503c22822fd6620vboxsync *
17d67aeb3722c094c6493a3e9a9d0cdfb9453ecdvboxsync * @param pVM The VM.
aca7a56d52c58d8b388343450503c22822fd6620vboxsync */
aca7a56d52c58d8b388343450503c22822fd6620vboxsyncSELMR3DECL(void) SELMR3Relocate(PVM pVM);
aca7a56d52c58d8b388343450503c22822fd6620vboxsync
aca7a56d52c58d8b388343450503c22822fd6620vboxsync/**
17d67aeb3722c094c6493a3e9a9d0cdfb9453ecdvboxsync * Notification callback which is called whenever there is a chance that a CR3
17d67aeb3722c094c6493a3e9a9d0cdfb9453ecdvboxsync * value might have changed.
aca7a56d52c58d8b388343450503c22822fd6620vboxsync * This is called by PGM.
aca7a56d52c58d8b388343450503c22822fd6620vboxsync *
aca7a56d52c58d8b388343450503c22822fd6620vboxsync * @param pVM The VM handle
aca7a56d52c58d8b388343450503c22822fd6620vboxsync */
0c587d7af645db20acefebcfc15b6f46c440ba4avboxsyncSELMR3DECL(void) SELMR3PagingModeChanged(PVM pVM);
0c587d7af645db20acefebcfc15b6f46c440ba4avboxsync
0c587d7af645db20acefebcfc15b6f46c440ba4avboxsync/**
0c587d7af645db20acefebcfc15b6f46c440ba4avboxsync * Terminates the SELM.
0c587d7af645db20acefebcfc15b6f46c440ba4avboxsync *
0c587d7af645db20acefebcfc15b6f46c440ba4avboxsync * Termination means cleaning up and freeing all resources,
0c587d7af645db20acefebcfc15b6f46c440ba4avboxsync * the VM it self is at this point powered off or suspended.
0c587d7af645db20acefebcfc15b6f46c440ba4avboxsync *
0c587d7af645db20acefebcfc15b6f46c440ba4avboxsync * @returns VBox status code.
0c587d7af645db20acefebcfc15b6f46c440ba4avboxsync * @param pVM The VM to operate on.
0c587d7af645db20acefebcfc15b6f46c440ba4avboxsync */
0c587d7af645db20acefebcfc15b6f46c440ba4avboxsyncSELMR3DECL(int) SELMR3Term(PVM pVM);
0c587d7af645db20acefebcfc15b6f46c440ba4avboxsync
cf5af7fccfec4bef83f4ec21662d6a6e6cbe3835vboxsync/**
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * The VM is being reset.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync *
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * For the SELM component this means that any GDT/LDT/TSS monitors
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * needs to be removed.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync *
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * @param pVM VM handle.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsyncSELMR3DECL(void) SELMR3Reset(PVM pVM);
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync/**
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * Updates the Guest GDT & LDT virtualization based on current CPU state.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync *
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * @returns VBox status code.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * @param pVM The VM to operate on.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync */
60b3bb99d58c291474ef79573ae7738ce769fdbbvboxsyncSELMR3DECL(int) SELMR3UpdateFromCPUM(PVM pVM);
60b3bb99d58c291474ef79573ae7738ce769fdbbvboxsync
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync/**
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * Compares the Guest GDT and LDT with the shadow tables.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * This is a VBOX_STRICT only function.
7eaaa8a4480370b82ef3735994f986f338fb4df2vboxsync *
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * @returns VBox status code.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * @param pVM The VM Handle.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsyncSELMR3DECL(int) SELMR3DebugCheck(PVM pVM);
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#ifdef VBOX_STRICT
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync# define SELMR3DEBUGCHECK(pVM) SELMR3DebugCheck(pVM)
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#else
17d67aeb3722c094c6493a3e9a9d0cdfb9453ecdvboxsync# define SELMR3DEBUGCHECK(pVM) do { } while (0)
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#endif
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync/**
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * Check if the TSS ring 0 stack selector and pointer were updated (for now)
17d67aeb3722c094c6493a3e9a9d0cdfb9453ecdvboxsync *
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * @returns VBox status code.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * @param pVM The VM to operate on.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsyncSELMR3DECL(int) SELMR3SyncTSS(PVM pVM);
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync/**
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * Gets information about a selector.
c48c4d769ded37e2496f97dddbbd36dc62f244b1vboxsync * Intended for the debugger mostly and will prefer the guest
47eb60db91f50291b3bd9b72b64d36341972a155vboxsync * descriptor tables over the shadow ones.
c48c4d769ded37e2496f97dddbbd36dc62f244b1vboxsync *
c48c4d769ded37e2496f97dddbbd36dc62f244b1vboxsync * @returns VINF_SUCCESS on success.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * @returns VERR_INVALID_SELECTOR if the selector isn't fully inside the descriptor table.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * @returns VERR_SELECTOR_NOT_PRESENT if the selector wasn't present.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * @returns VERR_PAGE_TABLE_NOT_PRESENT or VERR_PAGE_NOT_PRESENT if the pagetable or page
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * backing the selector table wasn't present.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * @returns Other VBox status code on other errros.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync *
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * @param pVM VM handle.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * @param Sel The selector to get info about.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * @param pSelInfo Where to store the information.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsyncSELMR3DECL(int) SELMR3GetSelectorInfo(PVM pVM, RTSEL Sel, PSELMSELINFO pSelInfo);
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync
17d67aeb3722c094c6493a3e9a9d0cdfb9453ecdvboxsync/**
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * Gets information about a selector from the shadow tables.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync *
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * This is intended to be faster than the SELMR3GetSelectorInfo() method, but requires
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * that the caller ensures that the shadow tables are up to date.
17d67aeb3722c094c6493a3e9a9d0cdfb9453ecdvboxsync *
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * @returns VINF_SUCCESS on success.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * @returns VERR_INVALID_SELECTOR if the selector isn't fully inside the descriptor table.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * @returns VERR_SELECTOR_NOT_PRESENT if the selector wasn't present.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * @returns VERR_PAGE_TABLE_NOT_PRESENT or VERR_PAGE_NOT_PRESENT if the pagetable or page
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * backing the selector table wasn't present.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * @returns Other VBox status code on other errors.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync *
c48c4d769ded37e2496f97dddbbd36dc62f244b1vboxsync * @param pVM VM handle.
c48c4d769ded37e2496f97dddbbd36dc62f244b1vboxsync * @param Sel The selector to get info about.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * @param pSelInfo Where to store the information.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync */
SELMR3DECL(int) SELMR3GetShadowSelectorInfo(PVM pVM, RTSEL Sel, PSELMSELINFO pSelInfo);
/**
* Validates the RawR0 TSS values against the one in the Guest TSS.
*
* @returns true if it matches.
* @returns false and assertions on mismatch..
* @param pVM VM Handle.
*/
SELMR3DECL(bool) SELMR3CheckTSS(PVM pVM);
/**
* Disable GDT/LDT/TSS monitoring and syncing
*
* @param pVM The VM to operate on.
*/
SELMR3DECL(void) SELMR3DisableMonitoring(PVM pVM);
/**
* Dumps a descriptor.
*
* @param Desc Descriptor to dump.
* @param Sel Selector number.
* @param pszMsg Message to prepend the log entry with.
*/
SELMR3DECL(void) SELMR3DumpDescriptor(VBOXDESC Desc, RTSEL Sel, const char *pszMsg);
/**
* Dumps the hypervisor GDT.
*
* @param pVM VM handle.
*/
SELMR3DECL(void) SELMR3DumpHyperGDT(PVM pVM);
/**
* Dumps the hypervisor LDT.
*
* @param pVM VM handle.
*/
SELMR3DECL(void) SELMR3DumpHyperLDT(PVM pVM);
/**
* Dumps the guest GDT.
*
* @param pVM VM handle.
*/
SELMR3DECL(void) SELMR3DumpGuestGDT(PVM pVM);
/**
* Dumps the guest LDT.
*
* @param pVM VM handle.
*/
SELMR3DECL(void) SELMR3DumpGuestLDT(PVM pVM);
/** @} */
#endif
/** @} */
__END_DECLS
#endif