VirtualBox

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

Last change on this file since 30111 was 28800, checked in by vboxsync, 15 years ago

Automated rebranding to Oracle copyright/license strings via filemuncher

  • 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 28800 2010-04-27 08:22:32Z 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/dbgf.h>
24#include <VBox/cpum.h>
25#include "DBGFInternal.h"
26#include <VBox/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 The VM handle.
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 The VM handle.
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 = VMR3ReqCallWait(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