VirtualBox

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

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

EM,IEM,VMX: Working on configuring exit history optimziations. Currently enabled in ring-0 for NEM but disabled for HM. bugref:9198

  • 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 72642 2018-06-21 15:41:14Z vboxsync $ */
2/** @file
3 * EM - Host Context Ring 0.
4 */
5
6/*
7 * Copyright (C) 2006-2018 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/vm.h>
26#include <VBox/vmm/gvm.h>
27#include <VBox/err.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 */
41VMMR0_INT_DECL(int) EMR0InitVM(PGVM pGVM, PVM pVM)
42{
43 /*
44 * Override ring-0 exit optimizations settings.
45 */
46 bool fEnabledR0 = pVM->aCpus[0].em.s.fExitOptimizationEnabled
47 && pVM->aCpus[0].em.s.fExitOptimizationEnabledR0
48 && (RTThreadPreemptIsPossible() || RTThreadPreemptIsPendingTrusty());
49 bool fEnabledR0PreemptDisabled = fEnabledR0
50 && pVM->aCpus[0].em.s.fExitOptimizationEnabledR0PreemptDisabled
51 && RTThreadPreemptIsPendingTrusty();
52 for (VMCPUID i = 0; i < pGVM->cCpus; i++)
53 {
54 pVM->aCpus[i].em.s.fExitOptimizationEnabledR0 = fEnabledR0;
55 pVM->aCpus[i].em.s.fExitOptimizationEnabledR0PreemptDisabled = fEnabledR0PreemptDisabled;
56 }
57
58 return VINF_SUCCESS;
59}
60
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