vbox的更動 67106 路徑 trunk/src/VBox/ValidationKit
- 時間撮記:
- 2017-5-25 下午10:58:59 (7 年 以前)
- 檔案:
-
- 修改 1 筆資料
圖例:
- 未更動
- 新增
- 刪除
-
trunk/src/VBox/ValidationKit/bootsectors/bs3-cpu-generated-1-template.c
r67105 r67106 2121 2121 { 2122 2122 unsigned off; 2123 if (iEncoding == 0) 2124 { 2125 off = Bs3Cg1InsertOpcodes(pThis, Bs3Cg1InsertReqPrefix(pThis, 0)); 2126 pThis->cbCurInstr = off; 2127 } 2128 else 2129 return 0; 2123 switch (iEncoding) 2124 { 2125 case 0: 2126 off = Bs3Cg1InsertOpcodes(pThis, Bs3Cg1InsertReqPrefix(pThis, 0)); 2127 pThis->cbCurInstr = off; 2128 break; 2129 default: 2130 return 0; 2131 } 2130 2132 return iEncoding + 1; 2131 2133 } … … 2135 2137 { 2136 2138 unsigned off; 2137 if (iEncoding == 0) 2138 { 2139 off = Bs3Cg1InsertOpcodes(pThis, Bs3Cg1InsertReqPrefix(pThis, 0)); 2140 pThis->aOperands[1].off = (uint8_t)off; 2141 pThis->abCurInstr[off++] = 0xff; 2142 pThis->cbCurInstr = off; 2143 } 2144 else 2145 return 0; 2139 switch (iEncoding) 2140 { 2141 case 0: 2142 off = Bs3Cg1InsertOpcodes(pThis, Bs3Cg1InsertReqPrefix(pThis, 0)); 2143 pThis->aOperands[1].off = (uint8_t)off; 2144 pThis->abCurInstr[off++] = 0xff; 2145 pThis->cbCurInstr = off; 2146 break; 2147 default: 2148 return 0; 2149 } 2146 2150 return iEncoding + 1; 2147 2151 } … … 2151 2155 { 2152 2156 unsigned off; 2153 if (iEncoding == 0) 2154 { 2155 off = Bs3Cg1InsertOpcodes(pThis, Bs3Cg1InsertReqPrefix(pThis, 0)); 2156 pThis->aOperands[1].off = (uint8_t)off; 2157 if (BS3_MODE_IS_16BIT_CODE(pThis->bMode)) 2158 { 2159 *(uint16_t *)&pThis->abCurInstr[off] = UINT16_MAX; 2160 off += 2; 2161 pThis->aOperands[0].cbOp = 2; 2162 pThis->aOperands[1].cbOp = 2; 2163 pThis->cbOperand = 2; 2164 } 2165 else 2166 { 2157 unsigned cbOp; 2158 switch (iEncoding) 2159 { 2160 case 0: 2161 off = Bs3Cg1InsertOpcodes(pThis, Bs3Cg1InsertReqPrefix(pThis, 0)); 2162 pThis->aOperands[1].off = (uint8_t)off; 2163 cbOp = pThis->cbOpDefault; 2164 if (cbOp == 2) 2165 *(uint16_t *)&pThis->abCurInstr[off] = UINT16_MAX; 2166 else 2167 *(uint32_t *)&pThis->abCurInstr[off] = UINT32_MAX; 2168 off += cbOp; 2169 pThis->aOperands[0].cbOp = cbOp; 2170 pThis->aOperands[1].cbOp = cbOp; 2171 pThis->cbOperand = cbOp; 2172 break; 2173 case 1: 2174 if ((g_uBs3CpuDetected & BS3CPU_TYPE_MASK) < BS3CPU_80386) 2175 return 0; 2176 pThis->abCurInstr[0] = P_OZ; 2177 off = Bs3Cg1InsertOpcodes(pThis, Bs3Cg1InsertReqPrefix(pThis, 1)); 2178 pThis->aOperands[1].off = (uint8_t)off; 2179 cbOp = pThis->cbOpOvrd66; 2180 if (cbOp == 2) 2181 *(uint16_t *)&pThis->abCurInstr[off] = UINT16_MAX; 2182 else 2183 *(uint32_t *)&pThis->abCurInstr[off] = UINT32_MAX; 2184 off += cbOp; 2185 pThis->aOperands[0].cbOp = cbOp; 2186 pThis->aOperands[1].cbOp = cbOp; 2187 pThis->cbOperand = cbOp; 2188 iEncoding += !BS3CG1_IS_64BIT_TARGET(pThis) ? 1 : 0; 2189 break; 2190 case 2: 2191 off = Bs3Cg1InsertReqPrefix(pThis, 0); 2192 pThis->abCurInstr[off++] = REX_W___; 2193 off = Bs3Cg1InsertOpcodes(pThis, off); 2194 pThis->aOperands[1].off = (uint8_t)off; 2167 2195 *(uint32_t *)&pThis->abCurInstr[off] = UINT32_MAX; 2168 2196 off += 4; 2169 pThis->aOperands[0].cbOp = 4;2197 pThis->aOperands[0].cbOp = 8; 2170 2198 pThis->aOperands[1].cbOp = 4; 2171 pThis->cbOperand = 4; 2172 } 2173 } 2174 else if (iEncoding == 1 && (g_uBs3CpuDetected & BS3CPU_TYPE_MASK) >= BS3CPU_80386) 2175 { 2176 pThis->abCurInstr[0] = P_OZ; 2177 off = Bs3Cg1InsertOpcodes(pThis, Bs3Cg1InsertReqPrefix(pThis, 1)); 2178 pThis->aOperands[1].off = (uint8_t)off; 2179 if (!BS3_MODE_IS_16BIT_CODE(pThis->bMode)) 2180 { 2181 *(uint16_t *)&pThis->abCurInstr[off] = UINT16_MAX; 2182 off += 2; 2183 pThis->aOperands[0].cbOp = 2; 2184 pThis->aOperands[1].cbOp = 2; 2185 pThis->cbOperand = 2; 2186 } 2187 else 2188 { 2189 *(uint32_t *)&pThis->abCurInstr[off] = UINT32_MAX; 2190 off += 4; 2191 pThis->aOperands[0].cbOp = 4; 2192 pThis->aOperands[1].cbOp = 4; 2193 pThis->cbOperand = 4; 2194 } 2195 } 2196 else if (iEncoding == 2 && BS3CG1_IS_64BIT_TARGET(pThis)) 2197 { 2198 off = Bs3Cg1InsertReqPrefix(pThis, 0); 2199 pThis->abCurInstr[off++] = REX_W___; 2200 off = Bs3Cg1InsertOpcodes(pThis, off); 2201 pThis->aOperands[1].off = (uint8_t)off; 2202 *(uint32_t *)&pThis->abCurInstr[off] = UINT32_MAX; 2203 off += 4; 2204 pThis->aOperands[0].cbOp = 8; 2205 pThis->aOperands[1].cbOp = 4; 2206 pThis->cbOperand = 8; 2207 } 2208 else 2209 return 0; 2199 pThis->cbOperand = 8; 2200 break; 2201 default: 2202 return 0; 2203 2204 /* IMAGE PADDING - workaround for "rd err" - remove later! */ 2205 case 4: 2206 ASMHalt(); 2207 ASMHalt(); 2208 ASMHalt(); 2209 return 0; 2210 2211 } 2210 2212 pThis->cbCurInstr = off; 2211 2213 return iEncoding + 1; … … 3532 3534 { 3533 3535 pThis->bAlignmentXcpt = UINT8_MAX; 3534 pThis->uVexL = UINT8_MAX;3536 pThis->uVexL = UINT8_MAX; 3535 3537 if (pThis->pfnEncoder) 3536 3538 return pThis->pfnEncoder(pThis, iEncoding); 3537 3539 3538 switch (pThis->enmEncoding) 3539 { 3540 case BS3CG1ENC_FIXED: 3541 return Bs3Cg1EncodeNext_FIXED(pThis, iEncoding); 3542 case BS3CG1ENC_FIXED_AL_Ib: 3543 return Bs3Cg1EncodeNext_FIXED_AL_Ib(pThis, iEncoding); 3544 case BS3CG1ENC_FIXED_rAX_Iz: 3545 return Bs3Cg1EncodeNext_FIXED_rAX_Iz(pThis, iEncoding); 3546 3547 /* 3548 * VEX stuff 3549 */ 3550 #ifdef BS3CG1_WITH_VEX 3551 case BS3CG1ENC_VEX_MODRM_VssZx_WO_Md: 3552 return Bs3Cg1EncodeNext_VEX_MODRM_VsomethingWO_Msomething_Wip_Lig_OR_ViceVersa(pThis, iEncoding); 3553 3554 #endif /* BS3CG1_WITH_VEX */ 3555 3556 default: 3557 Bs3TestFailedF("Internal error! BS3CG1ENC_XXX = %u not implemented", pThis->enmEncoding); 3558 break; 3559 } 3560 3561 3540 Bs3TestFailedF("Internal error! BS3CG1ENC_XXX = %u not implemented", pThis->enmEncoding); 3562 3541 return iEncoding; 3563 3542 } … … 4010 3989 case BS3CG1ENC_MODRM_Mq_WO_Vq: 4011 3990 case BS3CG1ENC_MODRM_Mq_WO_VqHi: 4012 pThis->pfnEncoder = Bs3Cg1EncodeNext_MODRM_Msomething_Vsomething_OR_ViceVersa;4013 pThis->iRmOp = 0;4014 pThis->iRegOp = 1;4015 pThis->aOperands[0].cbOp = 8;4016 pThis->aOperands[1].cbOp = 8;4017 pThis->aOperands[0].enmLocation = BS3CG1OPLOC_MEM_WO;4018 pThis->aOperands[0].enmLocationMem = BS3CG1OPLOC_MEM_WO;4019 pThis->aOperands[1].enmLocation = BS3CG1OPLOC_CTX;4020 pThis->aOperands[1].idxFieldBase = pThis->enmEncoding == BS3CG1ENC_MODRM_Mq_WO_Vq4021 ? BS3CG1DST_XMM0_LO : BS3CG1DST_XMM0_HI;3991 pThis->pfnEncoder = Bs3Cg1EncodeNext_MODRM_Msomething_Vsomething_OR_ViceVersa; 3992 pThis->iRmOp = 0; 3993 pThis->iRegOp = 1; 3994 pThis->aOperands[0].cbOp = 8; 3995 pThis->aOperands[1].cbOp = 8; 3996 pThis->aOperands[0].enmLocation = BS3CG1OPLOC_MEM_WO; 3997 pThis->aOperands[0].enmLocationMem = BS3CG1OPLOC_MEM_WO; 3998 pThis->aOperands[1].enmLocation = BS3CG1OPLOC_CTX; 3999 pThis->aOperands[1].idxFieldBase = pThis->enmEncoding == BS3CG1ENC_MODRM_Mq_WO_Vq 4000 ? BS3CG1DST_XMM0_LO : BS3CG1DST_XMM0_HI; 4022 4001 break; 4023 4002 4024 4003 case BS3CG1ENC_MODRM_Mps_WO_Vps: 4025 4004 case BS3CG1ENC_MODRM_Mpd_WO_Vpd: 4026 pThis->pfnEncoder = Bs3Cg1EncodeNext_MODRM_Msomething_Vsomething_OR_ViceVersa;4027 pThis->iRmOp = 0;4028 pThis->iRegOp = 1;4029 pThis->aOperands[0].cbOp = 16;4030 pThis->aOperands[1].cbOp = 16;4031 pThis->aOperands[0].enmLocation = BS3CG1OPLOC_MEM_WO;4032 pThis->aOperands[1].enmLocation = BS3CG1OPLOC_CTX;4033 pThis->aOperands[1].idxFieldBase = BS3CG1DST_XMM0;4005 pThis->pfnEncoder = Bs3Cg1EncodeNext_MODRM_Msomething_Vsomething_OR_ViceVersa; 4006 pThis->iRmOp = 0; 4007 pThis->iRegOp = 1; 4008 pThis->aOperands[0].cbOp = 16; 4009 pThis->aOperands[1].cbOp = 16; 4010 pThis->aOperands[0].enmLocation = BS3CG1OPLOC_MEM_WO; 4011 pThis->aOperands[1].enmLocation = BS3CG1OPLOC_CTX; 4012 pThis->aOperands[1].idxFieldBase = BS3CG1DST_XMM0; 4034 4013 break; 4035 4014 4036 4015 case BS3CG1ENC_FIXED: 4037 /* nothing to do here */4016 pThis->pfnEncoder = Bs3Cg1EncodeNext_FIXED; 4038 4017 break; 4039 4018 4040 4019 case BS3CG1ENC_FIXED_AL_Ib: 4041 pThis->aOperands[0].cbOp = 1; 4042 pThis->aOperands[1].cbOp = 1; 4043 pThis->aOperands[0].enmLocation = BS3CG1OPLOC_CTX; 4044 pThis->aOperands[1].enmLocation = BS3CG1OPLOC_IMM; 4045 pThis->aOperands[0].idxField = BS3CG1DST_AL; 4046 pThis->aOperands[1].idxField = BS3CG1DST_INVALID; 4020 pThis->pfnEncoder = Bs3Cg1EncodeNext_FIXED_AL_Ib; 4021 pThis->aOperands[0].cbOp = 1; 4022 pThis->aOperands[1].cbOp = 1; 4023 pThis->aOperands[0].enmLocation = BS3CG1OPLOC_CTX; 4024 pThis->aOperands[1].enmLocation = BS3CG1OPLOC_IMM; 4025 pThis->aOperands[0].idxField = BS3CG1DST_AL; 4026 pThis->aOperands[1].idxField = BS3CG1DST_INVALID; 4047 4027 break; 4048 4028 4049 4029 case BS3CG1ENC_FIXED_rAX_Iz: 4050 pThis->aOperands[0].cbOp = 2; 4051 pThis->aOperands[1].cbOp = 2; 4052 pThis->aOperands[0].enmLocation = BS3CG1OPLOC_CTX; 4053 pThis->aOperands[1].enmLocation = BS3CG1OPLOC_IMM; 4054 pThis->aOperands[0].idxField = BS3CG1DST_OZ_RAX; 4055 pThis->aOperands[1].idxField = BS3CG1DST_INVALID; 4030 pThis->pfnEncoder = Bs3Cg1EncodeNext_FIXED_rAX_Iz; 4031 pThis->aOperands[0].cbOp = 2; 4032 pThis->aOperands[1].cbOp = 2; 4033 pThis->aOperands[0].enmLocation = BS3CG1OPLOC_CTX; 4034 pThis->aOperands[1].enmLocation = BS3CG1OPLOC_IMM; 4035 pThis->aOperands[0].idxField = BS3CG1DST_OZ_RAX; 4036 pThis->aOperands[1].idxField = BS3CG1DST_INVALID; 4056 4037 break; 4057 4038 4058 4039 /* Unused or invalid instructions mostly. */ 4059 4040 case BS3CG1ENC_MODRM_MOD_EQ_3: 4060 pThis->pfnEncoder = Bs3Cg1EncodeNext_MODRM_MOD_EQ_3;4041 pThis->pfnEncoder = Bs3Cg1EncodeNext_MODRM_MOD_EQ_3; 4061 4042 break; 4062 4043 case BS3CG1ENC_MODRM_MOD_NE_3: 4063 pThis->pfnEncoder = Bs3Cg1EncodeNext_MODRM_MOD_NE_3;4044 pThis->pfnEncoder = Bs3Cg1EncodeNext_MODRM_MOD_NE_3; 4064 4045 break; 4065 4046
注意:
瀏覽 TracChangeset
來幫助您使用更動檢視器