VirtualBox

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

Last change on this file since 80333 was 80333, checked in by vboxsync, 6 years ago

VMM: Eliminating the VBOX_BUGREF_9217_PART_I preprocessor macro. bugref:9217

  • 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 80333 2019-08-16 20:28:38Z 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 * @param pVM The cross context VM structure.
40 */
41#ifdef VBOX_BUGREF_9217
42VMMR0_INT_DECL(int) EMR0InitVM(PGVM pGVM)
43#else
44VMMR0_INT_DECL(int) EMR0InitVM(PGVM pGVM, PVMCC pVM)
45#endif
46{
47 /*
48 * Override ring-0 exit optimizations settings.
49 */
50#ifdef VBOX_BUGREF_9217
51 PVMCPUCC pVCpu0 = &pGVM->aCpus[0];
52#else
53 PVMCPUCC pVCpu0 = VMCC_GET_CPU_0(pVM);
54#endif
55
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#ifdef VBOX_BUGREF_9217
65 PVMCPUCC pVCpu = &pGVM->aCpus[idCpu];
66#else
67 PVMCPUCC pVCpu = VMCC_GET_CPU(pVM, idCpu);
68#endif
69 pVCpu->em.s.fExitOptimizationEnabledR0 = fEnabledR0;
70 pVCpu->em.s.fExitOptimizationEnabledR0PreemptDisabled = fEnabledR0PreemptDisabled;
71 }
72
73 return VINF_SUCCESS;
74}
75
Note: See TracBrowser for help on using the repository browser.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette