0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** @file
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * DBGF - Debugger Facility, selector interface partly shared with SELM.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/*
c58f1213e628a545081c70e26c6b67a841cff880vboxsync * Copyright (C) 2006-2011 Oracle Corporation
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync *
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * available from http://www.virtualbox.org. This file is free software;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * you can redistribute it and/or modify it under the terms of the GNU
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * General Public License (GPL) as published by the Free Software
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync *
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * The contents of this file may alternatively be used under the terms
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * of the Common Development and Distribution License Version 1.0
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * VirtualBox OSE distribution, in which case the provisions of the
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * CDDL are applicable instead of those of the GPL.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync *
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * You may elect to license modified versions of this file under the
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * terms and conditions of either the GPL or the CDDL or both.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#ifndef ___VBox_vmm_dbgfsel_h
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#define ___VBox_vmm_dbgfsel_h
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#include <VBox/types.h>
2d97f8baccdd684bc0a8a15eb86bbe9ff2b85374vboxsync#include <iprt/x86.h>
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** @addtogroup grp_dbgf
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @{ */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/**
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * Selector information structure.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsynctypedef struct DBGFSELINFO
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync{
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** The base address.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * For gate descriptors, this is the target address. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync RTGCPTR GCPtrBase;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** The limit (-1).
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * For gate descriptors, this is set to zero. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync RTGCUINTPTR cbLimit;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** The raw descriptor. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync union
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync {
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync X86DESC Raw;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync X86DESC64 Raw64;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync } u;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** The selector. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync RTSEL Sel;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** The target selector for a gate.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * This is 0 if non-gate descriptor. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync RTSEL SelGate;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** Flags. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync uint32_t fFlags;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync} DBGFSELINFO;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** Pointer to a SELM selector information struct. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsynctypedef DBGFSELINFO *PDBGFSELINFO;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** Pointer to a const SELM selector information struct. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsynctypedef const DBGFSELINFO *PCDBGFSELINFO;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** @name DBGFSELINFO::fFlags
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @{ */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** The CPU is in real mode. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#define DBGFSELINFO_FLAGS_REAL_MODE RT_BIT_32(0)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** The CPU is in protected mode. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#define DBGFSELINFO_FLAGS_PROT_MODE RT_BIT_32(1)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** The CPU is in long mode. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#define DBGFSELINFO_FLAGS_LONG_MODE RT_BIT_32(2)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** The selector is a hyper selector. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#define DBGFSELINFO_FLAGS_HYPER RT_BIT_32(3)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** The selector is a gate selector. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#define DBGFSELINFO_FLAGS_GATE RT_BIT_32(4)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** The selector is invalid. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#define DBGFSELINFO_FLAGS_INVALID RT_BIT_32(5)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** The selector not present. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#define DBGFSELINFO_FLAGS_NOT_PRESENT RT_BIT_32(6)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** @} */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/**
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * Tests whether the selector info describes an expand-down selector or now.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync *
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @returns true / false.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param pSelInfo The selector info.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsyncDECLINLINE(bool) DBGFSelInfoIsExpandDown(PCDBGFSELINFO pSelInfo)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync{
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync return (pSelInfo)->u.Raw.Gen.u1DescType
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync && ((pSelInfo)->u.Raw.Gen.u4Type & (X86_SEL_TYPE_DOWN | X86_SEL_TYPE_CODE)) == X86_SEL_TYPE_DOWN;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync}
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsyncVMMR3DECL(int) DBGFR3SelInfoValidateCS(PCDBGFSELINFO pSelInfo, RTSEL SelCPL);
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync/** @} */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync#endif
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync