VirtualBox

source: vbox/trunk/src/VBox/VMM/VMMR0/EMR0.cpp@ 96945

Last change on this file since 96945 was 96407, checked in by vboxsync, 2 years ago

scm copyright and license note update

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.5 KB
Line 
1/* $Id: EMR0.cpp 96407 2022-08-22 17:43:14Z vboxsync $ */
2/** @file
3 * EM - Host Context Ring 0.
4 */
5
6/*
7 * Copyright (C) 2006-2022 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#define LOG_GROUP LOG_GROUP_EM
33#include <VBox/vmm/em.h>
34#include "EMInternal.h"
35#include <VBox/vmm/vmcc.h>
36#include <VBox/vmm/gvm.h>
37#include <iprt/errcore.h>
38#include <VBox/log.h>
39#include <iprt/assert.h>
40#include <iprt/thread.h>
41
42
43
44/**
45 * Adjusts EM configuration options.
46 *
47 * @returns VBox status code.
48 * @param pGVM The ring-0 VM structure.
49 */
50VMMR0_INT_DECL(int) EMR0InitVM(PGVM pGVM)
51{
52 /*
53 * Override ring-0 exit optimizations settings.
54 */
55 PVMCPUCC pVCpu0 = &pGVM->aCpus[0];
56 bool fEnabledR0 = pVCpu0->em.s.fExitOptimizationEnabled
57 && pVCpu0->em.s.fExitOptimizationEnabledR0
58 && (RTThreadPreemptIsPossible() || RTThreadPreemptIsPendingTrusty());
59 bool fEnabledR0PreemptDisabled = fEnabledR0
60 && pVCpu0->em.s.fExitOptimizationEnabledR0PreemptDisabled
61 && RTThreadPreemptIsPendingTrusty();
62 for (VMCPUID idCpu = 0; idCpu < pGVM->cCpus; idCpu++)
63 {
64 PVMCPUCC pVCpu = &pGVM->aCpus[idCpu];
65 pVCpu->em.s.fExitOptimizationEnabledR0 = fEnabledR0;
66 pVCpu->em.s.fExitOptimizationEnabledR0PreemptDisabled = fEnabledR0PreemptDisabled;
67 }
68
69 return VINF_SUCCESS;
70}
71
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