1 | /* $Id: IEMR0.cpp 106061 2024-09-16 14:03:52Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * IEM - Interpreted Execution Manager - Ring-0.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2011-2024 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_IEM
|
---|
33 | #define VMCPU_INCL_CPUM_GST_CTX
|
---|
34 | #include <VBox/vmm/iem.h>
|
---|
35 | #include <VBox/vmm/cpum.h>
|
---|
36 | #include <VBox/vmm/pgm.h>
|
---|
37 | #include "IEMInternal.h"
|
---|
38 | #include <VBox/vmm/vmcc.h>
|
---|
39 | #include <VBox/log.h>
|
---|
40 | #include <iprt/errcore.h>
|
---|
41 |
|
---|
42 |
|
---|
43 |
|
---|
44 | VMMR0_INT_DECL(int) IEMR0InitVM(PGVM pGVM)
|
---|
45 | {
|
---|
46 | AssertCompile(sizeof(pGVM->iem.s) <= sizeof(pGVM->iem.padding));
|
---|
47 | AssertCompile(sizeof(pGVM->aCpus[0].iem.s) <= sizeof(pGVM->aCpus[0].iem.padding));
|
---|
48 |
|
---|
49 | #ifdef VBOX_WITH_NESTED_HWVIRT_VMX
|
---|
50 | /*
|
---|
51 | * Register the per-VM VMX APIC-access page handler type.
|
---|
52 | */
|
---|
53 | if (pGVM->cpum.ro.GuestFeatures.fVmx)
|
---|
54 | {
|
---|
55 | int rc = PGMR0HandlerPhysicalTypeSetUpContext(pGVM, PGMPHYSHANDLERKIND_ALL, PGMPHYSHANDLER_F_NOT_IN_HM,
|
---|
56 | iemVmxApicAccessPageHandler, iemVmxApicAccessPagePfHandler,
|
---|
57 | "VMX APIC-access page", pGVM->iem.s.hVmxApicAccessPage);
|
---|
58 | AssertLogRelRCReturn(rc, rc);
|
---|
59 | }
|
---|
60 | #endif
|
---|
61 | return VINF_SUCCESS;
|
---|
62 | }
|
---|
63 |
|
---|