Changeset 26855 in vbox for trunk/src/VBox/VMM
- Timestamp:
- Feb 26, 2010 2:30:43 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMAll/EMAll.cpp
r26273 r26855 79 79 * Internal Functions * 80 80 *******************************************************************************/ 81 DECLINLINE(int) emInterpretInstructionCPU(PVM pVM, PVMCPU pVCpu, PDISCPUSTATE pDis, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault, uint32_t *pcbSize );81 DECLINLINE(int) emInterpretInstructionCPU(PVM pVM, PVMCPU pVCpu, PDISCPUSTATE pDis, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault, uint32_t *pcbSize, EMCODETYPE enmCodeType = EMCODETYPE_SUPERVISOR); 82 82 83 83 … … 360 360 * @param pvFault The fault address (CR2). 361 361 * @param pcbSize Size of the write (if applicable). 362 * @param enmCodeType Code type (user/supervisor) 362 363 * 363 364 * @remark Invalid opcode exceptions have a higher priority than GP (see Intel … … 368 369 * Make sure this can't happen!! (will add some assertions/checks later) 369 370 */ 370 VMMDECL(int) EMInterpretInstructionCPU (PVM pVM, PVMCPU pVCpu, PDISCPUSTATE pDis, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault, uint32_t *pcbSize)371 VMMDECL(int) EMInterpretInstructionCPUEx(PVM pVM, PVMCPU pVCpu, PDISCPUSTATE pDis, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault, uint32_t *pcbSize, EMCODETYPE enmCodeType) 371 372 { 372 373 STAM_PROFILE_START(&pVCpu->em.s.CTX_SUFF(pStats)->CTX_MID_Z(Stat,Emulate), a); 373 int rc = emInterpretInstructionCPU(pVM, pVCpu, pDis, pRegFrame, pvFault, pcbSize );374 int rc = emInterpretInstructionCPU(pVM, pVCpu, pDis, pRegFrame, pvFault, pcbSize, enmCodeType); 374 375 STAM_PROFILE_STOP(&pVCpu->em.s.CTX_SUFF(pStats)->CTX_MID_Z(Stat,Emulate), a); 375 376 if (RT_SUCCESS(rc)) … … 3150 3151 * @copydoc EMInterpretInstructionCPU 3151 3152 */ 3152 DECLINLINE(int) emInterpretInstructionCPU(PVM pVM, PVMCPU pVCpu, PDISCPUSTATE pDis, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault, uint32_t *pcbSize) 3153 { 3153 DECLINLINE(int) emInterpretInstructionCPU(PVM pVM, PVMCPU pVCpu, PDISCPUSTATE pDis, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault, uint32_t *pcbSize, EMCODETYPE enmCodeType) 3154 { 3155 Assert(enmCodeType == EMCODETYPE_SUPERVISOR || enmCodeType == EMCODETYPE_ALL); 3154 3156 Assert(pcbSize); 3155 3157 *pcbSize = 0; 3156 3158 3157 /* 3158 * Only supervisor guest code!! 3159 * And no complicated prefixes. 3160 */ 3161 /* Get the current privilege level. */ 3162 uint32_t cpl = CPUMGetGuestCPL(pVCpu, pRegFrame); 3163 if ( cpl != 0 3164 && pDis->pCurInstr->opcode != OP_RDTSC) /* rdtsc requires emulation in ring 3 as well */ 3165 { 3166 Log(("WARNING: refusing instruction emulation for user-mode code!!\n")); 3167 STAM_COUNTER_INC(&pVCpu->em.s.CTX_SUFF(pStats)->CTX_MID_Z(Stat,FailedUserMode)); 3168 return VERR_EM_INTERPRETER; 3169 } 3159 if (enmCodeType == EMCODETYPE_SUPERVISOR) 3160 { 3161 /* 3162 * Only supervisor guest code!! 3163 * And no complicated prefixes. 3164 */ 3165 /* Get the current privilege level. */ 3166 uint32_t cpl = CPUMGetGuestCPL(pVCpu, pRegFrame); 3167 if ( cpl != 0 3168 && pDis->pCurInstr->opcode != OP_RDTSC) /* rdtsc requires emulation in ring 3 as well */ 3169 { 3170 Log(("WARNING: refusing instruction emulation for user-mode code!!\n")); 3171 STAM_COUNTER_INC(&pVCpu->em.s.CTX_SUFF(pStats)->CTX_MID_Z(Stat,FailedUserMode)); 3172 return VERR_EM_INTERPRETER; 3173 } 3174 } 3175 else 3176 Log2(("emInterpretInstructionCPU allowed to interpret user-level code!!\n")); 3170 3177 3171 3178 #ifdef IN_RC
Note:
See TracChangeset
for help on using the changeset viewer.