DBGFAll.cpp revision eb8ecd89a3132555de65fdc69621fb1338c9bc9c
/* $Id$ */
/** @file
* DBGF - Debugger Facility, All Context Code.
*/
/*
* Copyright (C) 2006-2013 Oracle Corporation
*
* 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.
*/
/*******************************************************************************
* Header Files *
*******************************************************************************/
#define LOG_GROUP LOG_GROUP_DBGF
#include "DBGFInternal.h"
/**
* Gets the hardware breakpoint configuration as DR7.
*
* @returns DR7 from the DBGF point of view.
* @param pVM Pointer to the VM.
*/
{
while (cLeft-- > 0)
{
{
{
};
}
pBp++;
}
return uDr7;
}
/**
* Gets the address of the hardware breakpoint number 0.
*
* @returns DR0 from the DBGF point of view.
* @param pVM Pointer to the VM.
*/
{
}
/**
* Gets the address of the hardware breakpoint number 1.
*
* @returns DR1 from the DBGF point of view.
* @param pVM Pointer to the VM.
*/
{
}
/**
* Gets the address of the hardware breakpoint number 2.
*
* @returns DR2 from the DBGF point of view.
* @param pVM Pointer to the VM.
*/
{
}
/**
* Gets the address of the hardware breakpoint number 3.
*
* @returns DR3 from the DBGF point of view.
* @param pVM Pointer to the VM.
*/
{
}
/**
* Checks if any of the hardware breakpoints are armed.
*
* @returns true if armed, false if not.
* @param pVM The cross context VM structure.
*/
{
return (pVM->dbgf.s.aHwBreakpoints[0].fEnabled && pVM->dbgf.s.aHwBreakpoints[0].enmType == DBGFBPTYPE_REG)
|| (pVM->dbgf.s.aHwBreakpoints[1].fEnabled && pVM->dbgf.s.aHwBreakpoints[1].enmType == DBGFBPTYPE_REG)
|| (pVM->dbgf.s.aHwBreakpoints[2].fEnabled && pVM->dbgf.s.aHwBreakpoints[2].enmType == DBGFBPTYPE_REG)
|| (pVM->dbgf.s.aHwBreakpoints[3].fEnabled && pVM->dbgf.s.aHwBreakpoints[3].enmType == DBGFBPTYPE_REG);
}
/**
* Checks if any of the hardware I/O breakpoints are armed.
*
* @returns true if armed, false if not.
* @param pVM The cross context VM structure.
*/
{
/** @todo cache this! */
)
)
)
);
}
/**
* Checks I/O access for guest or hypervisor breakpoints.
*
* @returns Strict VBox status code
* @retval VINF_SUCCESS no breakpoint.
* @retval VINF_EM_DBG_BREAKPOINT hypervisor breakpoint triggered.
* @retval VINF_EM_RAW_GUEST_TRAP guest breakpoint triggered, DR6 and DR7 have
* been updated appropriately.
*
* @param pVM The cross context VM structure.
* @param pVCpu The cross context CPU structure for the calling EMT.
* @param pCtx The CPU context for the calling EMT.
* @param uIoPort The I/O port being accessed.
*/
VMM_INT_DECL(VBOXSTRICTRC) DBGFBpCheckIo(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx, RTIOPORT uIoPort, uint8_t cbValue)
{
/*
* Check hyper breakpoints first as the VMM debugger has priority over
* the guest.
*/
{
{
{
/* (See also DBGFRZTrap01Handler.) */
LogFlow(("DBGFBpCheckIo: hit hw breakpoint %d at %04x:%RGv (iop %#x)\n",
return VINF_EM_DBG_BREAKPOINT;
}
}
}
/*
* Check the guest.
*/
if ( (uDr7 & X86_DR7_ENABLED_MASK)
{
{
{
/* ASSUME the breakpoint and the I/O width qualifier uses the same encoding (1 2 x 4). */
{
/*
* Update DR6 and DR7.
*
* See "AMD64 Architecture Programmer's Manual Volume 2",
* chapter 13.1.1.3 for details on DR6 bits. The basics is
* that the B0..B3 bits are always cleared while the others
* must be cleared by software.
*
* The following sub chapters says the GD bit is always
* cleared when generating a #DB so the handler can safely
* access the debug registers.
*/
LogFlow(("DBGFBpCheckIo: hit hw breakpoint %d at %04x:%RGv (iop %#x)\n",
return VINF_EM_RAW_GUEST_TRAP;
}
}
}
}
return VINF_SUCCESS;
}
/**
* Returns the single stepping state for a virtual CPU.
*
* @returns stepping (true) or not (false).
*
* @param pVCpu Pointer to the VMCPU.
*/
{
}