Changeset 9101 in vbox for trunk/src/VBox
- Timestamp:
- May 26, 2008 2:27:35 AM (17 years ago)
- Location:
- trunk/src/VBox/Disassembler/testcase
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Disassembler/testcase/Makefile.kmk
r9100 r9101 59 59 tstBin-2.bin \ 60 60 tstBin-3.bin \ 61 tstBin-4.bin 61 tstBin-4.bin \ 62 tstBin-5.bin \ 63 tstBin-6.bin 62 64 # $(PATH_BIN)/testcase/tstDisasm-2$(SUFF_EXEC) 63 65 endif -
trunk/src/VBox/Disassembler/testcase/tstDisasm-2.cpp
r9099 r9101 359 359 case OP_POPF: 360 360 pszFmt = pCpu->opmode == CPUMODE_16BIT ? "popfw" : pCpu->opmode == CPUMODE_32BIT ? "popfd" : "popfq"; 361 break; 362 case OP_PUSHA: 363 pszFmt = pCpu->opmode == CPUMODE_16BIT ? "pushaw" : "pushad"; 364 break; 365 case OP_POPA: 366 pszFmt = pCpu->opmode == CPUMODE_16BIT ? "popaw" : "popad"; 361 367 break; 362 368 case OP_INSB: … … 703 709 || (pOp->param1 >= OP_PARM_REG_GEN16_START && pOp->param1 <= OP_PARM_REG_GEN16_END) 704 710 || (pOp->param2 >= OP_PARM_REG_GEN16_START && pOp->param2 <= OP_PARM_REG_GEN16_END) 711 || pCpu->mode != pCpu->opmode 705 712 ) 706 713 { … … 722 729 || (pOp->param1 >= OP_PARM_REG_GEN32_START && pOp->param1 <= OP_PARM_REG_GEN32_END) 723 730 || (pOp->param2 >= OP_PARM_REG_GEN32_START && pOp->param2 <= OP_PARM_REG_GEN32_END) 731 || pCpu->opmode != (pCpu->mode == CPUMODE_16BIT ? CPUMODE_16BIT : CPUMODE_32BIT) /* not perfect */ 724 732 ) 725 733 { … … 1079 1087 } 1080 1088 1081 /* nop w/ prefix(es). */ 1082 if ( fPrefixes 1083 && pState->Cpu.pCurInstr->opcode == OP_NOP) 1084 return true; 1085 1086 /* There are probably a whole bunch of these... */ 1089 /* Almost all prefixes are bad. */ 1090 if (fPrefixes) 1091 { 1092 switch (pState->Cpu.pCurInstr->opcode) 1093 { 1094 /* nop w/ prefix(es). */ 1095 case OP_NOP: 1096 return true; 1097 1098 case OP_JMP: 1099 if ( pState->Cpu.pCurInstr->param1 != OP_PARM_Jb 1100 && pState->Cpu.pCurInstr->param1 != OP_PARM_Jv) 1101 break; 1102 /* fall thru */ 1103 case OP_JO: 1104 case OP_JNO: 1105 case OP_JC: 1106 case OP_JNC: 1107 case OP_JE: 1108 case OP_JNE: 1109 case OP_JBE: 1110 case OP_JNBE: 1111 case OP_JS: 1112 case OP_JNS: 1113 case OP_JP: 1114 case OP_JNP: 1115 case OP_JL: 1116 case OP_JNL: 1117 case OP_JLE: 1118 case OP_JNLE: 1119 /** @todo branch hinting 0x2e/0x3e... */ 1120 return true; 1121 } 1122 1123 } 1124 1125 /* All but the segment prefix is bad news. */ 1087 1126 if (fPrefixes & ~PREFIX_SEG) 1088 1127 { … … 1110 1149 } 1111 1150 1112 1113 /* check for the version of xyz reg,reg instruction that the assembler doesn't use. 1114 expected: 1aee sbb ch, dh ; SBB r8, r/m8 1115 yasm: 18F5 sbb ch, dh ; SBB r/m8, r8 */ 1151 /* Implicit 8-bit register instructions doesn't mix with operand size. */ 1152 if ( (fPrefixes & PREFIX_OPSIZE) 1153 && ( ( pState->Cpu.pCurInstr->param1 == OP_PARM_Gb /* r8 */ 1154 && pState->Cpu.pCurInstr->param2 == OP_PARM_Eb /* r8/mem8 */) 1155 || ( pState->Cpu.pCurInstr->param2 == OP_PARM_Gb /* r8 */ 1156 && pState->Cpu.pCurInstr->param1 == OP_PARM_Eb /* r8/mem8 */)) 1157 ) 1158 { 1159 switch (pState->Cpu.pCurInstr->opcode) 1160 { 1161 case OP_ADD: 1162 case OP_OR: 1163 case OP_ADC: 1164 case OP_SBB: 1165 case OP_AND: 1166 case OP_SUB: 1167 case OP_XOR: 1168 case OP_CMP: 1169 return true; 1170 default: 1171 break; 1172 } 1173 } 1174 1175 1176 /* 1177 * Check for the version of xyz reg,reg instruction that the assembler doesn't use. 1178 * 1179 * For example: 1180 * expected: 1aee sbb ch, dh ; SBB r8, r/m8 1181 * yasm: 18F5 sbb ch, dh ; SBB r/m8, r8 1182 */ 1116 1183 if (pState->Cpu.ModRM.Bits.Mod == 3 /* reg,reg */) 1117 1184 { … … 1149 1216 default: 1150 1217 break; 1218 } 1219 } 1220 1221 /* shl eax,1 will be assembled to the form without the immediate byte. */ 1222 if ( pState->Cpu.pCurInstr->param2 == OP_PARM_Ib 1223 && (uint8_t)pState->Cpu.param2.parval == 1) 1224 { 1225 switch (pState->Cpu.pCurInstr->opcode) 1226 { 1227 case OP_SHL: 1228 case OP_SHR: 1229 case OP_SAR: 1230 case OP_RCL: 1231 case OP_RCR: 1232 case OP_ROL: 1233 case OP_ROR: 1234 return true; 1151 1235 } 1152 1236 }
Note:
See TracChangeset
for help on using the changeset viewer.