VirtualBox

source: vbox/trunk/src/VBox/VMM/tools/VBoxCpuReportMsrSup.cpp@ 98103

Last change on this file since 98103 was 98103, checked in by vboxsync, 23 months ago

Copyright year updates by scm.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.4 KB
Line 
1/* $Id: VBoxCpuReportMsrSup.cpp 98103 2023-01-17 14:15:46Z vboxsync $ */
2/** @file
3 * MsrSup - SupDrv-specific MSR access.
4 */
5
6/*
7 * Copyright (C) 2013-2023 Oracle and/or its affiliates.
8 *
9 * This file is part of VirtualBox base platform packages, as
10 * available from https://www.virtualbox.org.
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation, in version 3 of the
15 * License.
16 *
17 * This program is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, see <https://www.gnu.org/licenses>.
24 *
25 * SPDX-License-Identifier: GPL-3.0-only
26 */
27
28
29/*********************************************************************************************************************************
30* Header Files *
31*********************************************************************************************************************************/
32#include "VBoxCpuReport.h"
33#include <iprt/errcore.h>
34#include <iprt/x86.h>
35
36
37int VbCpuRepMsrProberInitSupDrv(PVBCPUREPMSRACCESSORS pMsrFunctions)
38{
39 int rc = SUPR3Init(NULL);
40 if (RT_SUCCESS(rc))
41 {
42 /* Test if the MSR prober is available, since the interface is optional. The TSC MSR will exist on any supported CPU. */
43 uint64_t uValue;
44 bool fGp;
45 rc = SUPR3MsrProberRead(MSR_IA32_TSC, NIL_RTCPUID, &uValue, &fGp);
46 if ( rc != VERR_NOT_IMPLEMENTED
47 && rc != VERR_INVALID_FUNCTION)
48 {
49 pMsrFunctions->fAtomic = true;
50 pMsrFunctions->pfnMsrProberRead = SUPR3MsrProberRead;
51 pMsrFunctions->pfnMsrProberWrite = SUPR3MsrProberWrite;
52 pMsrFunctions->pfnMsrProberModify = SUPR3MsrProberModify;
53
54 pMsrFunctions->pfnTerm = NULL;
55 return VINF_SUCCESS;
56
57 }
58 vbCpuRepDebug("warning: MSR probing not supported by the support driver (%Rrc).\n", rc);
59 }
60 else
61 vbCpuRepDebug("warning: Unable to initialize the support library (%Rrc).\n", rc);
62 return rc;
63}
64
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