1
/* $Id: DBGFCpu.cpp $ */
3
* DBGF - Debugger Facility, CPU State Accessors.
7
* Copyright (C) 2009 Sun Microsystems, Inc.
9
* This file is part of VirtualBox Open Source Edition (OSE), as
10
* available from http://www.virtualbox.org. This file is free software;
11
* you can redistribute it and/or modify it under the terms of the GNU
12
* General Public License (GPL) as published by the Free Software
13
* Foundation, in version 2 as it comes in the "COPYING" file of the
14
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
17
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
18
* Clara, CA 95054 USA or visit http://www.sun.com if you need
19
* additional information or have any questions.
23
/*******************************************************************************
25
*******************************************************************************/
26
#define LOG_GROUP LOG_GROUP_DBGF
27
#include <VBox/dbgf.h>
28
#include <VBox/cpum.h>
29
#include "DBGFInternal.h"
33
#include <VBox/param.h>
34
#include <iprt/assert.h>
38
* Wrapper around CPUMGetGuestMode.
40
* @returns VINF_SUCCESS.
41
* @param pVM The VM handle.
42
* @param idCpu The current CPU ID.
43
* @param penmMode Where to return the mode.
45
static DECLCALLBACK(int) dbgfR3CpuGetMode(PVM pVM, VMCPUID idCpu, CPUMMODE *penmMode)
47
Assert(idCpu == VMMGetCpuId(pVM));
48
PVMCPU pVCpu = VMMGetCpuById(pVM, idCpu);
49
*penmMode = CPUMGetGuestMode(pVCpu);
55
* Get the current CPU mode.
57
* @returns The CPU mode on success, CPUMMODE_INVALID on failure.
58
* @param pVM The VM handle.
59
* @param idCpu The target CPU ID.
61
VMMR3DECL(CPUMMODE) DBGFR3CpuGetMode(PVM pVM, VMCPUID idCpu)
63
VM_ASSERT_VALID_EXT_RETURN(pVM, CPUMMODE_INVALID);
64
AssertReturn(idCpu < pVM->cCpus, CPUMMODE_INVALID);
67
int rc = VMR3ReqCallWait(pVM, idCpu, (PFNRT)dbgfR3CpuGetMode, 3, pVM, idCpu, &enmMode);
69
return CPUMMODE_INVALID;