Changeset 19141 in vbox for trunk/src/VBox/VMM/PATM
- Timestamp:
- Apr 23, 2009 1:52:18 PM (16 years ago)
- svn:sync-xref-src-repo-rev:
- 46372
- Location:
- trunk/src/VBox/VMM/PATM
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/PATM/CSAM.cpp
r18992 r19141 228 228 pVM->csam.s.fScanningStarted = false; 229 229 230 VM_FF_CLEAR(pVM, VM_FF_CSAM_PENDING_ACTION); 230 PVMCPU pVCpu = &pVM->aCpus[0]; /* raw mode implies 1 VPCU */ 231 VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_CSAM_PENDING_ACTION); 231 232 pVM->csam.s.cDirtyPages = 0; 232 233 /* not necessary */ … … 2263 2264 * @returns VBox status code. 2264 2265 * @param pVM The VM to operate on. 2265 */ 2266 VMMR3DECL(int) CSAMR3DoPendingAction(PVM pVM) 2266 * @param pVCpu The VMCPU to operate on. 2267 */ 2268 VMMR3DECL(int) CSAMR3DoPendingAction(PVM pVM, PVMCPU pVCpu) 2267 2269 { 2268 2270 csamR3FlushDirtyPages(pVM); 2269 2271 csamR3FlushCodePages(pVM); 2270 2272 2271 VM _FF_CLEAR(pVM, VM_FF_CSAM_PENDING_ACTION);2273 VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_CSAM_PENDING_ACTION); 2272 2274 return VINF_SUCCESS; 2273 2275 } -
trunk/src/VBox/VMM/PATM/PATM.cpp
r18988 r19141 112 112 Log(("PATMR3Init: Patch record size %d\n", sizeof(PATCHINFO))); 113 113 114 AssertReleaseMsg(PATMInterruptFlag == (VM_FF_INTERRUPT_APIC | VM_FF_INTERRUPT_PIC | VM_FF_TIMER | VM_FF_REQUEST), 115 ("Interrupt flags out of sync!! PATMInterruptFlag=%#x expected %#x. broken assembler?\n", PATMInterruptFlag, VM_FF_INTERRUPT_APIC | VM_FF_INTERRUPT_PIC | VM_FF_TIMER | VM_FF_REQUEST)); 114 /* These values can't change as they are hardcoded in patch code (old saved states!) */ 115 AssertCompile(VM_FF_TIMER == VMCPU_FF_TIMER); 116 AssertCompile(VM_FF_REQUEST == VMCPU_FF_REQUEST); 117 AssertCompile(VMCPU_FF_INTERRUPT_APIC == RT_BIT_32(0)); 118 AssertCompile(VMCPU_FF_INTERRUPT_PIC == RT_BIT_32(1)); 119 120 AssertReleaseMsg(PATMInterruptFlag == (VMCPU_FF_INTERRUPT_APIC | VMCPU_FF_INTERRUPT_PIC | VMCPU_FF_TIMER | VMCPU_FF_REQUEST), 121 ("Interrupt flags out of sync!! PATMInterruptFlag=%#x expected %#x. broken assembler?\n", PATMInterruptFlag, VMCPU_FF_INTERRUPT_APIC | VMCPU_FF_INTERRUPT_PIC | VMCPU_FF_TIMER | VMCPU_FF_REQUEST)); 116 122 117 123 /* Allocate patch memory and GC patch state memory. */ … … 6233 6239 } 6234 6240 #endif 6235 EMSetInhibitInterruptsPC(pV M, pVCpu, pNewEip);6241 EMSetInhibitInterruptsPC(pVCpu, pNewEip); 6236 6242 pVM->patm.s.pGCStateHC->GCPtrInhibitInterrupts = 0; 6237 6243 } -
trunk/src/VBox/VMM/PATM/PATMA.asm
r11979 r19141 146 146 147 147 ; if interrupts are pending, then we must go back to the host context to handle them! 148 test dword [ss:PATM_VM_FORCEDACTIONS], VM _FF_INTERRUPT_APIC | VM_FF_INTERRUPT_PIC | VM_FF_TIMER | VM_FF_REQUEST148 test dword [ss:PATM_VM_FORCEDACTIONS], VMCPU_FF_INTERRUPT_APIC | VMCPU_FF_INTERRUPT_PIC | VMCPU_FF_TIMER | VMCPU_FF_REQUEST 149 149 jz PATMClearInhibitIRQFaultIF0_Continue 150 150 … … 221 221 222 222 ; if interrupts are pending, then we must go back to the host context to handle them! 223 test dword [ss:PATM_VM_FORCEDACTIONS], VM _FF_INTERRUPT_APIC | VM_FF_INTERRUPT_PIC | VM_FF_TIMER | VM_FF_REQUEST223 test dword [ss:PATM_VM_FORCEDACTIONS], VMCPU_FF_INTERRUPT_APIC | VMCPU_FF_INTERRUPT_PIC | VMCPU_FF_TIMER | VMCPU_FF_REQUEST 224 224 jz PATMClearInhibitIRQContIF0_Continue 225 225 … … 744 744 745 745 ; if interrupts are pending, then we must go back to the host context to handle them! 746 test dword [ss:PATM_VM_FORCEDACTIONS], VM _FF_INTERRUPT_APIC | VM_FF_INTERRUPT_PIC | VM_FF_TIMER | VM_FF_REQUEST746 test dword [ss:PATM_VM_FORCEDACTIONS], VMCPU_FF_INTERRUPT_APIC | VMCPU_FF_INTERRUPT_PIC | VMCPU_FF_TIMER | VMCPU_FF_REQUEST 747 747 jz PATMPopf32_Continue 748 748 … … 834 834 835 835 ; if interrupts are pending, then we must go back to the host context to handle them! 836 test dword [ss:PATM_VM_FORCEDACTIONS], VM _FF_INTERRUPT_APIC | VM_FF_INTERRUPT_PIC | VM_FF_TIMER | VM_FF_REQUEST836 test dword [ss:PATM_VM_FORCEDACTIONS], VMCPU_FF_INTERRUPT_APIC | VMCPU_FF_INTERRUPT_PIC | VMCPU_FF_TIMER | VMCPU_FF_REQUEST 837 837 jz PATMPopf32_NoExit_Continue 838 838 … … 922 922 ; if interrupts are pending, then we must go back to the host context to handle them! 923 923 ; @note we destroy the flags here, but that should really not matter (PATM_INT3 case) 924 test dword [ss:PATM_VM_FORCEDACTIONS], VM _FF_INTERRUPT_APIC | VM_FF_INTERRUPT_PIC | VM_FF_TIMER | VM_FF_REQUEST924 test dword [ss:PATM_VM_FORCEDACTIONS], VMCPU_FF_INTERRUPT_APIC | VMCPU_FF_INTERRUPT_PIC | VMCPU_FF_TIMER | VMCPU_FF_REQUEST 925 925 jz PATMPopf16_Continue 926 926 mov dword [ss:PATM_INTERRUPTFLAG], 1 … … 987 987 ; if interrupts are pending, then we must go back to the host context to handle them! 988 988 ; @note we destroy the flags here, but that should really not matter (PATM_INT3 case) 989 test dword [ss:PATM_VM_FORCEDACTIONS], VM _FF_INTERRUPT_APIC | VM_FF_INTERRUPT_PIC | VM_FF_TIMER | VM_FF_REQUEST989 test dword [ss:PATM_VM_FORCEDACTIONS], VMCPU_FF_INTERRUPT_APIC | VMCPU_FF_INTERRUPT_PIC | VMCPU_FF_TIMER | VMCPU_FF_REQUEST 990 990 jz PATMPopf16_Continue_NoExit 991 991 mov dword [ss:PATM_INTERRUPTFLAG], 1 … … 1238 1238 ; Note: This is very important as pending pic interrupts can be overriden by apic interrupts if we don't check early enough (Fedora 5 boot) 1239 1239 ; @@todo fix this properly, so we can dispatch pending interrupts in GC 1240 test dword [ss:PATM_VM_FORCEDACTIONS], VM _FF_INTERRUPT_APIC | VM_FF_INTERRUPT_PIC1240 test dword [ss:PATM_VM_FORCEDACTIONS], VMCPU_FF_INTERRUPT_APIC | VMCPU_FF_INTERRUPT_PIC 1241 1241 jz iret_continue 1242 1242 … … 2582 2582 ; For assertion during init (to make absolutely sure the flags are in sync in vm.mac & vm.h) 2583 2583 GLOBALNAME PATMInterruptFlag 2584 DD VM _FF_INTERRUPT_APIC | VM_FF_INTERRUPT_PIC | VM_FF_TIMER | VM_FF_REQUEST2585 2584 DD VMCPU_FF_INTERRUPT_APIC | VMCPU_FF_INTERRUPT_PIC | VMCPU_FF_TIMER | VMCPU_FF_REQUEST 2585 -
trunk/src/VBox/VMM/PATM/PATMInternal.h
r18927 r19141 41 41 #else 42 42 # define PATM_SSM_VERSION 54 43 # define PATM_SSM_VERSION_FIXUP_HACK 54 43 44 # define PATM_SSM_VERSION_VER16 53 44 45 #endif … … 134 135 #define PATM_STAT_MEMSIZE (PATM_STAT_MAX_COUNTERS*sizeof(STAMRATIOU32)) 135 136 137 /** aCpus[0].fLocalForcedActions fixup (must be uneven to avoid theoretical clashes with valid pointers) */ 138 #define PATM_FIXUP_CPU_FF_ACTION 0xffffff01 139 /** default cpuid pointer fixup */ 140 #define PATM_FIXUP_CPUID_DEFAULT 0xffffff03 141 /** standard cpuid pointer fixup */ 142 #define PATM_FIXUP_CPUID_STANDARD 0xffffff05 143 /** extended cpuid pointer fixup */ 144 #define PATM_FIXUP_CPUID_EXTENDED 0xffffff07 145 /** centaur cpuid pointer fixup */ 146 #define PATM_FIXUP_CPUID_CENTAUR 0xffffff09 136 147 137 148 typedef struct -
trunk/src/VBox/VMM/PATM/PATMPatch.cpp
r19075 r19141 287 287 case PATM_VM_FORCEDACTIONS: 288 288 /* @todo dirty assumptions when correcting this fixup during saved state loading. */ 289 dest = pVM->pVMRC + RT_OFFSETOF(VM, fForcedActions);289 dest = pVM->pVMRC + RT_OFFSETOF(VM, aCpus[0].fLocalForcedActions); 290 290 break; 291 291 -
trunk/src/VBox/VMM/PATM/PATMSSM.cpp
r19075 r19141 142 142 PSSMHANDLE pSSM = pVM->patm.s.savedstate.pSSM; 143 143 RELOCREC rec = *(PRELOCREC)pNode; 144 RTRCPTR *pFixup = (RTRCPTR *)rec.pRelocPos; 144 145 145 146 Assert(rec.pRelocPos); 147 /* Convert pointer to an offset into patch memory. */ 146 148 PATM_SUBTRACT_PTR(rec.pRelocPos, pVM->patm.s.pPatchMemHC); 149 150 if (rec.uType == FIXUP_ABSOLUTE) 151 { 152 /* Core.Key abused to store the fixup type. */ 153 if (*pFixup == pVM->pVMRC + RT_OFFSETOF(VM, aCpus[0].fLocalForcedActions)) 154 rec.Core.Key = (AVLPVKEY)PATM_FIXUP_CPU_FF_ACTION; 155 else 156 if (*pFixup == CPUMR3GetGuestCpuIdDefRCPtr(pVM)) 157 rec.Core.Key = (AVLPVKEY)PATM_FIXUP_CPUID_DEFAULT; 158 else 159 if (*pFixup == CPUMR3GetGuestCpuIdStdRCPtr(pVM)) 160 rec.Core.Key = (AVLPVKEY)PATM_FIXUP_CPUID_STANDARD; 161 else 162 if (*pFixup == CPUMR3GetGuestCpuIdExtRCPtr(pVM)) 163 rec.Core.Key = (AVLPVKEY)PATM_FIXUP_CPUID_EXTENDED; 164 else 165 if (*pFixup == CPUMR3GetGuestCpuIdCentaurRCPtr(pVM)) 166 rec.Core.Key = (AVLPVKEY)PATM_FIXUP_CPUID_CENTAUR; 167 } 147 168 148 169 /* Save the lookup record. */ … … 286 307 287 308 if ( u32Version != PATM_SSM_VERSION 309 && u32Version != PATM_SSM_VERSION_FIXUP_HACK 288 310 && u32Version != PATM_SSM_VERSION_VER16 289 311 #ifdef PATM_WITH_NEW_SSM … … 874 896 } 875 897 else 876 /* Note: rather assumptive! */877 if (*pFixup >= pVM->pVMRC898 if ( ulSSMVersion <= PATM_SSM_VERSION_FIXUP_HACK 899 && *pFixup >= pVM->pVMRC 878 900 && *pFixup < pVM->pVMRC + 32) 879 901 { 880 LogFlow(("Changing f ForcedActions fixup from %x to %x\n", *pFixup, pVM->pVMRC + RT_OFFSETOF(VM, fForcedActions)));881 *pFixup = pVM->pVMRC + RT_OFFSETOF(VM, fForcedActions);902 LogFlow(("Changing fLocalForcedActions fixup from %x to %x\n", *pFixup, pVM->pVMRC + RT_OFFSETOF(VM, aCpus[0].fLocalForcedActions))); 903 *pFixup = pVM->pVMRC + RT_OFFSETOF(VM, aCpus[0].fLocalForcedActions); 882 904 } 883 905 else 884 if ( *pFixup >= pVM->pVMRC 906 if ( ulSSMVersion <= PATM_SSM_VERSION_FIXUP_HACK 907 && *pFixup >= pVM->pVMRC 885 908 && *pFixup < pVM->pVMRC + 8192) 886 909 { … … 909 932 } 910 933 else 911 AssertMsgFailed(("Unexpected fixup value %x\n", *pFixup)); 934 if (ulSSMVersion >= PATM_SSM_VERSION) 935 { 936 #ifdef LOG_ENABLED 937 RTRCPTR oldFixup = *pFixup; 938 #endif 939 /* Core.Key abused to store the type of fixup */ 940 switch ((uint32_t)pRec->Core.Key) 941 { 942 case PATM_FIXUP_CPU_FF_ACTION: 943 *pFixup = pVM->pVMRC + RT_OFFSETOF(VM, aCpus[0].fLocalForcedActions); 944 LogFlow(("Changing cpu ff action fixup from %x to %x\n", oldFixup, *pFixup)); 945 break; 946 case PATM_FIXUP_CPUID_DEFAULT: 947 *pFixup = CPUMR3GetGuestCpuIdDefRCPtr(pVM); 948 LogFlow(("Changing cpuid def fixup from %x to %x\n", oldFixup, *pFixup)); 949 break; 950 case PATM_FIXUP_CPUID_STANDARD: 951 *pFixup = CPUMR3GetGuestCpuIdStdRCPtr(pVM); 952 LogFlow(("Changing cpuid std fixup from %x to %x\n", oldFixup, *pFixup)); 953 break; 954 case PATM_FIXUP_CPUID_EXTENDED: 955 *pFixup = CPUMR3GetGuestCpuIdExtRCPtr(pVM); 956 LogFlow(("Changing cpuid ext fixup from %x to %x\n", oldFixup, *pFixup)); 957 break; 958 case PATM_FIXUP_CPUID_CENTAUR: 959 *pFixup = CPUMR3GetGuestCpuIdCentaurRCPtr(pVM); 960 LogFlow(("Changing cpuid centaur fixup from %x to %x\n", oldFixup, *pFixup)); 961 break; 962 default: 963 AssertMsgFailed(("Unexpected fixup value %x\n", *pFixup)); 964 break; 965 } 966 } 912 967 913 968 #ifdef RT_OS_WINDOWS 914 AssertCompile(RT_OFFSETOF(VM, f ForcedActions) < 32);969 AssertCompile(RT_OFFSETOF(VM, fGlobalForcedActions) < 32); 915 970 #endif 916 971 break; -
trunk/src/VBox/VMM/PATM/VMMAll/CSAMAll.cpp
r14299 r19141 37 37 #include "CSAMInternal.h" 38 38 #include <VBox/vm.h> 39 #include <VBox/vmm.h> 39 40 #include <VBox/dbg.h> 40 41 #include <VBox/err.h> … … 68 69 69 70 STAM_COUNTER_ADD(&pVM->csam.s.StatNrTraps, 1); 70 VM _FF_SET(pVM, VM_FF_CSAM_SCAN_PAGE);71 VMCPU_FF_SET(VMMGetCpu0(pVM), VMCPU_FF_CSAM_SCAN_PAGE); 71 72 return VINF_CSAM_PENDING_ACTION; 72 73 } … … 205 206 { 206 207 pVM->csam.s.pvPossibleCodePage[pVM->csam.s.cPossibleCodePages++] = (RTRCPTR)GCPtr; 207 VM _FF_SET(pVM, VM_FF_CSAM_PENDING_ACTION);208 VMCPU_FF_SET(VMMGetCpu0(pVM), VMCPU_FF_CSAM_PENDING_ACTION); 208 209 } 209 210 return; -
trunk/src/VBox/VMM/PATM/VMMAll/PATMAll.cpp
r18927 r19141 191 191 if (CTXSUFF(pVM->patm.s.pGCState)->GCPtrInhibitInterrupts == (RTRCPTR)pCtxCore->eip) 192 192 { 193 EMSetInhibitInterruptsPC( pVM,VMMGetCpu0(pVM), pCtxCore->eip);193 EMSetInhibitInterruptsPC(VMMGetCpu0(pVM), pCtxCore->eip); 194 194 } 195 195 CTXSUFF(pVM->patm.s.pGCState)->GCPtrInhibitInterrupts = 0; -
trunk/src/VBox/VMM/PATM/VMMGC/CSAMGC.cpp
r18988 r19141 117 117 } 118 118 119 VM _FF_SET(pVM, VM_FF_CSAM_PENDING_ACTION);119 VMCPU_FF_SET(pVCpu, VMCPU_FF_CSAM_PENDING_ACTION); 120 120 121 121 /* Note that pvFault might be a different address in case of aliases. So use pvRange + offset instead!. */
Note:
See TracChangeset
for help on using the changeset viewer.