OLD | NEW |
1 // Copyright 2007-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2007-2009 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 488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
499 | 499 |
500 void Decoder::DecodeType01(Instr* instr) { | 500 void Decoder::DecodeType01(Instr* instr) { |
501 int type = instr->TypeField(); | 501 int type = instr->TypeField(); |
502 if ((type == 0) && instr->IsSpecialType0()) { | 502 if ((type == 0) && instr->IsSpecialType0()) { |
503 // multiply instruction or extra loads and stores | 503 // multiply instruction or extra loads and stores |
504 if (instr->Bits(7, 4) == 9) { | 504 if (instr->Bits(7, 4) == 9) { |
505 if (instr->Bit(24) == 0) { | 505 if (instr->Bit(24) == 0) { |
506 // multiply instructions | 506 // multiply instructions |
507 if (instr->Bit(23) == 0) { | 507 if (instr->Bit(23) == 0) { |
508 if (instr->Bit(21) == 0) { | 508 if (instr->Bit(21) == 0) { |
509 // Mul calls it Rd. Everyone else calls it Rn. | 509 // The MUL instruction description (A 4.1.33) refers to Rd as being |
| 510 // the destination for the operation, but it confusingly uses the |
| 511 // Rn field to encode it. |
510 Format(instr, "mul'cond's 'rn, 'rm, 'rs"); | 512 Format(instr, "mul'cond's 'rn, 'rm, 'rs"); |
511 } else { | 513 } else { |
512 // In the manual the order is rd, rm, rs, rn. But mla swaps the | 514 // The MLA instruction description (A 4.1.28) refers to the order |
513 // positions of rn and rd in the encoding. | 515 // of registers as "Rd, Rm, Rs, Rn". But confusingly it uses the |
| 516 // Rn field to encode the Rd register and the Rd field to encode |
| 517 // the Rn register. |
514 Format(instr, "mla'cond's 'rn, 'rm, 'rs, 'rd"); | 518 Format(instr, "mla'cond's 'rn, 'rm, 'rs, 'rd"); |
515 } | 519 } |
516 } else { | 520 } else { |
517 // In the manual the order is RdHi, RdLo, Rm, Rs. | 521 // The signed/long multiply instructions use the terms RdHi and RdLo |
518 // RdHi is what other instructions call Rn and RdLo is Rd. | 522 // when referring to the target registers. They are mapped to the Rn |
519 Format(instr, "'um'al'cond's 'rn, 'rd, 'rm, 'rs"); | 523 // and Rd fields as follows: |
| 524 // RdLo == Rd field |
| 525 // RdHi == Rn field |
| 526 // The order of registers is: <RdLo>, <RdHi>, <Rm>, <Rs> |
| 527 Format(instr, "'um'al'cond's 'rd, 'rn, 'rm, 'rs"); |
520 } | 528 } |
521 } else { | 529 } else { |
522 Unknown(instr); // not used by V8 | 530 Unknown(instr); // not used by V8 |
523 } | 531 } |
524 } else { | 532 } else { |
525 // extra load/store instructions | 533 // extra load/store instructions |
526 switch (instr->PUField()) { | 534 switch (instr->PUField()) { |
527 case 0: { | 535 case 0: { |
528 if (instr->Bit(22) == 0) { | 536 if (instr->Bit(22) == 0) { |
529 Format(instr, "'memop'cond'sign'h 'rd, ['rn], -'rm"); | 537 Format(instr, "'memop'cond'sign'h 'rd, ['rn], -'rm"); |
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
914 buffer[0] = '\0'; | 922 buffer[0] = '\0'; |
915 byte* prev_pc = pc; | 923 byte* prev_pc = pc; |
916 pc += d.InstructionDecode(buffer, pc); | 924 pc += d.InstructionDecode(buffer, pc); |
917 fprintf(f, "%p %08x %s\n", | 925 fprintf(f, "%p %08x %s\n", |
918 prev_pc, *reinterpret_cast<int32_t*>(prev_pc), buffer.start()); | 926 prev_pc, *reinterpret_cast<int32_t*>(prev_pc), buffer.start()); |
919 } | 927 } |
920 } | 928 } |
921 | 929 |
922 | 930 |
923 } // namespace disasm | 931 } // namespace disasm |
OLD | NEW |