20#include "gdbsupport/common-defs.h"
21#include "gdbsupport/common-regcache.h"
39 if ((inst1 & 0xe000) == 0xe000 && (inst1 & 0x1800) != 0)
56 return ((status_reg &
FLAG_Z) != 0);
58 return ((status_reg &
FLAG_Z) == 0);
60 return ((status_reg &
FLAG_C) != 0);
62 return ((status_reg &
FLAG_C) == 0);
64 return ((status_reg &
FLAG_N) != 0);
66 return ((status_reg &
FLAG_N) == 0);
68 return ((status_reg &
FLAG_V) != 0);
70 return ((status_reg &
FLAG_V) == 0);
76 return (((status_reg &
FLAG_N) == 0) == ((status_reg &
FLAG_V) == 0));
78 return (((status_reg &
FLAG_N) == 0) != ((status_reg &
FLAG_V) == 0));
80 return (((status_reg &
FLAG_Z) == 0)
81 && (((status_reg &
FLAG_N) == 0)
82 == ((status_reg &
FLAG_V) == 0)));
84 return (((status_reg &
FLAG_Z) != 0)
85 || (((status_reg &
FLAG_N) == 0)
86 != ((status_reg &
FLAG_V) == 0)));
99 itstate = (itstate & 0xe0) | ((itstate << 1) & 0x1f);
102 if ((itstate & 0x0f) == 0)
115 switch (
bits (this_instr, 24, 27))
125 if (
bits (this_instr, 12, 15) == 15)
126 error (_(
"Invalid update to pc in instruction"));
132 switch (
bits (this_instr, 25, 27))
135 if (
bits (this_instr, 23, 24) == 2 &&
bit (this_instr, 20) == 0)
138 if (
bit (this_instr, 4) == 1 &&
bit (this_instr, 7) == 1)
146 if (
bits (this_instr, 4, 27) == 0x12fff1
147 ||
bits (this_instr, 4, 27) == 0x12fff2
148 ||
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)
197 internal_error (_(
"bad value in switch"));
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);
337 : regcache_raw_get_unsigned (
regcache, rs)) & 0xFF;
340 shift =
bits (inst, 7, 11);
343 ? (pc_val + (
bit (inst, 4) ? 12 : 8))
344 : regcache_raw_get_unsigned (
regcache, rm));
349 res = shift >= 32 ? 0 : res << shift;
353 res = shift >= 32 ? 0 : res >> shift;
359 res = ((res & 0x80000000L)
360 ? ~((~res) >> shift) : res >> shift);
366 res = (res >> 1) | (carry ? 0x80000000L : 0);
368 res = (res >> shift) | (res << (32 - shift));
372 return res & 0xffffffff;
382#ifndef IN_PROCESS_AGENT
411 error (_(
"Invalid Arm FP type: %d"), fp_type);
417 return tdesc.release ();
427#ifndef IN_PROCESS_AGENT
460 error (_(
"Invalid Arm M type: %d"), m_type);
#define bits(obj, st, fn)
static int create_feature_arm_arm_core(struct target_desc *result, long regnum)
static int create_feature_arm_arm_m_profile_mve(struct target_desc *result, long regnum)
static int create_feature_arm_arm_m_profile_with_fpa(struct target_desc *result, long regnum)
static int create_feature_arm_arm_m_profile(struct target_desc *result, long regnum)
static int create_feature_arm_arm_m_system(struct target_desc *result, long regnum)
static int create_feature_arm_arm_tls(struct target_desc *result, long regnum)
static int create_feature_arm_arm_vfpv2(struct target_desc *result, long regnum)
static int create_feature_arm_arm_vfpv3(struct target_desc *result, long regnum)
target_desc * arm_create_target_description(arm_fp_type fp_type, bool tls)
int thumb_advance_itstate(unsigned int itstate)
unsigned long shifted_reg_val(struct regcache *regcache, unsigned long inst, int carry, unsigned long pc_val, unsigned long status_reg)
target_desc * arm_create_mprofile_target_description(arm_m_profile_type m_type)
int arm_instruction_changes_pc(uint32_t this_instr)
int thumb2_instruction_changes_pc(unsigned short inst1, unsigned short inst2)
int condition_true(unsigned long cond, unsigned long status_reg)
int thumb_insn_size(unsigned short inst1)
int thumb_instruction_changes_pc(unsigned short inst)
void set_tdesc_architecture(struct target_desc *target_desc, const char *name)
target_desc_up allocate_target_description(void)
static int create_feature_arm_xscale_iwmmxt(struct target_desc *result, long regnum)