aboutsummaryrefslogtreecommitdiff
path: root/gdb/ppc64-tdep.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/ppc64-tdep.c')
-rw-r--r--gdb/ppc64-tdep.c602
1 files changed, 289 insertions, 313 deletions
diff --git a/gdb/ppc64-tdep.c b/gdb/ppc64-tdep.c
index a7ab622..45bbe6c 100644
--- a/gdb/ppc64-tdep.c
+++ b/gdb/ppc64-tdep.c
@@ -29,56 +29,40 @@
operands are masked off before they're or-ed into the instruction,
you can use -1 to make masks. */
-#define insn_d(opcd, rts, ra, d) \
- ((((unsigned (opcd)) & 0x3f) << 26) \
- | (((unsigned (rts)) & 0x1f) << 21) \
- | (((unsigned (ra)) & 0x1f) << 16) \
- | ((unsigned (d)) & 0xffff))
-
-#define insn_ds(opcd, rts, ra, d, xo) \
- ((((unsigned (opcd)) & 0x3f) << 26) \
- | (((unsigned (rts)) & 0x1f) << 21) \
- | (((unsigned (ra)) & 0x1f) << 16) \
- | ((unsigned (d)) & 0xfffc) \
+#define insn_d(opcd, rts, ra, d) \
+ ((((unsigned (opcd)) & 0x3f) << 26) | (((unsigned (rts)) & 0x1f) << 21) \
+ | (((unsigned (ra)) & 0x1f) << 16) | ((unsigned (d)) & 0xffff))
+
+#define insn_ds(opcd, rts, ra, d, xo) \
+ ((((unsigned (opcd)) & 0x3f) << 26) | (((unsigned (rts)) & 0x1f) << 21) \
+ | (((unsigned (ra)) & 0x1f) << 16) | ((unsigned (d)) & 0xfffc) \
| ((unsigned (xo)) & 0x3))
-#define insn_xfx(opcd, rts, spr, xo) \
- ((((unsigned (opcd)) & 0x3f) << 26) \
- | (((unsigned (rts)) & 0x1f) << 21) \
- | (((unsigned (spr)) & 0x1f) << 16) \
- | (((unsigned (spr)) & 0x3e0) << 6) \
+#define insn_xfx(opcd, rts, spr, xo) \
+ ((((unsigned (opcd)) & 0x3f) << 26) | (((unsigned (rts)) & 0x1f) << 21) \
+ | (((unsigned (spr)) & 0x1f) << 16) | (((unsigned (spr)) & 0x3e0) << 6) \
| (((unsigned (xo)) & 0x3ff) << 1))
-#define prefix(a, b, R, do) \
- (((0x1) << 26) \
- | (((unsigned (a)) & 0x3) << 24) \
- | (((unsigned (b)) & 0x1) << 23) \
- | (((unsigned (R)) & 0x1) << 20) \
+#define prefix(a, b, R, do) \
+ (((0x1) << 26) | (((unsigned (a)) & 0x3) << 24) \
+ | (((unsigned (b)) & 0x1) << 23) | (((unsigned (R)) & 0x1) << 20) \
| ((unsigned (do)) & 0x3ffff))
-#define insn_md(opcd, ra, rs, sh, me, rc) \
- ((((unsigned (opcd)) & 0x3f) << 26) \
- | (((unsigned (rs)) & 0x1f) << 21) \
- | (((unsigned (ra)) & 0x1f) << 16) \
- | (((unsigned (sh)) & 0x3e) << 11) \
- | (((unsigned (me)) & 0x3f) << 25) \
- | (((unsigned (sh)) & 0x1) << 1) \
+#define insn_md(opcd, ra, rs, sh, me, rc) \
+ ((((unsigned (opcd)) & 0x3f) << 26) | (((unsigned (rs)) & 0x1f) << 21) \
+ | (((unsigned (ra)) & 0x1f) << 16) | (((unsigned (sh)) & 0x3e) << 11) \
+ | (((unsigned (me)) & 0x3f) << 25) | (((unsigned (sh)) & 0x1) << 1) \
| ((unsigned (rc)) & 0x1))
-#define insn_x(opcd, rt, ra, rb, opc2) \
- ((((unsigned (opcd)) & 0x3f) << 26) \
- | (((unsigned (rt)) & 0x1f) << 21) \
- | (((unsigned (ra)) & 0x1f) << 16) \
- | (((unsigned (rb)) & 0x3e) << 11) \
+#define insn_x(opcd, rt, ra, rb, opc2) \
+ ((((unsigned (opcd)) & 0x3f) << 26) | (((unsigned (rt)) & 0x1f) << 21) \
+ | (((unsigned (ra)) & 0x1f) << 16) | (((unsigned (rb)) & 0x3e) << 11) \
| (((unsigned (opc2)) & 0x3FF) << 1))
-#define insn_xo(opcd, rt, ra, rb, oe, rc, opc2) \
- ((((unsigned (opcd)) & 0x3f) << 26) \
- | (((unsigned (rt)) & 0x1f) << 21) \
- | (((unsigned (ra)) & 0x1f) << 16) \
- | (((unsigned (rb)) & 0x3e) << 11) \
- | (((unsigned (oe)) & 0x1) << 10) \
- | (((unsigned (opc2)) & 0x1FF) << 1) \
+#define insn_xo(opcd, rt, ra, rb, oe, rc, opc2) \
+ ((((unsigned (opcd)) & 0x3f) << 26) | (((unsigned (rt)) & 0x1f) << 21) \
+ | (((unsigned (ra)) & 0x1f) << 16) | (((unsigned (rb)) & 0x3e) << 11) \
+ | (((unsigned (oe)) & 0x1) << 10) | (((unsigned (opc2)) & 0x1FF) << 1) \
| (((unsigned (rc)))))
/* PLT_OFF is the TOC-relative offset of a 64-bit PowerPC PLT entry.
@@ -95,8 +79,8 @@ ppc64_plt_entry_point (frame_info_ptr frame, CORE_ADDR plt_off)
if (execution_direction == EXEC_REVERSE)
{
/* If executing in reverse, r2 will have been stored to the stack. */
- CORE_ADDR sp = get_frame_register_unsigned (frame,
- tdep->ppc_gp0_regnum + 1);
+ CORE_ADDR sp
+ = get_frame_register_unsigned (frame, tdep->ppc_gp0_regnum + 1);
unsigned int sp_off = tdep->elf_abi == POWERPC_ELF_V1 ? 40 : 24;
tocp = read_memory_unsigned_integer (sp + sp_off, 8, byte_order);
}
@@ -124,37 +108,36 @@ ppc64_plt_pcrel_entry_point (frame_info_ptr frame, CORE_ADDR plt_off,
/* Old ELFv1 PLT call stub. */
-static const struct ppc_insn_pattern ppc64_standard_linkage1[] =
- {
- /* addis r12, r2, <any> */
- { insn_d (-1, -1, -1, 0), insn_d (15, 12, 2, 0), 0 },
+static const struct ppc_insn_pattern ppc64_standard_linkage1[] = {
+ /* addis r12, r2, <any> */
+ { insn_d (-1, -1, -1, 0), insn_d (15, 12, 2, 0), 0 },
- /* std r2, 40(r1) */
- { (unsigned) -1, insn_ds (62, 2, 1, 40, 0), 0 },
+ /* std r2, 40(r1) */
+ { (unsigned) -1, insn_ds (62, 2, 1, 40, 0), 0 },
- /* ld r11, <any>(r12) */
- { insn_ds (-1, -1, -1, 0, -1), insn_ds (58, 11, 12, 0, 0), 0 },
+ /* ld r11, <any>(r12) */
+ { insn_ds (-1, -1, -1, 0, -1), insn_ds (58, 11, 12, 0, 0), 0 },
- /* addis r12, r12, 1 <optional> */
- { insn_d (-1, -1, -1, -1), insn_d (15, 12, 12, 1), 1 },
+ /* addis r12, r12, 1 <optional> */
+ { insn_d (-1, -1, -1, -1), insn_d (15, 12, 12, 1), 1 },
- /* ld r2, <any>(r12) */
- { insn_ds (-1, -1, -1, 0, -1), insn_ds (58, 2, 12, 0, 0), 0 },
+ /* ld r2, <any>(r12) */
+ { insn_ds (-1, -1, -1, 0, -1), insn_ds (58, 2, 12, 0, 0), 0 },
- /* addis r12, r12, 1 <optional> */
- { insn_d (-1, -1, -1, -1), insn_d (15, 12, 12, 1), 1 },
+ /* addis r12, r12, 1 <optional> */
+ { insn_d (-1, -1, -1, -1), insn_d (15, 12, 12, 1), 1 },
- /* mtctr r11 */
- { insn_xfx (-1, -1, -1, -1), insn_xfx (31, 11, 9, 467), 0 },
+ /* mtctr r11 */
+ { insn_xfx (-1, -1, -1, -1), insn_xfx (31, 11, 9, 467), 0 },
- /* ld r11, <any>(r12) <optional> */
- { insn_ds (-1, -1, -1, 0, -1), insn_ds (58, 11, 12, 0, 0), 1 },
+ /* ld r11, <any>(r12) <optional> */
+ { insn_ds (-1, -1, -1, 0, -1), insn_ds (58, 11, 12, 0, 0), 1 },
- /* bctr */
- { (unsigned) -1, 0x4e800420, 0 },
+ /* bctr */
+ { (unsigned) -1, 0x4e800420, 0 },
- { 0, 0, 0 }
- };
+ { 0, 0, 0 }
+};
/* ELFv1 PLT call stub to access PLT entries more than +/- 32k from r2.
Also supports older stub with different placement of std 2,40(1),
@@ -163,332 +146,321 @@ static const struct ppc_insn_pattern ppc64_standard_linkage1[] =
instructions following "cmpldi r2, 0", "bnectr+" and "b <glink_i>",
but there isn't any need to match them. */
-static const struct ppc_insn_pattern ppc64_standard_linkage2[] =
- {
- /* std r2, 40(r1) <optional> */
- { (unsigned) -1, insn_ds (62, 2, 1, 40, 0), 1 },
+static const struct ppc_insn_pattern ppc64_standard_linkage2[] = {
+ /* std r2, 40(r1) <optional> */
+ { (unsigned) -1, insn_ds (62, 2, 1, 40, 0), 1 },
- /* addis r12, r2, <any> */
- { insn_d (-1, -1, -1, 0), insn_d (15, 12, 2, 0), 0 },
+ /* addis r12, r2, <any> */
+ { insn_d (-1, -1, -1, 0), insn_d (15, 12, 2, 0), 0 },
- /* std r2, 40(r1) <optional> */
- { (unsigned) -1, insn_ds (62, 2, 1, 40, 0), 1 },
+ /* std r2, 40(r1) <optional> */
+ { (unsigned) -1, insn_ds (62, 2, 1, 40, 0), 1 },
- /* ld r11, <any>(r12) */
- { insn_ds (-1, -1, -1, 0, -1), insn_ds (58, 11, 12, 0, 0), 0 },
+ /* ld r11, <any>(r12) */
+ { insn_ds (-1, -1, -1, 0, -1), insn_ds (58, 11, 12, 0, 0), 0 },
- /* addi r12, r12, <any> <optional> */
- { insn_d (-1, -1, -1, 0), insn_d (14, 12, 12, 0), 1 },
+ /* addi r12, r12, <any> <optional> */
+ { insn_d (-1, -1, -1, 0), insn_d (14, 12, 12, 0), 1 },
- /* mtctr r11 */
- { insn_xfx (-1, -1, -1, -1), insn_xfx (31, 11, 9, 467), 0 },
+ /* mtctr r11 */
+ { insn_xfx (-1, -1, -1, -1), insn_xfx (31, 11, 9, 467), 0 },
- /* xor r11, r11, r11 <optional> */
- { (unsigned) -1, 0x7d6b5a78, 1 },
+ /* xor r11, r11, r11 <optional> */
+ { (unsigned) -1, 0x7d6b5a78, 1 },
- /* add r12, r12, r11 <optional> */
- { (unsigned) -1, 0x7d8c5a14, 1 },
+ /* add r12, r12, r11 <optional> */
+ { (unsigned) -1, 0x7d8c5a14, 1 },
- /* ld r2, <any>(r12) */
- { insn_ds (-1, -1, -1, 0, -1), insn_ds (58, 2, 12, 0, 0), 0 },
+ /* ld r2, <any>(r12) */
+ { insn_ds (-1, -1, -1, 0, -1), insn_ds (58, 2, 12, 0, 0), 0 },
- /* ld r11, <any>(r12) <optional> */
- { insn_ds (-1, -1, -1, 0, -1), insn_ds (58, 11, 12, 0, 0), 1 },
+ /* ld r11, <any>(r12) <optional> */
+ { insn_ds (-1, -1, -1, 0, -1), insn_ds (58, 11, 12, 0, 0), 1 },
- /* bctr <optional> */
- { (unsigned) -1, 0x4e800420, 1 },
+ /* bctr <optional> */
+ { (unsigned) -1, 0x4e800420, 1 },
- /* cmpldi r2, 0 <optional> */
- { (unsigned) -1, 0x28220000, 1 },
+ /* cmpldi r2, 0 <optional> */
+ { (unsigned) -1, 0x28220000, 1 },
- { 0, 0, 0 }
- };
+ { 0, 0, 0 }
+};
/* ELFv1 PLT call stub to access PLT entries within +/- 32k of r2. */
-static const struct ppc_insn_pattern ppc64_standard_linkage3[] =
- {
- /* std r2, 40(r1) <optional> */
- { (unsigned) -1, insn_ds (62, 2, 1, 40, 0), 1 },
+static const struct ppc_insn_pattern ppc64_standard_linkage3[] = {
+ /* std r2, 40(r1) <optional> */
+ { (unsigned) -1, insn_ds (62, 2, 1, 40, 0), 1 },
- /* ld r11, <any>(r2) */
- { insn_ds (-1, -1, -1, 0, -1), insn_ds (58, 11, 2, 0, 0), 0 },
+ /* ld r11, <any>(r2) */
+ { insn_ds (-1, -1, -1, 0, -1), insn_ds (58, 11, 2, 0, 0), 0 },
- /* addi r2, r2, <any> <optional> */
- { insn_d (-1, -1, -1, 0), insn_d (14, 2, 2, 0), 1 },
+ /* addi r2, r2, <any> <optional> */
+ { insn_d (-1, -1, -1, 0), insn_d (14, 2, 2, 0), 1 },
- /* mtctr r11 */
- { insn_xfx (-1, -1, -1, -1), insn_xfx (31, 11, 9, 467), 0 },
+ /* mtctr r11 */
+ { insn_xfx (-1, -1, -1, -1), insn_xfx (31, 11, 9, 467), 0 },
- /* xor r11, r11, r11 <optional> */
- { (unsigned) -1, 0x7d6b5a78, 1 },
+ /* xor r11, r11, r11 <optional> */
+ { (unsigned) -1, 0x7d6b5a78, 1 },
- /* add r2, r2, r11 <optional> */
- { (unsigned) -1, 0x7c425a14, 1 },
+ /* add r2, r2, r11 <optional> */
+ { (unsigned) -1, 0x7c425a14, 1 },
- /* ld r11, <any>(r2) <optional> */
- { insn_ds (-1, -1, -1, 0, -1), insn_ds (58, 11, 2, 0, 0), 1 },
+ /* ld r11, <any>(r2) <optional> */
+ { insn_ds (-1, -1, -1, 0, -1), insn_ds (58, 11, 2, 0, 0), 1 },
- /* ld r2, <any>(r2) */
- { insn_ds (-1, -1, -1, 0, -1), insn_ds (58, 2, 2, 0, 0), 0 },
+ /* ld r2, <any>(r2) */
+ { insn_ds (-1, -1, -1, 0, -1), insn_ds (58, 2, 2, 0, 0), 0 },
- /* bctr <optional> */
- { (unsigned) -1, 0x4e800420, 1 },
+ /* bctr <optional> */
+ { (unsigned) -1, 0x4e800420, 1 },
- /* cmpldi r2, 0 <optional> */
- { (unsigned) -1, 0x28220000, 1 },
+ /* cmpldi r2, 0 <optional> */
+ { (unsigned) -1, 0x28220000, 1 },
- { 0, 0, 0 }
- };
+ { 0, 0, 0 }
+};
/* ELFv1 PLT call stub to access PLT entries more than +/- 32k from r2.
A more modern variant of ppc64_standard_linkage2 differing in
register usage. */
-static const struct ppc_insn_pattern ppc64_standard_linkage4[] =
- {
- /* std r2, 40(r1) <optional> */
- { (unsigned) -1, insn_ds (62, 2, 1, 40, 0), 1 },
+static const struct ppc_insn_pattern ppc64_standard_linkage4[] = {
+ /* std r2, 40(r1) <optional> */
+ { (unsigned) -1, insn_ds (62, 2, 1, 40, 0), 1 },
- /* addis r11, r2, <any> */
- { insn_d (-1, -1, -1, 0), insn_d (15, 11, 2, 0), 0 },
+ /* addis r11, r2, <any> */
+ { insn_d (-1, -1, -1, 0), insn_d (15, 11, 2, 0), 0 },
- /* ld r12, <any>(r11) */
- { insn_ds (-1, -1, -1, 0, -1), insn_ds (58, 12, 11, 0, 0), 0 },
+ /* ld r12, <any>(r11) */
+ { insn_ds (-1, -1, -1, 0, -1), insn_ds (58, 12, 11, 0, 0), 0 },
- /* addi r11, r11, <any> <optional> */
- { insn_d (-1, -1, -1, 0), insn_d (14, 11, 11, 0), 1 },
+ /* addi r11, r11, <any> <optional> */
+ { insn_d (-1, -1, -1, 0), insn_d (14, 11, 11, 0), 1 },
- /* mtctr r12 */
- { insn_xfx (-1, -1, -1, -1), insn_xfx (31, 12, 9, 467), 0 },
+ /* mtctr r12 */
+ { insn_xfx (-1, -1, -1, -1), insn_xfx (31, 12, 9, 467), 0 },
- /* xor r2, r12, r12 <optional> */
- { (unsigned) -1, 0x7d826278, 1 },
+ /* xor r2, r12, r12 <optional> */
+ { (unsigned) -1, 0x7d826278, 1 },
- /* add r11, r11, r2 <optional> */
- { (unsigned) -1, 0x7d6b1214, 1 },
+ /* add r11, r11, r2 <optional> */
+ { (unsigned) -1, 0x7d6b1214, 1 },
- /* ld r2, <any>(r11) */
- { insn_ds (-1, -1, -1, 0, -1), insn_ds (58, 2, 11, 0, 0), 0 },
+ /* ld r2, <any>(r11) */
+ { insn_ds (-1, -1, -1, 0, -1), insn_ds (58, 2, 11, 0, 0), 0 },
- /* ld r11, <any>(r11) <optional> */
- { insn_ds (-1, -1, -1, 0, -1), insn_ds (58, 11, 11, 0, 0), 1 },
+ /* ld r11, <any>(r11) <optional> */
+ { insn_ds (-1, -1, -1, 0, -1), insn_ds (58, 11, 11, 0, 0), 1 },
- /* bctr <optional> */
- { (unsigned) -1, 0x4e800420, 1 },
+ /* bctr <optional> */
+ { (unsigned) -1, 0x4e800420, 1 },
- /* cmpldi r2, 0 <optional> */
- { (unsigned) -1, 0x28220000, 1 },
+ /* cmpldi r2, 0 <optional> */
+ { (unsigned) -1, 0x28220000, 1 },
- { 0, 0, 0 }
- };
+ { 0, 0, 0 }
+};
/* ELFv1 PLT call stub to access PLT entries within +/- 32k of r2.
A more modern variant of ppc64_standard_linkage3 differing in
register usage. */
-static const struct ppc_insn_pattern ppc64_standard_linkage5[] =
- {
- /* std r2, 40(r1) <optional> */
- { (unsigned) -1, insn_ds (62, 2, 1, 40, 0), 1 },
+static const struct ppc_insn_pattern ppc64_standard_linkage5[] = {
+ /* std r2, 40(r1) <optional> */
+ { (unsigned) -1, insn_ds (62, 2, 1, 40, 0), 1 },
- /* ld r12, <any>(r2) */
- { insn_ds (-1, -1, -1, 0, -1), insn_ds (58, 12, 2, 0, 0), 0 },
+ /* ld r12, <any>(r2) */
+ { insn_ds (-1, -1, -1, 0, -1), insn_ds (58, 12, 2, 0, 0), 0 },
- /* addi r2, r2, <any> <optional> */
- { insn_d (-1, -1, -1, 0), insn_d (14, 2, 2, 0), 1 },
+ /* addi r2, r2, <any> <optional> */
+ { insn_d (-1, -1, -1, 0), insn_d (14, 2, 2, 0), 1 },
- /* mtctr r12 */
- { insn_xfx (-1, -1, -1, -1), insn_xfx (31, 12, 9, 467), 0 },
+ /* mtctr r12 */
+ { insn_xfx (-1, -1, -1, -1), insn_xfx (31, 12, 9, 467), 0 },
- /* xor r11, r12, r12 <optional> */
- { (unsigned) -1, 0x7d8b6278, 1 },
+ /* xor r11, r12, r12 <optional> */
+ { (unsigned) -1, 0x7d8b6278, 1 },
- /* add r2, r2, r11 <optional> */
- { (unsigned) -1, 0x7c425a14, 1 },
+ /* add r2, r2, r11 <optional> */
+ { (unsigned) -1, 0x7c425a14, 1 },
- /* ld r11, <any>(r2) <optional> */
- { insn_ds (-1, -1, -1, 0, -1), insn_ds (58, 11, 2, 0, 0), 1 },
+ /* ld r11, <any>(r2) <optional> */
+ { insn_ds (-1, -1, -1, 0, -1), insn_ds (58, 11, 2, 0, 0), 1 },
- /* ld r2, <any>(r2) */
- { insn_ds (-1, -1, -1, 0, -1), insn_ds (58, 2, 2, 0, 0), 0 },
+ /* ld r2, <any>(r2) */
+ { insn_ds (-1, -1, -1, 0, -1), insn_ds (58, 2, 2, 0, 0), 0 },
- /* bctr <optional> */
- { (unsigned) -1, 0x4e800420, 1 },
+ /* bctr <optional> */
+ { (unsigned) -1, 0x4e800420, 1 },
- /* cmpldi r2, 0 <optional> */
- { (unsigned) -1, 0x28220000, 1 },
+ /* cmpldi r2, 0 <optional> */
+ { (unsigned) -1, 0x28220000, 1 },
- { 0, 0, 0 }
- };
+ { 0, 0, 0 }
+};
/* ELFv2 PLT call stub to access PLT entries more than +/- 32k from r2. */
-static const struct ppc_insn_pattern ppc64_standard_linkage6[] =
- {
- /* std r2, 24(r1) <optional> */
- { (unsigned) -1, insn_ds (62, 2, 1, 24, 0), 1 },
+static const struct ppc_insn_pattern ppc64_standard_linkage6[] = {
+ /* std r2, 24(r1) <optional> */
+ { (unsigned) -1, insn_ds (62, 2, 1, 24, 0), 1 },
- /* addis r11, r2, <any> */
- { insn_d (-1, -1, -1, 0), insn_d (15, 11, 2, 0), 0 },
+ /* addis r11, r2, <any> */
+ { insn_d (-1, -1, -1, 0), insn_d (15, 11, 2, 0), 0 },
- /* ld r12, <any>(r11) */
- { insn_ds (-1, -1, -1, 0, -1), insn_ds (58, 12, 11, 0, 0), 0 },
+ /* ld r12, <any>(r11) */
+ { insn_ds (-1, -1, -1, 0, -1), insn_ds (58, 12, 11, 0, 0), 0 },
- /* mtctr r12 */
- { insn_xfx (-1, -1, -1, -1), insn_xfx (31, 12, 9, 467), 0 },
+ /* mtctr r12 */
+ { insn_xfx (-1, -1, -1, -1), insn_xfx (31, 12, 9, 467), 0 },
- /* bctr */
- { (unsigned) -1, 0x4e800420, 0 },
+ /* bctr */
+ { (unsigned) -1, 0x4e800420, 0 },
- { 0, 0, 0 }
- };
+ { 0, 0, 0 }
+};
/* ELFv2 PLT call stub to access PLT entries within +/- 32k of r2. */
-static const struct ppc_insn_pattern ppc64_standard_linkage7[] =
- {
- /* std r2, 24(r1) <optional> */
- { (unsigned) -1, insn_ds (62, 2, 1, 24, 0), 1 },
+static const struct ppc_insn_pattern ppc64_standard_linkage7[] = {
+ /* std r2, 24(r1) <optional> */
+ { (unsigned) -1, insn_ds (62, 2, 1, 24, 0), 1 },
- /* ld r12, <any>(r2) */
- { insn_ds (-1, -1, -1, 0, -1), insn_ds (58, 12, 2, 0, 0), 0 },
+ /* ld r12, <any>(r2) */
+ { insn_ds (-1, -1, -1, 0, -1), insn_ds (58, 12, 2, 0, 0), 0 },
- /* mtctr r12 */
- { insn_xfx (-1, -1, -1, -1), insn_xfx (31, 12, 9, 467), 0 },
+ /* mtctr r12 */
+ { insn_xfx (-1, -1, -1, -1), insn_xfx (31, 12, 9, 467), 0 },
- /* bctr */
- { (unsigned) -1, 0x4e800420, 0 },
+ /* bctr */
+ { (unsigned) -1, 0x4e800420, 0 },
- { 0, 0, 0 }
- };
+ { 0, 0, 0 }
+};
/* ELFv2 PLT call stub to access PLT entries more than +/- 32k from r2,
supporting fusion. */
-static const struct ppc_insn_pattern ppc64_standard_linkage8[] =
- {
- /* std r2, 24(r1) <optional> */
- { (unsigned) -1, insn_ds (62, 2, 1, 24, 0), 1 },
+static const struct ppc_insn_pattern ppc64_standard_linkage8[] = {
+ /* std r2, 24(r1) <optional> */
+ { (unsigned) -1, insn_ds (62, 2, 1, 24, 0), 1 },
- /* addis r12, r2, <any> */
- { insn_d (-1, -1, -1, 0), insn_d (15, 12, 2, 0), 0 },
+ /* addis r12, r2, <any> */
+ { insn_d (-1, -1, -1, 0), insn_d (15, 12, 2, 0), 0 },
- /* ld r12, <any>(r12) */
- { insn_ds (-1, -1, -1, 0, -1), insn_ds (58, 12, 12, 0, 0), 0 },
+ /* ld r12, <any>(r12) */
+ { insn_ds (-1, -1, -1, 0, -1), insn_ds (58, 12, 12, 0, 0), 0 },
- /* mtctr r12 */
- { insn_xfx (-1, -1, -1, -1), insn_xfx (31, 12, 9, 467), 0 },
+ /* mtctr r12 */
+ { insn_xfx (-1, -1, -1, -1), insn_xfx (31, 12, 9, 467), 0 },
- /* bctr */
- { (unsigned) -1, 0x4e800420, 0 },
+ /* bctr */
+ { (unsigned) -1, 0x4e800420, 0 },
- { 0, 0, 0 }
- };
+ { 0, 0, 0 }
+};
/* Power 10 ELFv2 PLT call stubs */
-static const struct ppc_insn_pattern ppc64_standard_linkage9[] =
- {
- /* std %r2,0+40(%r1) <optional> */
- { insn_ds (-1, -1, -1, 0, 1), insn_ds (62, 2, 1, 40, 0), 1 },
+static const struct ppc_insn_pattern ppc64_standard_linkage9[] = {
+ /* std %r2,0+40(%r1) <optional> */
+ { insn_ds (-1, -1, -1, 0, 1), insn_ds (62, 2, 1, 40, 0), 1 },
- /* pld r12, <any> */
- { prefix (-1, -1, 1, 0), prefix (0, 0, 1, 0), 0 },
- { insn_d (-1, -1, -1, 0), insn_d (57, 12, 0, 0), 0 },
+ /* pld r12, <any> */
+ { prefix (-1, -1, 1, 0), prefix (0, 0, 1, 0), 0 },
+ { insn_d (-1, -1, -1, 0), insn_d (57, 12, 0, 0), 0 },
- /* mtctr r12 */
- { insn_xfx (-1, -1, -1, -1), insn_xfx (31, 12, 9, 467), 0 },
+ /* mtctr r12 */
+ { insn_xfx (-1, -1, -1, -1), insn_xfx (31, 12, 9, 467), 0 },
- /* bctr */
- { (unsigned) -1, 0x4e800420, 0 },
+ /* bctr */
+ { (unsigned) -1, 0x4e800420, 0 },
- { 0, 0, 0 }
- };
+ { 0, 0, 0 }
+};
-static const struct ppc_insn_pattern ppc64_standard_linkage10[] =
- {
- /* std %r2,0+40(%r1) <optional> */
- { insn_ds (-1, -1, -1, 0, 1), insn_ds (62, 2, 1, 40, 0), 1 },
+static const struct ppc_insn_pattern ppc64_standard_linkage10[] = {
+ /* std %r2,0+40(%r1) <optional> */
+ { insn_ds (-1, -1, -1, 0, 1), insn_ds (62, 2, 1, 40, 0), 1 },
- /* paddi r12,<any> */
- { prefix (-1, -1, 1, 0), prefix (2, 0, 1, 0), 0 },
- { insn_d (-1, -1, -1, 0), insn_d (14, 12, 0, 0), 0 },
+ /* paddi r12,<any> */
+ { prefix (-1, -1, 1, 0), prefix (2, 0, 1, 0), 0 },
+ { insn_d (-1, -1, -1, 0), insn_d (14, 12, 0, 0), 0 },
- /* mtctr r12 <optional> */
- { insn_xfx (-1, -1, -1, -1), insn_xfx (31, 12, 9, 467), 0 },
+ /* mtctr r12 <optional> */
+ { insn_xfx (-1, -1, -1, -1), insn_xfx (31, 12, 9, 467), 0 },
- /* bctr */
- { (unsigned) -1, 0x4e800420, 0 },
+ /* bctr */
+ { (unsigned) -1, 0x4e800420, 0 },
- { 0, 0, 0 }
- };
+ { 0, 0, 0 }
+};
-static const struct ppc_insn_pattern ppc64_standard_linkage11[] =
- {
- /* std %r2,0+40(%r1) <optional> */
- { insn_ds (-1, -1, -1, 0, 1), insn_ds (62, 2, 1, 40, 0), 1 },
+static const struct ppc_insn_pattern ppc64_standard_linkage11[] = {
+ /* std %r2,0+40(%r1) <optional> */
+ { insn_ds (-1, -1, -1, 0, 1), insn_ds (62, 2, 1, 40, 0), 1 },
- /* li %r11,0 <optional> */
- { insn_d (-1, -1, -1, 0), insn_d (14, 11, 0, 0), 1 },
+ /* li %r11,0 <optional> */
+ { insn_d (-1, -1, -1, 0), insn_d (14, 11, 0, 0), 1 },
- /* sldi %r11,%r11,34 <eq to rldicr rx,ry,n, 63-n> <optional> */
- { insn_md (-1, -1, -1, 0, 0, 1), insn_md (30, 11, 11, 34, 63-34, 0), 1 },
+ /* sldi %r11,%r11,34 <eq to rldicr rx,ry,n, 63-n> <optional> */
+ { insn_md (-1, -1, -1, 0, 0, 1), insn_md (30, 11, 11, 34, 63 - 34, 0), 1 },
- /* paddi r12, <any> */
- { prefix (-1, -1, 1, 0), prefix (2, 0, 1, 0), 0 },
- { insn_d (-1, -1, -1, 0), insn_d (14, 12, 0, 0), 0 },
+ /* paddi r12, <any> */
+ { prefix (-1, -1, 1, 0), prefix (2, 0, 1, 0), 0 },
+ { insn_d (-1, -1, -1, 0), insn_d (14, 12, 0, 0), 0 },
- /* ldx %r12,%r11,%r12 <optional> */
- { (unsigned) -1, insn_x (31, 12, 11, 12, 21), 1 },
+ /* ldx %r12,%r11,%r12 <optional> */
+ { (unsigned) -1, insn_x (31, 12, 11, 12, 21), 1 },
- /* add %r12,%r11,%r12 <optional> */
- { (unsigned) -1, insn_xo (31, 12, 11, 12, 0, 0, 40), 1 },
+ /* add %r12,%r11,%r12 <optional> */
+ { (unsigned) -1, insn_xo (31, 12, 11, 12, 0, 0, 40), 1 },
- /* mtctr r12 */
- { insn_xfx (-1, -1, -1, -1), insn_xfx (31, 12, 9, 467), 0 },
+ /* mtctr r12 */
+ { insn_xfx (-1, -1, -1, -1), insn_xfx (31, 12, 9, 467), 0 },
- /* bctr */ // 13, 14, 15, 16
- { (unsigned) -1, 0x4e800420, 0 },
+ /* bctr */ // 13, 14, 15, 16
+ { (unsigned) -1, 0x4e800420, 0 },
- { 0, 0, 0 }
- };
+ { 0, 0, 0 }
+};
-static const struct ppc_insn_pattern ppc64_standard_linkage12[] =
- {
- /* std %r2,0+40(%r1) <optional> */
- { insn_ds (-1, -1, -1, 0, 1), insn_ds (62, 2, 1, 40, 0), 1 },
+static const struct ppc_insn_pattern ppc64_standard_linkage12[] = {
+ /* std %r2,0+40(%r1) <optional> */
+ { insn_ds (-1, -1, -1, 0, 1), insn_ds (62, 2, 1, 40, 0), 1 },
- /* lis %r11,xxx@ha <equivalent addis rx, 0, val> */
- /* addis r12, r2, <any> */
- { insn_d (-1, -1, -1, 0), insn_d (15, 12, 2, 0), 0 },
+ /* lis %r11,xxx@ha <equivalent addis rx, 0, val> */
+ /* addis r12, r2, <any> */
+ { insn_d (-1, -1, -1, 0), insn_d (15, 12, 2, 0), 0 },
- /* ori %r11,%r11,xxx@l */
- { insn_d (-1, -1, -1, 0), insn_d (24, 11, 11, 0), 0 },
+ /* ori %r11,%r11,xxx@l */
+ { insn_d (-1, -1, -1, 0), insn_d (24, 11, 11, 0), 0 },
- /* sldi %r11,%r11,34 <optional> */
- { (unsigned) -1, insn_md (30, 11, 11, 34, 63-34, 0), 1 },
+ /* sldi %r11,%r11,34 <optional> */
+ { (unsigned) -1, insn_md (30, 11, 11, 34, 63 - 34, 0), 1 },
- /*paddi r12,<any> */
- { prefix (-1, -1, 1, 0), prefix (2, 0, 1, 0), 0 },
- { insn_d (-1, -1, -1, 0), insn_d (14, 12, 0, 0), 0 },
+ /*paddi r12,<any> */
+ { prefix (-1, -1, 1, 0), prefix (2, 0, 1, 0), 0 },
+ { insn_d (-1, -1, -1, 0), insn_d (14, 12, 0, 0), 0 },
- /* sldi %r11,%r11,34 <optional> */
- { (unsigned) -1, insn_md (30, 11, 11, 34, 63-34, 0), 1 },
+ /* sldi %r11,%r11,34 <optional> */
+ { (unsigned) -1, insn_md (30, 11, 11, 34, 63 - 34, 0), 1 },
- /* ldx %r12,%r11,%r12 <optional> */
- { (unsigned) -1, insn_x (31, 12, 11, 12, 21), 1 },
+ /* ldx %r12,%r11,%r12 <optional> */
+ { (unsigned) -1, insn_x (31, 12, 11, 12, 21), 1 },
- /* add %r12,%r11,%r12 <optional> */
- { (unsigned) -1, insn_xo (31, 12, 11, 12, 0, 0, 40), 1 },
+ /* add %r12,%r11,%r12 <optional> */
+ { (unsigned) -1, insn_xo (31, 12, 11, 12, 0, 0, 40), 1 },
- /* mtctr r12 */
- { insn_xfx (-1, -1, -1, -1), insn_xfx (31, 12, 9, 467), 0 },
+ /* mtctr r12 */
+ { insn_xfx (-1, -1, -1, -1), insn_xfx (31, 12, 9, 467), 0 },
- /* bctr */ // 17, 18, 19, 20
- { (unsigned) -1, 0x4e800420, 0 },
+ /* bctr */ // 17, 18, 19, 20
+ { (unsigned) -1, 0x4e800420, 0 },
- { 0, 0, 0 }
- };
+ { 0, 0, 0 }
+};
/* When the dynamic linker is doing lazy symbol resolution, the first
call to a function in another object will go like this:
@@ -548,8 +520,8 @@ static const struct ppc_insn_pattern ppc64_standard_linkage12[] =
static CORE_ADDR
ppc64_standard_linkage1_target (frame_info_ptr frame, unsigned int *insn)
{
- CORE_ADDR plt_off = ((ppc_insn_d_field (insn[0]) << 16)
- + ppc_insn_ds_field (insn[2]));
+ CORE_ADDR plt_off
+ = ((ppc_insn_d_field (insn[0]) << 16) + ppc_insn_ds_field (insn[2]));
return ppc64_plt_entry_point (frame, plt_off);
}
@@ -557,8 +529,8 @@ ppc64_standard_linkage1_target (frame_info_ptr frame, unsigned int *insn)
static CORE_ADDR
ppc64_standard_linkage2_target (frame_info_ptr frame, unsigned int *insn)
{
- CORE_ADDR plt_off = ((ppc_insn_d_field (insn[1]) << 16)
- + ppc_insn_ds_field (insn[3]));
+ CORE_ADDR plt_off
+ = ((ppc_insn_d_field (insn[1]) << 16) + ppc_insn_ds_field (insn[3]));
return ppc64_plt_entry_point (frame, plt_off);
}
@@ -574,8 +546,8 @@ ppc64_standard_linkage3_target (frame_info_ptr frame, unsigned int *insn)
static CORE_ADDR
ppc64_standard_linkage4_target (frame_info_ptr frame, unsigned int *insn)
{
- CORE_ADDR plt_off = ((ppc_insn_d_field (insn[1]) << 16)
- + ppc_insn_ds_field (insn[2]));
+ CORE_ADDR plt_off
+ = ((ppc_insn_d_field (insn[1]) << 16) + ppc_insn_ds_field (insn[2]));
return ppc64_plt_entry_point (frame, plt_off);
}
@@ -603,7 +575,6 @@ ppc64_pcrel_linkage2_target (frame_info_ptr frame, unsigned int *insn,
return ppc64_plt_pcrel_entry_point (frame, plt_off, pc);
}
-
/* Given that we've begun executing a call trampoline at PC, return
the entry point of the function the trampoline will go to.
@@ -613,21 +584,22 @@ ppc64_pcrel_linkage2_target (frame_info_ptr frame, unsigned int *insn,
static CORE_ADDR
ppc64_skip_trampoline_code_1 (frame_info_ptr frame, CORE_ADDR pc)
{
-#define MAX(a,b) ((a) > (b) ? (a) : (b))
- unsigned int insns[MAX (MAX (MAX (ARRAY_SIZE (ppc64_standard_linkage1),
- ARRAY_SIZE (ppc64_standard_linkage2)),
- MAX (ARRAY_SIZE (ppc64_standard_linkage3),
- ARRAY_SIZE (ppc64_standard_linkage4))),
- MAX(MAX (MAX (ARRAY_SIZE (ppc64_standard_linkage5),
- ARRAY_SIZE (ppc64_standard_linkage6)),
- MAX (ARRAY_SIZE (ppc64_standard_linkage7),
- ARRAY_SIZE (ppc64_standard_linkage8))),
- MAX (MAX (ARRAY_SIZE (ppc64_standard_linkage9),
- ARRAY_SIZE (ppc64_standard_linkage10)),
- MAX (ARRAY_SIZE (ppc64_standard_linkage11),
- ARRAY_SIZE (ppc64_standard_linkage12)))))
-
- - 1];
+#define MAX(a, b) ((a) > (b) ? (a) : (b))
+ unsigned int
+ insns[MAX (MAX (MAX (ARRAY_SIZE (ppc64_standard_linkage1),
+ ARRAY_SIZE (ppc64_standard_linkage2)),
+ MAX (ARRAY_SIZE (ppc64_standard_linkage3),
+ ARRAY_SIZE (ppc64_standard_linkage4))),
+ MAX (MAX (MAX (ARRAY_SIZE (ppc64_standard_linkage5),
+ ARRAY_SIZE (ppc64_standard_linkage6)),
+ MAX (ARRAY_SIZE (ppc64_standard_linkage7),
+ ARRAY_SIZE (ppc64_standard_linkage8))),
+ MAX (MAX (ARRAY_SIZE (ppc64_standard_linkage9),
+ ARRAY_SIZE (ppc64_standard_linkage10)),
+ MAX (ARRAY_SIZE (ppc64_standard_linkage11),
+ ARRAY_SIZE (ppc64_standard_linkage12)))))
+
+ - 1];
CORE_ADDR target;
int scan_limit, i;
@@ -640,19 +612,24 @@ ppc64_skip_trampoline_code_1 (frame_info_ptr frame, CORE_ADDR pc)
for (i = 0; i < scan_limit; i++)
{
if (i < ARRAY_SIZE (ppc64_standard_linkage12) - 1
- && ppc_insns_match_pattern (frame, pc, ppc64_standard_linkage12, insns))
+ && ppc_insns_match_pattern (frame, pc, ppc64_standard_linkage12,
+ insns))
pc = ppc64_pcrel_linkage1_target (frame, insns, pc);
else if (i < ARRAY_SIZE (ppc64_standard_linkage11) - 1
- && ppc_insns_match_pattern (frame, pc, ppc64_standard_linkage11, insns))
+ && ppc_insns_match_pattern (frame, pc, ppc64_standard_linkage11,
+ insns))
pc = ppc64_pcrel_linkage2_target (frame, insns, pc);
else if (i < ARRAY_SIZE (ppc64_standard_linkage10) - 1
- && ppc_insns_match_pattern (frame, pc, ppc64_standard_linkage10, insns))
+ && ppc_insns_match_pattern (frame, pc, ppc64_standard_linkage10,
+ insns))
pc = ppc64_pcrel_linkage1_target (frame, insns, pc);
else if (i < ARRAY_SIZE (ppc64_standard_linkage9) - 1
- && ppc_insns_match_pattern (frame, pc, ppc64_standard_linkage9, insns))
+ && ppc_insns_match_pattern (frame, pc, ppc64_standard_linkage9,
+ insns))
pc = ppc64_pcrel_linkage1_target (frame, insns, pc);
else if (i < ARRAY_SIZE (ppc64_standard_linkage8) - 1
- && ppc_insns_match_pattern (frame, pc, ppc64_standard_linkage8, insns))
+ && ppc_insns_match_pattern (frame, pc, ppc64_standard_linkage8,
+ insns))
pc = ppc64_standard_linkage4_target (frame, insns);
else if (i < ARRAY_SIZE (ppc64_standard_linkage7) - 1
&& ppc_insns_match_pattern (frame, pc, ppc64_standard_linkage7,
@@ -698,7 +675,7 @@ ppc64_skip_trampoline_code_1 (frame_info_ptr frame, CORE_ADDR pc)
symbols, find_solib_trampoline_target should be able to resolve them. */
target = find_solib_trampoline_target (frame, pc);
return target ? target : pc;
- }
+ }
return 0;
}
@@ -744,9 +721,8 @@ ppc64_skip_trampoline_code (frame_info_ptr frame, CORE_ADDR pc)
random addresses such as occur when there is no symbol table. */
CORE_ADDR
-ppc64_convert_from_func_ptr_addr (struct gdbarch *gdbarch,
- CORE_ADDR addr,
- struct target_ops *targ)
+ppc64_convert_from_func_ptr_addr (struct gdbarch *gdbarch, CORE_ADDR addr,
+ struct target_ops *targ)
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
const struct target_section *s = target_section_by_addr (targ, addr);
@@ -778,12 +754,12 @@ ppc64_convert_from_func_ptr_addr (struct gdbarch *gdbarch,
int res;
res = bfd_get_section_contents (s->the_bfd_section->owner,
- s->the_bfd_section,
- &buf, addr - s->addr, 8);
+ s->the_bfd_section, &buf, addr - s->addr,
+ 8);
if (res != 0)
return (extract_unsigned_integer (buf, 8, byte_order)
- bfd_section_vma (s->the_bfd_section) + s->addr);
- }
+ }
return addr;
}