1 | /* $Id: IEMR0.cpp 93655 2022-02-08 13:56:01Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * IEM - Interpreted Execution Manager - Ring-0.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2011-2022 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_IEM
|
---|
23 | #define VMCPU_INCL_CPUM_GST_CTX
|
---|
24 | #include <VBox/vmm/iem.h>
|
---|
25 | #include <VBox/vmm/cpum.h>
|
---|
26 | #include <VBox/vmm/pgm.h>
|
---|
27 | #include "IEMInternal.h"
|
---|
28 | #include <VBox/vmm/vmcc.h>
|
---|
29 | #include <VBox/log.h>
|
---|
30 | #include <iprt/errcore.h>
|
---|
31 |
|
---|
32 |
|
---|
33 |
|
---|
34 | VMMR0_INT_DECL(int) IEMR0InitVM(PGVM pGVM)
|
---|
35 | {
|
---|
36 | AssertCompile(sizeof(pGVM->iem.s) <= sizeof(pGVM->iem.padding));
|
---|
37 | AssertCompile(sizeof(pGVM->aCpus[0].iem.s) <= sizeof(pGVM->aCpus[0].iem.padding));
|
---|
38 |
|
---|
39 | #ifdef VBOX_WITH_NESTED_HWVIRT_VMX
|
---|
40 | /*
|
---|
41 | * Register the per-VM VMX APIC-access page handler type.
|
---|
42 | */
|
---|
43 | if (pGVM->cpum.ro.GuestFeatures.fVmx)
|
---|
44 | {
|
---|
45 | int rc = PGMR0HandlerPhysicalTypeSetUpContext(pGVM, PGMPHYSHANDLERKIND_ALL, 0 /*fFlags*/,
|
---|
46 | iemVmxApicAccessPageHandler, NULL /*pfnzPfHandlerR0*/,
|
---|
47 | "VMX APIC-access page", pGVM->iem.s.hVmxApicAccessPage);
|
---|
48 | AssertLogRelRCReturn(rc, rc);
|
---|
49 | }
|
---|
50 | #endif
|
---|
51 | return VINF_SUCCESS;
|
---|
52 | }
|
---|
53 |
|
---|