Changeset 42050 in vbox for trunk/src/VBox/Disassembler/DisasmFormatYasm.cpp
- Timestamp:
- Jul 9, 2012 12:41:24 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Disassembler/DisasmFormatYasm.cpp
r41792 r42050 816 816 817 817 case DISUSE_IMMEDIATE16_SX8: 818 PUT_SZ_STRICT("strict byte ", "byte "); 818 if ( !(pDis->fPrefix & DISPREFIX_OPSIZE) 819 || pDis->pCurInstr->uOpcode != OP_PUSH) 820 PUT_SZ_STRICT("strict byte ", "byte "); 821 else 822 PUT_SZ("word "); 819 823 PUT_NUM_16(pParam->uValue); 820 824 break; … … 839 843 840 844 case DISUSE_IMMEDIATE32_SX8: 841 PUT_SZ_STRICT("strict byte ", "byte "); 845 if ( !(pDis->fPrefix & DISPREFIX_OPSIZE) 846 || pDis->pCurInstr->uOpcode != OP_PUSH) 847 PUT_SZ_STRICT("strict byte ", "byte "); 848 else 849 PUT_SZ("dword "); 842 850 PUT_NUM_32(pParam->uValue); 843 851 break; 844 852 845 853 case DISUSE_IMMEDIATE64_SX8: 846 PUT_SZ_STRICT("strict byte ", "byte "); 854 if ( !(pDis->fPrefix & DISPREFIX_OPSIZE) 855 || pDis->pCurInstr->uOpcode != OP_PUSH) 856 PUT_SZ_STRICT("strict byte ", "byte "); 857 else 858 PUT_SZ("qword "); 847 859 PUT_NUM_64(pParam->uValue); 848 860 break; … … 1237 1249 * Check for multiple prefixes of the same kind. 1238 1250 */ 1251 uint8_t off1stSeg = UINT8_MAX; 1252 uint8_t offOpSize = UINT8_MAX; 1253 uint8_t offAddrSize = UINT8_MAX; 1239 1254 uint32_t fPrefixes = 0; 1240 1255 for (uint32_t offOpcode = 0; offOpcode < RT_ELEMENTS(pDis->abInstr); offOpcode++) … … 1258 1273 case 0x64: 1259 1274 case 0x65: 1275 if (off1stSeg == UINT8_MAX) 1276 off1stSeg = offOpcode; 1260 1277 f = DISPREFIX_SEG; 1261 1278 break; 1262 1279 1263 1280 case 0x66: 1281 if (offOpSize == UINT8_MAX) 1282 offOpSize = offOpcode; 1264 1283 f = DISPREFIX_OPSIZE; 1265 1284 break; 1266 1285 1267 1286 case 0x67: 1287 if (offAddrSize == UINT8_MAX) 1288 offAddrSize = offOpcode; 1268 1289 f = DISPREFIX_ADDRSIZE; 1269 1290 break; … … 1294 1315 && !DISUSE_IS_EFFECTIVE_ADDR(pDis->Param3.fUse)) 1295 1316 return true; 1317 1318 /* Yasm puts the segment prefixes before the operand prefix with no 1319 way of overriding it. */ 1320 if (offOpSize < off1stSeg) 1321 return true; 1296 1322 } 1297 1323 … … 1307 1333 } 1308 1334 1309 /* Almost all prefixes are bad . */1335 /* Almost all prefixes are bad for jumps. */ 1310 1336 if (fPrefixes) 1311 1337 { … … 1343 1369 } 1344 1370 1345 /* All but the segment prefix is bad news . */1371 /* All but the segment prefix is bad news for push/pop. */ 1346 1372 if (fPrefixes & ~DISPREFIX_SEG) 1347 1373 { … … 1387 1413 case OP_XOR: 1388 1414 case OP_CMP: 1415 return true; 1416 default: 1417 break; 1418 } 1419 } 1420 1421 /* Instructions taking no address or operand which thus may be annoyingly 1422 difficult to format for yasm. */ 1423 if (fPrefixes) 1424 { 1425 switch (pDis->pCurInstr->uOpcode) 1426 { 1427 case OP_STI: 1428 case OP_STC: 1429 case OP_CLI: 1430 case OP_CLD: 1431 case OP_CLC: 1432 case OP_INT: 1433 case OP_INT3: 1434 case OP_INTO: 1435 case OP_HLT: 1436 /* Many more to can be added... */ 1389 1437 return true; 1390 1438 default:
Note:
See TracChangeset
for help on using the changeset viewer.