Changeset 173312 in webkit for trunk/Source/JavaScriptCore/disassembler
- Timestamp:
- Sep 5, 2014, 9:17:17 AM (11 years ago)
- Location:
- trunk/Source/JavaScriptCore/disassembler/ARMv7
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/disassembler/ARMv7/ARMv7DOpcode.cpp
r170843 r173312 114 114 115 115 static Opcode32GroupInitializer opcode32BitGroupList[] = { 116 OPCODE_GROUP_ENTRY(0x4, ARMv7DOpcodeDataPopMultiple), 117 OPCODE_GROUP_ENTRY(0x4, ARMv7DOpcodeDataPushMultiple), 116 118 OPCODE_GROUP_ENTRY(0x5, ARMv7DOpcodeDataProcessingShiftedReg), 119 OPCODE_GROUP_ENTRY(0x6, ARMv7DOpcodeVLDR), 117 120 OPCODE_GROUP_ENTRY(0x6, ARMv7DOpcodeVMOVSinglePrecision), 118 121 OPCODE_GROUP_ENTRY(0x6, ARMv7DOpcodeVMOVDoublePrecision), 119 122 OPCODE_GROUP_ENTRY(0x7, ARMv7DOpcodeFPTransfer), 120 123 OPCODE_GROUP_ENTRY(0x7, ARMv7DOpcodeVMSR), 124 OPCODE_GROUP_ENTRY(0x7, ARMv7DOpcodeVCMP), 125 OPCODE_GROUP_ENTRY(0x7, ARMv7DOpcodeVCVTBetweenFPAndInt), 121 126 OPCODE_GROUP_ENTRY(0x8, ARMv7DOpcodeDataProcessingModifiedImmediate), 122 127 OPCODE_GROUP_ENTRY(0x8, ARMv7DOpcodeConditionalBranchT3), … … 134 139 OPCODE_GROUP_ENTRY(0xc, ARMv7DOpcodeLoadRegister), 135 140 OPCODE_GROUP_ENTRY(0xc, ARMv7DOpcodeDataPushPopSingle), // Should be before StoreSingle* 141 OPCODE_GROUP_ENTRY(0xc, ARMv7DOpcodeDataPopMultiple), 142 OPCODE_GROUP_ENTRY(0xc, ARMv7DOpcodeDataPushMultiple), 136 143 OPCODE_GROUP_ENTRY(0xc, ARMv7DOpcodeStoreSingleRegister), 137 144 OPCODE_GROUP_ENTRY(0xc, ARMv7DOpcodeStoreSingleImmediate12), … … 144 151 OPCODE_GROUP_ENTRY(0xd, ARMv7DOpcodeDataProcessingRegParallel), 145 152 OPCODE_GROUP_ENTRY(0xd, ARMv7DOpcodeDataProcessingRegMisc), 153 OPCODE_GROUP_ENTRY(0xe, ARMv7DOpcodeVLDR), 154 OPCODE_GROUP_ENTRY(0xf, ARMv7DOpcodeVCMP), 155 OPCODE_GROUP_ENTRY(0xf, ARMv7DOpcodeVCVTBetweenFPAndInt), 146 156 }; 147 157 … … 1426 1436 } 1427 1437 1438 void ARMv7DOpcodeDataPushPopMultiple::appendRegisterList() 1439 { 1440 unsigned registers = registerList(); 1441 1442 appendCharacter('{'); 1443 bool needSeparator = false; 1444 1445 for (unsigned i = 0; i < 16; i++) { 1446 if (registers & (1 << i)) { 1447 if (needSeparator) 1448 appendSeparator(); 1449 appendRegisterName(i); 1450 needSeparator = true; 1451 } 1452 } 1453 appendCharacter('}'); 1454 } 1455 1456 const char* ARMv7DOpcodeDataPopMultiple::format() 1457 { 1458 if (condition() != 0xe) 1459 bufferPrintf(" pop%-4.4s", conditionName(condition())); 1460 else 1461 appendInstructionName("pop"); 1462 appendRegisterList(); 1463 1464 return m_formatBuffer; 1465 } 1466 1467 const char* ARMv7DOpcodeDataPushMultiple::format() 1468 { 1469 if (condition() != 0xe) 1470 bufferPrintf(" push%-3.3s", conditionName(condition())); 1471 else 1472 appendInstructionName("push"); 1473 appendRegisterList(); 1474 1475 return m_formatBuffer; 1476 } 1477 1428 1478 const char* ARMv7DOpcodeStoreSingleImmediate12::format() 1429 1479 { … … 1490 1540 appendUnsignedImmediate(immediate2()); 1491 1541 } 1542 appendCharacter(']'); 1543 1544 return m_formatBuffer; 1545 } 1546 1547 const char* ARMv7DOpcodeVCMP::format() 1548 { 1549 bufferPrintf(" vcmp"); 1550 1551 if (eBit()) 1552 appendCharacter('e'); // Raise exception on qNaN 1553 1554 if (condition() != 0xe) 1555 appendString(conditionName(condition())); 1556 1557 appendCharacter('.'); 1558 appendString(szBit() ? "f64" : "f32"); 1559 appendCharacter(' '); 1560 if (szBit()) { 1561 appendFPRegisterName('d', (dBit() << 4) | vd()); 1562 appendSeparator(); 1563 appendFPRegisterName('d', (mBit() << 4) | vm()); 1564 } else { 1565 appendFPRegisterName('s', (vd() << 1) | dBit()); 1566 appendSeparator(); 1567 appendFPRegisterName('s', (vm() << 1) | mBit()); 1568 } 1569 1570 return m_formatBuffer; 1571 } 1572 1573 const char* ARMv7DOpcodeVCVTBetweenFPAndInt::format() 1574 { 1575 bufferPrintf(" vcvt"); 1576 bool convertToInteger = op2() & 0x4; 1577 1578 if (convertToInteger) { 1579 if (!op()) 1580 appendCharacter('r'); // Round using mode in FPSCR 1581 if (condition() != 0xe) 1582 appendString(conditionName(condition())); 1583 appendCharacter('.'); 1584 appendCharacter((op2() & 1) ? 's' : 'u'); 1585 appendString("32.f"); 1586 appendString(szBit() ? "64" : "32"); 1587 appendCharacter(' '); 1588 appendFPRegisterName('s', (vd() << 1) | dBit()); 1589 appendSeparator(); 1590 if (szBit()) 1591 appendFPRegisterName('d', (mBit() << 4) | vm()); 1592 else 1593 appendFPRegisterName('s', (vm() << 1) | mBit()); 1594 } else { 1595 if (condition() != 0xe) 1596 appendString(conditionName(condition())); 1597 appendCharacter('.'); 1598 appendString(szBit() ? "f64." : "f32."); 1599 appendString(op() ? "s32" : "u32"); 1600 appendCharacter(' '); 1601 if (szBit()) 1602 appendFPRegisterName('d', (dBit() << 4) | vd()); 1603 else 1604 appendFPRegisterName('s', (vd() << 1) | dBit()); 1605 appendSeparator(); 1606 appendFPRegisterName('s', (vm() << 1) | mBit()); 1607 } 1608 1609 return m_formatBuffer; 1610 } 1611 1612 const char* ARMv7DOpcodeVLDR::format() 1613 { 1614 if (condition() != 0xe) 1615 bufferPrintf(" vldr%-3.3s", conditionName(condition())); 1616 else 1617 appendInstructionName("vldr"); 1618 1619 appendFPRegisterName(doubleReg() ? 'd' : 's', vd()); 1620 appendSeparator(); 1621 1622 int immediate = immediate8() * 4; 1623 1624 if (!uBit()) 1625 immediate = -immediate; 1626 1627 appendCharacter('['); 1628 1629 if (rn() == RegPC) 1630 appendPCRelativeOffset(immediate); 1631 else { 1632 appendRegisterName(rn()); 1633 1634 if (immediate) { 1635 appendSeparator(); 1636 appendSignedImmediate(immediate); 1637 } 1638 } 1639 1492 1640 appendCharacter(']'); 1493 1641 -
trunk/Source/JavaScriptCore/disassembler/ARMv7/ARMv7DOpcode.h
r170839 r173312 1012 1012 }; 1013 1013 1014 class ARMv7DOpcodeDataPushPopMultiple : public ARMv7D32BitOpcode { 1015 protected: 1016 void appendRegisterList(); 1017 1018 unsigned registerList() { return m_opcode & 0xffff; } 1019 unsigned condition() { return m_opcode >> 28; } 1020 }; 1021 1022 class ARMv7DOpcodeDataPopMultiple : public ARMv7DOpcodeDataPushPopMultiple { 1023 public: 1024 static const uint32_t s_mask = 0x0fff0000; 1025 static const uint32_t s_pattern = 0x08bd0000; 1026 1027 DEFINE_STATIC_FORMAT32(ARMv7DOpcodeDataPopMultiple, thisObj); 1028 1029 protected: 1030 const char* format(); 1031 }; 1032 1033 class ARMv7DOpcodeDataPushMultiple : public ARMv7DOpcodeDataPushPopMultiple { 1034 public: 1035 static const uint32_t s_mask = 0xfe7f0000; 1036 static const uint32_t s_pattern = 0xe82d0000; 1037 1038 DEFINE_STATIC_FORMAT32(ARMv7DOpcodeDataPushMultiple, thisObj); 1039 1040 protected: 1041 const char* format(); 1042 }; 1043 1014 1044 class ARMv7DOpcodeDataStoreSingle : public ARMv7D32BitOpcode { 1015 1045 protected: … … 1087 1117 }; 1088 1118 1119 class ARMv7DOpcodeVCMP : public ARMv7D32BitOpcode { 1120 public: 1121 static const uint32_t s_mask = 0x0fbf0e50; 1122 static const uint32_t s_pattern = 0x0eb40a40; 1123 1124 DEFINE_STATIC_FORMAT32(ARMv7DOpcodeVCMP, thisObj); 1125 1126 protected: 1127 const char* format(); 1128 1129 unsigned condition() { return m_opcode >> 28; } 1130 unsigned dBit() { return (m_opcode >> 22) & 0x1; } 1131 unsigned vd() { return (m_opcode >> 12) & 0xf; } 1132 unsigned szBit() { return (m_opcode >> 8) & 0x1; } 1133 unsigned eBit() { return (m_opcode >> 7) & 0x1; } 1134 unsigned mBit() { return (m_opcode >> 5) & 0x1; } 1135 unsigned vm() { return m_opcode & 0xf; } 1136 }; 1137 1138 class ARMv7DOpcodeVCVTBetweenFPAndInt : public ARMv7D32BitOpcode { 1139 public: 1140 static const uint32_t s_mask = 0x0fb80e50; 1141 static const uint32_t s_pattern = 0x0eb80a40; 1142 1143 DEFINE_STATIC_FORMAT32(ARMv7DOpcodeVCVTBetweenFPAndInt, thisObj); 1144 1145 protected: 1146 const char* format(); 1147 1148 unsigned condition() { return m_opcode >> 28; } 1149 unsigned dBit() { return (m_opcode >> 22) & 0x1; } 1150 unsigned op2() { return (m_opcode >> 16) & 0x7; } 1151 unsigned vd() { return (m_opcode >> 12) & 0xf; } 1152 unsigned szBit() { return (m_opcode >> 8) & 0x1; } 1153 unsigned op() { return (m_opcode >> 7) & 0x1; } 1154 unsigned mBit() { return (m_opcode >> 5) & 0x1; } 1155 unsigned vm() { return m_opcode & 0xf; } 1156 }; 1157 1158 class ARMv7DOpcodeVLDR : public ARMv7D32BitOpcode { 1159 public: 1160 static const uint32_t s_mask = 0x0f300e00; 1161 static const uint32_t s_pattern = 0x0d100a00; 1162 1163 DEFINE_STATIC_FORMAT32(ARMv7DOpcodeVLDR, thisObj); 1164 1165 protected: 1166 const char* format(); 1167 1168 unsigned condition() { return m_opcode >> 28; } 1169 unsigned uBit() { return (m_opcode >> 23) & 0x1; } 1170 unsigned rn() { return (m_opcode >> 16) & 0xf; } 1171 unsigned vd() { return ((m_opcode >> 18) & 0x10) | ((m_opcode >> 12) & 0xf); } 1172 bool doubleReg() { return !!(m_opcode & 0x100); } 1173 unsigned immediate8() { return m_opcode & 0xff; } 1174 }; 1175 1089 1176 class ARMv7DOpcodeVMOVDoublePrecision : public ARMv7D32BitOpcode { 1090 1177 public:
Note:
See TracChangeset
for help on using the changeset viewer.