OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
408 if (instr->HasLink()) { | 408 if (instr->HasLink()) { |
409 Print("l"); | 409 Print("l"); |
410 } | 410 } |
411 return 1; | 411 return 1; |
412 } | 412 } |
413 case 'm': { | 413 case 'm': { |
414 if (format[1] == 'e') { // 'memop: load/store instructions | 414 if (format[1] == 'e') { // 'memop: load/store instructions |
415 ASSERT(STRING_STARTS_WITH(format, "memop")); | 415 ASSERT(STRING_STARTS_WITH(format, "memop")); |
416 if (instr->HasL()) { | 416 if (instr->HasL()) { |
417 Print("ldr"); | 417 Print("ldr"); |
| 418 } else if ((instr->Bits(27, 25) == 0) && (instr->Bit(20) == 0)) { |
| 419 if (instr->Bits(7, 4) == 0xf) { |
| 420 Print("strd"); |
| 421 } else { |
| 422 Print("ldrd"); |
| 423 } |
418 } else { | 424 } else { |
419 Print("str"); | 425 Print("str"); |
420 } | 426 } |
421 return 5; | 427 return 5; |
422 } | 428 } |
423 // 'msg: for simulator break instructions | 429 // 'msg: for simulator break instructions |
424 ASSERT(STRING_STARTS_WITH(format, "msg")); | 430 ASSERT(STRING_STARTS_WITH(format, "msg")); |
425 byte* str = | 431 byte* str = |
426 reinterpret_cast<byte*>(instr->InstructionBits() & 0x0fffffff); | 432 reinterpret_cast<byte*>(instr->InstructionBits() & 0x0fffffff); |
427 out_buffer_pos_ += v8i::OS::SNPrintF(out_buffer_ + out_buffer_pos_, | 433 out_buffer_pos_ += v8i::OS::SNPrintF(out_buffer_ + out_buffer_pos_, |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
586 // when referring to the target registers. They are mapped to the Rn | 592 // when referring to the target registers. They are mapped to the Rn |
587 // and Rd fields as follows: | 593 // and Rd fields as follows: |
588 // RdLo == Rd field | 594 // RdLo == Rd field |
589 // RdHi == Rn field | 595 // RdHi == Rn field |
590 // The order of registers is: <RdLo>, <RdHi>, <Rm>, <Rs> | 596 // The order of registers is: <RdLo>, <RdHi>, <Rm>, <Rs> |
591 Format(instr, "'um'al'cond's 'rd, 'rn, 'rm, 'rs"); | 597 Format(instr, "'um'al'cond's 'rd, 'rn, 'rm, 'rs"); |
592 } | 598 } |
593 } else { | 599 } else { |
594 Unknown(instr); // not used by V8 | 600 Unknown(instr); // not used by V8 |
595 } | 601 } |
| 602 } else if ((instr->Bit(20) == 0) && ((instr->Bits(7, 4) & 0xd) == 0xd)) { |
| 603 // ldrd, strd |
| 604 switch (instr->PUField()) { |
| 605 case 0: { |
| 606 if (instr->Bit(22) == 0) { |
| 607 Format(instr, "'memop'cond's 'rd, ['rn], -'rm"); |
| 608 } else { |
| 609 Format(instr, "'memop'cond's 'rd, ['rn], #-'off8"); |
| 610 } |
| 611 break; |
| 612 } |
| 613 case 1: { |
| 614 if (instr->Bit(22) == 0) { |
| 615 Format(instr, "'memop'cond's 'rd, ['rn], +'rm"); |
| 616 } else { |
| 617 Format(instr, "'memop'cond's 'rd, ['rn], #+'off8"); |
| 618 } |
| 619 break; |
| 620 } |
| 621 case 2: { |
| 622 if (instr->Bit(22) == 0) { |
| 623 Format(instr, "'memop'cond's 'rd, ['rn, -'rm]'w"); |
| 624 } else { |
| 625 Format(instr, "'memop'cond's 'rd, ['rn, #-'off8]'w"); |
| 626 } |
| 627 break; |
| 628 } |
| 629 case 3: { |
| 630 if (instr->Bit(22) == 0) { |
| 631 Format(instr, "'memop'cond's 'rd, ['rn, +'rm]'w"); |
| 632 } else { |
| 633 Format(instr, "'memop'cond's 'rd, ['rn, #+'off8]'w"); |
| 634 } |
| 635 break; |
| 636 } |
| 637 default: { |
| 638 // The PU field is a 2-bit field. |
| 639 UNREACHABLE(); |
| 640 break; |
| 641 } |
| 642 } |
596 } else { | 643 } else { |
597 // extra load/store instructions | 644 // extra load/store instructions |
598 switch (instr->PUField()) { | 645 switch (instr->PUField()) { |
599 case 0: { | 646 case 0: { |
600 if (instr->Bit(22) == 0) { | 647 if (instr->Bit(22) == 0) { |
601 Format(instr, "'memop'cond'sign'h 'rd, ['rn], -'rm"); | 648 Format(instr, "'memop'cond'sign'h 'rd, ['rn], -'rm"); |
602 } else { | 649 } else { |
603 Format(instr, "'memop'cond'sign'h 'rd, ['rn], #-'off8"); | 650 Format(instr, "'memop'cond'sign'h 'rd, ['rn], #-'off8"); |
604 } | 651 } |
605 break; | 652 break; |
(...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1171 buffer[0] = '\0'; | 1218 buffer[0] = '\0'; |
1172 byte* prev_pc = pc; | 1219 byte* prev_pc = pc; |
1173 pc += d.InstructionDecode(buffer, pc); | 1220 pc += d.InstructionDecode(buffer, pc); |
1174 fprintf(f, "%p %08x %s\n", | 1221 fprintf(f, "%p %08x %s\n", |
1175 prev_pc, *reinterpret_cast<int32_t*>(prev_pc), buffer.start()); | 1222 prev_pc, *reinterpret_cast<int32_t*>(prev_pc), buffer.start()); |
1176 } | 1223 } |
1177 } | 1224 } |
1178 | 1225 |
1179 | 1226 |
1180 } // namespace disasm | 1227 } // namespace disasm |
OLD | NEW |