51 #include "xtensa-isa.h" 53 #include "xtensa-config.h" 59 #define DEBUGWARN(args...) \ 60 if (xtensa_debug_level > 0) \ 61 fprintf_unfiltered (gdb_stdlog, "(warn ) " args) 63 #define DEBUGINFO(args...) \ 64 if (xtensa_debug_level > 1) \ 65 fprintf_unfiltered (gdb_stdlog, "(info ) " args) 67 #define DEBUGTRACE(args...) \ 68 if (xtensa_debug_level > 2) \ 69 fprintf_unfiltered (gdb_stdlog, "(trace) " args) 71 #define DEBUGVERB(args...) \ 72 if (xtensa_debug_level > 3) \ 73 fprintf_unfiltered (gdb_stdlog, "(verb ) " args) 77 #define SP_ALIGNMENT 16 82 #define ARGS_NUM_REGS 6 83 #define REGISTER_SIZE 4 87 #define PS_CALLINC_SHIFT 16 88 #define PS_CALLINC_MASK 0x00030000 89 #define CALLINC(ps) (((ps) & PS_CALLINC_MASK) >> PS_CALLINC_SHIFT) 90 #define WINSIZE(ra) (4 * (( (ra) >> 30) & 0x3)) 98 #define ARG_NOF(gdbarch) \ 99 (gdbarch_tdep (gdbarch)->call_abi \ 100 == CallAbiCall0Only ? C0_NARGS : (ARGS_NUM_REGS)) 101 #define ARG_1ST(gdbarch) \ 102 (gdbarch_tdep (gdbarch)->call_abi == CallAbiCall0Only \ 103 ? (gdbarch_tdep (gdbarch)->a0_base + C0_ARGS) \ 104 : (gdbarch_tdep (gdbarch)->a0_base + 6)) 109 #define XTENSA_IS_ENTRY(gdbarch, op1) \ 110 ((gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG) \ 111 ? ((op1) == 0x6c) : ((op1) == 0x36)) 113 #define XTENSA_ENTRY_LENGTH 3 119 #define PS_WOE (1<<18) 120 #define PS_EXC (1<<4) 123 #define XTENSA_MAX_REGISTER_SIZE 64 143 arreg = a_regnum - tdep->
a0_base;
158 areg = ar_regnum - tdep->
ar_base;
161 areg = (areg - wb * 4) & (tdep->
num_aregs - 1);
162 return (areg > 15) ? -1 : areg;
172 return (
unsigned long)
value;
201 DEBUGTRACE (
"extract_call_winsize (pc = 0x%08x)\n", (
int)
pc);
215 if (byte_order == BFD_ENDIAN_LITTLE)
217 if (((insn & 0xf) == 0x5) || ((insn & 0xcf) == 0xc0))
218 winsize = (insn & 0x30) >> 2;
222 if (((insn >> 20) == 0x5) || (((insn >> 16) & 0xf3) == 0x03))
223 winsize = (insn >> 16) & 0xc;
271 && regnum < tdep->
a0_base + 16))
381 unsigned int *ptr =
value;
382 unsigned int regval,
m, mem = 0;
384 int bytesize =
reg->byte_size;
385 int bitsize = bytesize * 8;
388 DEBUGTRACE (
"xtensa_register_write_masked ()\n");
392 for (i = 0; i < bytesize; i++)
395 mem |= (
buffer[bytesize - i - 1] << 24);
400 for (i = 0; i < bytesize; i++)
412 *ptr = mem >> (((0 - bytesize) & 3) * 8);
417 for (i = 0; i < mask->count; i++)
419 start = mask->mask[i].bit_start;
420 size = mask->mask[i].bit_size;
421 regval = mem >> shift;
423 if ((shift +=
size) > bitsize)
424 error (
_(
"size of all masks is larger than the register"));
433 regval |= mem << (
size - shift);
437 r = mask->mask[i].reg_num;
438 if (r >= 0 &&
size > 0)
443 m = 0xffffffff >> (32 -
size) << start;
445 regval = (regval &
m) | (old_val & ~
m);
465 unsigned int *ptr =
value;
466 unsigned int regval, mem = 0;
468 int bytesize =
reg->byte_size;
469 int bitsize = bytesize * 8;
472 DEBUGTRACE (
"xtensa_register_read_masked (reg \"%s\", ...)\n",
476 for (i = 0; i < mask->count; i++)
478 int r = mask->mask[i].reg_num;
487 regval = (
unsigned int) val;
492 start = mask->mask[i].bit_start;
493 size = mask->mask[i].bit_size;
498 regval &= (0xffffffff >> (32 -
size));
500 mem |= regval << shift;
502 if ((shift +=
size) > bitsize)
503 error (
_(
"size of all masks is larger than the register"));
514 mem = regval >> (
size - shift);
526 for (i = 0; i < bytesize; i++)
530 buffer[bytesize - i - 1] = mem & 0xff;
534 for (i = 0; i < bytesize; i++)
554 DEBUGTRACE (
"xtensa_pseudo_register_read (... regnum = %d (%s) ...)\n",
603 warning (
_(
"cannot read register %s"),
615 warning (
_(
"cannot read register"));
622 warning (
_(
"cannot read register"));
636 _(
"invalid register number %d"),
regnum);
648 DEBUGTRACE (
"xtensa_pseudo_register_write (... regnum = %d (%s) ...)\n",
689 warning (
_(
"cannot write register %s"),
701 warning (
_(
"cannot write register"));
709 warning (
_(
"cannot write register"));
726 _(
"invalid register number %d"),
regnum);
782 #define SAVE_REST_FLAGS (XTENSA_REGISTER_FLAGS_READABLE \ 783 | XTENSA_REGISTER_FLAGS_WRITABLE \ 784 | XTENSA_REGISTER_FLAGS_VOLATILE) 786 #define SAVE_REST_VALID (XTENSA_REGISTER_FLAGS_READABLE \ 787 | XTENSA_REGISTER_FLAGS_WRITABLE) 863 (
char *) ®s->
lbeg);
866 (
char *) ®s->
lend);
872 (
char *) ®s->
sar);
883 (
char *) ®s->
ar[i]);
906 DEBUGTRACE (
"xtensa_iterate_over_regset_sections\n");
916 #define XTENSA_NUM_SAVED_AREGS 12 1007 DEBUGTRACE (
"xtensa_alloc_frame_cache ()\n");
1016 cache->
call0 = !windowed;
1050 return address & ~15;
1060 DEBUGTRACE (
"xtensa_unwind_pc (next_frame = %s)\n",
1066 DEBUGINFO (
"[xtensa_unwind_pc] pc = 0x%08x\n", (
unsigned int)
pc);
1097 if (byte_order == BFD_ENDIAN_BIG)
1100 code = insn & 0xf000ff00;
1101 if ((
code == 0x00009000) || (
code == 0x00009400))
1104 code = insn & 0xffffff00;
1105 return ((
code == 0x00430000) || (
code == 0x00530000));
1110 code = insn & 0x00ff000f;
1111 if ((
code == 0x090000) || (
code == 0x490000))
1114 code = insn & 0x00ffffff;
1115 return ((
code == 0x00003400) || (
code == 0x00003500));
1122 #define XTENSA_ISA_BSZ 32 1123 #define XTENSA_ISA_BADPC ((CORE_ADDR)0) 1128 #define RETURN_FP goto done 1133 xtensa_insnbuf ins, slot;
1137 int ilen, islots, is;
1139 const char *opcname;
1142 if (start_addr == 0)
1147 ins = xtensa_insnbuf_alloc (isa);
1148 slot = xtensa_insnbuf_alloc (isa);
1151 for (ia = start_addr, bt = ia; ia < current_pc ; ia += ilen)
1153 if (ia + xtensa_isa_maxlength (isa) > bt)
1162 xtensa_insnbuf_from_chars (isa, ins, &ibuf[ia-ba], 0);
1163 ifmt = xtensa_format_decode (isa, ins);
1164 if (ifmt == XTENSA_UNDEFINED)
1166 ilen = xtensa_format_length (isa, ifmt);
1167 if (ilen == XTENSA_UNDEFINED)
1169 islots = xtensa_format_num_slots (isa, ifmt);
1170 if (islots == XTENSA_UNDEFINED)
1173 for (is = 0; is < islots; ++is)
1175 if (xtensa_format_get_slot (isa, ifmt, is, ins, slot))
1178 opc = xtensa_opcode_decode (isa, ifmt, is, slot);
1179 if (opc == XTENSA_UNDEFINED)
1182 opcname = xtensa_opcode_name (isa, opc);
1184 if (strcasecmp (opcname,
"mov.n") == 0
1185 || strcasecmp (opcname,
"or") == 0)
1187 unsigned int register_operand;
1192 if (xtensa_operand_get_field (isa, opc, 1, ifmt,
1193 is, slot, ®ister_operand) != 0)
1195 if (xtensa_operand_decode (isa, opc, 1, ®ister_operand) != 0)
1197 if (register_operand == 1)
1199 if (xtensa_operand_get_field (isa, opc, 0, ifmt, is, slot,
1200 ®ister_operand) != 0)
1202 if (xtensa_operand_decode (isa, opc, 0,
1203 ®ister_operand) != 0)
1215 || strcasecmp (opcname,
"ill") == 0
1216 || strcasecmp (opcname,
"ill.n") == 0
1218 || strcasecmp (opcname,
"break") == 0
1219 || strcasecmp (opcname,
"break.n") == 0
1221 || xtensa_opcode_is_branch (isa, opc) > 0
1222 || xtensa_opcode_is_jump (isa, opc) > 0
1223 || xtensa_opcode_is_loop (isa, opc) > 0
1224 || xtensa_opcode_is_call (isa, opc) > 0
1225 || strcasecmp (opcname,
"simcall") == 0
1226 || strcasecmp (opcname,
"syscall") == 0)
1232 xtensa_insnbuf_free(isa, slot);
1233 xtensa_insnbuf_free(isa, ins);
1274 *this_cache = cache;
1307 cache->
ra = (cache->
pc & 0xc0000000) | (ra & 0x3fffffff);
1321 cache->
wd.
ws = ws & ~(1 << wb);
1324 cache->
ra = (pc & 0xc0000000) | (ra & 0x3fffffff);
1329 if (cache->
wd.
ws == 0)
1337 for (i = 0; i < 4; i++, sp += 4)
1351 for ( i = 4; i < cache->
wd.
callsize; i++, sp += 4)
1358 if ((cache->
prev_sp == 0) && ( ra != 0 ))
1362 if ((cache->
wd.
ws & (1 << cache->
wd.
wb)) == 0)
1410 \nUnrecognised function prologue. Stack trace cannot be resolved. \ 1411 This message will not be repeated in this session.\n"));
1431 static struct value *
1441 if (*this_cache == NULL)
1483 && cache->
wd.
aregs[areg] != -1)
1557 bfd_byte *valbuf = (bfd_byte *) dst;
1563 DEBUGTRACE (
"xtensa_extract_return_value (...)\n");
1574 if (len > (callsize > 8 ? 8 : 16))
1576 _(
"cannot extract return value of %d bytes long"),
1592 DEBUGINFO (
"[xtensa_extract_return_value] areg %d len %d\n", areg, len);
1597 for (; len > 0; len -= 4, areg++, valbuf += 4)
1613 const bfd_byte *valbuf = (
const bfd_byte *) dst;
1620 DEBUGTRACE (
"xtensa_store_return_value (...)\n");
1629 if (len > (callsize > 8 ? 8 : 16))
1631 _(
"unimplemented for this length: %d"),
1636 DEBUGTRACE (
"[xtensa_store_return_value] callsize %d wb %d\n",
1637 callsize, (
int) wb);
1647 for (; len > 0; len -= 4, areg++, valbuf += 4)
1659 struct value *
function,
1660 struct type *valtype,
1677 if (writebuf != NULL)
1682 if (readbuf != NULL)
1695 struct value *
function,
1699 struct value **args,
1706 int size, onstack_size;
1709 struct argument_info
1711 const bfd_byte *contents;
1722 struct argument_info *arg_info =
1723 (
struct argument_info *) alloca (nargs *
sizeof (
struct argument_info));
1727 DEBUGTRACE (
"xtensa_push_dummy_call (...)\n");
1732 DEBUGINFO (
"[xtensa_push_dummy_call] nargs = %d\n", nargs);
1733 DEBUGINFO (
"[xtensa_push_dummy_call] sp=0x%x, struct_return=%d, " 1734 "struct_addr=0x%x\n",
1737 for (i = 0; i < nargs; i++)
1739 struct value *arg = args[i];
1773 for (i = 0; i < nargs; i++)
1775 struct argument_info *info = &arg_info[i];
1776 struct value *arg = args[i];
1817 size = (
size + info->align - 1) & ~(info->align - 1);
1818 onstack_size = (onstack_size + info->align - 1) & ~(info->align - 1);
1823 info->u.offset = onstack_size;
1824 onstack_size += info->length;
1831 size += info->length;
1853 for (i = 0; i < nargs; i++)
1855 struct argument_info *info = &arg_info[i];
1859 int n = info->length;
1875 int n = info->length;
1876 const bfd_byte *cp = info->contents;
1877 int r = info->u.regno;
1918 ra = (bp_addr & 0x3fffffff) | 0x40000000;
1920 ps = (
unsigned long) val & ~0x00030000;
1966 #define BIG_BREAKPOINT { 0x00, 0x04, 0x00 } 1967 #define LITTLE_BREAKPOINT { 0x00, 0x40, 0x00 } 1968 #define DENSITY_BIG_BREAKPOINT { 0xd2, 0x0f } 1969 #define DENSITY_LITTLE_BREAKPOINT { 0x2d, 0xf0 } 1991 static unsigned char density_little_breakpoint[]
1995 return density_big_breakpoint;
1997 return density_little_breakpoint;
2008 #define RETURN_RET goto done 2010 xtensa_insnbuf ins, slot;
2014 int ilen, islots, is;
2016 const char *opcname;
2021 ins = xtensa_insnbuf_alloc (isa);
2022 slot = xtensa_insnbuf_alloc (isa);
2025 for (ia = start_pc, bt = ia; ia < finish_pc ; ia += ilen)
2027 if (ia + xtensa_isa_maxlength (isa) > bt)
2036 xtensa_insnbuf_from_chars (isa, ins, &ibuf[ia-ba], 0);
2037 ifmt = xtensa_format_decode (isa, ins);
2038 if (ifmt == XTENSA_UNDEFINED)
2040 ilen = xtensa_format_length (isa, ifmt);
2041 if (ilen == XTENSA_UNDEFINED)
2043 islots = xtensa_format_num_slots (isa, ifmt);
2044 if (islots == XTENSA_UNDEFINED)
2047 for (is = 0; is < islots; ++is)
2049 if (xtensa_format_get_slot (isa, ifmt, is, ins, slot))
2052 opc = xtensa_opcode_decode (isa, ifmt, is, slot);
2053 if (opc == XTENSA_UNDEFINED)
2056 opcname = xtensa_opcode_name (isa, opc);
2058 if ((strcasecmp (opcname,
"ret.n") == 0)
2059 || (strcasecmp (opcname,
"ret") == 0))
2067 xtensa_insnbuf_free(isa, slot);
2068 xtensa_insnbuf_free(isa, ins);
2105 char ch = *opcname++;
2107 if ((ch !=
'r') && (ch !=
'w') && (ch !=
'x'))
2109 if (*opcname++ !=
's')
2111 if (*opcname++ !=
'r')
2113 if (*opcname++ !=
'.')
2124 const char *opcname;
2127 DEBUGTRACE (
"call0_classify_opcode (..., opc = %d)\n", opc);
2131 opcname = xtensa_opcode_name (isa, opc);
2134 || strcasecmp (opcname,
"ill") == 0
2135 || strcasecmp (opcname,
"ill.n") == 0)
2137 else if (strcasecmp (opcname,
"break") == 0
2138 || strcasecmp (opcname,
"break.n") == 0)
2140 else if (strcasecmp (opcname,
"entry") == 0)
2142 else if (strcasecmp (opcname,
"rfwo") == 0)
2144 else if (strcasecmp (opcname,
"rfwu") == 0)
2146 else if (xtensa_opcode_is_branch (isa, opc) > 0
2147 || xtensa_opcode_is_jump (isa, opc) > 0
2148 || xtensa_opcode_is_loop (isa, opc) > 0
2149 || xtensa_opcode_is_call (isa, opc) > 0
2150 || strcasecmp (opcname,
"simcall") == 0
2151 || strcasecmp (opcname,
"syscall") == 0)
2155 else if (strcasecmp (opcname,
"add") == 0
2156 || strcasecmp (opcname,
"add.n") == 0)
2158 else if (strcasecmp (opcname,
"and") == 0)
2160 else if (strcasecmp (opcname,
"addi") == 0
2161 || strcasecmp (opcname,
"addi.n") == 0
2162 || strcasecmp (opcname,
"addmi") == 0)
2164 else if (strcasecmp (opcname,
"sub") == 0)
2166 else if (strcasecmp (opcname,
"mov.n") == 0
2167 || strcasecmp (opcname,
"or") == 0)
2169 else if (strcasecmp (opcname,
"movi") == 0
2170 || strcasecmp (opcname,
"movi.n") == 0)
2172 else if (strcasecmp (opcname,
"l32r") == 0)
2174 else if (strcasecmp (opcname,
"s32i") == 0
2175 || strcasecmp (opcname,
"s32i.n") == 0)
2177 else if (strcasecmp (opcname,
"l32e") == 0)
2179 else if (strcasecmp (opcname,
"s32e") == 0)
2200 unsigned litbase, litaddr, litval;
2213 if (src[odv[1]].fr_reg ==
C0_CONST)
2218 else if (src[odv[2]].fr_reg ==
C0_CONST)
2231 if ((src[odv[0]].fr_reg == spreg) && (src[odv[1]].fr_reg == spreg))
2233 if (src[odv[2]].fr_reg ==
C0_CONST)
2237 else if ((src[odv[0]].fr_reg == spreg)
2238 && (src[odv[2]].fr_reg == spreg))
2240 if (src[odv[1]].fr_reg ==
C0_CONST)
2246 if (src[odv[1]].fr_reg ==
C0_CONST)
2251 else if (src[odv[2]].fr_reg ==
C0_CONST)
2261 if (src[odv[2]].fr_reg ==
C0_CONST)
2285 dst[odv[0]].
fr_ofs = odv[1];
2294 litaddr = litbase & 1
2295 ? (litbase & ~1) + (
signed)odv[1]
2296 : (pc + 3 + (signed)odv[1]) & ~3;
2299 dst[odv[0]].
fr_ofs = litval;
2307 && (odv[1] == spreg)
2311 if (src[odv[1]].fr_reg == spreg
2312 && (src[odv[1]].fr_ofs & 3) == 0
2313 && src[odv[0]].fr_reg >= 0
2314 && src[odv[0]].fr_ofs == 0
2315 && src[src[odv[0]].fr_reg].to_stk ==
C0_NOSTK)
2371 xtensa_insnbuf ins, slot;
2373 int ilen, islots, is;
2386 DEBUGTRACE (
"call0_analyze_prologue (start = 0x%08x, pc = 0x%08x, ...)\n",
2387 (
int)start, (
int)
pc);
2403 if (prologue_sal.
line != 0)
2404 body_pc = prologue_sal.
end;
2411 body_pc = std::min (end_pc, body_pc);
2414 body_pc = std::min (
pc, body_pc);
2421 ins = xtensa_insnbuf_alloc (isa);
2422 slot = xtensa_insnbuf_alloc (isa);
2424 for (ia = start, bt = ia; ia < body_pc ; ia += ilen)
2430 if (ia + xtensa_isa_maxlength (isa) > bt)
2435 error (
_(
"Unable to read target memory ..."));
2440 xtensa_insnbuf_from_chars (isa, ins, &ibuf[ia-ba], 0);
2441 ifmt = xtensa_format_decode (isa, ins);
2442 if (ifmt == XTENSA_UNDEFINED)
2447 ilen = xtensa_format_length (isa, ifmt);
2448 if (ilen == XTENSA_UNDEFINED)
2453 islots = xtensa_format_num_slots (isa, ifmt);
2454 if (islots == XTENSA_UNDEFINED)
2464 for (j = 0; j < nregs; ++j)
2467 for (is = 0; is < islots; ++is)
2471 fail = xtensa_format_get_slot (isa, ifmt, is, ins, slot);
2475 opc = xtensa_opcode_decode (isa, ifmt, is, slot);
2476 DEBUGVERB (
"[call0_analyze_prologue] instr addr = 0x%08x, opc = %d\n",
2478 if (opc == XTENSA_UNDEFINED)
2511 nods = xtensa_opcode_num_operands (isa, opc);
2512 if (nods == XTENSA_UNDEFINED)
2520 fail = xtensa_operand_get_field (isa, opc, j, ifmt,
2525 fail = xtensa_operand_decode (isa, opc, j, &odv[j]);
2533 if (odv[2] == odv[1])
2536 if ((odv[0] == 1) && (odv[1] != 1))
2550 opclass, nods, odv, ia, 1, cache);
2556 DEBUGVERB (
"[call0_analyze_prologue] stopped at instr addr 0x%08x, %s\n",
2557 (
unsigned)ia, fail ?
"failed" :
"succeeded");
2558 xtensa_insnbuf_free(isa, slot);
2559 xtensa_insnbuf_free(isa, ins);
2574 int fp_regnum =
C0_SP, c0_hasfp = 0, c0_frmsz = 0, prev_sp = 0, to_stk;
2591 goto finish_frame_analysis;
2634 goto finish_frame_analysis;
2646 prev_sp = unaligned_sp + c0_frmsz;
2649 prev_sp = fp + c0_frmsz;
2658 c0_frmsz += fp - sp;
2705 finish_frame_analysis:
2706 cache->
pc = start_pc;
2709 cache->
prev_sp = (ra != 0) ? prev_sp : 0;
2730 unsigned int spilled_value
2766 #define XTENSA_MAX_WINDOW_INTERRUPT_HANDLER_LEN 200 2781 xtensa_insnbuf ins, slot;
2785 int ilen, islots, is;
2793 int WindowUnderflow12 = (current_pc & 0x1ff) >= 0x140;
2797 ins = xtensa_insnbuf_alloc (isa);
2798 slot = xtensa_insnbuf_alloc (isa);
2809 if (ia + xtensa_isa_maxlength (isa) > bt)
2816 xtensa_insnbuf_from_chars (isa, ins, &ibuf[ia-ba], 0);
2817 ifmt = xtensa_format_decode (isa, ins);
2818 if (ifmt == XTENSA_UNDEFINED)
2820 ilen = xtensa_format_length (isa, ifmt);
2821 if (ilen == XTENSA_UNDEFINED)
2823 islots = xtensa_format_num_slots (isa, ifmt);
2824 if (islots == XTENSA_UNDEFINED)
2826 for (is = 0; is < islots; ++is)
2828 if (xtensa_format_get_slot (isa, ifmt, is, ins, slot))
2830 opc = xtensa_opcode_decode (isa, ifmt, is, slot);
2831 if (opc == XTENSA_UNDEFINED)
2862 if (WindowUnderflow12)
2885 if ( xtensa_opcode_num_operands (isa, opc) != 3 )
2887 if (xtensa_operand_get_field (isa, opc, 0, ifmt, is, slot, &at))
2889 if (xtensa_operand_decode (isa, opc, 0, &at))
2891 if (xtensa_operand_get_field (isa, opc, 1, ifmt, is, slot, &as))
2893 if (xtensa_operand_decode (isa, opc, 1, &as))
2895 if (xtensa_operand_get_field (isa, opc, 2, ifmt, is, slot, &
offset))
2897 if (xtensa_operand_decode (isa, opc, 2, &
offset))
2917 int epc1_regnum, i,
regnum;
2932 Unable to decode Xtensa Window Interrupt Handler's code."));
2942 cache->
wd.
ws = ws ^ (1 << wb);
2944 cache->
wd.
ws = ws | (1 << wb);
2946 cache->
wd.
wb = (
ps & 0xf00) >> 8;
2961 if (epc1_regnum < 0)
2962 error(
_(
"Unable to read Xtensa register EPC1"));
3011 DEBUGTRACE (
"xtensa_skip_prologue (start_pc = 0x%08x)\n", (
int) start_pc);
3013 #if DONT_SKIP_PROLOGUE 3020 if (prologue_sal.
line != 0)
3037 if (end_func != start_pc)
3040 return prologue_sal.
end;
3046 return body_pc != 0 ? body_pc : start_pc;
3059 \n\tnum_aregs: Number of AR registers (%d) is not a power of two!"),
3065 log.printf (
_(
"\n\tpc_regnum: No PC register"));
3067 log.printf (
_(
"\n\tps_regnum: No PS register"));
3072 log.printf (
_(
"\n\twb_regnum: No WB register"));
3074 log.printf (
_(
"\n\tws_regnum: No WS register"));
3076 log.printf (
_(
"\n\tar_base: No AR registers"));
3080 log.printf (
_(
"\n\ta0_base: No Ax registers"));
3084 _(
"the following are invalid: %s"),
log.c_str ());
3094 int n, max_size = 4;
3100 #define XTENSA_DBREGN_SREG(n) (0x0200+(n)) 3102 #define XTENSA_DBREGN_UREG(n) (0x0300+(n)) 3184 info.
byte_order = XCHAL_HAVE_BE ? BFD_ENDIAN_BIG : BFD_ENDIAN_LITTLE;
3273 error (
_(
"xtensa_dump_tdep(): not implemented"));
3285 _(
"Set Xtensa debugging."),
3286 _(
"Show Xtensa debugging."),
_(
"\ 3287 When non-zero, Xtensa-specific debugging is enabled. \ 3288 Can be 1, 2, 3, or 4 indicating the level of debugging."),
struct xtensa_frame_cache xtensa_frame_cache_t
void reggroup_add(struct gdbarch *gdbarch, struct reggroup *group)
void set_gdbarch_num_regs(struct gdbarch *gdbarch, int num_regs)
void set_gdbarch_frame_align(struct gdbarch *gdbarch, gdbarch_frame_align_ftype frame_align)
void set_gdbarch_have_nonsteppable_watchpoint(struct gdbarch *gdbarch, int have_nonsteppable_watchpoint)
#define DEBUGINFO(args...)
static enum register_status xtensa_register_read_masked(struct regcache *regcache, xtensa_register_t *reg, gdb_byte *buffer)
xtensa_isa xtensa_default_isa
void set_gdbarch_ps_regnum(struct gdbarch *gdbarch, int ps_regnum)
static enum return_value_convention xtensa_return_value(struct gdbarch *gdbarch, struct value *function, struct type *valtype, struct regcache *regcache, gdb_byte *readbuf, const gdb_byte *writebuf)
static CORE_ADDR xtensa_frame_base_address(struct frame_info *this_frame, void **this_cache)
struct frame_id frame_id_build(CORE_ADDR stack_addr, CORE_ADDR code_addr)
CORE_ADDR extract_typed_address(const gdb_byte *buf, struct type *type)
static int rwx_special_register(const char *opcname)
struct type * virtual_type
#define XTENSA_DBREGN_UREG(n)
CORE_ADDR get_frame_pc(struct frame_info *frame)
void gdbarch_init_osabi(struct gdbarch_info info, struct gdbarch *gdbarch)
struct reggroup * reggroup_new(const char *name, enum reggroup_type type)
void set_gdbarch_wchar_bit(struct gdbarch *gdbarch, int wchar_bit)
static void xtensa_supply_gregset(const struct regset *regset, struct regcache *rc, int regnum, const void *gregs, size_t len)
static int windowing_enabled(struct gdbarch *gdbarch, unsigned int ps)
struct value * frame_unwind_got_memory(struct frame_info *frame, int regnum, CORE_ADDR addr)
void write_memory_unsigned_integer(CORE_ADDR addr, int len, enum bfd_endian byte_order, ULONGEST value)
void() iterate_over_regset_sections_cb(const char *sect_name, int size, const struct regset *regset, const char *human_name, void *cb_data)
struct xtensa_call0_frame_cache xtensa_call0_frame_cache_t
static struct xtensa_frame_cache * xtensa_alloc_frame_cache(int windowed)
void warning(const char *fmt,...)
struct gdbarch_tdep * tdep
#define DENSITY_BIG_BREAKPOINT
void set_gdbarch_stab_reg_to_regnum(struct gdbarch *gdbarch, gdbarch_stab_reg_to_regnum_ftype stab_reg_to_regnum)
static struct reggroup * xtensa_cp[XTENSA_MAX_COPROCESSOR]
ULONGEST align_down(ULONGEST v, int n)
const struct builtin_type * builtin_type(struct gdbarch *gdbarch)
struct gdbarch_tdep xtensa_tdep
unsigned int isa_use_windowed_registers
void internal_error(const char *file, int line, const char *fmt,...)
static struct xtensa_frame_cache * xtensa_frame_cache(struct frame_info *this_frame, void **this_cache)
void frame_unwind_register(struct frame_info *frame, int regnum, gdb_byte *buf)
static int arreg_number(struct gdbarch *gdbarch, int a_regnum, ULONGEST wb)
static int xtensa_register_reggroup_p(struct gdbarch *gdbarch, int regnum, struct reggroup *group)
struct type * builtin_uint8
static int extract_call_winsize(struct gdbarch *gdbarch, CORE_ADDR pc)
static CORE_ADDR xtensa_skip_prologue(struct gdbarch *gdbarch, CORE_ADDR start_pc)
struct type * builtin_uint16
void set_gdbarch_register_reggroup_p(struct gdbarch *gdbarch, gdbarch_register_reggroup_p_ftype register_reggroup_p)
int safe_read_memory_integer(CORE_ADDR memaddr, int len, enum bfd_endian byte_order, LONGEST *return_value)
xtensa_register_t * regmap
constexpr gdb_byte little_breakpoint[]
static enum register_status xtensa_pseudo_register_read(struct gdbarch *gdbarch, struct regcache *regcache, int regnum, gdb_byte *buffer)
struct link_map_offsets * svr4_ilp32_fetch_link_map_offsets(void)
static unsigned int xtensa_scan_prologue(struct gdbarch *gdbarch, CORE_ADDR current_pc)
xtensa_call0_frame_cache_t c0
struct xtensa_c0reg xtensa_c0reg_t
static struct reggroup * xtensa_user_reggroup
static struct type * xtensa_register_type(struct gdbarch *gdbarch, int regnum)
struct reggroup *const restore_reggroup
int gdbarch_num_regs(struct gdbarch *gdbarch)
xtensa_windowed_frame_cache_t wd
struct reggroup *const all_reggroup
static struct reggroup * xtensa_vectra_reggroup
void set_gdbarch_dwarf2_reg_to_regnum(struct gdbarch *gdbarch, gdbarch_dwarf2_reg_to_regnum_ftype dwarf2_reg_to_regnum)
struct gdbarch_tdep * gdbarch_tdep(struct gdbarch *gdbarch)
int gdbarch_ps_regnum(struct gdbarch *gdbarch)
void frame_unwind_append_unwinder(struct gdbarch *gdbarch, const struct frame_unwind *unwinder)
int max_register_virtual_size
struct regcache * get_current_regcache(void)
#define XTENSA_MAX_COPROCESSOR
void set_gdbarch_wchar_signed(struct gdbarch *gdbarch, int wchar_signed)
#define FRAME_OBSTACK_ZALLOC(TYPE)
struct ctype_cache * next
#define host_address_to_string(ADDR)
struct type * arch_integer_type(struct gdbarch *gdbarch, int bit, int unsigned_p, const char *name)
static struct reggroup * xtensa_ar_reggroup
struct value * frame_unwind_got_constant(struct frame_info *frame, int regnum, ULONGEST val)
void gdbarch_register(enum bfd_architecture bfd_architecture, gdbarch_init_ftype *init, gdbarch_dump_tdep_ftype *dump_tdep)
void add_setshow_zuinteger_cmd(const char *name, enum command_class theclass, unsigned int *var, const char *set_doc, const char *show_doc, const char *help_doc, cmd_const_sfunc_ftype *set_func, show_value_ftype *show_func, struct cmd_list_element **set_list, struct cmd_list_element **show_list)
static void warning_once(void)
mach_port_t kern_return_t mach_port_t msgports mach_port_t kern_return_t pid_t pid mach_port_t kern_return_t mach_port_t task mach_port_t kern_return_t int flags
int gdbarch_num_pseudo_regs(struct gdbarch *gdbarch)
struct reggroup *const float_reggroup
void frame_base_set_default(struct gdbarch *gdbarch, const struct frame_base *default_base)
void set_gdbarch_pseudo_register_write(struct gdbarch *gdbarch, gdbarch_pseudo_register_write_ftype pseudo_register_write)
static CORE_ADDR xtensa_unwind_pc(struct gdbarch *gdbarch, struct frame_info *next_frame)
static void xtensa_iterate_over_regset_sections(struct gdbarch *gdbarch, iterate_over_regset_sections_cb *cb, void *cb_data, const struct regcache *regcache)
void set_gdbarch_register_type(struct gdbarch *gdbarch, gdbarch_register_type_ftype register_type)
static struct regset xtensa_gregset
struct type * check_typedef(struct type *type)
LONGEST read_memory_integer(CORE_ADDR memaddr, int len, enum bfd_endian byte_order)
unsigned int isa_use_exceptions
const gdb_byte * value_contents(struct value *value)
struct reggroup *const general_reggroup
enum register_status regcache_raw_read_part(struct regcache *regcache, int regnum, int offset, int len, gdb_byte *buf)
static void xtensa_add_reggroups(struct gdbarch *gdbarch)
static int xtensa_find_register_by_name(struct gdbarch *gdbarch, const char *name)
struct symtab_and_line find_pc_line(CORE_ADDR pc, int notcurrent)
static void xtensa_derive_tdep(struct gdbarch_tdep *tdep)
#define XTENSA_DBREGN_SREG(n)
static ULONGEST extract_unsigned_integer(const gdb_byte *addr, int len, enum bfd_endian byte_order)
enum register_status regcache_cooked_read_unsigned(struct regcache *regcache, int regnum, ULONGEST *val)
struct reggroup *const system_reggroup
void set_gdbarch_sp_regnum(struct gdbarch *gdbarch, int sp_regnum)
static const char * xtensa_register_name(struct gdbarch *gdbarch, int regnum)
void set_gdbarch_decr_pc_after_break(struct gdbarch *gdbarch, CORE_ADDR decr_pc_after_break)
xtensa_elf_greg_t windowstart
void set_gdbarch_dummy_id(struct gdbarch *gdbarch, gdbarch_dummy_id_ftype dummy_id)
void fprintf_unfiltered(struct ui_file *stream, const char *format,...)
static CORE_ADDR xtensa_push_dummy_call(struct gdbarch *gdbarch, struct value *function, struct regcache *regcache, CORE_ADDR bp_addr, int nargs, struct value **args, CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr)
void set_gdbarch_believe_pcc_promotion(struct gdbarch *gdbarch, int believe_pcc_promotion)
xtensa_exception_handler_t
enum bfd_endian gdbarch_byte_order(struct gdbarch *gdbarch)
static void execute_l32e(struct gdbarch *gdbarch, int at, int as, int offset, CORE_ADDR wb)
void set_solib_svr4_fetch_link_map_offsets(struct gdbarch *gdbarch, struct link_map_offsets *(*flmo)(void))
int find_pc_partial_function(CORE_ADDR pc, const char **name, CORE_ADDR *address, CORE_ADDR *endaddr)
static void call0_frame_cache(struct frame_info *this_frame, xtensa_frame_cache_t *cache, CORE_ADDR pc)
static void xtensa_init_reggroups(void)
unsigned int num_nopriv_regs
static const gdb_byte * xtensa_sw_breakpoint_from_kind(struct gdbarch *gdbarch, int kind, int *size)
void set_gdbarch_unwind_pc(struct gdbarch *gdbarch, gdbarch_unwind_pc_ftype unwind_pc)
struct type * builtin_uint32
int default_frame_sniffer(const struct frame_unwind *self, struct frame_info *this_frame, void **this_prologue_cache)
xtensa_c0reg_t c0_rt[C0_NREGS]
static xtensa_exception_handler_t execute_code(struct gdbarch *gdbarch, CORE_ADDR current_pc, CORE_ADDR wb)
mach_port_t mach_port_t name mach_port_t mach_port_t name kern_return_t int status
struct type * builtin_long
struct value * value_cast(struct type *type, struct value *arg2)
static const struct frame_unwind xtensa_unwind
xtensa_elf_greg_t windowbase
static CORE_ADDR call0_analyze_prologue(struct gdbarch *gdbarch, CORE_ADDR start, CORE_ADDR pc, int nregs, xtensa_frame_cache_t *cache)
static int xtensa_window_interrupt_insn(struct gdbarch *gdbarch, CORE_ADDR pc)
static CORE_ADDR a0_saved
char * xstrprintf(const char *format,...)
struct cmd_list_element * setdebuglist
void read_memory(CORE_ADDR memaddr, gdb_byte *myaddr, ssize_t len)
struct reggroup *const vector_reggroup
ULONGEST get_frame_register_unsigned(struct frame_info *frame, int regnum)
static void xtensa_dump_tdep(struct gdbarch *gdbarch, struct ui_file *file)
struct type * builtin_uint128
void set_gdbarch_breakpoint_kind_from_pc(struct gdbarch *gdbarch, gdbarch_breakpoint_kind_from_pc_ftype breakpoint_kind_from_pc)
void set_gdbarch_frame_args_skip(struct gdbarch *gdbarch, CORE_ADDR frame_args_skip)
CORE_ADDR aregs[XTENSA_NUM_SAVED_AREGS]
int max_register_raw_size
static void xtensa_write_register(int regnum, ULONGEST value)
static int call0_track_op(struct gdbarch *gdbarch, xtensa_c0reg_t dst[], xtensa_c0reg_t src[], xtensa_insn_kind opclass, int nods, unsigned odv[], CORE_ADDR pc, int spreg, xtensa_frame_cache_t *cache)
static CORE_ADDR xtensa_frame_align(struct gdbarch *gdbarch, CORE_ADDR address)
static int xtensa_breakpoint_kind_from_pc(struct gdbarch *gdbarch, CORE_ADDR *pcptr)
static CORE_ADDR a7_saved
void regcache_raw_write_part(struct regcache *regcache, int regnum, int offset, int len, const gdb_byte *buf)
static void execute_s32e(struct gdbarch *gdbarch, int at, int as, int offset, CORE_ADDR wb)
unsigned int target_number
constexpr gdb_byte big_breakpoint[]
int core_addr_lessthan(CORE_ADDR lhs, CORE_ADDR rhs)
void set_gdbarch_pseudo_register_read(struct gdbarch *gdbarch, gdbarch_pseudo_register_read_ftype pseudo_register_read)
void _initialize_xtensa_tdep(void)
static int areg_number(struct gdbarch *gdbarch, int ar_regnum, unsigned int wb)
#define DEBUGVERB(args...)
unsigned int target_flags
#define TYPE_CODE(thistype)
enum register_status regcache_raw_read(struct regcache *regcache, int regnum, gdb_byte *buf)
static struct value * xtensa_frame_prev_register(struct frame_info *this_frame, void **this_cache, int regnum)
struct value * frame_unwind_got_register(struct frame_info *frame, int regnum, int new_regnum)
void regcache_cooked_write_unsigned(struct regcache *regcache, int regnum, ULONGEST val)
#define LITTLE_BREAKPOINT
int target_read_memory(CORE_ADDR memaddr, gdb_byte *myaddr, ssize_t len)
struct type * builtin_data_ptr
const xtensa_mask_t * mask
static void xtensa_frame_this_id(struct frame_info *this_frame, void **this_cache, struct frame_id *this_id)
static void xtensa_verify_config(struct gdbarch *gdbarch)
void regcache_raw_write_unsigned(struct regcache *regcache, int regnum, ULONGEST val)
void set_gdbarch_num_pseudo_regs(struct gdbarch *gdbarch, int num_pseudo_regs)
static xtensa_insn_kind call0_classify_opcode(xtensa_isa isa, xtensa_opcode opc)
void dwarf2_append_unwinders(struct gdbarch *gdbarch)
struct ctype_cache * type_entries
static void xtensa_store_return_value(struct type *type, struct regcache *regcache, const void *dst)
#define DENSITY_LITTLE_BREAKPOINT
static int xtensa_reg_to_regnum(struct gdbarch *gdbarch, int regnum)
#define XTENSA_NUM_SAVED_AREGS
void regcache_raw_supply(struct regcache *regcache, int regnum, const void *buf)
static void xtensa_window_interrupt_frame_cache(struct frame_info *this_frame, xtensa_frame_cache_t *cache, CORE_ADDR pc)
unsigned long long ULONGEST
enum unwind_stop_reason default_frame_unwind_stop_reason(struct frame_info *this_frame, void **this_cache)
static unsigned int xtensa_debug_level
struct type * value_type(const struct value *value)
static const struct frame_base xtensa_frame_base
void set_gdbarch_return_value(struct gdbarch *gdbarch, gdbarch_return_value_ftype return_value)
struct cmd_list_element * showdebuglist
int gdbarch_pc_regnum(struct gdbarch *gdbarch)
static CORE_ADDR a11_saved
static void xtensa_pseudo_register_write(struct gdbarch *gdbarch, struct regcache *regcache, int regnum, const gdb_byte *buffer)
struct reggroup *const save_reggroup
#define TYPE_LENGTH(thistype)
static void xtensa_extract_return_value(struct type *type, struct regcache *regcache, void *dst)
static int xtensa_coprocessor_register_group(struct reggroup *group)
enum register_status regcache_raw_read_unsigned(struct regcache *regcache, int regnum, ULONGEST *val)
void set_gdbarch_push_dummy_call(struct gdbarch *gdbarch, gdbarch_push_dummy_call_ftype push_dummy_call)
static struct gdbarch * xtensa_gdbarch_init(struct gdbarch_info info, struct gdbarch_list *arches)
#define XTENSA_IS_ENTRY(gdbarch, op1)
ULONGEST read_memory_unsigned_integer(CORE_ADDR memaddr, int len, enum bfd_endian byte_order)
struct type * builtin_uint64
void set_gdbarch_sw_breakpoint_from_kind(struct gdbarch *gdbarch, gdbarch_sw_breakpoint_from_kind_ftype sw_breakpoint_from_kind)
void set_gdbarch_iterate_over_regset_sections(struct gdbarch *gdbarch, gdbarch_iterate_over_regset_sections_ftype iterate_over_regset_sections)
#define XTENSA_MAX_REGISTER_SIZE
unsigned int num_pseudo_regs
#define DEBUGTRACE(args...)
void write_memory(CORE_ADDR memaddr, const bfd_byte *myaddr, ssize_t len)
void set_gdbarch_skip_prologue(struct gdbarch *gdbarch, gdbarch_skip_prologue_ftype skip_prologue)
#define XTENSA_REGISTER_FLAGS_PRIVILEGED
static unsigned long xtensa_read_register(int regnum)
enum bfd_endian byte_order
static struct frame_id xtensa_dummy_id(struct gdbarch *gdbarch, struct frame_info *this_frame)
struct xtensa_windowed_frame_cache xtensa_windowed_frame_cache_t
enum bfd_endian byte_order
void set_gdbarch_pc_regnum(struct gdbarch *gdbarch, int pc_regnum)
void set_gdbarch_register_name(struct gdbarch *gdbarch, gdbarch_register_name_ftype register_name)
CORE_ADDR get_frame_func(struct frame_info *this_frame)
void error(const char *fmt,...)
struct gdbarch * gdbarch_alloc(const struct gdbarch_info *info, struct gdbarch_tdep *tdep)
void set_gdbarch_inner_than(struct gdbarch *gdbarch, gdbarch_inner_than_ftype inner_than)
struct gdbarch * get_frame_arch(struct frame_info *this_frame)
static void xtensa_register_write_masked(struct regcache *regcache, xtensa_register_t *reg, const gdb_byte *buffer)
static int xtensa_session_once_reported
void regcache_cooked_write(struct regcache *regcache, int regnum, const gdb_byte *buf)
#define XTENSA_MAX_WINDOW_INTERRUPT_HANDLER_LEN
static int call0_ret(CORE_ADDR start_pc, CORE_ADDR finish_pc)
static void store_unsigned_integer(gdb_byte *addr, int len, enum bfd_endian byte_order, ULONGEST val)
struct type * builtin_int
void regcache_raw_write(struct regcache *regcache, int regnum, const gdb_byte *buf)