DBGFAddr.cpp revision e17f587595bd5d3a7be56a892e3fd3a0ef83d268
45e9809aff7304721fddb95654901b32195c9c7avboxsync * DBGF - Debugger Facility, Mixed Address Methods.
45e9809aff7304721fddb95654901b32195c9c7avboxsync * Copyright (C) 2006-2007 Sun Microsystems, Inc.
45e9809aff7304721fddb95654901b32195c9c7avboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
45e9809aff7304721fddb95654901b32195c9c7avboxsync * available from http://www.virtualbox.org. This file is free software;
45e9809aff7304721fddb95654901b32195c9c7avboxsync * you can redistribute it and/or modify it under the terms of the GNU
45e9809aff7304721fddb95654901b32195c9c7avboxsync * General Public License (GPL) as published by the Free Software
45e9809aff7304721fddb95654901b32195c9c7avboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
45e9809aff7304721fddb95654901b32195c9c7avboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
45e9809aff7304721fddb95654901b32195c9c7avboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
45e9809aff7304721fddb95654901b32195c9c7avboxsync * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
45e9809aff7304721fddb95654901b32195c9c7avboxsync * Clara, CA 95054 USA or visit http://www.sun.com if you need
45e9809aff7304721fddb95654901b32195c9c7avboxsync * additional information or have any questions.
45e9809aff7304721fddb95654901b32195c9c7avboxsync/*******************************************************************************
45e9809aff7304721fddb95654901b32195c9c7avboxsync* Header Files *
45e9809aff7304721fddb95654901b32195c9c7avboxsync*******************************************************************************/
45e9809aff7304721fddb95654901b32195c9c7avboxsync * Checks if an address is in the HMA or not.
45e9809aff7304721fddb95654901b32195c9c7avboxsync * @returns true if it's inside the HMA.
45e9809aff7304721fddb95654901b32195c9c7avboxsync * @returns flase if it's not inside the HMA.
45e9809aff7304721fddb95654901b32195c9c7avboxsync * @param pVM The VM handle.
45e9809aff7304721fddb95654901b32195c9c7avboxsync * @param FlatPtr The address in question.
45e9809aff7304721fddb95654901b32195c9c7avboxsyncDECLINLINE(bool) dbgfR3IsHMA(PVM pVM, RTGCUINTPTR FlatPtr)
45e9809aff7304721fddb95654901b32195c9c7avboxsync * Common worker for DBGFR3AddrFromSelOff and DBGFR3AddrFromSelInfoOff.
45e9809aff7304721fddb95654901b32195c9c7avboxsyncstatic int dbgfR3AddrFromSelInfoOffWorker(PDBGFADDRESS pAddress, PCDBGFSELINFO pSelInfo, RTUINTPTR off)
45e9809aff7304721fddb95654901b32195c9c7avboxsync if (pSelInfo->fFlags & (DBGFSELINFO_FLAGS_INVALID | DBGFSELINFO_FLAGS_NOT_PRESENT))
45e9809aff7304721fddb95654901b32195c9c7avboxsync return pSelInfo->fFlags & DBGFSELINFO_FLAGS_NOT_PRESENT
45e9809aff7304721fddb95654901b32195c9c7avboxsync /** @todo This all goes voodoo in long mode. */
45e9809aff7304721fddb95654901b32195c9c7avboxsync /* check limit. */
45e9809aff7304721fddb95654901b32195c9c7avboxsync /** @todo fix all these selector tests! */
45e9809aff7304721fddb95654901b32195c9c7avboxsync else if (pSelInfo->cbLimit <= UINT32_C(0xffffffff))
45e9809aff7304721fddb95654901b32195c9c7avboxsync * Creates a mixed address from a Sel:off pair.
45e9809aff7304721fddb95654901b32195c9c7avboxsync * @returns VBox status code.
45e9809aff7304721fddb95654901b32195c9c7avboxsync * @param pVM The VM handle.
45e9809aff7304721fddb95654901b32195c9c7avboxsync * @param idCpu The CPU ID.
45e9809aff7304721fddb95654901b32195c9c7avboxsync * @param pAddress Where to store the mixed address.
45e9809aff7304721fddb95654901b32195c9c7avboxsync * @param Sel The selector part.
45e9809aff7304721fddb95654901b32195c9c7avboxsync * @param off The offset part.
45e9809aff7304721fddb95654901b32195c9c7avboxsyncVMMR3DECL(int) DBGFR3AddrFromSelOff(PVM pVM, VMCPUID idCpu, PDBGFADDRESS pAddress, RTSEL Sel, RTUINTPTR off)
45e9809aff7304721fddb95654901b32195c9c7avboxsync AssertReturn(idCpu < pVM->cCpus, VERR_INVALID_PARAMETER);
45e9809aff7304721fddb95654901b32195c9c7avboxsync int rc = DBGFR3SelQueryInfo(pVM, idCpu, Sel, DBGFSELQI_FLAGS_DT_GUEST | DBGFSELQI_FLAGS_DT_ADJ_64BIT_MODE, &SelInfo);
45e9809aff7304721fddb95654901b32195c9c7avboxsync rc = dbgfR3AddrFromSelInfoOffWorker(pAddress, &SelInfo, off);
45e9809aff7304721fddb95654901b32195c9c7avboxsync * Creates a mixed address from selector info and an offset into the segment
45e9809aff7304721fddb95654901b32195c9c7avboxsync * described by it.
VMMR3DECL(int) DBGFR3AddrFromSelInfoOff(PVM pVM, PDBGFADDRESS pAddress, PCDBGFSELINFO pSelInfo, RTUINTPTR off)
return rc;
return VINF_SUCCESS;
return pAddress;
return pAddress;
static DECLCALLBACK(int) dbgfR3AddrToPhysOnVCpu(PVMCPU pVCpu, PDBGFADDRESS pAddress, PRTGCPHYS pGCPhys)
int rc;
return rc;
VMMR3DECL(int) DBGFR3AddrToHostPhys(PVM pVM, VMCPUID idCpu, PDBGFADDRESS pAddress, PRTHCPHYS pHCPhys)
int rc;
return rc;
static DECLCALLBACK(int) dbgfR3AddrToVolatileR3PtrOnVCpu(PVM pVM, VMCPUID idCpu, PDBGFADDRESS pAddress, bool fReadOnly, void **ppvR3Ptr)
int rc;
if (pv)
if (fReadOnly)
if (fReadOnly)
return rc;
VMMR3DECL(int) DBGFR3AddrToVolatileR3Ptr(PVM pVM, VMCPUID idCpu, PDBGFADDRESS pAddress, bool fReadOnly, void **ppvR3Ptr)
return rc;
return pAddress;
return pAddress;