29 if ((inst1 & 0xe000) == 0xe000 && (inst1 & 0x1800) != 0)
41 for (nbits = 0; val != 0; nbits++)
57 return ((status_reg &
FLAG_Z) != 0);
59 return ((status_reg &
FLAG_Z) == 0);
61 return ((status_reg &
FLAG_C) != 0);
63 return ((status_reg &
FLAG_C) == 0);
65 return ((status_reg &
FLAG_N) != 0);
67 return ((status_reg &
FLAG_N) == 0);
69 return ((status_reg &
FLAG_V) != 0);
71 return ((status_reg &
FLAG_V) == 0);
77 return (((status_reg &
FLAG_N) == 0) == ((status_reg &
FLAG_V) == 0));
79 return (((status_reg &
FLAG_N) == 0) != ((status_reg &
FLAG_V) == 0));
81 return (((status_reg &
FLAG_Z) == 0)
82 && (((status_reg &
FLAG_N) == 0)
83 == ((status_reg &
FLAG_V) == 0)));
85 return (((status_reg &
FLAG_Z) != 0)
86 || (((status_reg &
FLAG_N) == 0)
87 != ((status_reg &
FLAG_V) == 0)));
100 itstate = (itstate & 0xe0) | ((itstate << 1) & 0x1f);
103 if ((itstate & 0x0f) == 0)
116 switch (
bits (this_instr, 24, 27))
126 if (
bits (this_instr, 12, 15) == 15)
127 error (
_(
"Invalid update to pc in instruction"));
133 switch (
bits (this_instr, 25, 27))
136 if (
bits (this_instr, 23, 24) == 2 &&
bit (this_instr, 20) == 0)
139 if (
bit (this_instr, 4) == 1 &&
bit (this_instr, 7) == 1)
147 if (
bits (this_instr, 4, 27) == 0x12fff1
148 ||
bits (this_instr, 4, 27) == 0x12fff2
149 ||
bits (this_instr, 4, 27) == 0x12fff3)
159 if (
bits (this_instr, 12, 15) == 15)
167 if (
bits (this_instr, 25, 27) == 3 &&
bit (this_instr, 4) == 1)
171 if (
bit (this_instr, 20) == 0)
182 if (
bit (this_instr, 20) == 1 &&
bit (this_instr, 15) == 1)
206 if ((inst & 0xff00) == 0xbd00)
209 if ((inst & 0xf000) == 0xd000)
212 if ((inst & 0xf800) == 0xe000)
215 if ((inst & 0xff00) == 0x4700)
218 if ((inst & 0xff87) == 0x4687)
221 if ((inst & 0xf500) == 0xb100)
233 if ((inst1 & 0xf800) == 0xf000 && (inst2 & 0x8000) == 0x8000)
237 if ((inst2 & 0x1000) != 0 || (inst2 & 0xd001) == 0xc000)
242 else if (inst1 == 0xf3de && (inst2 & 0xff00) == 0x3f00)
247 else if ((inst2 & 0xd000) == 0x8000 && (inst1 & 0x0380) != 0x0380)
256 if ((inst1 & 0xfe50) == 0xe810)
260 if (
bit (inst1, 7) && !
bit (inst1, 8))
266 else if (!
bit (inst1, 7) &&
bit (inst1, 8))
272 else if (
bit (inst1, 7) &&
bit (inst1, 8))
277 else if (!
bit (inst1, 7) && !
bit (inst1, 8))
286 if ((inst1 & 0xffef) == 0xea4f && (inst2 & 0xfff0) == 0x0f00)
292 if ((inst1 & 0xff70) == 0xf850 && (inst2 & 0xf000) == 0xf000)
295 if (
bits (inst1, 0, 3) == 15)
301 if ((inst2 & 0x0fc0) == 0x0000)
307 if ((inst1 & 0xfff0) == 0xe8d0 && (inst2 & 0xfff0) == 0xf000)
313 if ((inst1 & 0xfff0) == 0xe8d0 && (inst2 & 0xfff0) == 0xf010)
326 int carry,
unsigned long pc_val,
unsigned long status_reg)
328 unsigned long res, shift;
329 int rm =
bits (inst, 0, 3);
334 int rs =
bits (inst, 8, 11);
340 shift =
bits (inst, 7, 11);
343 ? (pc_val + (
bit (inst, 4) ? 12 : 8))
349 res = shift >= 32 ? 0 : res << shift;
353 res = shift >= 32 ? 0 : res >> shift;
359 res = ((res & 0x80000000
L)
360 ? ~((~res) >> shift) : res >> shift);
366 res = (res >> 1) | (carry ? 0x80000000L : 0);
368 res = (res >> shift) | (res << (32 - shift));
372 return res & 0xffffffff;
ULONGEST regcache_raw_get_unsigned(struct regcache *regcache, int regnum)
void internal_error(const char *file, int line, const char *fmt,...)
#define bits(obj, st, fn)
int thumb_instruction_changes_pc(unsigned short inst)
int thumb_advance_itstate(unsigned int itstate)
int thumb_insn_size(unsigned short inst1)
int arm_instruction_changes_pc(uint32_t this_instr)
int bitcount(unsigned long val)
int condition_true(unsigned long cond, unsigned long status_reg)
unsigned long shifted_reg_val(struct regcache *regcache, unsigned long inst, int carry, unsigned long pc_val, unsigned long status_reg)
int thumb2_instruction_changes_pc(unsigned short inst1, unsigned short inst2)
void error(const char *fmt,...)