Changeset 1125 in vbox
- Timestamp:
- Mar 1, 2007 12:30:38 PM (18 years ago)
- svn:sync-xref-src-repo-rev:
- 19022
- Location:
- trunk/src/VBox/VMM/PATM
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/PATM/PATM.cpp
r1086 r1125 243 243 STAM_REG(pVM, &pVM->patm.s.StatSysEnter, STAMTYPE_COUNTER, "/PATM/Emul/SysEnter", STAMUNIT_OCCURENCES, "Number of times sysenter was emulated."); 244 244 STAM_REG(pVM, &pVM->patm.s.StatSysExit, STAMTYPE_COUNTER, "/PATM/Emul/SysExit" , STAMUNIT_OCCURENCES, "Number of times sysexit was emulated."); 245 STAM_REG(pVM, &pVM->patm.s.StatEmulIret, STAMTYPE_COUNTER, "/PATM/Emul/Iret/Success", STAMUNIT_OCCURENCES, "Number of times iret was emulated."); 246 STAM_REG(pVM, &pVM->patm.s.StatEmulIretFailed, STAMTYPE_COUNTER, "/PATM/Emul/Iret/Failed", STAMUNIT_OCCURENCES, "Number of times iret was emulated."); 245 247 246 248 STAM_REG(pVM, &pVM->patm.s.StatGenRet, STAMTYPE_COUNTER, "/PATM/Gen/Ret" , STAMUNIT_OCCURENCES, "Number of generated ret instructions."); -
trunk/src/VBox/VMM/PATM/PATMA.asm
r1122 r1125 1128 1128 jnz iret_fault1 1129 1129 1130 ; we can't do an iret to v86 code, as we run with CPL=1. The iret w ill attempt a protected mode iret and will(most likely) fault.1130 ; we can't do an iret to v86 code, as we run with CPL=1. The iret would attempt a protected mode iret and (most likely) fault. 1131 1131 test dword [esp+12], X86_EFL_VM 1132 1132 jnz iret_fault1 1133 ;; jnz iret_return_to_v86 1133 1134 1134 1135 ;;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! … … 1180 1181 ; Set IF again; below we make sure this won't cause problems. 1181 1182 or dword [ss:PATM_VMFLAGS], X86_EFL_IF 1182 popfd1183 1183 1184 1184 ; make sure iret is executed fully (including the iret below; cli ... iret can otherwise be interrupted) 1185 1185 mov dword [ss:PATM_INHIBITIRQADDR], PATM_CURINSTRADDR 1186 1187 popfd 1186 1188 mov dword [ss:PATM_INTERRUPTFLAG], 1 1187 1189 iretd … … 1237 1239 iretd 1238 1240 1241 iret_return_to_v86: 1242 ; Go to our hypervisor trap handler to perform the iret to v86 code 1243 mov dword [ss:PATM_TEMP_EAX], eax 1244 mov dword [ss:PATM_TEMP_ECX], ecx 1245 mov dword [ss:PATM_TEMP_RESTORE_FLAGS], PATM_RESTORE_EAX | PATM_RESTORE_ECX 1246 mov eax, PATM_ACTION_DO_V86_IRET 1247 lock or dword [ss:PATM_PENDINGACTION], eax 1248 mov ecx, PATM_ACTION_MAGIC 1249 1250 popfd 1251 1252 db 0fh, 0bh ; illegal instr (hardcoded assumption in PATMHandleIllegalInstrTrap) 1253 ; does not return 1254 1255 1239 1256 iret_fault3: 1240 1257 pop eax … … 1261 1278 DD PATMIretEnd- PATMIretStart 1262 1279 %ifdef PATM_LOG_PATCHIRET 1263 DD 2 21280 DD 26 1264 1281 %else 1265 DD 2 11282 DD 25 1266 1283 %endif 1267 1284 DD PATM_INTERRUPTFLAG … … 1310 1327 DD 0 1311 1328 DD PATM_VMFLAGS 1329 DD 0 1330 DD PATM_TEMP_EAX 1331 DD 0 1332 DD PATM_TEMP_ECX 1333 DD 0 1334 DD PATM_TEMP_RESTORE_FLAGS 1335 DD 0 1336 DD PATM_PENDINGACTION 1312 1337 DD 0 1313 1338 DD 0ffffffffh -
trunk/src/VBox/VMM/PATM/PATMA.h
r742 r1125 84 84 #define PATM_ACTION_DISPATCH_PENDING_IRQ 2 85 85 #define PATM_ACTION_PENDING_IRQ_AFTER_IRET 3 86 #define PATM_ACTION_LOG_IF1 4 87 #define PATM_ACTION_LOG_CLI 5 88 #define PATM_ACTION_LOG_STI 6 89 #define PATM_ACTION_LOG_POPF_IF1 7 90 #define PATM_ACTION_LOG_POPF_IF0 8 91 #define PATM_ACTION_LOG_PUSHF 9 92 #define PATM_ACTION_LOG_IRET 10 93 #define PATM_ACTION_LOG_RET 11 94 #define PATM_ACTION_LOG_CALL 12 86 #define PATM_ACTION_DO_V86_IRET 4 87 #define PATM_ACTION_LOG_IF1 5 88 #define PATM_ACTION_LOG_CLI 6 89 #define PATM_ACTION_LOG_STI 7 90 #define PATM_ACTION_LOG_POPF_IF1 8 91 #define PATM_ACTION_LOG_POPF_IF0 9 92 #define PATM_ACTION_LOG_PUSHF 10 93 #define PATM_ACTION_LOG_IRET 11 94 #define PATM_ACTION_LOG_RET 12 95 #define PATM_ACTION_LOG_CALL 13 95 96 96 97 /* Magic dword found in ecx for patm pending actions. */ -
trunk/src/VBox/VMM/PATM/PATMA.mac
r742 r1125 83 83 %define PATM_ACTION_DISPATCH_PENDING_IRQ 2 84 84 %define PATM_ACTION_PENDING_IRQ_AFTER_IRET 3 85 %define PATM_ACTION_LOG_IF1 4 86 %define PATM_ACTION_LOG_CLI 5 87 %define PATM_ACTION_LOG_STI 6 88 %define PATM_ACTION_LOG_POPF_IF1 7 89 %define PATM_ACTION_LOG_POPF_IF0 8 90 %define PATM_ACTION_LOG_PUSHF 9 91 %define PATM_ACTION_LOG_IRET 10 92 %define PATM_ACTION_LOG_RET 11 93 %define PATM_ACTION_LOG_CALL 12 85 %define PATM_ACTION_DO_V86_IRET 4 86 %define PATM_ACTION_LOG_IF1 5 87 %define PATM_ACTION_LOG_CLI 6 88 %define PATM_ACTION_LOG_STI 7 89 %define PATM_ACTION_LOG_POPF_IF1 8 90 %define PATM_ACTION_LOG_POPF_IF0 9 91 %define PATM_ACTION_LOG_PUSHF 10 92 %define PATM_ACTION_LOG_IRET 11 93 %define PATM_ACTION_LOG_RET 12 94 %define PATM_ACTION_LOG_CALL 13 94 95 95 96 ;/* Magic dword found in ecx for patm pending actions. */ -
trunk/src/VBox/VMM/PATM/PATMInternal.h
r742 r1125 37 37 38 38 39 #define PATM_SSM_VERSION 5 139 #define PATM_SSM_VERSION 52 40 40 41 41 /* Enable for call patching. */ … … 475 475 STAMCOUNTER StatSysEnter; 476 476 STAMCOUNTER StatSysExit; 477 STAMCOUNTER StatEmulIret; 478 STAMCOUNTER StatEmulIretFailed; 477 479 478 480 STAMCOUNTER StatInstrDirty; -
trunk/src/VBox/VMM/PATM/VMMAll/PATMAll.cpp
r1110 r1125 586 586 return VINF_PATM_PENDING_IRQ_AFTER_IRET; 587 587 588 case PATM_ACTION_DO_V86_IRET: 589 { 590 Log(("PATMGC: Do iret to V86 code; eip=%VGv\n", pRegFrame->eip)); 591 Assert(pVM->patm.s.CTXSUFF(pGCState)->Restore.uFlags == (PATM_RESTORE_EAX|PATM_RESTORE_ECX)); 592 Assert(pVM->patm.s.CTXSUFF(pGCState)->fPIF == 0); 593 594 pRegFrame->eax = pVM->patm.s.CTXSUFF(pGCState)->Restore.uEAX; 595 pRegFrame->ecx = pVM->patm.s.CTXSUFF(pGCState)->Restore.uECX; 596 pVM->patm.s.CTXSUFF(pGCState)->Restore.uFlags = 0; 597 598 /* We are no longer executing PATM code; set PIF again. */ 599 pVM->patm.s.CTXSUFF(pGCState)->fPIF = 1; 600 rc = EMInterpretIret(pVM, pRegFrame); 601 if (VBOX_SUCCESS(rc)) 602 STAM_COUNTER_INC(&pVM->patm.s.StatEmulIret); 603 else 604 STAM_COUNTER_INC(&pVM->patm.s.StatEmulIretFailed); 605 return rc; 606 } 607 588 608 #ifdef DEBUG 589 609 case PATM_ACTION_LOG_CLI:
Note:
See TracChangeset
for help on using the changeset viewer.