Lines Matching full:data
312 static void get_modrm(byte data, int* mod, int* regop, int* rm) { in get_modrm() argument
313 *mod = (data >> 6) & 3; in get_modrm()
314 *regop = (data & 0x38) >> 3; in get_modrm()
315 *rm = data & 7; in get_modrm()
319 static void get_sib(byte data, int* scale, int* index, int* base) { in get_sib() argument
320 *scale = (data >> 6) & 3; in get_sib()
321 *index = (data >> 3) & 7; in get_sib()
322 *base = data & 7; in get_sib()
331 int PrintOperands(const char* mnem, OperandOrder op_order, byte* data);
332 int PrintImmediateOp(byte* data);
333 int F7Instruction(byte* data);
334 int D1D3C1Instruction(byte* data);
335 int JumpShort(byte* data);
336 int JumpConditional(byte* data, const char* comment);
337 int JumpConditionalShort(byte* data, const char* comment);
338 int SetCC(byte* data);
339 int CMov(byte* data);
340 int FPUInstruction(byte* data);
470 // Returns number of bytes used including the current *data.
474 byte* data) { in PrintOperands() argument
475 byte modrm = *data; in PrintOperands()
482 advance = PrintRightOperand(data); in PrintOperands()
487 advance = PrintRightOperand(data); in PrintOperands()
499 // Returns number of bytes used by machine instruction, including *data byte.
501 int DisassemblerX87::PrintImmediateOp(byte* data) { in PrintImmediateOp() argument
502 bool sign_extension_bit = (*data & 0x02) != 0; in PrintImmediateOp()
503 byte modrm = *(data+1); in PrintImmediateOp()
518 int count = PrintRightOperand(data+1); in PrintImmediateOp()
520 AppendToBuffer(",0x%x", *(data + 1 + count)); in PrintImmediateOp()
523 AppendToBuffer(",0x%x", *reinterpret_cast<int32_t*>(data + 1 + count)); in PrintImmediateOp()
529 // Returns number of bytes used, including *data.
530 int DisassemblerX87::F7Instruction(byte* data) { in F7Instruction() argument
531 DCHECK_EQ(0xF7, *data); in F7Instruction()
532 byte modrm = *++data; in F7Instruction()
562 int count = PrintRightOperand(data); in F7Instruction()
564 AppendToBuffer(",0x%x", *reinterpret_cast<int32_t*>(data + count)); in F7Instruction()
571 int DisassemblerX87::D1D3C1Instruction(byte* data) { in D1D3C1Instruction() argument
572 byte op = *data; in D1D3C1Instruction()
574 byte modrm = *++data; in D1D3C1Instruction()
605 int count = PrintRightOperand(data); in D1D3C1Instruction()
609 imm8 = *(data + 1); in D1D3C1Instruction()
623 // Returns number of bytes used, including *data.
624 int DisassemblerX87::JumpShort(byte* data) { in JumpShort() argument
625 DCHECK_EQ(0xEB, *data); in JumpShort()
626 byte b = *(data+1); in JumpShort()
627 byte* dest = data + static_cast<int8_t>(b) + 2; in JumpShort()
633 // Returns number of bytes used, including *data.
634 int DisassemblerX87::JumpConditional(byte* data, const char* comment) { in JumpConditional() argument
635 DCHECK_EQ(0x0F, *data); in JumpConditional()
636 byte cond = *(data+1) & 0x0F; in JumpConditional()
637 byte* dest = data + *reinterpret_cast<int32_t*>(data+2) + 6; in JumpConditional()
647 // Returns number of bytes used, including *data.
648 int DisassemblerX87::JumpConditionalShort(byte* data, const char* comment) { in JumpConditionalShort() argument
649 byte cond = *data & 0x0F; in JumpConditionalShort()
650 byte b = *(data+1); in JumpConditionalShort()
651 byte* dest = data + static_cast<int8_t>(b) + 2; in JumpConditionalShort()
661 // Returns number of bytes used, including *data.
662 int DisassemblerX87::SetCC(byte* data) { in SetCC() argument
663 DCHECK_EQ(0x0F, *data); in SetCC()
664 byte cond = *(data+1) & 0x0F; in SetCC()
667 PrintRightByteOperand(data+2); in SetCC()
672 // Returns number of bytes used, including *data.
673 int DisassemblerX87::CMov(byte* data) { in CMov() argument
674 DCHECK_EQ(0x0F, *data); in CMov()
675 byte cond = *(data + 1) & 0x0F; in CMov()
677 int op_size = PrintOperands(mnem, REG_OPER_OP_ORDER, data + 2); in CMov()
682 // Returns number of bytes used, including *data.
683 int DisassemblerX87::FPUInstruction(byte* data) { in FPUInstruction() argument
684 byte escape_opcode = *data; in FPUInstruction()
686 byte modrm_byte = *(data+1); in FPUInstruction()
691 return MemoryFPUInstruction(escape_opcode, modrm_byte, data+1); in FPUInstruction()
917 byte* data = instr; in InstructionDecode() local
921 if (*data == 0x3E /*ds*/) { in InstructionDecode()
923 data++; in InstructionDecode()
924 } else if (*data == 0x2E /*cs*/) { in InstructionDecode()
926 data++; in InstructionDecode()
930 const InstructionDesc& idesc = instruction_table_->Get(*data); in InstructionDecode()
934 data++; in InstructionDecode()
938 data++; in InstructionDecode()
939 data += PrintOperands(idesc.mnem, idesc.op_order_, data); in InstructionDecode()
943 data += JumpConditionalShort(data, branch_hint); in InstructionDecode()
947 AppendToBuffer("%s %s", idesc.mnem, NameOfCPURegister(*data & 0x07)); in InstructionDecode()
948 data++; in InstructionDecode()
952 byte* addr = reinterpret_cast<byte*>(*reinterpret_cast<int32_t*>(data+1)); in InstructionDecode()
954 NameOfCPURegister(*data & 0x07), in InstructionDecode()
956 data += 5; in InstructionDecode()
961 byte* addr = data + *reinterpret_cast<int32_t*>(data+1) + 5; in InstructionDecode()
963 data += 5; in InstructionDecode()
968 byte* addr = reinterpret_cast<byte*>(*reinterpret_cast<int32_t*>(data+1)); in InstructionDecode()
970 data += 5; in InstructionDecode()
975 AppendToBuffer("%s al,0x%x", idesc.mnem, data[1]); in InstructionDecode()
976 data += 2; in InstructionDecode()
989 switch (*data) { in InstructionDecode()
991 AppendToBuffer("ret 0x%x", *reinterpret_cast<uint16_t*>(data+1)); in InstructionDecode()
992 data += 3; in InstructionDecode()
996 data++; in InstructionDecode()
997 data += PrintOperands("imul", REG_OPER_OP_ORDER, data); in InstructionDecode()
998 AppendToBuffer(",%d", *data); in InstructionDecode()
999 data++; in InstructionDecode()
1003 data++; in InstructionDecode()
1004 data += PrintOperands("imul", REG_OPER_OP_ORDER, data); in InstructionDecode()
1005 AppendToBuffer(",%d", *reinterpret_cast<int32_t*>(data)); in InstructionDecode()
1006 data += 4; in InstructionDecode()
1011 { data++; in InstructionDecode()
1013 get_modrm(*data, &mod, ®op, &rm); in InstructionDecode()
1016 data += PrintRightByteOperand(data); in InstructionDecode()
1017 int32_t imm = *data; in InstructionDecode()
1019 data++; in InstructionDecode()
1028 data += PrintImmediateOp(data); in InstructionDecode()
1032 { byte f0byte = data[1]; in InstructionDecode()
1035 data += 2; in InstructionDecode()
1037 get_modrm(*data, &mod, ®op, &rm); in InstructionDecode()
1040 data += PrintRightOperand(data); in InstructionDecode()
1041 } else if (f0byte == 0x1F && data[2] == 0) { in InstructionDecode()
1043 data += 3; in InstructionDecode()
1044 } else if (f0byte == 0x1F && data[2] == 0x40 && data[3] == 0) { in InstructionDecode()
1046 data += 4; in InstructionDecode()
1047 } else if (f0byte == 0x1F && data[2] == 0x44 && data[3] == 0 && in InstructionDecode()
1048 data[4] == 0) { in InstructionDecode()
1050 data += 5; in InstructionDecode()
1051 } else if (f0byte == 0x1F && data[2] == 0x80 && data[3] == 0 && in InstructionDecode()
1052 data[4] == 0 && data[5] == 0 && data[6] == 0) { in InstructionDecode()
1054 data += 7; in InstructionDecode()
1055 } else if (f0byte == 0x1F && data[2] == 0x84 && data[3] == 0 && in InstructionDecode()
1056 data[4] == 0 && data[5] == 0 && data[6] == 0 && in InstructionDecode()
1057 data[7] == 0) { in InstructionDecode()
1059 data += 8; in InstructionDecode()
1062 data += 2; in InstructionDecode()
1064 data += 2; in InstructionDecode()
1066 get_modrm(*data, &mod, ®op, &rm); in InstructionDecode()
1070 data++; in InstructionDecode()
1088 data += 2; in InstructionDecode()
1090 get_modrm(*data, &mod, ®op, &rm); in InstructionDecode()
1094 data += PrintRightXMMOperand(data); in InstructionDecode()
1096 data += 2; in InstructionDecode()
1098 get_modrm(*data, &mod, ®op, &rm); in InstructionDecode()
1102 data++; in InstructionDecode()
1105 data += 2; in InstructionDecode()
1107 get_modrm(*data, &mod, ®op, &rm); in InstructionDecode()
1108 int8_t imm8 = static_cast<int8_t>(data[1]); in InstructionDecode()
1113 data += 2; in InstructionDecode()
1115 data += JumpConditional(data, branch_hint); in InstructionDecode()
1118 data += 2; in InstructionDecode()
1119 data += PrintOperands(f0mnem, REG_OPER_OP_ORDER, data); in InstructionDecode()
1121 data += SetCC(data); in InstructionDecode()
1123 data += CMov(data); in InstructionDecode()
1126 data += 2; in InstructionDecode()
1129 get_modrm(*data, &mod, ®op, &rm); in InstructionDecode()
1130 data += PrintRightOperand(data); in InstructionDecode()
1137 data += 2; in InstructionDecode()
1139 get_modrm(*data, &mod, ®op, &rm); in InstructionDecode()
1141 data += PrintRightOperand(data); in InstructionDecode()
1149 { data++; in InstructionDecode()
1151 get_modrm(*data, &mod, ®op, &rm); in InstructionDecode()
1154 data += PrintRightOperand(data); in InstructionDecode()
1160 { data++; in InstructionDecode()
1162 get_modrm(*data, &mod, ®op, &rm); in InstructionDecode()
1173 data += PrintRightOperand(data); in InstructionDecode()
1179 { bool is_byte = *data == 0xC6; in InstructionDecode()
1180 data++; in InstructionDecode()
1183 data += PrintRightByteOperand(data); in InstructionDecode()
1184 int32_t imm = *data; in InstructionDecode()
1186 data++; in InstructionDecode()
1189 data += PrintRightOperand(data); in InstructionDecode()
1190 int32_t imm = *reinterpret_cast<int32_t*>(data); in InstructionDecode()
1192 data += 4; in InstructionDecode()
1198 { data++; in InstructionDecode()
1200 get_modrm(*data, &mod, ®op, &rm); in InstructionDecode()
1208 data += PrintRightByteOperand(data); in InstructionDecode()
1209 int32_t imm = *data; in InstructionDecode()
1211 data++; in InstructionDecode()
1217 { bool is_byte = *data == 0x88; in InstructionDecode()
1219 data++; in InstructionDecode()
1220 get_modrm(*data, &mod, ®op, &rm); in InstructionDecode()
1223 data += PrintRightByteOperand(data); in InstructionDecode()
1227 data += PrintRightOperand(data); in InstructionDecode()
1234 while (*data == 0x66) data++; in InstructionDecode()
1235 if (*data == 0xf && data[1] == 0x1f) { in InstructionDecode()
1237 } else if (*data == 0x90) { in InstructionDecode()
1239 } else if (*data == 0x8B) { in InstructionDecode()
1240 data++; in InstructionDecode()
1241 data += PrintOperands("mov_w", REG_OPER_OP_ORDER, data); in InstructionDecode()
1242 } else if (*data == 0x89) { in InstructionDecode()
1243 data++; in InstructionDecode()
1245 get_modrm(*data, &mod, ®op, &rm); in InstructionDecode()
1247 data += PrintRightOperand(data); in InstructionDecode()
1249 } else if (*data == 0xC7) { in InstructionDecode()
1250 data++; in InstructionDecode()
1252 data += PrintRightOperand(data); in InstructionDecode()
1253 int imm = *reinterpret_cast<int16_t*>(data); in InstructionDecode()
1255 data += 2; in InstructionDecode()
1256 } else if (*data == 0x0F) { in InstructionDecode()
1257 data++; in InstructionDecode()
1258 if (*data == 0x38) { in InstructionDecode()
1259 data++; in InstructionDecode()
1260 if (*data == 0x17) { in InstructionDecode()
1261 data++; in InstructionDecode()
1263 get_modrm(*data, &mod, ®op, &rm); in InstructionDecode()
1267 data++; in InstructionDecode()
1268 } else if (*data == 0x2A) { in InstructionDecode()
1270 data++; in InstructionDecode()
1272 get_modrm(*data, &mod, ®op, &rm); in InstructionDecode()
1274 data += PrintRightOperand(data); in InstructionDecode()
1278 } else if (*data == 0x3A) { in InstructionDecode()
1279 data++; in InstructionDecode()
1280 if (*data == 0x0B) { in InstructionDecode()
1281 data++; in InstructionDecode()
1283 get_modrm(*data, &mod, ®op, &rm); in InstructionDecode()
1284 int8_t imm8 = static_cast<int8_t>(data[1]); in InstructionDecode()
1289 data += 2; in InstructionDecode()
1290 } else if (*data == 0x16) { in InstructionDecode()
1291 data++; in InstructionDecode()
1293 get_modrm(*data, &mod, ®op, &rm); in InstructionDecode()
1294 int8_t imm8 = static_cast<int8_t>(data[1]); in InstructionDecode()
1299 data += 2; in InstructionDecode()
1300 } else if (*data == 0x17) { in InstructionDecode()
1301 data++; in InstructionDecode()
1303 get_modrm(*data, &mod, ®op, &rm); in InstructionDecode()
1304 int8_t imm8 = static_cast<int8_t>(data[1]); in InstructionDecode()
1309 data += 2; in InstructionDecode()
1310 } else if (*data == 0x22) { in InstructionDecode()
1311 data++; in InstructionDecode()
1313 get_modrm(*data, &mod, ®op, &rm); in InstructionDecode()
1314 int8_t imm8 = static_cast<int8_t>(data[1]); in InstructionDecode()
1319 data += 2; in InstructionDecode()
1323 } else if (*data == 0x2E || *data == 0x2F) { in InstructionDecode()
1324 const char* mnem = (*data == 0x2E) ? "ucomisd" : "comisd"; in InstructionDecode()
1325 data++; in InstructionDecode()
1327 get_modrm(*data, &mod, ®op, &rm); in InstructionDecode()
1332 data++; in InstructionDecode()
1335 data += PrintRightOperand(data); in InstructionDecode()
1337 } else if (*data == 0x50) { in InstructionDecode()
1338 data++; in InstructionDecode()
1340 get_modrm(*data, &mod, ®op, &rm); in InstructionDecode()
1344 data++; in InstructionDecode()
1345 } else if (*data == 0x54) { in InstructionDecode()
1346 data++; in InstructionDecode()
1348 get_modrm(*data, &mod, ®op, &rm); in InstructionDecode()
1352 data++; in InstructionDecode()
1353 } else if (*data == 0x56) { in InstructionDecode()
1354 data++; in InstructionDecode()
1356 get_modrm(*data, &mod, ®op, &rm); in InstructionDecode()
1360 data++; in InstructionDecode()
1361 } else if (*data == 0x57) { in InstructionDecode()
1362 data++; in InstructionDecode()
1364 get_modrm(*data, &mod, ®op, &rm); in InstructionDecode()
1368 data++; in InstructionDecode()
1369 } else if (*data == 0x6E) { in InstructionDecode()
1370 data++; in InstructionDecode()
1372 get_modrm(*data, &mod, ®op, &rm); in InstructionDecode()
1374 data += PrintRightOperand(data); in InstructionDecode()
1375 } else if (*data == 0x6F) { in InstructionDecode()
1376 data++; in InstructionDecode()
1378 get_modrm(*data, &mod, ®op, &rm); in InstructionDecode()
1380 data += PrintRightXMMOperand(data); in InstructionDecode()
1381 } else if (*data == 0x70) { in InstructionDecode()
1382 data++; in InstructionDecode()
1384 get_modrm(*data, &mod, ®op, &rm); in InstructionDecode()
1385 int8_t imm8 = static_cast<int8_t>(data[1]); in InstructionDecode()
1390 data += 2; in InstructionDecode()
1391 } else if (*data == 0x76) { in InstructionDecode()
1392 data++; in InstructionDecode()
1394 get_modrm(*data, &mod, ®op, &rm); in InstructionDecode()
1398 data++; in InstructionDecode()
1399 } else if (*data == 0x90) { in InstructionDecode()
1400 data++; in InstructionDecode()
1402 } else if (*data == 0xF3) { in InstructionDecode()
1403 data++; in InstructionDecode()
1405 get_modrm(*data, &mod, ®op, &rm); in InstructionDecode()
1409 data++; in InstructionDecode()
1410 } else if (*data == 0x73) { in InstructionDecode()
1411 data++; in InstructionDecode()
1413 get_modrm(*data, &mod, ®op, &rm); in InstructionDecode()
1414 int8_t imm8 = static_cast<int8_t>(data[1]); in InstructionDecode()
1420 data += 2; in InstructionDecode()
1421 } else if (*data == 0xD3) { in InstructionDecode()
1422 data++; in InstructionDecode()
1424 get_modrm(*data, &mod, ®op, &rm); in InstructionDecode()
1428 data++; in InstructionDecode()
1429 } else if (*data == 0x7F) { in InstructionDecode()
1431 data++; in InstructionDecode()
1433 get_modrm(*data, &mod, ®op, &rm); in InstructionDecode()
1434 data += PrintRightXMMOperand(data); in InstructionDecode()
1436 } else if (*data == 0x7E) { in InstructionDecode()
1437 data++; in InstructionDecode()
1439 get_modrm(*data, &mod, ®op, &rm); in InstructionDecode()
1441 data += PrintRightOperand(data); in InstructionDecode()
1443 } else if (*data == 0xDB) { in InstructionDecode()
1444 data++; in InstructionDecode()
1446 get_modrm(*data, &mod, ®op, &rm); in InstructionDecode()
1450 data++; in InstructionDecode()
1451 } else if (*data == 0xE7) { in InstructionDecode()
1452 data++; in InstructionDecode()
1454 get_modrm(*data, &mod, ®op, &rm); in InstructionDecode()
1457 data += PrintRightOperand(data); in InstructionDecode()
1462 } else if (*data == 0xEF) { in InstructionDecode()
1463 data++; in InstructionDecode()
1465 get_modrm(*data, &mod, ®op, &rm); in InstructionDecode()
1469 data++; in InstructionDecode()
1470 } else if (*data == 0xEB) { in InstructionDecode()
1471 data++; in InstructionDecode()
1473 get_modrm(*data, &mod, ®op, &rm); in InstructionDecode()
1477 data++; in InstructionDecode()
1487 { data++; in InstructionDecode()
1489 get_modrm(*data, &mod, ®op, &rm); in InstructionDecode()
1492 data += PrintRightOperand(data); in InstructionDecode()
1500 AppendToBuffer("push 0x%x", *reinterpret_cast<int32_t*>(data+1)); in InstructionDecode()
1501 data += 5; in InstructionDecode()
1505 AppendToBuffer("push 0x%x", *reinterpret_cast<int8_t*>(data + 1)); in InstructionDecode()
1506 data += 2; in InstructionDecode()
1510 AppendToBuffer("test al,0x%x", *reinterpret_cast<uint8_t*>(data+1)); in InstructionDecode()
1511 data += 2; in InstructionDecode()
1515 AppendToBuffer("test eax,0x%x", *reinterpret_cast<int32_t*>(data+1)); in InstructionDecode()
1516 data += 5; in InstructionDecode()
1522 data += D1D3C1Instruction(data); in InstructionDecode()
1533 data += FPUInstruction(data); in InstructionDecode()
1537 data += JumpShort(data); in InstructionDecode()
1541 if (*(data+1) == 0x0F) { in InstructionDecode()
1542 byte b2 = *(data+2); in InstructionDecode()
1545 data += 3; in InstructionDecode()
1547 get_modrm(*data, &mod, ®op, &rm); in InstructionDecode()
1548 data += PrintRightXMMOperand(data); in InstructionDecode()
1551 data += 3; in InstructionDecode()
1553 get_modrm(*data, &mod, ®op, &rm); in InstructionDecode()
1555 data += PrintRightXMMOperand(data); in InstructionDecode()
1557 data += 3; in InstructionDecode()
1559 get_modrm(*data, &mod, ®op, &rm); in InstructionDecode()
1561 data += PrintRightXMMOperand(data); in InstructionDecode()
1574 data += 3; in InstructionDecode()
1576 get_modrm(*data, &mod, ®op, &rm); in InstructionDecode()
1579 data += PrintRightOperand(data); in InstructionDecode()
1582 data += PrintRightXMMOperand(data); in InstructionDecode()
1596 pseudo_op[data[1]], in InstructionDecode()
1599 data += 2; in InstructionDecode()
1602 data += PrintRightXMMOperand(data); in InstructionDecode()
1611 if (*(data+1) == 0x0F) { in InstructionDecode()
1612 byte b2 = *(data+2); in InstructionDecode()
1615 data += 3; in InstructionDecode()
1617 get_modrm(*data, &mod, ®op, &rm); in InstructionDecode()
1618 data += PrintRightXMMOperand(data); in InstructionDecode()
1621 data += 3; in InstructionDecode()
1623 get_modrm(*data, &mod, ®op, &rm); in InstructionDecode()
1625 data += PrintRightXMMOperand(data); in InstructionDecode()
1627 data += 3; in InstructionDecode()
1629 get_modrm(*data, &mod, ®op, &rm); in InstructionDecode()
1631 data += PrintRightXMMOperand(data); in InstructionDecode()
1633 data += 3; in InstructionDecode()
1635 get_modrm(*data, &mod, ®op, &rm); in InstructionDecode()
1637 data += PrintRightXMMOperand(data); in InstructionDecode()
1639 data += 3; in InstructionDecode()
1641 get_modrm(*data, &mod, ®op, &rm); in InstructionDecode()
1643 data += PrintRightXMMOperand(data); in InstructionDecode()
1646 data += 3; in InstructionDecode()
1648 get_modrm(*data, &mod, ®op, &rm); in InstructionDecode()
1649 data += PrintRightXMMOperand(data); in InstructionDecode()
1654 } else if (*(data+1) == 0xA5) { in InstructionDecode()
1655 data += 2; in InstructionDecode()
1657 } else if (*(data+1) == 0xAB) { in InstructionDecode()
1658 data += 2; in InstructionDecode()
1666 data += F7Instruction(data); in InstructionDecode()
1678 int instr_len = data - instr; in InstructionDecode()
1680 printf("%02x", *data); in InstructionDecode()
1686 for (byte* bp = instr; bp < data; bp++) { in InstructionDecode()