Changeset 47382 in vbox for trunk/src/VBox/VMM/VMMAll
- Timestamp:
- Jul 24, 2013 10:31:09 PM (12 years ago)
- Location:
- trunk/src/VBox/VMM/VMMAll
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMAll/IEMAll.cpp
r47350 r47382 6674 6674 return iemRaiseMathFault(pIemCpu); \ 6675 6675 } while (0) 6676 #define IEM_MC_MAYBE_RAISE_SSE2_RELATED_XCPT() \ 6677 do { \ 6678 if ( (pIemCpu->CTX_SUFF(pCtx)->cr0 & X86_CR0_EM) \ 6679 || !(pIemCpu->CTX_SUFF(pCtx)->cr4 & X86_CR4_OSFSXR) \ 6680 || !IEM_IS_INTEL_CPUID_FEATURE_PRESENT_EDX(X86_CPUID_FEATURE_EDX_SSE2) ) \ 6681 return iemRaiseUndefinedOpcode(pIemCpu); \ 6682 if (pIemCpu->CTX_SUFF(pCtx)->cr0 & X86_CR0_TS) \ 6683 return iemRaiseDeviceNotAvailable(pIemCpu); \ 6684 } while (0) 6685 #define IEM_MC_MAYBE_RAISE_MMX_RELATED_XCPT() \ 6686 do { \ 6687 if ( ((pIemCpu)->CTX_SUFF(pCtx)->cr0 & X86_CR0_EM) \ 6688 || !IEM_IS_INTEL_CPUID_FEATURE_PRESENT_EDX(X86_CPUID_FEATURE_EDX_MMX) ) \ 6689 return iemRaiseUndefinedOpcode(pIemCpu); \ 6690 if (pIemCpu->CTX_SUFF(pCtx)->cr0 & X86_CR0_TS) \ 6691 return iemRaiseDeviceNotAvailable(pIemCpu); \ 6692 } while (0) 6676 6693 #define IEM_MC_RAISE_GP0_IF_CPL_NOT_ZERO() \ 6677 6694 do { \ … … 6834 6851 6835 6852 #define IEM_MC_CLEAR_FSW_EX() do { (pIemCpu)->CTX_SUFF(pCtx)->fpu.FSW &= X86_FSW_C_MASK | X86_FSW_TOP_MASK; } while (0) 6853 6854 6855 #define IEM_MC_STORE_MREG_U64(a_iMReg, a_u64Value) \ 6856 do { pIemCpu->CTX_SUFF(pCtx)->fpu.aRegs[(a_iMReg)].mmx = (a_u64Value); } while (0) 6857 #define IEM_MC_STORE_MREG_U32_ZX_U64(a_iMReg, a_u32Value) \ 6858 do { pIemCpu->CTX_SUFF(pCtx)->fpu.aRegs[(a_iMReg)].mmx = (uint32_t)(a_u32Value); } while (0) 6859 6860 #define IEM_MC_STORE_XREG_U64_ZX_U128(a_iXReg, a_u64Value) \ 6861 do { pIemCpu->CTX_SUFF(pCtx)->fpu.aXMM[(a_iXReg)].au64[0] = (a_u64Value); \ 6862 pIemCpu->CTX_SUFF(pCtx)->fpu.aXMM[(a_iXReg)].au64[1] = 0; \ 6863 } while (0) 6864 #define IEM_MC_STORE_XREG_U32_ZX_U128(a_iXReg, a_u32Value) \ 6865 do { pIemCpu->CTX_SUFF(pCtx)->fpu.aXMM[(a_iXReg)].au64[0] = (uint32_t)(a_u32Value); \ 6866 pIemCpu->CTX_SUFF(pCtx)->fpu.aXMM[(a_iXReg)].au64[1] = 0; \ 6867 } while (0) 6836 6868 6837 6869 … … 7429 7461 if (pIemCpu->enmCpuMode == IEMMODE_64BIT) \ 7430 7462 pIemCpu->enmEffOpSize = pIemCpu->enmDefOpSize = IEMMODE_64BIT; \ 7463 } while (0) 7464 7465 /** Only a REX prefix immediately preceeding the first opcode byte takes 7466 * effect. This macro helps ensuring this as well as logging bad guest code. */ 7467 #define IEMOP_HLP_CLEAR_REX_NOT_BEFORE_OPCODE(a_szPrf) \ 7468 do \ 7469 { \ 7470 if (RT_UNLIKELY(pIemCpu->fPrefixes & IEM_OP_PRF_REX)) \ 7471 { \ 7472 Log5((a_szPrf ## ": Overriding REX prefix at %RX16! fPrefixes=%#x\n", \ 7473 pIemCpu->CTX_SUFF(pCtx)->rip, pIemCpu->fPrefixes)); \ 7474 pIemCpu->fPrefixes &= ~IEM_OP_PRF_REX_MASK; \ 7475 pIemCpu->uRexB = 0; \ 7476 pIemCpu->uRexIndex = 0; \ 7477 pIemCpu->uRexReg = 0; \ 7478 iemRecalEffOpSize(pIemCpu); \ 7479 } \ 7431 7480 } while (0) 7432 7481 -
trunk/src/VBox/VMM/VMMAll/IEMAllInstructions.cpp.h
r47379 r47382 1822 1822 FNIEMOP_STUB(iemOp_maxps_Vps_Wps__maxpd_Vpd_Wpd__maxss_Vss_Wss__maxsd_Vsd_Wsd); 1823 1823 /** Opcode 0x0f 0x60. */ 1824 FNIEMOP_STUB(iemOp_punpcklbw_Pq_Qd__punpcklbw_Vdq_Wdq); 1824 FNIEMOP_STUB(iemOp_punpcklbw_Pq_Qd__punpcklbw_Vdq_Wdq); // NEXT 1825 1825 /** Opcode 0x0f 0x61. */ 1826 1826 FNIEMOP_STUB(iemOp_punpcklwd_Pq_Qd__punpcklwd_Vdq_Wdq); … … 1849 1849 /** Opcode 0x0f 0x6d. */ 1850 1850 FNIEMOP_STUB(iemOp_punpckhqdq_Vdq_Wdq); 1851 1852 1851 1853 /** Opcode 0x0f 0x6e. */ 1852 FNIEMOP_STUB(iemOp_movd_q_Pd_Ey__movd_q_Vy_Ey); 1854 FNIEMOP_DEF(iemOp_movd_q_Pd_Ey__movd_q_Vy_Ey) 1855 { 1856 uint8_t bRm; IEM_OPCODE_GET_NEXT_U8(&bRm); 1857 if ((bRm & X86_MODRM_MOD_MASK) == (3 << X86_MODRM_MOD_SHIFT)) 1858 { 1859 IEMOP_HLP_DONE_DECODING_NO_LOCK_PREFIX(); 1860 IEM_MC_BEGIN(0, 1); 1861 if (pIemCpu->fPrefixes & IEM_OP_PRF_SIZE_OP) 1862 { 1863 /* XMM, greg*/ 1864 IEM_MC_MAYBE_RAISE_SSE2_RELATED_XCPT(); 1865 if (pIemCpu->fPrefixes & IEM_OP_PRF_SIZE_REX_W) 1866 { 1867 IEM_MC_LOCAL(uint64_t, u64Tmp); 1868 IEM_MC_FETCH_GREG_U64(u64Tmp, (bRm & X86_MODRM_RM_MASK) | pIemCpu->uRexB); 1869 IEM_MC_STORE_XREG_U64_ZX_U128(((bRm >> X86_MODRM_REG_SHIFT) & X86_MODRM_REG_SMASK) | pIemCpu->uRexReg, u64Tmp); 1870 } 1871 else 1872 { 1873 IEM_MC_LOCAL(uint32_t, u32Tmp); 1874 IEM_MC_FETCH_GREG_U32(u32Tmp, (bRm & X86_MODRM_RM_MASK) | pIemCpu->uRexB); 1875 IEM_MC_STORE_XREG_U32_ZX_U128(((bRm >> X86_MODRM_REG_SHIFT) & X86_MODRM_REG_SMASK) | pIemCpu->uRexReg, u32Tmp); 1876 } 1877 } 1878 else 1879 { 1880 /* MMX, greg */ 1881 IEM_MC_MAYBE_RAISE_MMX_RELATED_XCPT(); 1882 IEM_MC_LOCAL(uint64_t, u64Tmp); 1883 if (pIemCpu->fPrefixes & IEM_OP_PRF_SIZE_REX_W) 1884 IEM_MC_FETCH_GREG_U64(u64Tmp, (bRm & X86_MODRM_RM_MASK) | pIemCpu->uRexB); 1885 else 1886 IEM_MC_FETCH_GREG_U32_ZX_U64(u64Tmp, (bRm & X86_MODRM_RM_MASK) | pIemCpu->uRexB); 1887 IEM_MC_STORE_MREG_U64(((bRm >> X86_MODRM_REG_SHIFT) & X86_MODRM_REG_SMASK) | pIemCpu->uRexReg, u64Tmp); 1888 } 1889 IEM_MC_ADVANCE_RIP(); 1890 IEM_MC_END(); 1891 } 1892 else 1893 { 1894 /* memory source operand. */ 1895 IEM_MC_BEGIN(0, 2); 1896 IEM_MC_LOCAL(RTGCPTR, GCPtrEffSrc); 1897 if (pIemCpu->fPrefixes & IEM_OP_PRF_SIZE_OP) 1898 { 1899 /* XMM, [mem] */ 1900 IEM_MC_MAYBE_RAISE_SSE2_RELATED_XCPT(); 1901 IEM_MC_CALC_RM_EFF_ADDR(GCPtrEffSrc, bRm, 1); 1902 IEMOP_HLP_DONE_DECODING_NO_LOCK_PREFIX(); 1903 if (pIemCpu->fPrefixes & IEM_OP_PRF_SIZE_REX_W) 1904 { 1905 IEM_MC_LOCAL(uint64_t, u64Tmp); 1906 IEM_MC_FETCH_MEM_U64(u64Tmp, pIemCpu->iEffSeg, GCPtrEffSrc); 1907 IEM_MC_STORE_XREG_U64_ZX_U128(((bRm >> X86_MODRM_REG_SHIFT) & X86_MODRM_REG_SMASK) | pIemCpu->uRexReg, u64Tmp); 1908 } 1909 else 1910 { 1911 IEM_MC_LOCAL(uint32_t, u32Tmp); 1912 IEM_MC_FETCH_MEM_U32(u32Tmp, pIemCpu->iEffSeg, GCPtrEffSrc); 1913 IEM_MC_STORE_XREG_U32_ZX_U128(((bRm >> X86_MODRM_REG_SHIFT) & X86_MODRM_REG_SMASK) | pIemCpu->uRexReg, u32Tmp); 1914 } 1915 } 1916 else 1917 { 1918 /* MMX, [mem] */ 1919 IEM_MC_MAYBE_RAISE_MMX_RELATED_XCPT(); 1920 IEM_MC_CALC_RM_EFF_ADDR(GCPtrEffSrc, bRm, 1); 1921 IEMOP_HLP_DONE_DECODING_NO_LOCK_PREFIX(); 1922 if (pIemCpu->fPrefixes & IEM_OP_PRF_SIZE_REX_W) 1923 { 1924 IEM_MC_LOCAL(uint64_t, u64Tmp); 1925 IEM_MC_FETCH_MEM_U64(u64Tmp, pIemCpu->iEffSeg, GCPtrEffSrc); 1926 IEM_MC_STORE_MREG_U64(((bRm >> X86_MODRM_REG_SHIFT) & X86_MODRM_REG_SMASK) | pIemCpu->uRexReg, u64Tmp); 1927 } 1928 else 1929 { 1930 IEM_MC_LOCAL(uint32_t, u32Tmp); 1931 IEM_MC_FETCH_MEM_U32(u32Tmp, pIemCpu->iEffSeg, GCPtrEffSrc); 1932 IEM_MC_STORE_MREG_U32_ZX_U64(((bRm >> X86_MODRM_REG_SHIFT) & X86_MODRM_REG_SMASK) | pIemCpu->uRexReg, u32Tmp); 1933 } 1934 } 1935 IEM_MC_ADVANCE_RIP(); 1936 IEM_MC_END(); 1937 } 1938 1939 return VINF_SUCCESS; 1940 } 1941 1853 1942 /** Opcode 0x0f 0x6f. */ 1854 FNIEMOP_STUB(iemOp_movq_Pq_Qq__movdqa_Vdq_Wdq__movdqu_Vdq_Wdq); 1943 FNIEMOP_STUB(iemOp_movq_Pq_Qq__movdqa_Vdq_Wdq__movdqu_Vdq_Wdq); // NEXT 1855 1944 /** Opcode 0x0f 0x70. */ 1856 FNIEMOP_STUB(iemOp_pshufw_Pq_Qq_Ib__pshufd_Vdq_Wdq_Ib__pshufhw_Vdq_Wdq_Ib__pshuflq_Vdq_Wdq_Ib); 1945 FNIEMOP_STUB(iemOp_pshufw_Pq_Qq_Ib__pshufd_Vdq_Wdq_Ib__pshufhw_Vdq_Wdq_Ib__pshuflq_Vdq_Wdq_Ib); // NEXT 1857 1946 1858 1947 /** Opcode 0x0f 0x71 11/2. */ … … 2027 2116 2028 2117 /** Opcode 0x0f 0x74. */ 2029 FNIEMOP_STUB(iemOp_pcmpeqb_Pq_Qq__pcmpeqb_Vdq_Wdq); 2118 FNIEMOP_STUB(iemOp_pcmpeqb_Pq_Qq__pcmpeqb_Vdq_Wdq); // NEXT 2030 2119 /** Opcode 0x0f 0x75. */ 2031 2120 FNIEMOP_STUB(iemOp_pcmpeqw_Pq_Qq__pcmpeqw_Vdq_Wdq); … … 4305 4394 4306 4395 4307 FNIEMOP_DEF_1(iemOpCommonLoadSRegAndGreg, uint8_t, iSegReg) 4308 { 4309 uint8_t bRm; IEM_OPCODE_GET_NEXT_U8(&bRm); 4310 IEMOP_HLP_NO_LOCK_PREFIX(); /** @todo should probably not be raised until we've fetched all the opcode bytes? */ 4311 4312 /* The source cannot be a register. */ 4313 if ((bRm & X86_MODRM_MOD_MASK) == (3 << X86_MODRM_MOD_SHIFT)) 4314 return IEMOP_RAISE_INVALID_OPCODE(); 4396 FNIEMOP_DEF_2(iemOpCommonLoadSRegAndGreg, uint8_t, iSegReg, uint8_t, bRm) 4397 { 4398 Assert((bRm & X86_MODRM_MOD_MASK) != (3 << X86_MODRM_MOD_SHIFT)); /* Caller checks this */ 4315 4399 uint8_t const iGReg = ((bRm >> X86_MODRM_REG_SHIFT) & X86_MODRM_REG_SMASK) | pIemCpu->uRexReg; 4316 4400 … … 4326 4410 IEM_MC_LOCAL(RTGCPTR, GCPtrEff); 4327 4411 IEM_MC_CALC_RM_EFF_ADDR(GCPtrEff, bRm, 0); 4412 IEMOP_HLP_DONE_DECODING_NO_LOCK_PREFIX(); 4328 4413 IEM_MC_FETCH_MEM_U16(offSeg, pIemCpu->iEffSeg, GCPtrEff); 4329 4414 IEM_MC_FETCH_MEM_U16_DISP(uSel, pIemCpu->iEffSeg, GCPtrEff, 2); … … 4341 4426 IEM_MC_LOCAL(RTGCPTR, GCPtrEff); 4342 4427 IEM_MC_CALC_RM_EFF_ADDR(GCPtrEff, bRm, 0); 4428 IEMOP_HLP_DONE_DECODING_NO_LOCK_PREFIX(); 4343 4429 IEM_MC_FETCH_MEM_U32(offSeg, pIemCpu->iEffSeg, GCPtrEff); 4344 4430 IEM_MC_FETCH_MEM_U16_DISP(uSel, pIemCpu->iEffSeg, GCPtrEff, 4); … … 4356 4442 IEM_MC_LOCAL(RTGCPTR, GCPtrEff); 4357 4443 IEM_MC_CALC_RM_EFF_ADDR(GCPtrEff, bRm, 0); 4358 IEM_MC_FETCH_MEM_U64(offSeg, pIemCpu->iEffSeg, GCPtrEff); 4444 IEMOP_HLP_DONE_DECODING_NO_LOCK_PREFIX(); 4445 if (IEM_IS_GUEST_CPU_AMD(pIemCpu)) /** @todo testcase: rev 3.15 of the amd manuals claims it only loads a 32-bit greg. */ 4446 IEM_MC_FETCH_MEM_U32_SX_U64(offSeg, pIemCpu->iEffSeg, GCPtrEff); 4447 else 4448 IEM_MC_FETCH_MEM_U64(offSeg, pIemCpu->iEffSeg, GCPtrEff); 4359 4449 IEM_MC_FETCH_MEM_U16_DISP(uSel, pIemCpu->iEffSeg, GCPtrEff, 8); 4360 4450 IEM_MC_CALL_CIMPL_5(iemCImpl_load_SReg_Greg, uSel, offSeg, iSegRegArg, iGRegArg, enmEffOpSize); … … 4371 4461 { 4372 4462 IEMOP_MNEMONIC("lss Gv,Mp"); 4373 return FNIEMOP_CALL_1(iemOpCommonLoadSRegAndGreg, X86_SREG_SS); 4463 uint8_t bRm; IEM_OPCODE_GET_NEXT_U8(&bRm); 4464 if ((bRm & X86_MODRM_MOD_MASK) == (3 << X86_MODRM_MOD_SHIFT)) 4465 return IEMOP_RAISE_INVALID_OPCODE(); 4466 return FNIEMOP_CALL_2(iemOpCommonLoadSRegAndGreg, X86_SREG_SS, bRm); 4374 4467 } 4375 4468 … … 4387 4480 { 4388 4481 IEMOP_MNEMONIC("lfs Gv,Mp"); 4389 return FNIEMOP_CALL_1(iemOpCommonLoadSRegAndGreg, X86_SREG_FS); 4482 uint8_t bRm; IEM_OPCODE_GET_NEXT_U8(&bRm); 4483 if ((bRm & X86_MODRM_MOD_MASK) == (3 << X86_MODRM_MOD_SHIFT)) 4484 return IEMOP_RAISE_INVALID_OPCODE(); 4485 return FNIEMOP_CALL_2(iemOpCommonLoadSRegAndGreg, X86_SREG_FS, bRm); 4390 4486 } 4391 4487 … … 4395 4491 { 4396 4492 IEMOP_MNEMONIC("lgs Gv,Mp"); 4397 return FNIEMOP_CALL_1(iemOpCommonLoadSRegAndGreg, X86_SREG_GS); 4493 uint8_t bRm; IEM_OPCODE_GET_NEXT_U8(&bRm); 4494 if ((bRm & X86_MODRM_MOD_MASK) == (3 << X86_MODRM_MOD_SHIFT)) 4495 return IEMOP_RAISE_INVALID_OPCODE(); 4496 return FNIEMOP_CALL_2(iemOpCommonLoadSRegAndGreg, X86_SREG_GS, bRm); 4398 4497 } 4399 4498 … … 5377 5476 FNIEMOP_STUB(iemOp_movq_Wq_Vq__movq2dq_Vdq_Nq__movdq2q_Pq_Uq); 5378 5477 /** Opcode 0x0f 0xd7. */ 5379 FNIEMOP_STUB(iemOp_pmovmskb_Gd_Nq__pmovmskb_Gd_Udq); 5478 FNIEMOP_STUB(iemOp_pmovmskb_Gd_Nq__pmovmskb_Gd_Udq); //NEXT 5380 5479 /** Opcode 0x0f 0xd8. */ 5381 5480 FNIEMOP_STUB(iemOp_psubusb_Pq_Qq__psubusb_Vdq_Wdq); … … 5425 5524 FNIEMOP_STUB(iemOp_pmaxsw_Pq_Qq__pmaxsw_Vdq_Wdq); 5426 5525 /** Opcode 0x0f 0xef. */ 5427 FNIEMOP_STUB(iemOp_pxor_Pq_Qq__pxor_Vdq_Wdq); 5526 FNIEMOP_STUB(iemOp_pxor_Pq_Qq__pxor_Vdq_Wdq); // NEXT 5428 5527 /** Opcode 0x0f 0xf0. */ 5429 5528 FNIEMOP_STUB(iemOp_lddqu_Vdq_Mdq); … … 6050 6149 FNIEMOP_DEF(iemOp_seg_ES) 6051 6150 { 6151 IEMOP_HLP_CLEAR_REX_NOT_BEFORE_OPCODE("seg es"); 6052 6152 pIemCpu->fPrefixes |= IEM_OP_PRF_SEG_ES; 6053 6153 pIemCpu->iEffSeg = X86_SREG_ES; … … 6113 6213 FNIEMOP_DEF(iemOp_seg_CS) 6114 6214 { 6215 IEMOP_HLP_CLEAR_REX_NOT_BEFORE_OPCODE("seg cs"); 6115 6216 pIemCpu->fPrefixes |= IEM_OP_PRF_SEG_CS; 6116 6217 pIemCpu->iEffSeg = X86_SREG_CS; … … 6182 6283 FNIEMOP_DEF(iemOp_seg_SS) 6183 6284 { 6285 IEMOP_HLP_CLEAR_REX_NOT_BEFORE_OPCODE("seg ss"); 6184 6286 pIemCpu->fPrefixes |= IEM_OP_PRF_SEG_SS; 6185 6287 pIemCpu->iEffSeg = X86_SREG_SS; … … 6247 6349 FNIEMOP_DEF(iemOp_seg_DS) 6248 6350 { 6351 IEMOP_HLP_CLEAR_REX_NOT_BEFORE_OPCODE("seg ds"); 6249 6352 pIemCpu->fPrefixes |= IEM_OP_PRF_SEG_DS; 6250 6353 pIemCpu->iEffSeg = X86_SREG_DS; … … 6312 6415 if (pIemCpu->enmCpuMode == IEMMODE_64BIT) 6313 6416 { 6417 IEMOP_HLP_CLEAR_REX_NOT_BEFORE_OPCODE("rex"); 6314 6418 pIemCpu->fPrefixes |= IEM_OP_PRF_REX; 6315 6419 … … 6331 6435 if (pIemCpu->enmCpuMode == IEMMODE_64BIT) 6332 6436 { 6437 IEMOP_HLP_CLEAR_REX_NOT_BEFORE_OPCODE("rex.b"); 6333 6438 pIemCpu->fPrefixes |= IEM_OP_PRF_REX | IEM_OP_PRF_REX_B; 6334 6439 pIemCpu->uRexB = 1 << 3; … … 6351 6456 if (pIemCpu->enmCpuMode == IEMMODE_64BIT) 6352 6457 { 6458 IEMOP_HLP_CLEAR_REX_NOT_BEFORE_OPCODE("rex.x"); 6353 6459 pIemCpu->fPrefixes |= IEM_OP_PRF_REX | IEM_OP_PRF_REX_X; 6354 6460 pIemCpu->uRexIndex = 1 << 3; … … 6372 6478 if (pIemCpu->enmCpuMode == IEMMODE_64BIT) 6373 6479 { 6480 IEMOP_HLP_CLEAR_REX_NOT_BEFORE_OPCODE("rex.bx"); 6374 6481 pIemCpu->fPrefixes |= IEM_OP_PRF_REX | IEM_OP_PRF_REX_B | IEM_OP_PRF_REX_X; 6375 6482 pIemCpu->uRexB = 1 << 3; … … 6393 6500 if (pIemCpu->enmCpuMode == IEMMODE_64BIT) 6394 6501 { 6502 IEMOP_HLP_CLEAR_REX_NOT_BEFORE_OPCODE("rex.r"); 6395 6503 pIemCpu->fPrefixes |= IEM_OP_PRF_REX | IEM_OP_PRF_REX_R; 6396 6504 pIemCpu->uRexReg = 1 << 3; … … 6413 6521 if (pIemCpu->enmCpuMode == IEMMODE_64BIT) 6414 6522 { 6523 IEMOP_HLP_CLEAR_REX_NOT_BEFORE_OPCODE("rex.rb"); 6415 6524 pIemCpu->fPrefixes |= IEM_OP_PRF_REX | IEM_OP_PRF_REX_R | IEM_OP_PRF_REX_B; 6416 6525 pIemCpu->uRexReg = 1 << 3; … … 6434 6543 if (pIemCpu->enmCpuMode == IEMMODE_64BIT) 6435 6544 { 6545 IEMOP_HLP_CLEAR_REX_NOT_BEFORE_OPCODE("rex.rx"); 6436 6546 pIemCpu->fPrefixes |= IEM_OP_PRF_REX | IEM_OP_PRF_REX_R | IEM_OP_PRF_REX_X; 6437 6547 pIemCpu->uRexReg = 1 << 3; … … 6455 6565 if (pIemCpu->enmCpuMode == IEMMODE_64BIT) 6456 6566 { 6567 IEMOP_HLP_CLEAR_REX_NOT_BEFORE_OPCODE("rex.rbx"); 6457 6568 pIemCpu->fPrefixes |= IEM_OP_PRF_REX | IEM_OP_PRF_REX_R | IEM_OP_PRF_REX_B | IEM_OP_PRF_REX_X; 6458 6569 pIemCpu->uRexReg = 1 << 3; … … 6477 6588 if (pIemCpu->enmCpuMode == IEMMODE_64BIT) 6478 6589 { 6590 IEMOP_HLP_CLEAR_REX_NOT_BEFORE_OPCODE("rex.w"); 6479 6591 pIemCpu->fPrefixes |= IEM_OP_PRF_REX | IEM_OP_PRF_SIZE_REX_W; 6480 6592 iemRecalEffOpSize(pIemCpu); … … 6497 6609 if (pIemCpu->enmCpuMode == IEMMODE_64BIT) 6498 6610 { 6611 IEMOP_HLP_CLEAR_REX_NOT_BEFORE_OPCODE("rex.bw"); 6499 6612 pIemCpu->fPrefixes |= IEM_OP_PRF_REX | IEM_OP_PRF_REX_B | IEM_OP_PRF_SIZE_REX_W; 6500 6613 pIemCpu->uRexB = 1 << 3; … … 6518 6631 if (pIemCpu->enmCpuMode == IEMMODE_64BIT) 6519 6632 { 6633 IEMOP_HLP_CLEAR_REX_NOT_BEFORE_OPCODE("rex.xw"); 6520 6634 pIemCpu->fPrefixes |= IEM_OP_PRF_REX | IEM_OP_PRF_REX_X | IEM_OP_PRF_SIZE_REX_W; 6521 6635 pIemCpu->uRexIndex = 1 << 3; … … 6539 6653 if (pIemCpu->enmCpuMode == IEMMODE_64BIT) 6540 6654 { 6655 IEMOP_HLP_CLEAR_REX_NOT_BEFORE_OPCODE("rex.bxw"); 6541 6656 pIemCpu->fPrefixes |= IEM_OP_PRF_REX | IEM_OP_PRF_REX_B | IEM_OP_PRF_REX_X | IEM_OP_PRF_SIZE_REX_W; 6542 6657 pIemCpu->uRexB = 1 << 3; … … 6561 6676 if (pIemCpu->enmCpuMode == IEMMODE_64BIT) 6562 6677 { 6678 IEMOP_HLP_CLEAR_REX_NOT_BEFORE_OPCODE("rex.rw"); 6563 6679 pIemCpu->fPrefixes |= IEM_OP_PRF_REX | IEM_OP_PRF_REX_R | IEM_OP_PRF_SIZE_REX_W; 6564 6680 pIemCpu->uRexReg = 1 << 3; … … 6582 6698 if (pIemCpu->enmCpuMode == IEMMODE_64BIT) 6583 6699 { 6700 IEMOP_HLP_CLEAR_REX_NOT_BEFORE_OPCODE("rex.rbw"); 6584 6701 pIemCpu->fPrefixes |= IEM_OP_PRF_REX | IEM_OP_PRF_REX_R | IEM_OP_PRF_REX_B | IEM_OP_PRF_SIZE_REX_W; 6585 6702 pIemCpu->uRexReg = 1 << 3; … … 6604 6721 if (pIemCpu->enmCpuMode == IEMMODE_64BIT) 6605 6722 { 6723 IEMOP_HLP_CLEAR_REX_NOT_BEFORE_OPCODE("rex.rxw"); 6606 6724 pIemCpu->fPrefixes |= IEM_OP_PRF_REX | IEM_OP_PRF_REX_R | IEM_OP_PRF_REX_X | IEM_OP_PRF_SIZE_REX_W; 6607 6725 pIemCpu->uRexReg = 1 << 3; … … 6626 6744 if (pIemCpu->enmCpuMode == IEMMODE_64BIT) 6627 6745 { 6746 IEMOP_HLP_CLEAR_REX_NOT_BEFORE_OPCODE("rex.rbxw"); 6628 6747 pIemCpu->fPrefixes |= IEM_OP_PRF_REX | IEM_OP_PRF_REX_R | IEM_OP_PRF_REX_B | IEM_OP_PRF_REX_X | IEM_OP_PRF_SIZE_REX_W; 6629 6748 pIemCpu->uRexReg = 1 << 3; … … 6945 7064 FNIEMOP_DEF(iemOp_seg_FS) 6946 7065 { 7066 IEMOP_HLP_CLEAR_REX_NOT_BEFORE_OPCODE("seg fs"); 6947 7067 pIemCpu->fPrefixes |= IEM_OP_PRF_SEG_FS; 6948 7068 pIemCpu->iEffSeg = X86_SREG_FS; … … 6956 7076 FNIEMOP_DEF(iemOp_seg_GS) 6957 7077 { 7078 IEMOP_HLP_CLEAR_REX_NOT_BEFORE_OPCODE("seg gs"); 6958 7079 pIemCpu->fPrefixes |= IEM_OP_PRF_SEG_GS; 6959 7080 pIemCpu->iEffSeg = X86_SREG_GS; … … 6967 7088 FNIEMOP_DEF(iemOp_op_size) 6968 7089 { 7090 IEMOP_HLP_CLEAR_REX_NOT_BEFORE_OPCODE("op size"); 6969 7091 pIemCpu->fPrefixes |= IEM_OP_PRF_SIZE_OP; 6970 7092 iemRecalEffOpSize(pIemCpu); … … 6978 7100 FNIEMOP_DEF(iemOp_addr_size) 6979 7101 { 7102 IEMOP_HLP_CLEAR_REX_NOT_BEFORE_OPCODE("addr size"); 6980 7103 pIemCpu->fPrefixes |= IEM_OP_PRF_SIZE_ADDR; 6981 7104 switch (pIemCpu->enmDefAddrMode) … … 10718 10841 FNIEMOP_DEF(iemOp_les_Gv_Mp) 10719 10842 { 10843 uint8_t bRm; IEM_OPCODE_GET_NEXT_U8(&bRm); 10844 if ( pIemCpu->enmCpuMode == IEMMODE_64BIT 10845 || (bRm & X86_MODRM_MOD_MASK) == (3 << X86_MODRM_MOD_SHIFT)) 10846 { 10847 IEMOP_MNEMONIC("2-byte-vex"); 10848 /* The LES instruction is invalid 64-bit mode. In legacy and 10849 compatability mode it is invalid with MOD=3. 10850 The use as a VEX prefix is made possible by assigning the inverted 10851 REX.R to the top MOD bit, and the top bit in the inverted register 10852 specifier to the bottom MOD bit, thereby effectively limiting 32-bit 10853 to accessing registers 0..7 in this VEX form. */ 10854 /** @todo VEX: Just use new tables for it. */ 10855 return IEMOP_RAISE_INVALID_OPCODE(); 10856 } 10720 10857 IEMOP_MNEMONIC("les Gv,Mp"); 10721 return FNIEMOP_CALL_ 1(iemOpCommonLoadSRegAndGreg, X86_SREG_ES);10858 return FNIEMOP_CALL_2(iemOpCommonLoadSRegAndGreg, X86_SREG_ES, bRm); 10722 10859 } 10723 10860 … … 10726 10863 FNIEMOP_DEF(iemOp_lds_Gv_Mp) 10727 10864 { 10865 uint8_t bRm; IEM_OPCODE_GET_NEXT_U8(&bRm); 10866 if ( pIemCpu->enmCpuMode == IEMMODE_64BIT 10867 || (bRm & X86_MODRM_MOD_MASK) == (3 << X86_MODRM_MOD_SHIFT)) 10868 { 10869 IEMOP_MNEMONIC("3-byte-vex"); 10870 /* The LDS instruction is invalid 64-bit mode. In legacy and 10871 compatability mode it is invalid with MOD=3. 10872 The use as a VEX prefix is made possible by assigning the inverted 10873 REX.R and REX.X to the two MOD bits, since the REX bits are ignored 10874 outside of 64-bit mode. */ 10875 /** @todo VEX: Just use new tables for it. */ 10876 return IEMOP_RAISE_INVALID_OPCODE(); 10877 } 10728 10878 IEMOP_MNEMONIC("lds Gv,Mp"); 10729 return FNIEMOP_CALL_ 1(iemOpCommonLoadSRegAndGreg, X86_SREG_DS);10879 return FNIEMOP_CALL_2(iemOpCommonLoadSRegAndGreg, X86_SREG_DS, bRm); 10730 10880 } 10731 10881 … … 14767 14917 FNIEMOP_DEF(iemOp_lock) 14768 14918 { 14919 IEMOP_HLP_CLEAR_REX_NOT_BEFORE_OPCODE("lock"); 14769 14920 pIemCpu->fPrefixes |= IEM_OP_PRF_LOCK; 14770 14921 … … 14779 14930 /* This overrides any previous REPE prefix. */ 14780 14931 pIemCpu->fPrefixes &= ~IEM_OP_PRF_REPZ; 14932 IEMOP_HLP_CLEAR_REX_NOT_BEFORE_OPCODE("repne"); 14781 14933 pIemCpu->fPrefixes |= IEM_OP_PRF_REPNZ; 14782 14934 … … 14791 14943 /* This overrides any previous REPNE prefix. */ 14792 14944 pIemCpu->fPrefixes &= ~IEM_OP_PRF_REPNZ; 14945 IEMOP_HLP_CLEAR_REX_NOT_BEFORE_OPCODE("repe"); 14793 14946 pIemCpu->fPrefixes |= IEM_OP_PRF_REPZ; 14794 14947
Note:
See TracChangeset
for help on using the changeset viewer.