Changeset 73555 in vbox for trunk/src/VBox/VMM
- Timestamp:
- Aug 8, 2018 8:49:36 AM (6 years ago)
- Location:
- trunk/src/VBox/VMM
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMAll/IEMAll.cpp
r73440 r73555 2400 2400 # define IEM_OPCODE_GET_NEXT_S8_SX_U64(a_pu64) (*(a_pu64) = (int8_t)iemOpcodeGetNextU8Jmp(pVCpu)) 2401 2401 #endif 2402 2403 2404 #ifndef IEM_WITH_SETJMP 2405 /** 2406 * Fetches the next opcode byte. 2407 * 2408 * @returns Strict VBox status code. 2409 * @param pVCpu The cross context virtual CPU structure of the 2410 * calling thread. 2411 * @param pu8 Where to return the opcode byte. 2412 */ 2413 DECLINLINE(VBOXSTRICTRC) iemOpcodeGetNextRm(PVMCPU pVCpu, uint8_t *pu8) 2414 { 2415 uintptr_t const offOpcode = pVCpu->iem.s.offOpcode; 2416 pVCpu->iem.s.offModRm = offOpcode; 2417 if (RT_LIKELY((uint8_t)offOpcode < pVCpu->iem.s.cbOpcode)) 2418 { 2419 pVCpu->iem.s.offOpcode = (uint8_t)offOpcode + 1; 2420 *pu8 = pVCpu->iem.s.abOpcode[offOpcode]; 2421 return VINF_SUCCESS; 2422 } 2423 return iemOpcodeGetNextU8Slow(pVCpu, pu8); 2424 } 2425 #else /* IEM_WITH_SETJMP */ 2426 /** 2427 * Fetches the next opcode byte, longjmp on error. 2428 * 2429 * @returns The opcode byte. 2430 * @param pVCpu The cross context virtual CPU structure of the calling thread. 2431 */ 2432 DECLINLINE(uint8_t) iemOpcodeGetNextRmJmp(PVMCPU pVCpu) 2433 { 2434 # ifdef IEM_WITH_CODE_TLB 2435 uintptr_t offBuf = pVCpu->iem.s.offInstrNextByte; 2436 pVCpu->iem.s.offModRm = offOpcode; 2437 uint8_t const *pbBuf = pVCpu->iem.s.pbInstrBuf; 2438 if (RT_LIKELY( pbBuf != NULL 2439 && offBuf < pVCpu->iem.s.cbInstrBuf)) 2440 { 2441 pVCpu->iem.s.offInstrNextByte = (uint32_t)offBuf + 1; 2442 return pbBuf[offBuf]; 2443 } 2444 # else 2445 uintptr_t offOpcode = pVCpu->iem.s.offOpcode; 2446 pVCpu->iem.s.offModRm = offOpcode; 2447 if (RT_LIKELY((uint8_t)offOpcode < pVCpu->iem.s.cbOpcode)) 2448 { 2449 pVCpu->iem.s.offOpcode = (uint8_t)offOpcode + 1; 2450 return pVCpu->iem.s.abOpcode[offOpcode]; 2451 } 2452 # endif 2453 return iemOpcodeGetNextU8SlowJmp(pVCpu); 2454 } 2455 #endif /* IEM_WITH_SETJMP */ 2456 2457 /** 2458 * Fetches the next opcode byte, which is a ModR/M byte, returns automatically 2459 * on failure. 2460 * 2461 * Will note down the position of the ModR/M byte for VT-x exits. 2462 * 2463 * @param a_pbRm Where to return the RM opcode byte. 2464 * @remark Implicitly references pVCpu. 2465 */ 2466 #ifndef IEM_WITH_SETJMP 2467 # define IEM_OPCODE_GET_NEXT_RM(a_pbRm) \ 2468 do \ 2469 { \ 2470 VBOXSTRICTRC rcStrict2 = iemOpcodeGetNextRm(pVCpu, (a_pu8)); \ 2471 if (rcStrict2 == VINF_SUCCESS) \ 2472 { /* likely */ } \ 2473 else \ 2474 return rcStrict2; \ 2475 } while (0) 2476 #else 2477 # define IEM_OPCODE_GET_NEXT_RM(a_pbRm) (*(a_pbRm) = iemOpcodeGetNextRmJmp(pVCpu)) 2478 #endif /* IEM_WITH_SETJMP */ 2402 2479 2403 2480 -
trunk/src/VBox/VMM/include/IEMInternal.h
r72866 r73555 422 422 uint8_t iEffSeg; /* 0x2b */ 423 423 424 /** The offset of the ModR/M byte relative to the start of the instruction. */ 425 uint8_t offModRm; /* 0x2c */ 424 426 #else 425 427 /** The size of what has currently been fetched into abOpcode. */ … … 427 429 /** The current offset into abOpcode. */ 428 430 uint8_t offOpcode; /* 0x09 */ 431 /** The offset of the ModR/M byte relative to the start of the instruction. */ 432 uint8_t offModRm; /* 0x0a */ 429 433 430 434 /** The effective segment register (X86_SREG_XXX). */ 431 uint8_t iEffSeg; /* 0x0a */ 432 433 /** The extra REX ModR/M register field bit (REX.R << 3). */ 434 uint8_t uRexReg; /* 0x0b */ 435 uint8_t iEffSeg; /* 0x0b */ 436 435 437 /** The prefix mask (IEM_OP_PRF_XXX). */ 436 438 uint32_t fPrefixes; /* 0x0c */ 439 /** The extra REX ModR/M register field bit (REX.R << 3). */ 440 uint8_t uRexReg; /* 0x10 */ 437 441 /** The extra REX ModR/M r/m field, SIB base and opcode reg bit 438 442 * (REX.B << 3). */ 439 uint8_t uRexB; /* 0x1 0*/443 uint8_t uRexB; /* 0x11 */ 440 444 /** The extra REX SIB index field bit (REX.X << 3). */ 441 uint8_t uRexIndex; /* 0x1 1*/445 uint8_t uRexIndex; /* 0x12 */ 442 446 443 447 #endif 444 448 445 449 /** The effective operand mode. */ 446 IEMMODE enmEffOpSize; /* 0x2 c, 0x12*/450 IEMMODE enmEffOpSize; /* 0x2d, 0x13 */ 447 451 /** The default addressing mode. */ 448 IEMMODE enmDefAddrMode; /* 0x2 d, 0x13*/452 IEMMODE enmDefAddrMode; /* 0x2e, 0x14 */ 449 453 /** The effective addressing mode. */ 450 IEMMODE enmEffAddrMode; /* 0x2 e, 0x14*/454 IEMMODE enmEffAddrMode; /* 0x2f, 0x15 */ 451 455 /** The default operand mode. */ 452 IEMMODE enmDefOpSize; /* 0x 2f, 0x15*/456 IEMMODE enmDefOpSize; /* 0x30, 0x16 */ 453 457 454 458 /** Prefix index (VEX.pp) for two byte and three byte tables. */ 455 uint8_t idxPrefix; /* 0x3 0, 0x16*/459 uint8_t idxPrefix; /* 0x31, 0x17 */ 456 460 /** 3rd VEX/EVEX/XOP register. 457 461 * Please use IEM_GET_EFFECTIVE_VVVV to access. */ 458 uint8_t uVex3rdReg; /* 0x3 1, 0x17*/462 uint8_t uVex3rdReg; /* 0x32, 0x18 */ 459 463 /** The VEX/EVEX/XOP length field. */ 460 uint8_t uVexLength; /* 0x3 2, 0x18*/464 uint8_t uVexLength; /* 0x33, 0x19 */ 461 465 /** Additional EVEX stuff. */ 462 uint8_t fEvexStuff; /* 0x33, 0x19 */ 463 466 uint8_t fEvexStuff; /* 0x34, 0x1a */ 467 468 /** Explicit alignment padding. */ 469 uint8_t abAlignment2a[1]; /* 0x35, 0x1b */ 464 470 /** The FPU opcode (FOP). */ 465 uint16_t uFpuOpcode; /* 0x3 4, 0x1a*/466 471 uint16_t uFpuOpcode; /* 0x36, 0x1c */ 472 #ifndef IEM_WITH_CODE_TLB 467 473 /** Explicit alignment padding. */ 468 #ifdef IEM_WITH_CODE_TLB 469 uint8_t abAlignment2a[2]; /* 0x36 */ 474 uint8_t abAlignment2b[2]; /* 0x1e */ 470 475 #endif 471 476 472 477 /** The opcode bytes. */ 473 uint8_t abOpcode[15]; /* 0x48, 0x 1c*/478 uint8_t abOpcode[15]; /* 0x48, 0x20 */ 474 479 /** Explicit alignment padding. */ 475 480 #ifdef IEM_WITH_CODE_TLB 476 481 uint8_t abAlignment2c[0x48 - 0x47]; /* 0x37 */ 477 482 #else 478 uint8_t abAlignment2c[0x48 - 0x2 b]; /* 0x2b*/483 uint8_t abAlignment2c[0x48 - 0x2f]; /* 0x2f */ 479 484 #endif 480 485 /** @} */ -
trunk/src/VBox/VMM/testcase/tstIEMCheckMc.cpp
r72518 r73555 93 93 94 94 95 #define IEM_OPCODE_GET_NEXT_RM(a_pu8) do { *(a_pu8) = g_bRandom; CHK_PTYPE(uint8_t *, a_pu8); } while (0) 95 96 #define IEM_OPCODE_GET_NEXT_U8(a_pu8) do { *(a_pu8) = g_bRandom; CHK_PTYPE(uint8_t *, a_pu8); } while (0) 96 97 #define IEM_OPCODE_GET_NEXT_S8(a_pi8) do { *(a_pi8) = g_bRandom; CHK_PTYPE(int8_t *, a_pi8); } while (0)
Note:
See TracChangeset
for help on using the changeset viewer.