Changeset 36780 in vbox
- Timestamp:
- Apr 21, 2011 12:38:30 AM (14 years ago)
- Location:
- trunk/src/VBox/VMM
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMAll/IEMAll.cpp
r36778 r36780 1082 1082 1083 1083 static VBOXSTRICTRC iemRaiseGeneralProtectionFault0(PIEMCPU pIemCpu) 1084 { 1085 AssertFailed(/** @todo implement this */); 1086 return VERR_NOT_IMPLEMENTED; 1087 } 1088 1089 1090 static VBOXSTRICTRC iemRaiseNotCanonical(PIEMCPU pIemCpu) 1084 1091 { 1085 1092 AssertFailed(/** @todo implement this */); … … 3852 3859 PCPUMCTX pCtx = pIemCpu->CTX_SUFF(pCtx); 3853 3860 uint64_t OldPC = pCtx->rip + cbInstr; 3861 uint64_t NewPC = OldPC + offDisp; 3862 if (!IEM_IS_CANONICAL(NewPC)) 3863 return iemRaiseNotCanonical(pIemCpu); 3854 3864 3855 3865 VBOXSTRICTRC rcStrict = iemMemStackPushU64(pIemCpu, OldPC); … … 3857 3867 return rcStrict; 3858 3868 3859 pCtx->rip = OldPC + offDisp;3869 pCtx->rip = NewPC; 3860 3870 return VINF_SUCCESS; 3861 3871 } … … 3974 3984 else 3975 3985 { 3976 if (offSeg > offSeg)3986 if (offSeg > cbLimit) 3977 3987 { 3978 3988 Log(("jmpf %04x:%08x -> out of bounds (%#x)\n", uSel, offSeg, cbLimit)); … … 4158 4168 /* Check the limit of the new EIP. */ 4159 4169 /** @todo Intel pseudo code only does the limit check for 16-bit 4160 * operands, AMD does make any distinction. What is right? */4170 * operands, AMD does not make any distinction. What is right? */ 4161 4171 if (uNewEip > pCtx->csHid.u32Limit) 4162 4172 return iemRaiseSelectorBounds(pIemCpu, X86_SREG_CS, IEM_ACCESS_INSTRUCTION); … … 4181 4191 4182 4192 /** 4193 * Implements retn. 4194 * 4195 * We're doing this in C because of the \#GP that might be raised if the popped 4196 * program counter is out of bounds. 4197 * 4198 * @param enmEffOpSize The effective operand size. 4199 * @param cbPop The amount of arguments to pop from the stack 4200 * (bytes). 4201 */ 4202 IEM_CIMPL_DEF_2(iemCImpl_retn, IEMMODE, enmEffOpSize, uint16_t, cbPop) 4203 { 4204 PCPUMCTX pCtx = pIemCpu->CTX_SUFF(pCtx); 4205 4206 /* Fetch the RSP from the stack. */ 4207 VBOXSTRICTRC rcStrict; 4208 RTUINT64U NewRip; 4209 RTUINT64U NewRsp; 4210 NewRsp.u = pCtx->rsp; 4211 switch (enmEffOpSize) 4212 { 4213 case IEMMODE_16BIT: 4214 NewRip.u = 0; 4215 rcStrict = iemMemStackPopU16Ex(pIemCpu, &NewRip.Words.w0, &NewRsp); 4216 break; 4217 case IEMMODE_32BIT: 4218 NewRip.u = 0; 4219 rcStrict = iemMemStackPopU32Ex(pIemCpu, &NewRip.DWords.dw0, &NewRsp); 4220 break; 4221 case IEMMODE_64BIT: 4222 rcStrict = iemMemStackPopU64Ex(pIemCpu, &NewRip.u, &NewRsp); 4223 break; 4224 IEM_NOT_REACHED_DEFAULT_CASE_RET(); 4225 } 4226 if (rcStrict != VINF_SUCCESS) 4227 return rcStrict; 4228 4229 /* Check the new RSP before loading it. */ 4230 /** @todo Should test this as the intel+amd pseudo code doesn't mention half 4231 * of it. The canonical test is performed here and for call. */ 4232 if (enmEffOpSize != IEMMODE_64BIT) 4233 { 4234 if (NewRip.DWords.dw0 > pCtx->csHid.u32Limit) 4235 { 4236 Log(("retn newrip=%llx - out of bounds (%x) -> #GP\n", NewRip.u, pCtx->csHid.u32Limit)); 4237 return iemRaiseSelectorBounds(pIemCpu, X86_SREG_CS, IEM_ACCESS_INSTRUCTION); 4238 } 4239 } 4240 else 4241 { 4242 if (!IEM_IS_CANONICAL(NewRip.u)) 4243 { 4244 Log(("retn newrip=%llx - not canonical -> #GP\n", NewRip.u)); 4245 return iemRaiseNotCanonical(pIemCpu); 4246 } 4247 } 4248 4249 /* Commit it. */ 4250 pCtx->rip = NewRip.u; 4251 pCtx->rsp = NewRsp.u; 4252 if (cbPop) 4253 iemRegAddToRsp(pCtx, cbPop); 4254 4255 return VINF_SUCCESS; 4256 } 4257 4258 4259 /** 4183 4260 * Implements int3 and int XX. 4184 4261 * … … 4221 4298 4222 4299 /* load the vector address into cs:ip. */ 4223 pCtx->cs = Idte.sel;4224 pCtx->csHid.u64Base = (uint32_t)Idte.sel << 4;4300 pCtx->cs = Idte.sel; 4301 pCtx->csHid.u64Base = (uint32_t)Idte.sel << 4; 4225 4302 /** @todo do we load attribs and limit as well? Should we check against limit like far jump? */ 4226 pCtx->rip = Idte.off; 4303 pCtx->rip = Idte.off; 4304 pCtx->eflags.Bits.u1IF = 0; 4227 4305 return VINF_SUCCESS; 4228 4306 } … … 5296 5374 5297 5375 #define IEM_MC_FETCH_GREG_U8(a_u8Dst, a_iGReg) (a_u8Dst) = iemGRegFetchU8(pIemCpu, (a_iGReg)) 5376 #define IEM_MC_FETCH_GREG_U8_ZX_U16(a_u16Dst, a_iGReg) (a_u16Dst) = iemGRegFetchU8(pIemCpu, (a_iGReg)) 5377 #define IEM_MC_FETCH_GREG_U8_ZX_U32(a_u32Dst, a_iGReg) (a_u32Dst) = iemGRegFetchU8(pIemCpu, (a_iGReg)) 5378 #define IEM_MC_FETCH_GREG_U8_ZX_U64(a_u64Dst, a_iGReg) (a_u64Dst) = iemGRegFetchU8(pIemCpu, (a_iGReg)) 5298 5379 #define IEM_MC_FETCH_GREG_U16(a_u16Dst, a_iGReg) (a_u16Dst) = iemGRegFetchU16(pIemCpu, (a_iGReg)) 5380 #define IEM_MC_FETCH_GREG_U16_ZX_U32(a_u32Dst, a_iGReg) (a_u32Dst) = iemGRegFetchU16(pIemCpu, (a_iGReg)) 5381 #define IEM_MC_FETCH_GREG_U16_ZX_U64(a_u64Dst, a_iGReg) (a_u64Dst) = iemGRegFetchU16(pIemCpu, (a_iGReg)) 5299 5382 #define IEM_MC_FETCH_GREG_U32(a_u32Dst, a_iGReg) (a_u32Dst) = iemGRegFetchU32(pIemCpu, (a_iGReg)) 5383 #define IEM_MC_FETCH_GREG_U32_ZX_U64(a_u64Dst, a_iGReg) (a_u64Dst) = iemGRegFetchU32(pIemCpu, (a_iGReg)) 5300 5384 #define IEM_MC_FETCH_GREG_U64(a_u64Dst, a_iGReg) (a_u64Dst) = iemGRegFetchU64(pIemCpu, (a_iGReg)) 5301 5385 #define IEM_MC_FETCH_SREG_U16(a_u16Dst, a_iSReg) (a_u16Dst) = iemSRegFetchU16(pIemCpu, (a_iSReg)) 5302 #define IEM_MC_FETCH_SREG_ U32_ZX(a_u32Dst, a_iSReg) (a_u32Dst) = iemSRegFetchU16(pIemCpu, (a_iSReg))5303 #define IEM_MC_FETCH_SREG_ U64_ZX(a_u64Dst, a_iSReg) (a_u64Dst) = iemSRegFetchU16(pIemCpu, (a_iSReg))5386 #define IEM_MC_FETCH_SREG_ZX_U32(a_u32Dst, a_iSReg) (a_u32Dst) = iemSRegFetchU16(pIemCpu, (a_iSReg)) 5387 #define IEM_MC_FETCH_SREG_ZX_U64(a_u64Dst, a_iSReg) (a_u64Dst) = iemSRegFetchU16(pIemCpu, (a_iSReg)) 5304 5388 #define IEM_MC_FETCH_EFLAGS(a_EFlags) (a_EFlags) = (pIemCpu)->CTX_SUFF(pCtx)->eflags.u 5305 5389 … … 5352 5436 #define IEM_MC_FETCH_MEM_U64(a_u64Dst, a_iSeg, a_GCPtrMem) \ 5353 5437 IEM_MC_RETURN_ON_FAILURE(iemMemFetchDataU64(pIemCpu, &(a_u64Dst), (a_iSeg), (a_GCPtrMem))) 5438 5439 #define IEM_MC_FETCH_MEM_U8_ZX_U16(a_u16Dst, a_iSeg, a_GCPtrMem) \ 5440 do { \ 5441 uint8_t u8Tmp; \ 5442 IEM_MC_RETURN_ON_FAILURE(iemMemFetchDataU8(pIemCpu, &u8Tmp, (a_iSeg), (a_GCPtrMem))); \ 5443 (a_u16Dst) = u8Tmp; \ 5444 } while (0) 5445 #define IEM_MC_FETCH_MEM_U8_ZX_U32(a_u32Dst, a_iSeg, a_GCPtrMem) \ 5446 do { \ 5447 uint8_t u8Tmp; \ 5448 IEM_MC_RETURN_ON_FAILURE(iemMemFetchDataU8(pIemCpu, &u8Tmp, (a_iSeg), (a_GCPtrMem))); \ 5449 (a_u32Dst) = u8Tmp; \ 5450 } while (0) 5451 #define IEM_MC_FETCH_MEM_U8_ZX_U64(a_u64Dst, a_iSeg, a_GCPtrMem) \ 5452 do { \ 5453 uint8_t u8Tmp; \ 5454 IEM_MC_RETURN_ON_FAILURE(iemMemFetchDataU8(pIemCpu, &u8Tmp, (a_iSeg), (a_GCPtrMem))); \ 5455 (a_u64Dst) = u8Tmp; \ 5456 } while (0) 5457 #define IEM_MC_FETCH_MEM_U16_ZX_U32(a_u32Dst, a_iSeg, a_GCPtrMem) \ 5458 do { \ 5459 uint16_t u16Tmp; \ 5460 IEM_MC_RETURN_ON_FAILURE(iemMemFetchDataU16(pIemCpu, &u16Tmp, (a_iSeg), (a_GCPtrMem))); \ 5461 (a_u32Dst) = u16Tmp; \ 5462 } while (0) 5463 #define IEM_MC_FETCH_MEM_U16_ZX_U64(a_u64Dst, a_iSeg, a_GCPtrMem) \ 5464 do { \ 5465 uint16_t u16Tmp; \ 5466 IEM_MC_RETURN_ON_FAILURE(iemMemFetchDataU16(pIemCpu, &u16Tmp, (a_iSeg), (a_GCPtrMem))); \ 5467 (a_u64Dst) = u16Tmp; \ 5468 } while (0) 5469 #define IEM_MC_FETCH_MEM_U32_ZX_U64(a_u64Dst, a_iSeg, a_GCPtrMem) \ 5470 do { \ 5471 uint32_t u32Tmp; \ 5472 IEM_MC_RETURN_ON_FAILURE(iemMemFetchDataU32(pIemCpu, &u32Tmp, (a_iSeg), (a_GCPtrMem))); \ 5473 (a_u64Dst) = u32Tmp; \ 5474 } while (0) 5354 5475 5355 5476 #define IEM_MC_STORE_MEM_U8(a_iSeg, a_GCPtrMem, a_u8Value) \ … … 5877 5998 static void iemExecVerificationModeSetup(PIEMCPU pIemCpu) 5878 5999 { 6000 /* 6001 * Switch state. 6002 */ 5879 6003 static CPUMCTX s_DebugCtx; /* Ugly! */ 5880 6004 … … 5882 6006 s_DebugCtx = *pOrgCtx; 5883 6007 pIemCpu->CTX_SUFF(pCtx) = &s_DebugCtx; 6008 6009 /* 6010 * See if there is an interrupt pending in TRPM and inject it if we can. 6011 */ 6012 PVMCPU pVCpu = IEMCPU_TO_VMCPU(pIemCpu); 6013 if ( pOrgCtx->eflags.Bits.u1IF 6014 && TRPMHasTrap(pVCpu) 6015 //&& TRPMIsSoftwareInterrupt(pVCpu) 6016 && EMGetInhibitInterruptsPC(pVCpu) != pOrgCtx->rip) 6017 { 6018 Log(("Injecting trap %#x\n", TRPMGetTrapNo(pVCpu))); 6019 iemCImpl_int(pIemCpu, 0, TRPMGetTrapNo(pVCpu), false); 6020 } 6021 6022 /* 6023 * Reset the counters. 6024 */ 5884 6025 pIemCpu->cIOReads = 0; 5885 6026 pIemCpu->cIOWrites = 0; 5886 6027 pIemCpu->fMulDivHack = false; 5887 6028 pIemCpu->fShlHack = false; 5888 5889 6029 } 5890 6030 … … 5942 6082 } 5943 6083 else 5944 RTAssertMsg2Weak(" the FPU state differs - happen ds the first time...\n");6084 RTAssertMsg2Weak(" the FPU state differs - happens the first time...\n"); 5945 6085 } 5946 6086 CHECK_FIELD(rip); … … 6067 6207 { 6068 6208 PIEMCPU pIemCpu = &pVCpu->iem.s; 6209 6210 #if defined(IEM_VERIFICATION_MODE) && defined(IN_RING3) 6211 iemExecVerificationModeSetup(pIemCpu); 6212 #endif 6069 6213 #ifdef DEBUG 6070 6214 PCPUMCTX pCtx = pIemCpu->CTX_SUFF(pCtx); … … 6087 6231 szInstr)); 6088 6232 #endif 6089 #if defined(IEM_VERIFICATION_MODE) && defined(IN_RING3)6090 iemExecVerificationModeSetup(pIemCpu);6091 #endif6092 6233 6093 6234 /* … … 6102 6243 if (rcStrict == VINF_SUCCESS) 6103 6244 pIemCpu->cInstructions++; 6245 //#ifdef DEBUG 6246 // AssertMsg(pIemCpu->offOpcode == cbInstr || rcStrict != VINF_SUCCESS, ("%u %u\n", pIemCpu->offOpcode, cbInstr)); 6247 //#endif 6104 6248 6105 6249 /* Execute the next instruction as well if a cli, pop ss or … … 6122 6266 * Assert some sanity. 6123 6267 */ 6124 #ifdef DEBUG6125 AssertMsg(pIemCpu->offOpcode == cbInstr || rcStrict != VINF_SUCCESS, ("%u %u\n", pIemCpu->offOpcode, cbInstr));6126 #endif6127 6268 #if defined(IEM_VERIFICATION_MODE) && defined(IN_RING3) 6128 6269 iemExecVerificationModeCheck(pIemCpu); -
trunk/src/VBox/VMM/VMMAll/IEMAllInstructions.cpp.h
r36775 r36780 1718 1718 /** Opcode 0x0f 0xb5. */ 1719 1719 FNIEMOP_STUB(iemOp_lgs_Gv_Mp); 1720 1721 1720 1722 /** Opcode 0x0f 0xb6. */ 1721 FNIEMOP_STUB(iemOp_movzx_Gv_Eb); 1723 FNIEMOP_DEF(iemOp_movzx_Gv_Eb) 1724 { 1725 IEMOP_MNEMONIC("movzx Gv,Eb"); 1726 1727 uint8_t bRm; IEM_OPCODE_GET_NEXT_BYTE(pIemCpu, &bRm); 1728 IEMOP_HLP_NO_LOCK_PREFIX(); /** @todo should probably not be raised until we've fetched all the opcode bytes? */ 1729 1730 /* 1731 * If rm is denoting a register, no more instruction bytes. 1732 */ 1733 if ((bRm & X86_MODRM_MOD_MASK) == (3 << X86_MODRM_MOD_SHIFT)) 1734 { 1735 switch (pIemCpu->enmEffOpSize) 1736 { 1737 case IEMMODE_16BIT: 1738 IEM_MC_BEGIN(0, 1); 1739 IEM_MC_LOCAL(uint16_t, u16Value); 1740 IEM_MC_FETCH_GREG_U8_ZX_U16(u16Value, (bRm & X86_MODRM_RM_MASK) | pIemCpu->uRexB); 1741 IEM_MC_STORE_GREG_U16(((bRm >> X86_MODRM_REG_SHIFT) & X86_MODRM_REG_SMASK) | pIemCpu->uRexReg, u16Value); 1742 IEM_MC_ADVANCE_RIP(); 1743 IEM_MC_END(); 1744 return VINF_SUCCESS; 1745 1746 case IEMMODE_32BIT: 1747 IEM_MC_BEGIN(0, 1); 1748 IEM_MC_LOCAL(uint32_t, u32Value); 1749 IEM_MC_FETCH_GREG_U8_ZX_U32(u32Value, (bRm & X86_MODRM_RM_MASK) | pIemCpu->uRexB); 1750 IEM_MC_STORE_GREG_U32(((bRm >> X86_MODRM_REG_SHIFT) & X86_MODRM_REG_SMASK) | pIemCpu->uRexReg, u32Value); 1751 IEM_MC_ADVANCE_RIP(); 1752 IEM_MC_END(); 1753 return VINF_SUCCESS; 1754 1755 case IEMMODE_64BIT: 1756 IEM_MC_BEGIN(0, 1); 1757 IEM_MC_LOCAL(uint64_t, u64Value); 1758 IEM_MC_FETCH_GREG_U8_ZX_U64(u64Value, (bRm & X86_MODRM_RM_MASK) | pIemCpu->uRexB); 1759 IEM_MC_STORE_GREG_U64(((bRm >> X86_MODRM_REG_SHIFT) & X86_MODRM_REG_SMASK) | pIemCpu->uRexReg, u64Value); 1760 IEM_MC_ADVANCE_RIP(); 1761 IEM_MC_END(); 1762 return VINF_SUCCESS; 1763 1764 IEM_NOT_REACHED_DEFAULT_CASE_RET(); 1765 } 1766 } 1767 else 1768 { 1769 /* 1770 * We're loading a register from memory. 1771 */ 1772 switch (pIemCpu->enmEffOpSize) 1773 { 1774 case IEMMODE_16BIT: 1775 IEM_MC_BEGIN(0, 2); 1776 IEM_MC_LOCAL(uint16_t, u16Value); 1777 IEM_MC_LOCAL(RTGCPTR, GCPtrEffDst); 1778 IEM_MC_CALC_RM_EFF_ADDR(GCPtrEffDst, bRm); 1779 IEM_MC_FETCH_MEM_U8_ZX_U16(u16Value, pIemCpu->iEffSeg, GCPtrEffDst); 1780 IEM_MC_STORE_GREG_U16(((bRm >> X86_MODRM_REG_SHIFT) & X86_MODRM_REG_SMASK) | pIemCpu->uRexReg, u16Value); 1781 IEM_MC_ADVANCE_RIP(); 1782 IEM_MC_END(); 1783 return VINF_SUCCESS; 1784 1785 case IEMMODE_32BIT: 1786 IEM_MC_BEGIN(0, 2); 1787 IEM_MC_LOCAL(uint32_t, u32Value); 1788 IEM_MC_LOCAL(RTGCPTR, GCPtrEffDst); 1789 IEM_MC_CALC_RM_EFF_ADDR(GCPtrEffDst, bRm); 1790 IEM_MC_FETCH_MEM_U8_ZX_U32(u32Value, pIemCpu->iEffSeg, GCPtrEffDst); 1791 IEM_MC_STORE_GREG_U32(((bRm >> X86_MODRM_REG_SHIFT) & X86_MODRM_REG_SMASK) | pIemCpu->uRexReg, u32Value); 1792 IEM_MC_ADVANCE_RIP(); 1793 IEM_MC_END(); 1794 return VINF_SUCCESS; 1795 1796 case IEMMODE_64BIT: 1797 IEM_MC_BEGIN(0, 2); 1798 IEM_MC_LOCAL(uint64_t, u64Value); 1799 IEM_MC_LOCAL(RTGCPTR, GCPtrEffDst); 1800 IEM_MC_CALC_RM_EFF_ADDR(GCPtrEffDst, bRm); 1801 IEM_MC_FETCH_MEM_U8_ZX_U64(u64Value, pIemCpu->iEffSeg, GCPtrEffDst); 1802 IEM_MC_STORE_GREG_U64(((bRm >> X86_MODRM_REG_SHIFT) & X86_MODRM_REG_SMASK) | pIemCpu->uRexReg, u64Value); 1803 IEM_MC_ADVANCE_RIP(); 1804 IEM_MC_END(); 1805 return VINF_SUCCESS; 1806 1807 IEM_NOT_REACHED_DEFAULT_CASE_RET(); 1808 } 1809 } 1810 } 1811 1812 1722 1813 /** Opcode 0x0f 0xb7. */ 1723 1814 FNIEMOP_STUB(iemOp_movzx_Gv_Ew); … … 2101 2192 IEM_MC_BEGIN(0, 1); 2102 2193 IEM_MC_LOCAL(uint32_t, u32Value); 2103 IEM_MC_FETCH_SREG_ U32_ZX(u32Value, iReg);2194 IEM_MC_FETCH_SREG_ZX_U32(u32Value, iReg); 2104 2195 IEM_MC_PUSH_U32(u32Value); 2105 2196 IEM_MC_ADVANCE_RIP(); … … 2110 2201 IEM_MC_BEGIN(0, 1); 2111 2202 IEM_MC_LOCAL(uint64_t, u64Value); 2112 IEM_MC_FETCH_SREG_ U64_ZX(u64Value, iReg);2203 IEM_MC_FETCH_SREG_ZX_U64(u64Value, iReg); 2113 2204 IEM_MC_PUSH_U64(u64Value); 2114 2205 IEM_MC_ADVANCE_RIP(); … … 3630 3721 FNIEMOP_DEF(iemOp_insb_Yb_DX) 3631 3722 { 3632 uint8_t u8Imm; IEM_OPCODE_GET_NEXT_BYTE(pIemCpu, &u8Imm);3633 3723 IEMOP_HLP_NO_LOCK_PREFIX(); 3634 3635 /*3636 * Use the C implementation if a repeate prefix is encountered.3637 */3638 3724 if (pIemCpu->fPrefixes & (IEM_OP_PRF_REPNZ | IEM_OP_PRF_REPZ)) 3639 3725 { … … 3644 3730 case IEMMODE_32BIT: return IEM_MC_DEFER_TO_CIMPL_0(iemCImpl_rep_ins_op8_addr32); 3645 3731 case IEMMODE_64BIT: return IEM_MC_DEFER_TO_CIMPL_0(iemCImpl_rep_ins_op8_addr64); 3732 IEM_NOT_REACHED_DEFAULT_CASE_RET(); 3646 3733 } 3647 3734 } … … 3654 3741 case IEMMODE_32BIT: return IEM_MC_DEFER_TO_CIMPL_0(iemCImpl_ins_op8_addr32); 3655 3742 case IEMMODE_64BIT: return IEM_MC_DEFER_TO_CIMPL_0(iemCImpl_ins_op8_addr64); 3743 IEM_NOT_REACHED_DEFAULT_CASE_RET(); 3656 3744 } 3657 3745 } 3658 AssertFailedReturn(VERR_INTERNAL_ERROR_3);3659 3746 } 3660 3747 … … 3663 3750 FNIEMOP_DEF(iemOp_inswd_Yv_DX) 3664 3751 { 3665 uint8_t u8Imm; IEM_OPCODE_GET_NEXT_BYTE(pIemCpu, &u8Imm);3666 3752 IEMOP_HLP_NO_LOCK_PREFIX(); 3667 3753 if (pIemCpu->fPrefixes & (IEM_OP_PRF_REPZ | IEM_OP_PRF_REPNZ)) … … 3676 3762 case IEMMODE_32BIT: return IEM_MC_DEFER_TO_CIMPL_0(iemCImpl_rep_ins_op16_addr32); 3677 3763 case IEMMODE_64BIT: return IEM_MC_DEFER_TO_CIMPL_0(iemCImpl_rep_ins_op16_addr64); 3764 IEM_NOT_REACHED_DEFAULT_CASE_RET(); 3678 3765 } 3679 3766 break; … … 3685 3772 case IEMMODE_32BIT: return IEM_MC_DEFER_TO_CIMPL_0(iemCImpl_rep_ins_op32_addr32); 3686 3773 case IEMMODE_64BIT: return IEM_MC_DEFER_TO_CIMPL_0(iemCImpl_rep_ins_op32_addr64); 3774 IEM_NOT_REACHED_DEFAULT_CASE_RET(); 3687 3775 } 3688 3776 break; 3777 IEM_NOT_REACHED_DEFAULT_CASE_RET(); 3689 3778 } 3690 3779 } … … 3700 3789 case IEMMODE_32BIT: return IEM_MC_DEFER_TO_CIMPL_0(iemCImpl_ins_op16_addr32); 3701 3790 case IEMMODE_64BIT: return IEM_MC_DEFER_TO_CIMPL_0(iemCImpl_ins_op16_addr64); 3791 IEM_NOT_REACHED_DEFAULT_CASE_RET(); 3702 3792 } 3703 3793 break; … … 3709 3799 case IEMMODE_32BIT: return IEM_MC_DEFER_TO_CIMPL_0(iemCImpl_ins_op32_addr32); 3710 3800 case IEMMODE_64BIT: return IEM_MC_DEFER_TO_CIMPL_0(iemCImpl_ins_op32_addr64); 3801 IEM_NOT_REACHED_DEFAULT_CASE_RET(); 3711 3802 } 3712 3803 break; 3804 IEM_NOT_REACHED_DEFAULT_CASE_RET(); 3713 3805 } 3714 3806 } 3715 AssertFailedReturn(VERR_INTERNAL_ERROR_3);3716 3807 } 3717 3808 … … 3720 3811 FNIEMOP_DEF(iemOp_outsb_Yb_DX) 3721 3812 { 3722 uint8_t u8Imm; IEM_OPCODE_GET_NEXT_BYTE(pIemCpu, &u8Imm);3723 3813 IEMOP_HLP_NO_LOCK_PREFIX(); 3724 3725 /*3726 * Use the C implementation if a repeate prefix is encountered.3727 */3728 3814 if (pIemCpu->fPrefixes & (IEM_OP_PRF_REPNZ | IEM_OP_PRF_REPZ)) 3729 3815 { … … 3734 3820 case IEMMODE_32BIT: return IEM_MC_DEFER_TO_CIMPL_0(iemCImpl_rep_outs_op8_addr32); 3735 3821 case IEMMODE_64BIT: return IEM_MC_DEFER_TO_CIMPL_0(iemCImpl_rep_outs_op8_addr64); 3822 IEM_NOT_REACHED_DEFAULT_CASE_RET(); 3736 3823 } 3737 3824 } … … 3744 3831 case IEMMODE_32BIT: return IEM_MC_DEFER_TO_CIMPL_0(iemCImpl_outs_op8_addr32); 3745 3832 case IEMMODE_64BIT: return IEM_MC_DEFER_TO_CIMPL_0(iemCImpl_outs_op8_addr64); 3833 IEM_NOT_REACHED_DEFAULT_CASE_RET(); 3746 3834 } 3747 3835 } 3748 AssertFailedReturn(VERR_INTERNAL_ERROR_3);3749 3836 } 3750 3837 … … 3753 3840 FNIEMOP_DEF(iemOp_outswd_Yv_DX) 3754 3841 { 3755 uint8_t u8Imm; IEM_OPCODE_GET_NEXT_BYTE(pIemCpu, &u8Imm);3756 3842 IEMOP_HLP_NO_LOCK_PREFIX(); 3757 3843 if (pIemCpu->fPrefixes & (IEM_OP_PRF_REPZ | IEM_OP_PRF_REPNZ)) … … 3766 3852 case IEMMODE_32BIT: return IEM_MC_DEFER_TO_CIMPL_0(iemCImpl_rep_outs_op16_addr32); 3767 3853 case IEMMODE_64BIT: return IEM_MC_DEFER_TO_CIMPL_0(iemCImpl_rep_outs_op16_addr64); 3854 IEM_NOT_REACHED_DEFAULT_CASE_RET(); 3768 3855 } 3769 3856 break; … … 3775 3862 case IEMMODE_32BIT: return IEM_MC_DEFER_TO_CIMPL_0(iemCImpl_rep_outs_op32_addr32); 3776 3863 case IEMMODE_64BIT: return IEM_MC_DEFER_TO_CIMPL_0(iemCImpl_rep_outs_op32_addr64); 3864 IEM_NOT_REACHED_DEFAULT_CASE_RET(); 3777 3865 } 3778 3866 break; 3867 IEM_NOT_REACHED_DEFAULT_CASE_RET(); 3779 3868 } 3780 3869 } … … 3790 3879 case IEMMODE_32BIT: return IEM_MC_DEFER_TO_CIMPL_0(iemCImpl_outs_op16_addr32); 3791 3880 case IEMMODE_64BIT: return IEM_MC_DEFER_TO_CIMPL_0(iemCImpl_outs_op16_addr64); 3881 IEM_NOT_REACHED_DEFAULT_CASE_RET(); 3792 3882 } 3793 3883 break; … … 3799 3889 case IEMMODE_32BIT: return IEM_MC_DEFER_TO_CIMPL_0(iemCImpl_outs_op32_addr32); 3800 3890 case IEMMODE_64BIT: return IEM_MC_DEFER_TO_CIMPL_0(iemCImpl_outs_op32_addr64); 3891 IEM_NOT_REACHED_DEFAULT_CASE_RET(); 3801 3892 } 3802 3893 break; 3894 IEM_NOT_REACHED_DEFAULT_CASE_RET(); 3803 3895 } 3804 3896 } 3805 AssertFailedReturn(VERR_INTERNAL_ERROR_3);3806 3897 } 3807 3898 … … 4762 4853 IEM_MC_LOCAL(RTGCPTR, GCPtrEffDst); 4763 4854 IEM_MC_CALC_RM_EFF_ADDR(GCPtrEffDst, bRm); 4764 Log(("GCPtrEffDst=%RGv\n", GCPtrEffDst));4765 4855 IEM_MC_FETCH_MEM_U16(u16Value, pIemCpu->iEffSeg, GCPtrEffDst); 4766 Log(("u16Value=%#x\n", u16Value));4767 4856 IEM_MC_STORE_GREG_U16(((bRm >> X86_MODRM_REG_SHIFT) & X86_MODRM_REG_SMASK) | pIemCpu->uRexReg, u16Value); 4768 4857 IEM_MC_ADVANCE_RIP(); … … 4834 4923 IEM_MC_BEGIN(0, 1); 4835 4924 IEM_MC_LOCAL(uint32_t, u32Value); 4836 IEM_MC_FETCH_SREG_ U32_ZX(u32Value, iSegReg);4925 IEM_MC_FETCH_SREG_ZX_U32(u32Value, iSegReg); 4837 4926 IEM_MC_STORE_GREG_U32((bRm & X86_MODRM_RM_MASK) | pIemCpu->uRexB, u32Value); 4838 4927 IEM_MC_ADVANCE_RIP(); … … 4843 4932 IEM_MC_BEGIN(0, 1); 4844 4933 IEM_MC_LOCAL(uint64_t, u64Value); 4845 IEM_MC_FETCH_SREG_ U64_ZX(u64Value, iSegReg);4934 IEM_MC_FETCH_SREG_ZX_U64(u64Value, iSegReg); 4846 4935 IEM_MC_STORE_GREG_U64((bRm & X86_MODRM_RM_MASK) | pIemCpu->uRexB, u64Value); 4847 4936 IEM_MC_ADVANCE_RIP(); … … 6007 6096 6008 6097 /** Opcode 0xc2. */ 6009 FNIEMOP_STUB(iemOp_retn_Iw); 6098 FNIEMOP_DEF(iemOp_retn_Iw) 6099 { 6100 IEMOP_MNEMONIC("retn Iw"); 6101 uint16_t u16Imm; IEM_OPCODE_GET_NEXT_U16(pIemCpu, &u16Imm); 6102 IEMOP_HLP_NO_LOCK_PREFIX(); 6103 IEMOP_HLP_DEFAULT_64BIT_OP_SIZE(); 6104 return IEM_MC_DEFER_TO_CIMPL_2(iemCImpl_retn, pIemCpu->enmEffOpSize, u16Imm); 6105 } 6010 6106 6011 6107 … … 6015 6111 IEMOP_MNEMONIC("retn"); 6016 6112 IEMOP_HLP_DEFAULT_64BIT_OP_SIZE(); 6017 switch (pIemCpu->enmEffOpSize) 6018 { 6019 case IEMMODE_16BIT: 6020 IEM_MC_BEGIN(0, 1); 6021 IEM_MC_LOCAL(uint16_t, u16NewIP); 6022 IEM_MC_POP_U16(&u16NewIP); 6023 /** @todo This should raise GP(0) if u16NewIP > csHid.u32Limit. 6024 * The intel manual does not indicate that this is the 6025 * case for 32-bit or 64-bit (canonical check). Needs to 6026 * be tested. */ 6027 IEM_MC_SET_RIP_U16(u16NewIP); 6028 IEM_MC_END() 6029 return VINF_SUCCESS; 6030 6031 case IEMMODE_32BIT: 6032 IEM_MC_BEGIN(0, 1); 6033 IEM_MC_LOCAL(uint32_t, u32NewIP); 6034 IEM_MC_POP_U32(&u32NewIP); 6035 IEM_MC_SET_RIP_U32(u32NewIP); 6036 IEM_MC_END() 6037 return VINF_SUCCESS; 6038 6039 case IEMMODE_64BIT: 6040 IEM_MC_BEGIN(0, 1); 6041 IEM_MC_LOCAL(uint64_t, u64NewIP); 6042 IEM_MC_POP_U64(&u64NewIP); 6043 IEM_MC_SET_RIP_U64(u64NewIP); 6044 IEM_MC_END() 6045 return VINF_SUCCESS; 6046 6047 default: 6048 AssertFailedReturn(VERR_INTERNAL_ERROR_2); 6049 } 6113 IEMOP_HLP_NO_LOCK_PREFIX(); 6114 return IEM_MC_DEFER_TO_CIMPL_2(iemCImpl_retn, pIemCpu->enmEffOpSize, 0); 6050 6115 } 6051 6116 … … 6186 6251 uint16_t u16Imm; IEM_OPCODE_GET_NEXT_U16(pIemCpu, &u16Imm); 6187 6252 IEMOP_HLP_NO_LOCK_PREFIX(); 6253 IEMOP_HLP_DEFAULT_64BIT_OP_SIZE(); 6188 6254 return IEM_MC_DEFER_TO_CIMPL_2(iemCImpl_retf, pIemCpu->enmEffOpSize, u16Imm); 6189 6255 } … … 6195 6261 IEMOP_MNEMONIC("retf"); 6196 6262 IEMOP_HLP_NO_LOCK_PREFIX(); 6263 IEMOP_HLP_DEFAULT_64BIT_OP_SIZE(); 6197 6264 return IEM_MC_DEFER_TO_CIMPL_2(iemCImpl_retf, pIemCpu->enmEffOpSize, 0); 6198 6265 } … … 6303 6370 case 2: pImpl = &g_iemAImpl_rcl; IEMOP_MNEMONIC("rcl Ev,1"); break; 6304 6371 case 3: pImpl = &g_iemAImpl_rcr; IEMOP_MNEMONIC("rcr Ev,1"); break; 6305 case 4: pImpl = &g_iemAImpl_shl; IEMOP_MNEMONIC("shl Ev,1"); break; 6372 case 4: 6373 pImpl = &g_iemAImpl_shl; IEMOP_MNEMONIC("shl Ev,1"); 6374 #ifdef IEM_VERIFICATION_MODE 6375 pIemCpu->fShlHack = true; 6376 #endif 6377 break; 6306 6378 case 5: pImpl = &g_iemAImpl_shr; IEMOP_MNEMONIC("shr Ev,1"); break; 6307 6379 case 7: pImpl = &g_iemAImpl_sar; IEMOP_MNEMONIC("sar Ev,1"); break; … … 6490 6562 case 2: pImpl = &g_iemAImpl_rcl; IEMOP_MNEMONIC("rcl Ev,CL"); break; 6491 6563 case 3: pImpl = &g_iemAImpl_rcr; IEMOP_MNEMONIC("rcr Ev,CL"); break; 6492 case 4: pImpl = &g_iemAImpl_shl; IEMOP_MNEMONIC("shl Ev,CL"); break; 6564 case 4: 6565 pImpl = &g_iemAImpl_shl; IEMOP_MNEMONIC("shl Ev,CL"); 6566 #ifdef IEM_VERIFICATION_MODE 6567 pIemCpu->fShlHack = true; 6568 #endif 6569 break; 6493 6570 case 5: pImpl = &g_iemAImpl_shr; IEMOP_MNEMONIC("shr Ev,CL"); break; 6494 6571 case 7: pImpl = &g_iemAImpl_sar; IEMOP_MNEMONIC("sar Ev,CL"); break; -
trunk/src/VBox/VMM/VMMR3/EM.cpp
r36768 r36780 1995 1995 */ 1996 1996 case EMSTATE_RAW: 1997 #if def IEM_VERIFICATION_MODE /* remove later */1997 #ifndef IEM_VERIFICATION_MODE /* remove later */ 1998 1998 AssertFailed(); 1999 #endif2000 1999 rc = emR3RawExecute(pVM, pVCpu, &fFFDone); 2001 2000 break; 2001 #endif 2002 2002 2003 2003 /* … … 2005 2005 */ 2006 2006 case EMSTATE_HWACC: 2007 #if def IEM_VERIFICATION_MODE /* remove later */2007 #ifndef IEM_VERIFICATION_MODE /* remove later */ 2008 2008 AssertFailed(); 2009 #endif2010 2009 rc = emR3HwAccExecute(pVM, pVCpu, &fFFDone); 2011 2010 break; 2011 #endif 2012 2012 2013 2013 /*
Note:
See TracChangeset
for help on using the changeset viewer.