OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <assert.h> | 5 #include <assert.h> |
6 #include <stdarg.h> | 6 #include <stdarg.h> |
7 #include <stdio.h> | 7 #include <stdio.h> |
8 | 8 |
9 #if V8_TARGET_ARCH_X87 | 9 #if V8_TARGET_ARCH_X87 |
10 | 10 |
(...skipping 1271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1282 data += PrintRightOperand(data); | 1282 data += PrintRightOperand(data); |
1283 AppendToBuffer(",%s", NameOfCPURegister(regop)); | 1283 AppendToBuffer(",%s", NameOfCPURegister(regop)); |
1284 } | 1284 } |
1285 } | 1285 } |
1286 break; | 1286 break; |
1287 | 1287 |
1288 case 0x66: // prefix | 1288 case 0x66: // prefix |
1289 while (*data == 0x66) data++; | 1289 while (*data == 0x66) data++; |
1290 if (*data == 0xf && data[1] == 0x1f) { | 1290 if (*data == 0xf && data[1] == 0x1f) { |
1291 AppendToBuffer("nop"); // 0x66 prefix | 1291 AppendToBuffer("nop"); // 0x66 prefix |
1292 } else if (*data == 0x90) { | 1292 } else if (*data == 0x39) { |
1293 AppendToBuffer("nop"); // 0x66 prefix | |
1294 } else if (*data == 0x8B) { | |
1295 data++; | 1293 data++; |
1296 data += PrintOperands("mov_w", REG_OPER_OP_ORDER, data); | 1294 data += PrintOperands("cmpw", OPER_REG_OP_ORDER, data); |
| 1295 } else if (*data == 0x3B) { |
| 1296 data++; |
| 1297 data += PrintOperands("cmpw", REG_OPER_OP_ORDER, data); |
| 1298 } else if (*data == 0x81) { |
| 1299 data++; |
| 1300 AppendToBuffer("cmpw "); |
| 1301 data += PrintRightOperand(data); |
| 1302 int imm = *reinterpret_cast<int16_t*>(data); |
| 1303 AppendToBuffer(",0x%x", imm); |
| 1304 data += 2; |
1297 } else if (*data == 0x87) { | 1305 } else if (*data == 0x87) { |
1298 data++; | 1306 data++; |
1299 int mod, regop, rm; | 1307 int mod, regop, rm; |
1300 get_modrm(*data, &mod, ®op, &rm); | 1308 get_modrm(*data, &mod, ®op, &rm); |
1301 AppendToBuffer("xchg_w %s,", NameOfCPURegister(regop)); | 1309 AppendToBuffer("xchg_w %s,", NameOfCPURegister(regop)); |
1302 data += PrintRightOperand(data); | 1310 data += PrintRightOperand(data); |
1303 } else if (*data == 0x89) { | 1311 } else if (*data == 0x89) { |
1304 data++; | 1312 data++; |
1305 int mod, regop, rm; | 1313 int mod, regop, rm; |
1306 get_modrm(*data, &mod, ®op, &rm); | 1314 get_modrm(*data, &mod, ®op, &rm); |
1307 AppendToBuffer("mov_w "); | 1315 AppendToBuffer("mov_w "); |
1308 data += PrintRightOperand(data); | 1316 data += PrintRightOperand(data); |
1309 AppendToBuffer(",%s", NameOfCPURegister(regop)); | 1317 AppendToBuffer(",%s", NameOfCPURegister(regop)); |
| 1318 } else if (*data == 0x8B) { |
| 1319 data++; |
| 1320 data += PrintOperands("mov_w", REG_OPER_OP_ORDER, data); |
| 1321 } else if (*data == 0x90) { |
| 1322 AppendToBuffer("nop"); // 0x66 prefix |
1310 } else if (*data == 0xC7) { | 1323 } else if (*data == 0xC7) { |
1311 data++; | 1324 data++; |
1312 AppendToBuffer("%s ", "mov_w"); | 1325 AppendToBuffer("%s ", "mov_w"); |
1313 data += PrintRightOperand(data); | 1326 data += PrintRightOperand(data); |
1314 int imm = *reinterpret_cast<int16_t*>(data); | 1327 int imm = *reinterpret_cast<int16_t*>(data); |
1315 AppendToBuffer(",0x%x", imm); | 1328 AppendToBuffer(",0x%x", imm); |
1316 data += 2; | 1329 data += 2; |
1317 } else if (*data == 0xF7) { | 1330 } else if (*data == 0xF7) { |
1318 data++; | 1331 data++; |
1319 AppendToBuffer("%s ", "test_w"); | 1332 AppendToBuffer("%s ", "test_w"); |
(...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1853 fprintf(f, " "); | 1866 fprintf(f, " "); |
1854 } | 1867 } |
1855 fprintf(f, " %s\n", buffer.start()); | 1868 fprintf(f, " %s\n", buffer.start()); |
1856 } | 1869 } |
1857 } | 1870 } |
1858 | 1871 |
1859 | 1872 |
1860 } // namespace disasm | 1873 } // namespace disasm |
1861 | 1874 |
1862 #endif // V8_TARGET_ARCH_X87 | 1875 #endif // V8_TARGET_ARCH_X87 |
OLD | NEW |