VirtualBox

source: vbox/trunk/src/VBox/VMM/VMMR3/DBGFCpu.cpp@ 43038

Last change on this file since 43038 was 41783, checked in by vboxsync, 12 years ago

Doxygen, comment typos.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.1 KB
Line 
1/* $Id: DBGFCpu.cpp 41783 2012-06-16 19:24:15Z vboxsync $ */
2/** @file
3 * DBGF - Debugger Facility, CPU State Accessors.
4 */
5
6/*
7 * Copyright (C) 2009 Oracle Corporation
8 *
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.
16 */
17
18
19/*******************************************************************************
20* Header Files *
21*******************************************************************************/
22#define LOG_GROUP LOG_GROUP_DBGF
23#include <VBox/vmm/dbgf.h>
24#include <VBox/vmm/cpum.h>
25#include "DBGFInternal.h"
26#include <VBox/vmm/vm.h>
27#include <VBox/err.h>
28#include <VBox/log.h>
29#include <VBox/param.h>
30#include <iprt/assert.h>
31
32
33/**
34 * Wrapper around CPUMGetGuestMode.
35 *
36 * @returns VINF_SUCCESS.
37 * @param pVM Pointer to the VM.
38 * @param idCpu The current CPU ID.
39 * @param penmMode Where to return the mode.
40 */
41static DECLCALLBACK(int) dbgfR3CpuGetMode(PVM pVM, VMCPUID idCpu, CPUMMODE *penmMode)
42{
43 Assert(idCpu == VMMGetCpuId(pVM));
44 PVMCPU pVCpu = VMMGetCpuById(pVM, idCpu);
45 *penmMode = CPUMGetGuestMode(pVCpu);
46 return VINF_SUCCESS;
47}
48
49
50/**
51 * Get the current CPU mode.
52 *
53 * @returns The CPU mode on success, CPUMMODE_INVALID on failure.
54 * @param pVM Pointer to the VM.
55 * @param idCpu The target CPU ID.
56 */
57VMMR3DECL(CPUMMODE) DBGFR3CpuGetMode(PVM pVM, VMCPUID idCpu)
58{
59 VM_ASSERT_VALID_EXT_RETURN(pVM, CPUMMODE_INVALID);
60 AssertReturn(idCpu < pVM->cCpus, CPUMMODE_INVALID);
61
62 CPUMMODE enmMode;
63 int rc = VMR3ReqPriorityCallWait(pVM, idCpu, (PFNRT)dbgfR3CpuGetMode, 3, pVM, idCpu, &enmMode);
64 if (RT_FAILURE(rc))
65 return CPUMMODE_INVALID;
66 return enmMode;
67}
68
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette