~ubuntu-branches/ubuntu/trusty/virtualbox-ose/trusty

« back to all changes in this revision

Viewing changes to src/VBox/VMM/DBGFCpu.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Felix Geyer
  • Date: 2009-12-18 16:44:29 UTC
  • mfrom: (0.3.3 upstream) (0.4.6 squeeze)
  • Revision ID: james.westby@ubuntu.com-20091218164429-jd34ccexpv5na11a
Tags: 3.1.2-dfsg-1ubuntu1
* Merge from Debian unstable (LP: #498219), remaining changes:
  - Disable update action
    - debian/patches/u01-disable-update-action.dpatch
  - VirtualBox should go in Accessories, not in System tools (LP: #288590)
    - debian/virtualbox-ose-qt.files/virtualbox-ose.desktop
  - Add Apport hook
    - debian/virtualbox-ose.files/source_virtualbox-ose.py
    - debian/virtualbox-ose.install
  - Add Launchpad integration
    - debian/control
    - debian/lpi-bug.xpm
    - debian/patches/u02-lp-integration.dpatch
* Fixes the following bugs:
  - Kernel module fails to build with Linux >= 2.6.32 (LP: #474625)
  - X.Org drivers need to be rebuilt against X-Server 1.7 (LP: #495935)
  - The *-source packages try to build the kernel modules even though the
    kernel headers aren't available (LP: #473334)
* Replace *-source packages with transitional packages for *-dkms.
* Adapt u01-disable-update-action.dpatch and u02-lp-integration.dpatch for
  new upstream version.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* $Id: DBGFCpu.cpp $ */
 
2
/** @file
 
3
 * DBGF - Debugger Facility, CPU State Accessors.
 
4
 */
 
5
 
 
6
/*
 
7
 * Copyright (C) 2009 Sun Microsystems, Inc.
 
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
 * 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.
 
20
 */
 
21
 
 
22
 
 
23
/*******************************************************************************
 
24
*   Header Files                                                               *
 
25
*******************************************************************************/
 
26
#define LOG_GROUP LOG_GROUP_DBGF
 
27
#include <VBox/dbgf.h>
 
28
#include <VBox/cpum.h>
 
29
#include "DBGFInternal.h"
 
30
#include <VBox/vm.h>
 
31
#include <VBox/err.h>
 
32
#include <VBox/log.h>
 
33
#include <VBox/param.h>
 
34
#include <iprt/assert.h>
 
35
 
 
36
 
 
37
/**
 
38
 * Wrapper around CPUMGetGuestMode.
 
39
 *
 
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.
 
44
 */
 
45
static DECLCALLBACK(int) dbgfR3CpuGetMode(PVM pVM, VMCPUID idCpu, CPUMMODE *penmMode)
 
46
{
 
47
    Assert(idCpu == VMMGetCpuId(pVM));
 
48
    PVMCPU pVCpu = VMMGetCpuById(pVM, idCpu);
 
49
    *penmMode = CPUMGetGuestMode(pVCpu);
 
50
    return VINF_SUCCESS;
 
51
}
 
52
 
 
53
 
 
54
/**
 
55
 * Get the current CPU mode.
 
56
 *
 
57
 * @returns The CPU mode on success, CPUMMODE_INVALID on failure.
 
58
 * @param   pVM                 The VM handle.
 
59
 * @param   idCpu               The target CPU ID.
 
60
 */
 
61
VMMR3DECL(CPUMMODE) DBGFR3CpuGetMode(PVM pVM, VMCPUID idCpu)
 
62
{
 
63
    VM_ASSERT_VALID_EXT_RETURN(pVM, CPUMMODE_INVALID);
 
64
    AssertReturn(idCpu < pVM->cCpus, CPUMMODE_INVALID);
 
65
 
 
66
    CPUMMODE enmMode;
 
67
    int rc = VMR3ReqCallWait(pVM, idCpu, (PFNRT)dbgfR3CpuGetMode, 3, pVM, idCpu, &enmMode);
 
68
    if (RT_FAILURE(rc))
 
69
        return CPUMMODE_INVALID;
 
70
    return enmMode;
 
71
}
 
72