53 CORE_ADDR breaks[2] = {CORE_ADDR_MAX, CORE_ADDR_MAX};
56 unsigned short insn1, insn2;
59 int last_breakpoint = 0;
60 const int atomic_sequence_length = 16;
65 itstate = ((
status >> 8) & 0xfc) | ((
status >> 25) & 0x3);
79 if (!((insn1 & 0xfff0) == 0xe850
80 || ((insn1 & 0xfff0) == 0xe8d0 && (insn2 & 0x00c0) == 0x0040)))
85 for (insn_count = 0; insn_count < atomic_sequence_length; ++insn_count)
95 if ((insn1 & 0xf000) == 0xd000 &&
bits (insn1, 8, 11) != 0x0f)
97 if (last_breakpoint > 0)
101 breaks[1] =
loc + 2 + (
sbits (insn1, 0, 7) << 1);
121 if ((insn1 & 0xf800) == 0xf000
122 && (insn2 & 0xd000) == 0x8000
123 && (insn1 & 0x0380) != 0x0380)
125 int sign, j1, j2, imm1, imm2;
128 sign =
sbits (insn1, 10, 10);
129 imm1 =
bits (insn1, 0, 5);
130 imm2 =
bits (insn2, 0, 10);
131 j1 =
bit (insn2, 13);
132 j2 =
bit (insn2, 11);
134 offset = (sign << 20) + (j2 << 19) + (j1 << 18);
135 offset += (imm1 << 12) + (imm2 << 1);
137 if (last_breakpoint > 0)
141 breaks[1] =
loc + offset;
153 if ((insn1 & 0xfff0) == 0xe840
154 || ((insn1 & 0xfff0) == 0xe8c0 && (insn2 & 0x00c0) == 0x0040))
160 if (insn_count == atomic_sequence_length)
169 && (breaks[1] == breaks[0]
170 || (breaks[1] >= pc && breaks[1] <
loc)))
173 std::vector<CORE_ADDR> next_pcs;
176 for (index = 0; index <= last_breakpoint; index++)
191 CORE_ADDR breaks[2] = {CORE_ADDR_MAX, CORE_ADDR_MAX};
197 int last_breakpoint = 0;
198 const int atomic_sequence_length = 16;
206 if ((insn & 0xff9000f0) != 0xe1900090)
211 for (insn_count = 0; insn_count < atomic_sequence_length; ++insn_count)
220 if (
bits (insn, 24, 27) == 0xa)
222 if (last_breakpoint > 0)
237 if ((insn & 0xff9000f0) == 0xe1800090)
242 if (insn_count == atomic_sequence_length)
251 && (breaks[1] == breaks[0]
252 || (breaks[1] >= pc && breaks[1] <
loc)))
255 std::vector<CORE_ADDR> next_pcs;
258 for (index = 0; index <= last_breakpoint; index++)
259 next_pcs.push_back (breaks[index]);
272 unsigned long pc_val = ((
unsigned long) pc) + 4;
273 unsigned short inst1;
274 CORE_ADDR nextpc = pc + 2;
277 std::vector<CORE_ADDR> next_pcs;
293 itstate = ((
status >> 8) & 0xfc) | ((
status >> 25) & 0x3);
305 if ((inst1 & 0xff00) == 0xbf00 && (inst1 & 0x000f) != 0)
310 itstate = inst1 & 0x00ff;
323 else if (itstate != 0)
343 else if ((itstate & 0x0f) == 0x08)
365 gdb_assert ((itstate & 0x0f) != 0);
368 cond_negated = (itstate >> 4) & 1;
381 while (itstate != 0 && ((itstate >> 4) & 1) == cond_negated);
389 else if (itstate & 0x0f)
392 int cond = itstate >> 4;
406 if ((inst1 & 0xff00) == 0xbd00)
417 else if ((inst1 & 0xf000) == 0xd000)
419 unsigned long cond =
bits (inst1, 8, 11);
425 nextpc = pc_val + (
sbits (inst1, 0, 7) << 1);
427 else if ((inst1 & 0xf800) == 0xe000)
429 nextpc = pc_val + (
sbits (inst1, 0, 10) << 1);
433 unsigned short inst2;
440 if ((inst1 & 0xf800) == 0xf000 && (inst2 & 0x8000) == 0x8000)
444 if ((inst2 & 0x1000) != 0 || (inst2 & 0xd001) == 0xc000)
447 int j1, j2, imm1, imm2;
449 imm1 =
sbits (inst1, 0, 10);
450 imm2 =
bits (inst2, 0, 10);
451 j1 =
bit (inst2, 13);
452 j2 =
bit (inst2, 11);
454 unsigned long offset = ((imm1 << 12) + (imm2 << 1));
455 offset ^= ((!j2) << 22) | ((!j1) << 23);
457 nextpc = pc_val + offset;
459 if (
bit (inst2, 12) == 0)
460 nextpc = nextpc & 0xfffffffc;
462 else if (inst1 == 0xf3de && (inst2 & 0xff00) == 0x3f00)
466 nextpc -= inst2 & 0x00ff;
468 else if ((inst2 & 0xd000) == 0x8000 && (inst1 & 0x0380) != 0x0380)
473 int sign, j1, j2, imm1, imm2;
475 sign =
sbits (inst1, 10, 10);
476 imm1 =
bits (inst1, 0, 5);
477 imm2 =
bits (inst2, 0, 10);
478 j1 =
bit (inst2, 13);
479 j2 =
bit (inst2, 11);
482 = (sign << 20) + (j2 << 19) + (j1 << 18);
483 offset += (imm1 << 12) + (imm2 << 1);
485 nextpc = pc_val + offset;
489 else if ((inst1 & 0xfe50) == 0xe810)
492 int rn, offset, load_pc = 1;
494 rn =
bits (inst1, 0, 3);
495 if (
bit (inst1, 7) && !
bit (inst1, 8))
498 if (!
bit (inst2, 15))
500 offset = count_one_bits (inst2) * 4 - 4;
502 else if (!
bit (inst1, 7) &&
bit (inst1, 8))
505 if (!
bit (inst2, 15))
509 else if (
bit (inst1, 7) &&
bit (inst1, 8))
514 else if (!
bit (inst1, 7) && !
bit (inst1, 8))
524 CORE_ADDR addr = regcache_raw_get_unsigned (
regcache, rn);
528 else if ((inst1 & 0xffef) == 0xea4f && (inst2 & 0xfff0) == 0x0f00)
531 nextpc = regcache_raw_get_unsigned (
regcache,
bits (inst2, 0, 3));
534 else if ((inst1 & 0xff70) == 0xf850 && (inst2 & 0xf000) == 0xf000)
540 rn =
bits (inst1, 0, 3);
541 base = regcache_raw_get_unsigned (
regcache, rn);
544 base = (base + 4) & ~(CORE_ADDR) 0x3;
546 base +=
bits (inst2, 0, 11);
548 base -=
bits (inst2, 0, 11);
550 else if (
bit (inst1, 7))
551 base +=
bits (inst2, 0, 11);
552 else if (
bit (inst2, 11))
557 base +=
bits (inst2, 0, 7);
559 base -=
bits (inst2, 0, 7);
562 else if ((inst2 & 0x0fc0) == 0x0000)
564 int shift =
bits (inst2, 4, 5), rm =
bits (inst2, 0, 3);
565 base += regcache_raw_get_unsigned (
regcache, rm) << shift;
575 else if ((inst1 & 0xfff0) == 0xe8d0 && (inst2 & 0xfff0) == 0xf000)
578 CORE_ADDR tbl_reg, table, offset, length;
580 tbl_reg =
bits (inst1, 0, 3);
584 table = regcache_raw_get_unsigned (
regcache, tbl_reg);
586 offset = regcache_raw_get_unsigned (
regcache,
bits (inst2, 0, 3));
588 nextpc = pc_val + length;
590 else if ((inst1 & 0xfff0) == 0xe8d0 && (inst2 & 0xfff0) == 0xf010)
593 CORE_ADDR tbl_reg, table, offset, length;
595 tbl_reg =
bits (inst1, 0, 3);
599 table = regcache_raw_get_unsigned (
regcache, tbl_reg);
601 offset = 2 * regcache_raw_get_unsigned (
regcache,
bits (inst2, 0, 3));
603 nextpc = pc_val + length;
606 else if ((inst1 & 0xff00) == 0x4700)
608 if (
bits (inst1, 3, 6) == 0x0f)
611 nextpc = regcache_raw_get_unsigned (
regcache,
bits (inst1, 3, 6));
613 else if ((inst1 & 0xff87) == 0x4687)
615 if (
bits (inst1, 3, 6) == 0x0f)
618 nextpc = regcache_raw_get_unsigned (
regcache,
bits (inst1, 3, 6));
622 else if ((inst1 & 0xf500) == 0xb100)
625 int imm = (
bit (inst1, 9) << 6) + (
bits (inst1, 3, 7) << 1);
626 ULONGEST reg = regcache_raw_get_unsigned (
regcache,
bits (inst1, 0, 2));
628 if (
bit (inst1, 11) && reg != 0)
629 nextpc = pc_val + imm;
630 else if (!
bit (inst1, 11) && reg == 0)
631 nextpc = pc_val + imm;
634 next_pcs.push_back (nextpc);
652 unsigned long pc_val;
653 unsigned long this_instr = 0;
658 std::vector<CORE_ADDR> next_pcs;
660 pc_val = (
unsigned long) pc;
664 nextpc = (CORE_ADDR) (pc_val + 4);
667 switch (
bits (this_instr, 24, 27))
674 nextpc |=
bit (this_instr, 24) << 1;
682 if (
bits (this_instr, 12, 15) == 15)
683 error (_(
"Invalid update to pc in instruction"));
688 switch (
bits (this_instr, 24, 27))
695 unsigned long operand1, operand2, result = 0;
699 if (
bits (this_instr, 12, 15) != 15)
702 if (
bits (this_instr, 22, 25) == 0
703 &&
bits (this_instr, 4, 7) == 9)
704 error (_(
"Invalid update to pc in instruction"));
707 if (
bits (this_instr, 4, 27) == 0x12fff1
708 ||
bits (this_instr, 4, 27) == 0x12fff3)
710 rn =
bits (this_instr, 0, 3);
713 : regcache_raw_get_unsigned (
regcache, rn));
715 next_pcs.push_back (nextpc);
721 rn =
bits (this_instr, 16, 19);
724 : regcache_raw_get_unsigned (
regcache, rn));
726 if (
bit (this_instr, 25))
728 unsigned long immval =
bits (this_instr, 0, 7);
729 unsigned long rotate = 2 *
bits (this_instr, 8, 11);
730 operand2 = ((immval >> rotate) | (immval << (32 - rotate)))
737 switch (
bits (this_instr, 21, 24))
740 result = operand1 & operand2;
744 result = operand1 ^ operand2;
748 result = operand1 - operand2;
752 result = operand2 - operand1;
756 result = operand1 + operand2;
760 result = operand1 + operand2 + c;
764 result = operand1 - operand2 + c;
768 result = operand2 - operand1 + c;
775 result = (
unsigned long) nextpc;
779 result = operand1 | operand2;
788 result = operand1 & ~operand2;
803 if (
bits (this_instr, 25, 27) == 0x3 &&
bit (this_instr, 4) == 1)
810 if (
bit (this_instr, 20))
813 if (
bits (this_instr, 12, 15) == 15)
819 if (
bit (this_instr, 22))
820 error (_(
"Invalid update to pc in instruction"));
823 rn =
bits (this_instr, 16, 19);
826 : regcache_raw_get_unsigned (
regcache, rn));
828 if (
bit (this_instr, 24))
832 unsigned long offset =
833 (
bit (this_instr, 25)
836 :
bits (this_instr, 0, 11));
838 if (
bit (this_instr, 23))
852 if (
bit (this_instr, 20))
855 if (
bit (this_instr, 15))
859 CORE_ADDR rn_val_offset = 0;
861 = regcache_raw_get_unsigned (
regcache,
862 bits (this_instr, 16, 19));
864 if (
bit (this_instr, 23))
867 unsigned long reglist =
bits (this_instr, 0, 14);
868 offset = count_one_bits_l (reglist) * 4;
869 if (
bit (this_instr, 24))
872 else if (
bit (this_instr, 24))
875 rn_val_offset = rn_val + offset;
900 error (_(
"Bad bit-field extraction"));
905 next_pcs.push_back (nextpc);