Changeset 67079 in vbox for trunk/src/VBox/ValidationKit
- Timestamp:
- May 25, 2017 9:43:41 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ValidationKit/bootsectors/bs3-cpu-generated-1-template.c
r67078 r67079 1433 1433 1434 1434 1435 /** Also encodes idxField of the register operand using idxFieldBase. */ 1436 static unsigned BS3_NEAR_CODE 1437 Bs3Cfg1EncodeMemMod0DispWithRegFieldAndSizeAndDefaults(PBS3CG1STATE pThis, unsigned off, uint8_t iReg, uint8_t cbOp) 1438 { 1439 pThis->aOperands[pThis->iRegOp].idxField = pThis->aOperands[pThis->iRegOp].idxFieldBase + iReg; 1440 return Bs3Cfg1EncodeMemMod0Disp(pThis, false /*fAddrOverride*/, off, iReg & 7, cbOp, 0 /*cbMisalign*/, 1441 pThis->aOperands[pThis->iRmOp].enmLocation); 1442 } 1443 1444 /** Also encodes idxField of the register operand using idxFieldBase. */ 1445 static unsigned BS3_NEAR_CODE 1446 Bs3Cfg1EncodeMemMod0DispWithRegFieldAndSizeAndDefaultsAddrOverride(PBS3CG1STATE pThis, unsigned off, uint8_t iReg, uint8_t cbOp) 1447 { 1448 pThis->aOperands[pThis->iRegOp].idxField = pThis->aOperands[pThis->iRegOp].idxFieldBase + iReg; 1449 return Bs3Cfg1EncodeMemMod0Disp(pThis, true /*fAddrOverride*/, off, iReg & 7, cbOp, 0 /*cbMisalign*/, 1450 pThis->aOperands[pThis->iRmOp].enmLocation); 1451 } 1452 1453 1435 1454 /** The modrm.reg value is taken from the instruction byte at @a off. */ 1436 1455 static unsigned BS3_NEAR_CODE … … 2272 2291 unsigned off; 2273 2292 unsigned cbOp = BS3_MODE_IS_16BIT_CODE(pThis->bMode) ? 2 : 4; 2274 if (iEncoding == 0) 2275 { 2276 pThis->aOperands[pThis->iRegOp].idxField = BS3CG1DST_OZ_RBP; 2277 off = Bs3Cg1InsertOpcodes(pThis, Bs3Cg1InsertReqPrefix(pThis, 0)); 2278 off = Bs3Cfg1EncodeMemMod0Disp(pThis, false, off, X86_GREG_xBP, cbOp * 2, 0, BS3CG1OPLOC_MEM); 2279 } 2280 else if (iEncoding == 1 && (g_uBs3CpuDetected & BS3CPU_TYPE_MASK) >= BS3CPU_80386) 2281 { 2282 cbOp = cbOp == 2 ? 4 : 2; 2283 pThis->aOperands[pThis->iRegOp].idxField = BS3CG1DST_OZ_RBP; 2284 pThis->abCurInstr[0] = P_OZ; 2285 off = Bs3Cg1InsertOpcodes(pThis, Bs3Cg1InsertReqPrefix(pThis, 1)); 2286 off = Bs3Cfg1EncodeMemMod0Disp(pThis, false, off, X86_GREG_xBP, cbOp * 2, 0, BS3CG1OPLOC_MEM); 2287 } 2288 else if (iEncoding == 2) 2289 { 2290 pThis->aOperands[pThis->iRegOp].idxField = BS3CG1DST_OZ_RBP; 2291 pThis->abCurInstr[0] = P_AZ; 2292 off = Bs3Cg1InsertOpcodes(pThis, Bs3Cg1InsertReqPrefix(pThis, 1)); 2293 off = Bs3Cfg1EncodeMemMod0Disp(pThis, true, off, X86_GREG_xBP, cbOp * 2, 0, BS3CG1OPLOC_MEM); 2294 } 2295 else if (iEncoding == 3) 2296 { 2297 cbOp = cbOp == 2 ? 4 : 2; 2298 pThis->aOperands[pThis->iRegOp].idxField = BS3CG1DST_OZ_RBP; 2299 pThis->abCurInstr[0] = P_AZ; 2300 pThis->abCurInstr[1] = P_OZ; 2301 off = Bs3Cg1InsertOpcodes(pThis, Bs3Cg1InsertReqPrefix(pThis, 2)); 2302 off = Bs3Cfg1EncodeMemMod0Disp(pThis, true, off, X86_GREG_xBP, cbOp * 2, 0, BS3CG1OPLOC_MEM); 2303 } 2304 else 2305 return 0; 2293 switch (iEncoding) 2294 { 2295 case 0: 2296 off = Bs3Cg1InsertOpcodes(pThis, Bs3Cg1InsertReqPrefix(pThis, 0)); 2297 off = Bs3Cfg1EncodeMemMod0DispWithRegFieldAndSizeAndDefaults(pThis, off, X86_GREG_xBP, cbOp * 2); 2298 break; 2299 case 1: 2300 if ((g_uBs3CpuDetected & BS3CPU_TYPE_MASK) < BS3CPU_80386) 2301 return 0; 2302 cbOp = cbOp == 2 ? 4 : 2; 2303 pThis->abCurInstr[0] = P_OZ; 2304 off = Bs3Cg1InsertOpcodes(pThis, Bs3Cg1InsertReqPrefix(pThis, 1)); 2305 off = Bs3Cfg1EncodeMemMod0DispWithRegFieldAndSizeAndDefaults(pThis, off, X86_GREG_xBP, cbOp * 2); 2306 break; 2307 case 2: 2308 pThis->abCurInstr[0] = P_AZ; 2309 off = Bs3Cg1InsertOpcodes(pThis, Bs3Cg1InsertReqPrefix(pThis, 1)); 2310 off = Bs3Cfg1EncodeMemMod0DispWithRegFieldAndSizeAndDefaultsAddrOverride(pThis, off, X86_GREG_xBP, cbOp * 2); 2311 break; 2312 case 3: 2313 cbOp = cbOp == 2 ? 4 : 2; 2314 pThis->abCurInstr[0] = P_AZ; 2315 pThis->abCurInstr[1] = P_OZ; 2316 off = Bs3Cg1InsertOpcodes(pThis, Bs3Cg1InsertReqPrefix(pThis, 2)); 2317 off = Bs3Cfg1EncodeMemMod0DispWithRegFieldAndSizeAndDefaultsAddrOverride(pThis, off, X86_GREG_xBP, cbOp * 2); 2318 break; 2319 default: 2320 return 0; 2321 } 2306 2322 pThis->aOperands[pThis->iRegOp].cbOp = cbOp; 2307 2323 pThis->cbOperand = cbOp; … … 3945 3961 return Bs3Cg1EncodeNext_MODRM_VqZx_WO_Nq(pThis, iEncoding); 3946 3962 3947 case BS3CG1ENC_MODRM_Gv_RO_Ma:3948 return Bs3Cg1EncodeNext_MODRM_Gv_RO_Ma(pThis, iEncoding);3949 3950 3963 case BS3CG1ENC_FIXED: 3951 3964 return Bs3Cg1EncodeNext_FIXED(pThis, iEncoding); … … 4102 4115 4103 4116 case BS3CG1ENC_MODRM_Gv_RO_Ma: 4117 pThis->pfnEncoder = Bs3Cg1EncodeNext_MODRM_Gv_RO_Ma; 4104 4118 pThis->iRmOp = 1; 4105 4119 pThis->iRegOp = 0; … … 4107 4121 pThis->aOperands[0].cbOp = 2; 4108 4122 pThis->aOperands[1].cbOp = 4; 4109 pThis->aOperands[0].enmLocation = BS3CG1OPLOC_CTX;4110 pThis->aOperands[1].enmLocation = BS3CG1OPLOC_MEM;4111 pThis->aOperands[ 1].idxField = BS3CG1DST_INVALID;4123 pThis->aOperands[0].enmLocation = BS3CG1OPLOC_CTX; 4124 pThis->aOperands[1].enmLocation = BS3CG1OPLOC_MEM; 4125 pThis->aOperands[0].idxFieldBase = BS3CG1DST_OZ_RAX; 4112 4126 break; 4113 4127
Note:
See TracChangeset
for help on using the changeset viewer.