VirtualBox

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

Last change on this file since 80540 was 80336, checked in by vboxsync, 5 years ago

VMM: Eliminating the VBOX_BUGREF_9217 preprocessor macro. [doxyfixes] bugref:9217

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