GNU Binutils with patches for OS216
修订版 | 14e140b572b1ed8e69a9e6f40965325b4231fa58 (tree) |
---|---|
时间 | 2004-03-10 00:46:06 |
作者 | Daniel Jacobowitz <drow@fals...> |
Commiter | Daniel Jacobowitz |
* arm-tdep.c (thumb_get_next_pc): Handle BX.
(arm_get_next_pc): Handle BX and BLX.
@@ -1,3 +1,8 @@ | ||
1 | +2004-03-07 Daniel Jacobowitz <drow@mvista.com> | |
2 | + | |
3 | + * arm-tdep.c (thumb_get_next_pc): Handle BX. | |
4 | + (arm_get_next_pc): Handle BX and BLX. | |
5 | + | |
1 | 6 | 2004-03-05 David Carlton <carlton@kealia.com> |
2 | 7 | |
3 | 8 | * cp-namespace.c (cp_lookup_transparent_type_loop): Fix recursion |
@@ -1657,6 +1657,17 @@ thumb_get_next_pc (CORE_ADDR pc) | ||
1657 | 1657 | offset = (sbits (inst1, 0, 10) << 12) + (bits (inst2, 0, 10) << 1); |
1658 | 1658 | nextpc = pc_val + offset; |
1659 | 1659 | } |
1660 | + else if ((inst1 & 0xff80) == 0x4700) /* branch and exchange (bx) */ | |
1661 | + { | |
1662 | + if (bits (inst1, 3, 6) == 0x0f) | |
1663 | + nextpc = pc_val; | |
1664 | + else | |
1665 | + nextpc = read_register (bits (inst1, 3, 6)); | |
1666 | + | |
1667 | + nextpc = ADDR_BITS_REMOVE (nextpc); | |
1668 | + if (nextpc == pc) | |
1669 | + error ("Infinite loop detected"); | |
1670 | + } | |
1660 | 1671 | |
1661 | 1672 | return nextpc; |
1662 | 1673 | } |
@@ -1697,6 +1708,20 @@ arm_get_next_pc (CORE_ADDR pc) | ||
1697 | 1708 | && bits (this_instr, 4, 7) == 9) /* multiply */ |
1698 | 1709 | error ("Illegal update to pc in instruction"); |
1699 | 1710 | |
1711 | + /* BX <reg>, BLX <reg> */ | |
1712 | + if (bits (this_instr, 4, 28) == 0x12fff1 | |
1713 | + || bits (this_instr, 4, 28) == 0x12fff3) | |
1714 | + { | |
1715 | + rn = bits (this_instr, 0, 3); | |
1716 | + result = (rn == 15) ? pc_val + 8 : read_register (rn); | |
1717 | + nextpc = (CORE_ADDR) ADDR_BITS_REMOVE (result); | |
1718 | + | |
1719 | + if (nextpc == pc) | |
1720 | + error ("Infinite loop detected"); | |
1721 | + | |
1722 | + return nextpc; | |
1723 | + } | |
1724 | + | |
1700 | 1725 | /* Multiply into PC */ |
1701 | 1726 | c = (status & FLAG_C) ? 1 : 0; |
1702 | 1727 | rn = bits (this_instr, 16, 19); |
@@ -1862,6 +1887,10 @@ arm_get_next_pc (CORE_ADDR pc) | ||
1862 | 1887 | { |
1863 | 1888 | nextpc = BranchDest (pc, this_instr); |
1864 | 1889 | |
1890 | + /* BLX */ | |
1891 | + if (bits (this_instr, 28, 31) == INST_NV) | |
1892 | + nextpc |= bit (this_instr, 24) << 1; | |
1893 | + | |
1865 | 1894 | nextpc = ADDR_BITS_REMOVE (nextpc); |
1866 | 1895 | if (nextpc == pc) |
1867 | 1896 | error ("Infinite loop detected"); |