1 | /* $Id: IEMR3.cpp 42437 2012-07-27 14:51:48Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * IEM - Interpreted Execution Manager.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2011 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 | * Header Files *
|
---|
20 | *******************************************************************************/
|
---|
21 | #define LOG_GROUP LOG_GROUP_EM
|
---|
22 | #include <VBox/vmm/iem.h>
|
---|
23 | #include "IEMInternal.h"
|
---|
24 | #include <VBox/vmm/vm.h>
|
---|
25 | #include <VBox/err.h>
|
---|
26 |
|
---|
27 | #include <iprt/assert.h>
|
---|
28 |
|
---|
29 |
|
---|
30 | VMMR3DECL(int) IEMR3Init(PVM pVM)
|
---|
31 | {
|
---|
32 | for (VMCPUID idCpu = 0; idCpu < pVM->cCpus; idCpu++)
|
---|
33 | {
|
---|
34 | PVMCPU pVCpu = &pVM->aCpus[idCpu];
|
---|
35 | pVCpu->iem.s.offVM = -RT_OFFSETOF(VM, aCpus[idCpu].iem.s);
|
---|
36 | pVCpu->iem.s.offVMCpu = -RT_OFFSETOF(VMCPU, iem.s);
|
---|
37 | pVCpu->iem.s.pCtxR3 = CPUMQueryGuestCtxPtr(pVCpu);
|
---|
38 | pVCpu->iem.s.pCtxR0 = VM_R0_ADDR(pVM, pVCpu->iem.s.pCtxR3);
|
---|
39 | pVCpu->iem.s.pCtxRC = VM_RC_ADDR(pVM, pVCpu->iem.s.pCtxR3);
|
---|
40 |
|
---|
41 | STAMR3RegisterF(pVM, &pVCpu->iem.s.cInstructions, STAMTYPE_U32, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT,
|
---|
42 | "Instructions interpreted", "/IEM/CPU%u/cInstructions", idCpu);
|
---|
43 | STAMR3RegisterF(pVM, &pVCpu->iem.s.cPotentialExits, STAMTYPE_U32, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT,
|
---|
44 | "Potential exists", "/IEM/CPU%u/cPotentialExits", idCpu);
|
---|
45 | STAMR3RegisterF(pVM, &pVCpu->iem.s.cRetAspectNotImplemented, STAMTYPE_U32_RESET, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT,
|
---|
46 | "VERR_IEM_ASPECT_NOT_IMPLEMENTED", "/IEM/CPU%u/cRetAspectNotImplemented", idCpu);
|
---|
47 | STAMR3RegisterF(pVM, &pVCpu->iem.s.cRetInstrNotImplemented, STAMTYPE_U32_RESET, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT,
|
---|
48 | "VERR_IEM_INSTR_NOT_IMPLEMENTED", "/IEM/CPU%u/cRetInstrNotImplemented", idCpu);
|
---|
49 | STAMR3RegisterF(pVM, &pVCpu->iem.s.cRetInfStatuses, STAMTYPE_U32_RESET, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT,
|
---|
50 | "Informational statuses returned", "/IEM/CPU%u/cRetInfStatuses", idCpu);
|
---|
51 | STAMR3RegisterF(pVM, &pVCpu->iem.s.cRetErrStatuses, STAMTYPE_U32_RESET, STAMVISIBILITY_ALWAYS, STAMUNIT_COUNT,
|
---|
52 | "Error statuses returned", "/IEM/CPU%u/cRetErrStatuses", idCpu);
|
---|
53 | STAMR3RegisterF(pVM, &pVCpu->iem.s.cbWritten, STAMTYPE_U32, STAMVISIBILITY_ALWAYS, STAMUNIT_BYTES,
|
---|
54 | "Approx bytes written", "/IEM/CPU%u/cbWritten", idCpu);
|
---|
55 | }
|
---|
56 | return VINF_SUCCESS;
|
---|
57 | }
|
---|
58 |
|
---|
59 |
|
---|
60 | VMMR3DECL(int) IEMR3Term(PVM pVM)
|
---|
61 | {
|
---|
62 | NOREF(pVM);
|
---|
63 | return VINF_SUCCESS;
|
---|
64 | }
|
---|
65 |
|
---|
66 |
|
---|
67 | VMMR3DECL(void) IEMR3Relocate(PVM pVM)
|
---|
68 | {
|
---|
69 | for (VMCPUID idCpu = 0; idCpu < pVM->cCpus; idCpu++)
|
---|
70 | pVM->aCpus[idCpu].iem.s.pCtxRC = VM_RC_ADDR(pVM, pVM->aCpus[idCpu].iem.s.pCtxR3);
|
---|
71 | }
|
---|
72 |
|
---|