Hi
Here's a patch which I hope others can take a look at. Most of it is
"noise" in that the register numbers are different. This gets
libunwind working on Power7/PPC64. I'll follow-up in the near future
with a Power8 patch (if needed).
Hopefully others are friendly to our Solaris changes as well. (Should
be easier to review)
Thanks
diff --git a/include/libunwind-ppc64.h b/include/libunwind-ppc64.h
index 9944628..4cbb1ff 100644
--- a/include/libunwind-ppc64.h
+++ b/include/libunwind-ppc64.h
@@ -44,26 +44,6 @@ extern "C" {
#define _U_TDEP_QP_TRUE 0 /* see libunwind-dynamic.h */
-/*
- * This needs to be big enough to accommodate "struct cursor", while
- * leaving some slack for future expansion. Changing this value will
- * require recompiling all users of this library. Stack allocation is
- * relatively cheap and unwind-state copying is relatively rare, so we want
- * to err on making it rather too big than too small.
- *
- * To simplify this whole process, we are at least initially taking the
- * tack that UNW_PPC64_* map straight across to the .eh_frame column register
- * numbers. These register numbers come from gcc's source in
- * gcc/config/rs6000/rs6000.h
- *
- * UNW_TDEP_CURSOR_LEN is in terms of unw_word_t size. Since we have 115
- * elements in the loc array, each sized 2 * unw_word_t, plus the rest of
- * the cursor struct, this puts us at about 2 * 115 + 40 = 270. Let's
- * round that up to 280.
- */
-
-#define UNW_TDEP_CURSOR_LEN 280
-
#if __WORDSIZE==32
typedef uint32_t unw_word_t;
typedef int32_t unw_sword_t;
@@ -81,9 +61,15 @@ typedef struct {
uint64_t halves[2];
} unw_tdep_vreg_t;
+/*
+ * To simplify this whole process, we are at least initially taking the
+ * tack that UNW_PPC64_* map straight across to the .eh_frame column register
+ * numbers. These register numbers come from bg/q in /usr/include/asm/ptrace.h
+ */
+
typedef enum
{
- UNW_PPC64_R0,
+ UNW_PPC64_R0=0,
UNW_PPC64_R1, /* called STACK_POINTER in gcc */
UNW_PPC64_R2,
UNW_PPC64_R3,
@@ -115,8 +101,24 @@ typedef enum
UNW_PPC64_R29,
UNW_PPC64_R30,
UNW_PPC64_R31, /* called HARD_FRAME_POINTER in gcc */
-
- UNW_PPC64_F0 = 32,
+ UNW_PPC64_FRAME_POINTER = UNW_PPC64_R31,
+
+ UNW_PPC64_NIP = 32,
+ UNW_PPC64_MSR = 33,
+ UNW_PPC64_ORIG_R3 = 34,
+ UNW_PPC64_CTR = 35,
+ UNW_PPC64_LR = 36,
+ UNW_PPC64_XER = 37,
+ UNW_PPC64_CCR = 38,
+ UNW_PPC64_SOFTE = 39,
+ UNW_PPC64_TRAP = 40,
+ UNW_PPC64_DAR = 41,
+ UNW_PPC64_DSISR = 42,
+ UNW_PPC64_RESULT = 43,
+ UNW_PPC64_REGS_COUNT = 44,
+ UNW_PPC64_ARG_POINTER,
+
+ UNW_PPC64_F0 = 48,
UNW_PPC64_F1,
UNW_PPC64_F2,
UNW_PPC64_F3,
@@ -148,6 +150,7 @@ typedef enum
UNW_PPC64_F29,
UNW_PPC64_F30,
UNW_PPC64_F31,
+ UNW_PPC64_FPSCR = ( UNW_PPC64_F0 + 32 ),
/* Note that there doesn't appear to be an .eh_frame register column
for the FPSCR register. I don't know why this is. Since .eh_frame
info is what this implementation uses for unwinding, we have no way
@@ -155,70 +158,86 @@ typedef enum
number in the libunwind API.
*/
- UNW_PPC64_LR = 65,
- UNW_PPC64_CTR = 66,
- UNW_PPC64_ARG_POINTER = 67,
-
- UNW_PPC64_CR0 = 68,
- UNW_PPC64_CR1,
- UNW_PPC64_CR2,
- UNW_PPC64_CR3,
- UNW_PPC64_CR4,
- /* CR5 .. CR7 are currently unused */
- UNW_PPC64_CR5,
- UNW_PPC64_CR6,
- UNW_PPC64_CR7,
-
- UNW_PPC64_XER = 76,
-
- UNW_PPC64_V0 = 77,
- UNW_PPC64_V1,
- UNW_PPC64_V2,
- UNW_PPC64_V3,
- UNW_PPC64_V4,
- UNW_PPC64_V5,
- UNW_PPC64_V6,
- UNW_PPC64_V7,
- UNW_PPC64_V8,
- UNW_PPC64_V9,
- UNW_PPC64_V10,
- UNW_PPC64_V11,
- UNW_PPC64_V12,
- UNW_PPC64_V13,
- UNW_PPC64_V14,
- UNW_PPC64_V15,
- UNW_PPC64_V16,
- UNW_PPC64_V17,
- UNW_PPC64_V18,
- UNW_PPC64_V19,
- UNW_PPC64_V20,
- UNW_PPC64_V21,
- UNW_PPC64_V22,
- UNW_PPC64_V23,
- UNW_PPC64_V24,
- UNW_PPC64_V25,
- UNW_PPC64_V26,
- UNW_PPC64_V27,
- UNW_PPC64_V28,
- UNW_PPC64_V29,
- UNW_PPC64_V30,
- UNW_PPC64_V31,
-
- UNW_PPC64_VRSAVE = 109,
- UNW_PPC64_VSCR = 110,
- UNW_PPC64_SPE_ACC = 111,
- UNW_PPC64_SPEFSCR = 112,
-
- /* frame info (read-only) */
- UNW_PPC64_FRAME_POINTER,
- UNW_PPC64_NIP,
-
-
- UNW_TDEP_LAST_REG = UNW_PPC64_NIP,
+ UNW_PPC64_V0 = 82, /* each Vector reg occupies 2 slots in 64-bit */
+ UNW_PPC64_V1 = 84,
+ UNW_PPC64_V2 = 86,
+ UNW_PPC64_V3 = 88,
+ UNW_PPC64_V4 = 90,
+ UNW_PPC64_V5 = 92,
+ UNW_PPC64_V6 = 94,
+ UNW_PPC64_V7 = 96,
+ UNW_PPC64_V8 = 98,
+ UNW_PPC64_V9 = 100,
+ UNW_PPC64_V10 = 102,
+ UNW_PPC64_V11 = 104,
+ UNW_PPC64_V12 = 106,
+ UNW_PPC64_V13 = 108,
+ UNW_PPC64_V14 = 110,
+ UNW_PPC64_V15 = 112,
+ UNW_PPC64_V16 = 114,
+ UNW_PPC64_V17 = 116,
+ UNW_PPC64_V18 = 118,
+ UNW_PPC64_V19 = 120,
+ UNW_PPC64_V20 = 122,
+ UNW_PPC64_V21 = 124,
+ UNW_PPC64_V22 = 126,
+ UNW_PPC64_V23 = 128,
+ UNW_PPC64_V24 = 130,
+ UNW_PPC64_V25 = 132,
+ UNW_PPC64_V26 = 134,
+ UNW_PPC64_V27 = 136,
+ UNW_PPC64_V28 = 138,
+ UNW_PPC64_V29 = 140,
+ UNW_PPC64_V30 = 142,
+ UNW_PPC64_V31 = 144,
+// 146 is unused
+ UNW_PPC64_VSCR = (UNW_PPC64_V0 + 32*2 + 1), //147
+ UNW_PPC64_VRSAVE = (UNW_PPC64_V0 + 33*2), //148
+/*
+ * * Only store first 32 VSRs here. The second 32 VSRs in VR0-31
+ * */
+ UNW_PPC64_VSR0 = 150, /* each VSR reg occupies 2 slots in 64-bit */
+ UNW_PPC64_VSR1 = 152,
+ UNW_PPC64_VSR2 = 154,
+ UNW_PPC64_VSR3 = 156,
+ UNW_PPC64_VSR4 = 158,
+ UNW_PPC64_VSR5 = 160,
+ UNW_PPC64_VSR6 = 162,
+ UNW_PPC64_VSR7 = 164,
+ UNW_PPC64_VSR8 = 166,
+ UNW_PPC64_VSR9 = 168,
+ UNW_PPC64_VSR10 = 170,
+ UNW_PPC64_VSR11 = 172,
+ UNW_PPC64_VSR12 = 174,
+ UNW_PPC64_VSR13 = 176,
+ UNW_PPC64_VSR14 = 178,
+ UNW_PPC64_VSR15 = 180,
+ UNW_PPC64_VSR16 = 182,
+ UNW_PPC64_VSR17 = 184,
+ UNW_PPC64_VSR18 = 186,
+ UNW_PPC64_VSR19 = 188,
+ UNW_PPC64_VSR20 = 190,
+ UNW_PPC64_VSR21 = 192,
+ UNW_PPC64_VSR22 = 194,
+ UNW_PPC64_VSR23 = 196,
+ UNW_PPC64_VSR24 = 198,
+ UNW_PPC64_VSR25 = 200,
+ UNW_PPC64_VSR26 = 202,
+ UNW_PPC64_VSR27 = 204,
+ UNW_PPC64_VSR28 = 206,
+ UNW_PPC64_VSR29 = 208,
+ UNW_PPC64_VSR30 = 210,
+ UNW_PPC64_VSR31 = 212,
+
+ UNW_PPC64_SPE_ACC = 214,
+ UNW_PPC64_SPEFSCR = 216,
+#define UNW_PPC64_REGS_AMOUNT 218
+
+ UNW_TDEP_LAST_REG = UNW_PPC64_NIP, // maybe it should be some some more registers to restore
UNW_TDEP_IP = UNW_PPC64_NIP,
UNW_TDEP_SP = UNW_PPC64_R1,
- UNW_TDEP_EH = UNW_PPC64_R12
+ UNW_TDEP_EH = UNW_PPC64_R12,
}
ppc64_regnum_t;
@@ -229,6 +248,25 @@ typedef enum
}
ppc64_abi_t;
+#include "dwarf-config.h"
+#if DWARF_NUM_PRESERVED_REGS != UNW_PPC64_REGS_AMOUNT
+#error DWARF_NUM_PRESERVED_REGS must be equal to UNW_PPC64_REGS_AMOUNT
+#endif
+
+/*
+ * This needs to be big enough to accommodate "struct cursor", while
+ * leaving some slack for future expansion. Changing this value will
+ * require recompiling all users of this library. Stack allocation is
+ * relatively cheap and unwind-state copying is relatively rare, so we want
+ * to err on making it rather too big than too small.
+ *
+ * UNW_TDEP_CURSOR_LEN is in terms of unw_word_t size. Since we have UNW_LAST_REG
+ * elements in the loc array, each sized 2 * unw_word_t(see struct dwarf_loc_t in dwarf-config.h),
+ * plus the rest of the cursor struct (see struct dwarf_cursor_t in include/dwarf.h)
+ */
+
+#define UNW_TDEP_CURSOR_LEN (128 + UNW_PPC64_REGS_AMOUNT * 2)
+
/*
* According to David Edelsohn, GNU gcc uses R3, R4, R5, and maybe R6 for
* passing parameters to exception handlers.
diff --git a/include/tdep-ppc64/dwarf-config.h b/include/tdep-ppc64/dwarf-config.h
index 6d8ef0a..f7161c1 100644
--- a/include/tdep-ppc64/dwarf-config.h
+++ b/include/tdep-ppc64/dwarf-config.h
@@ -32,10 +32,10 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#ifndef dwarf_config_h
#define dwarf_config_h
-/* For PPC64, 48 GPRs + 33 FPRs + 33 AltiVec + 1 SPE */
-#define DWARF_NUM_PRESERVED_REGS 115
+/* For PPC64, see register numbers in include/libunwind-ppc64.h, that is equal to /usr/include/asm/ptrace.h */
+#define DWARF_NUM_PRESERVED_REGS 218
-#define DWARF_REGNUM_MAP_LENGTH 115
+#define DWARF_REGNUM_MAP_LENGTH (DWARF_NUM_PRESERVED_REGS)
/* Return TRUE if the ADDR_SPACE uses big-endian byte-order. */
#define dwarf_is_big_endian(addr_space) ((addr_space)->big_endian)
diff --git a/include/tdep-ppc64/libunwind_i.h b/include/tdep-ppc64/libunwind_i.h
index 41fb433..ccce231 100644
--- a/include/tdep-ppc64/libunwind_i.h
+++ b/include/tdep-ppc64/libunwind_i.h
@@ -79,6 +79,7 @@ struct cursor
}
sigcontext_format;
unw_word_t sigcontext_addr;
+ ucontext_t *uc;
};
#define DWARF_GET_LOC(l) ((l).val)
diff --git a/src/ppc/Gget_proc_info.c b/src/ppc/Gget_proc_info.c
index ff08d1b..2b63e54 100644
--- a/src/ppc/Gget_proc_info.c
+++ b/src/ppc/Gget_proc_info.c
@@ -29,6 +29,19 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
PROTECTED int
unw_get_proc_info (unw_cursor_t *cursor, unw_proc_info_t *pi)
{
- /* XXX: empty stub. */
- return -UNW_EINVAL;
+ struct cursor *c = (struct cursor *) cursor;
+
+ if (dwarf_make_proc_info (&c->dwarf) < 0)
+ {
+ /* On x86-64, some key routines such as _start() and _dl_start()
+ * are missing DWARF unwind info. We don't want to fail in that
+ * case, because those frames are uninteresting and just mark
+ * the end of the frame-chain anyhow. */
+ memset (pi, 0, sizeof (*pi));
+ pi->start_ip = c->dwarf.ip;
+ pi->end_ip = c->dwarf.ip + 1;
+ return 0;
+ }
+ *pi = c->dwarf.pi;
+ return 0;
}
diff --git a/src/ppc/Gget_save_loc.c b/src/ppc/Gget_save_loc.c
index c5beb81..951ef41 100644
--- a/src/ppc/Gget_save_loc.c
+++ b/src/ppc/Gget_save_loc.c
@@ -29,6 +29,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
PROTECTED int
unw_get_save_loc (unw_cursor_t *cursor, int reg, unw_save_loc_t *sloc)
{
+ abort();
/* XXX: empty stub. */
return 0;
}
diff --git a/src/ppc/Ginit_local.c b/src/ppc/Ginit_local.c
index 4ca2b25..e2d68df 100644
--- a/src/ppc/Ginit_local.c
+++ b/src/ppc/Ginit_local.c
@@ -37,6 +37,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
PROTECTED int
unw_init_local (unw_cursor_t *cursor, ucontext_t *uc)
{
+ abort();
/* XXX: empty stub. */
return -UNW_EINVAL;
}
@@ -55,6 +56,8 @@ unw_init_local (unw_cursor_t *cursor, ucontext_t *uc)
c->dwarf.as = unw_local_addr_space;
c->dwarf.as_arg = uc;
+ c->uc = uc;
+ Debug (1, "(c->uc=%p)\n", uc);
#ifdef UNW_TARGET_PPC64
return common_init_ppc64 (c, 1);
#else
diff --git a/src/ppc64/Gglobal.c b/src/ppc64/Gglobal.c
index 9d0b0f5..dc99eb7 100644
--- a/src/ppc64/Gglobal.c
+++ b/src/ppc64/Gglobal.c
@@ -35,124 +35,159 @@ HIDDEN int tdep_init_done;
registers, for now at least. */
HIDDEN const uint8_t dwarf_to_unw_regnum_map[DWARF_REGNUM_MAP_LENGTH] =
{
- [UNW_PPC64_R0]=UNW_PPC64_R0,
- [UNW_PPC64_R1]=UNW_PPC64_R1,
- [UNW_PPC64_R2]=UNW_PPC64_R2,
- [UNW_PPC64_R3]=UNW_PPC64_R3,
- [UNW_PPC64_R4]=UNW_PPC64_R4,
- [UNW_PPC64_R5]=UNW_PPC64_R5,
- [UNW_PPC64_R6]=UNW_PPC64_R6,
- [UNW_PPC64_R7]=UNW_PPC64_R7,
- [UNW_PPC64_R8]=UNW_PPC64_R8,
- [UNW_PPC64_R9]=UNW_PPC64_R9,
- [UNW_PPC64_R10]=UNW_PPC64_R10,
- [UNW_PPC64_R11]=UNW_PPC64_R11,
- [UNW_PPC64_R12]=UNW_PPC64_R12,
- [UNW_PPC64_R13]=UNW_PPC64_R13,
- [UNW_PPC64_R14]=UNW_PPC64_R14,
- [UNW_PPC64_R15]=UNW_PPC64_R15,
- [UNW_PPC64_R16]=UNW_PPC64_R16,
- [UNW_PPC64_R17]=UNW_PPC64_R17,
- [UNW_PPC64_R18]=UNW_PPC64_R18,
- [UNW_PPC64_R19]=UNW_PPC64_R19,
- [UNW_PPC64_R20]=UNW_PPC64_R20,
- [UNW_PPC64_R21]=UNW_PPC64_R21,
- [UNW_PPC64_R22]=UNW_PPC64_R22,
- [UNW_PPC64_R23]=UNW_PPC64_R23,
- [UNW_PPC64_R24]=UNW_PPC64_R24,
- [UNW_PPC64_R25]=UNW_PPC64_R25,
- [UNW_PPC64_R26]=UNW_PPC64_R26,
- [UNW_PPC64_R27]=UNW_PPC64_R27,
- [UNW_PPC64_R28]=UNW_PPC64_R28,
- [UNW_PPC64_R29]=UNW_PPC64_R29,
- [UNW_PPC64_R30]=UNW_PPC64_R30,
- [UNW_PPC64_R31]=UNW_PPC64_R31,
-
- [UNW_PPC64_F0]=UNW_PPC64_F0,
- [UNW_PPC64_F1]=UNW_PPC64_F1,
- [UNW_PPC64_F2]=UNW_PPC64_F2,
- [UNW_PPC64_F3]=UNW_PPC64_F3,
- [UNW_PPC64_F4]=UNW_PPC64_F4,
- [UNW_PPC64_F5]=UNW_PPC64_F5,
- [UNW_PPC64_F6]=UNW_PPC64_F6,
- [UNW_PPC64_F7]=UNW_PPC64_F7,
- [UNW_PPC64_F8]=UNW_PPC64_F8,
- [UNW_PPC64_F9]=UNW_PPC64_F9,
- [UNW_PPC64_F10]=UNW_PPC64_F10,
- [UNW_PPC64_F11]=UNW_PPC64_F11,
- [UNW_PPC64_F12]=UNW_PPC64_F12,
- [UNW_PPC64_F13]=UNW_PPC64_F13,
- [UNW_PPC64_F14]=UNW_PPC64_F14,
- [UNW_PPC64_F15]=UNW_PPC64_F15,
- [UNW_PPC64_F16]=UNW_PPC64_F16,
- [UNW_PPC64_F17]=UNW_PPC64_F17,
- [UNW_PPC64_F18]=UNW_PPC64_F18,
- [UNW_PPC64_F19]=UNW_PPC64_F19,
- [UNW_PPC64_F20]=UNW_PPC64_F20,
- [UNW_PPC64_F21]=UNW_PPC64_F21,
- [UNW_PPC64_F22]=UNW_PPC64_F22,
- [UNW_PPC64_F23]=UNW_PPC64_F23,
- [UNW_PPC64_F24]=UNW_PPC64_F24,
- [UNW_PPC64_F25]=UNW_PPC64_F25,
- [UNW_PPC64_F26]=UNW_PPC64_F26,
- [UNW_PPC64_F27]=UNW_PPC64_F27,
- [UNW_PPC64_F28]=UNW_PPC64_F28,
- [UNW_PPC64_F29]=UNW_PPC64_F29,
- [UNW_PPC64_F30]=UNW_PPC64_F30,
- [UNW_PPC64_F31]=UNW_PPC64_F31,
-
- [UNW_PPC64_LR]=UNW_PPC64_LR,
- [UNW_PPC64_CTR]=UNW_PPC64_CTR,
- [UNW_PPC64_ARG_POINTER]=UNW_PPC64_ARG_POINTER,
-
- [UNW_PPC64_CR0]=UNW_PPC64_CR0,
- [UNW_PPC64_CR1]=UNW_PPC64_CR1,
- [UNW_PPC64_CR2]=UNW_PPC64_CR2,
- [UNW_PPC64_CR3]=UNW_PPC64_CR3,
- [UNW_PPC64_CR4]=UNW_PPC64_CR4,
- [UNW_PPC64_CR5]=UNW_PPC64_CR5,
- [UNW_PPC64_CR6]=UNW_PPC64_CR6,
- [UNW_PPC64_CR7]=UNW_PPC64_CR7,
-
- [UNW_PPC64_XER]=UNW_PPC64_XER,
-
- [UNW_PPC64_V0]=UNW_PPC64_V0,
- [UNW_PPC64_V1]=UNW_PPC64_V1,
- [UNW_PPC64_V2]=UNW_PPC64_V2,
- [UNW_PPC64_V3]=UNW_PPC64_V3,
- [UNW_PPC64_V4]=UNW_PPC64_V4,
- [UNW_PPC64_V5]=UNW_PPC64_V5,
- [UNW_PPC64_V6]=UNW_PPC64_V6,
- [UNW_PPC64_V7]=UNW_PPC64_V7,
- [UNW_PPC64_V8]=UNW_PPC64_V8,
- [UNW_PPC64_V9]=UNW_PPC64_V9,
- [UNW_PPC64_V10]=UNW_PPC64_V10,
- [UNW_PPC64_V11]=UNW_PPC64_V11,
- [UNW_PPC64_V12]=UNW_PPC64_V12,
- [UNW_PPC64_V13]=UNW_PPC64_V13,
- [UNW_PPC64_V14]=UNW_PPC64_V14,
- [UNW_PPC64_V15]=UNW_PPC64_V15,
- [UNW_PPC64_V16]=UNW_PPC64_V16,
- [UNW_PPC64_V17]=UNW_PPC64_V17,
- [UNW_PPC64_V18]=UNW_PPC64_V18,
- [UNW_PPC64_V19]=UNW_PPC64_V19,
- [UNW_PPC64_V20]=UNW_PPC64_V20,
- [UNW_PPC64_V21]=UNW_PPC64_V21,
- [UNW_PPC64_V22]=UNW_PPC64_V22,
- [UNW_PPC64_V23]=UNW_PPC64_V23,
- [UNW_PPC64_V24]=UNW_PPC64_V24,
- [UNW_PPC64_V25]=UNW_PPC64_V25,
- [UNW_PPC64_V26]=UNW_PPC64_V26,
- [UNW_PPC64_V27]=UNW_PPC64_V27,
- [UNW_PPC64_V28]=UNW_PPC64_V28,
- [UNW_PPC64_V29]=UNW_PPC64_V29,
- [UNW_PPC64_V30]=UNW_PPC64_V30,
- [UNW_PPC64_V31]=UNW_PPC64_V31,
-
- [UNW_PPC64_VRSAVE]=UNW_PPC64_VRSAVE,
- [UNW_PPC64_VSCR]=UNW_PPC64_VSCR,
- [UNW_PPC64_SPE_ACC]=UNW_PPC64_SPE_ACC,
- [UNW_PPC64_SPEFSCR]=UNW_PPC64_SPEFSCR,
+ [UNW_PPC64_R0]=UNW_PPC64_R0,
+ [UNW_PPC64_R1]=UNW_PPC64_R1,
+ [UNW_PPC64_R2]=UNW_PPC64_R2,
+ [UNW_PPC64_R3]=UNW_PPC64_R3,
+ [UNW_PPC64_R4]=UNW_PPC64_R4,
+ [UNW_PPC64_R5]=UNW_PPC64_R5,
+ [UNW_PPC64_R6]=UNW_PPC64_R6,
+ [UNW_PPC64_R7]=UNW_PPC64_R7,
+ [UNW_PPC64_R8]=UNW_PPC64_R8,
+ [UNW_PPC64_R9]=UNW_PPC64_R9,
+ [UNW_PPC64_R10]=UNW_PPC64_R10,
+ [UNW_PPC64_R11]=UNW_PPC64_R11,
+ [UNW_PPC64_R12]=UNW_PPC64_R12,
+ [UNW_PPC64_R13]=UNW_PPC64_R13,
+ [UNW_PPC64_R14]=UNW_PPC64_R14,
+ [UNW_PPC64_R15]=UNW_PPC64_R15,
+ [UNW_PPC64_R16]=UNW_PPC64_R16,
+ [UNW_PPC64_R17]=UNW_PPC64_R17,
+ [UNW_PPC64_R18]=UNW_PPC64_R18,
+ [UNW_PPC64_R19]=UNW_PPC64_R19,
+ [UNW_PPC64_R20]=UNW_PPC64_R20,
+ [UNW_PPC64_R21]=UNW_PPC64_R21,
+ [UNW_PPC64_R22]=UNW_PPC64_R22,
+ [UNW_PPC64_R23]=UNW_PPC64_R23,
+ [UNW_PPC64_R24]=UNW_PPC64_R24,
+ [UNW_PPC64_R25]=UNW_PPC64_R25,
+ [UNW_PPC64_R26]=UNW_PPC64_R26,
+ [UNW_PPC64_R27]=UNW_PPC64_R27,
+ [UNW_PPC64_R28]=UNW_PPC64_R28,
+ [UNW_PPC64_R29]=UNW_PPC64_R29,
+ [UNW_PPC64_R30]=UNW_PPC64_R30,
+ [UNW_PPC64_R31]=UNW_PPC64_R31,
+
+ [UNW_PPC64_NIP]=UNW_PPC64_NIP,
+ [UNW_PPC64_MSR]=UNW_PPC64_MSR,
+ [UNW_PPC64_ORIG_R3]=UNW_PPC64_ORIG_R3,
+ [UNW_PPC64_CTR]=UNW_PPC64_CTR,
+ [UNW_PPC64_LR]=UNW_PPC64_LR,
+ [UNW_PPC64_XER]=UNW_PPC64_XER,
+ [UNW_PPC64_CCR]=UNW_PPC64_CCR,
+ [UNW_PPC64_SOFTE]=UNW_PPC64_SOFTE,
+ [UNW_PPC64_TRAP]=UNW_PPC64_TRAP,
+ [UNW_PPC64_DAR]=UNW_PPC64_DAR,
+ [UNW_PPC64_DSISR]=UNW_PPC64_DSISR,
+ [UNW_PPC64_RESULT]=UNW_PPC64_RESULT,
+ [UNW_PPC64_REGS_COUNT]=UNW_PPC64_REGS_COUNT,
+ [UNW_PPC64_ARG_POINTER]=UNW_PPC64_ARG_POINTER,
+
+ [UNW_PPC64_F0]=UNW_PPC64_F0,
+ [UNW_PPC64_F1]=UNW_PPC64_F1,
+ [UNW_PPC64_F2]=UNW_PPC64_F2,
+ [UNW_PPC64_F3]=UNW_PPC64_F3,
+ [UNW_PPC64_F4]=UNW_PPC64_F4,
+ [UNW_PPC64_F5]=UNW_PPC64_F5,
+ [UNW_PPC64_F6]=UNW_PPC64_F6,
+ [UNW_PPC64_F7]=UNW_PPC64_F7,
+ [UNW_PPC64_F8]=UNW_PPC64_F8,
+ [UNW_PPC64_F9]=UNW_PPC64_F9,
+ [UNW_PPC64_F10]=UNW_PPC64_F10,
+ [UNW_PPC64_F11]=UNW_PPC64_F11,
+ [UNW_PPC64_F12]=UNW_PPC64_F12,
+ [UNW_PPC64_F13]=UNW_PPC64_F13,
+ [UNW_PPC64_F14]=UNW_PPC64_F14,
+ [UNW_PPC64_F15]=UNW_PPC64_F15,
+ [UNW_PPC64_F16]=UNW_PPC64_F16,
+ [UNW_PPC64_F17]=UNW_PPC64_F17,
+ [UNW_PPC64_F18]=UNW_PPC64_F18,
+ [UNW_PPC64_F19]=UNW_PPC64_F19,
+ [UNW_PPC64_F20]=UNW_PPC64_F20,
+ [UNW_PPC64_F21]=UNW_PPC64_F21,
+ [UNW_PPC64_F22]=UNW_PPC64_F22,
+ [UNW_PPC64_F23]=UNW_PPC64_F23,
+ [UNW_PPC64_F24]=UNW_PPC64_F24,
+ [UNW_PPC64_F25]=UNW_PPC64_F25,
+ [UNW_PPC64_F26]=UNW_PPC64_F26,
+ [UNW_PPC64_F27]=UNW_PPC64_F27,
+ [UNW_PPC64_F28]=UNW_PPC64_F28,
+ [UNW_PPC64_F29]=UNW_PPC64_F29,
+ [UNW_PPC64_F30]=UNW_PPC64_F30,
+ [UNW_PPC64_F31]=UNW_PPC64_F31,
+
+ [UNW_PPC64_FPSCR]=UNW_PPC64_FPSCR,
+
+ [UNW_PPC64_V0]=UNW_PPC64_V0,
+ [UNW_PPC64_V1]=UNW_PPC64_V1,
+ [UNW_PPC64_V2]=UNW_PPC64_V2,
+ [UNW_PPC64_V3]=UNW_PPC64_V3,
+ [UNW_PPC64_V4]=UNW_PPC64_V4,
+ [UNW_PPC64_V5]=UNW_PPC64_V5,
+ [UNW_PPC64_V6]=UNW_PPC64_V6,
+ [UNW_PPC64_V7]=UNW_PPC64_V7,
+ [UNW_PPC64_V8]=UNW_PPC64_V8,
+ [UNW_PPC64_V9]=UNW_PPC64_V9,
+ [UNW_PPC64_V10]=UNW_PPC64_V10,
+ [UNW_PPC64_V11]=UNW_PPC64_V11,
+ [UNW_PPC64_V12]=UNW_PPC64_V12,
+ [UNW_PPC64_V13]=UNW_PPC64_V13,
+ [UNW_PPC64_V14]=UNW_PPC64_V14,
+ [UNW_PPC64_V15]=UNW_PPC64_V15,
+ [UNW_PPC64_V16]=UNW_PPC64_V16,
+ [UNW_PPC64_V17]=UNW_PPC64_V17,
+ [UNW_PPC64_V18]=UNW_PPC64_V18,
+ [UNW_PPC64_V19]=UNW_PPC64_V19,
+ [UNW_PPC64_V20]=UNW_PPC64_V20,
+ [UNW_PPC64_V21]=UNW_PPC64_V21,
+ [UNW_PPC64_V22]=UNW_PPC64_V22,
+ [UNW_PPC64_V23]=UNW_PPC64_V23,
+ [UNW_PPC64_V24]=UNW_PPC64_V24,
+ [UNW_PPC64_V25]=UNW_PPC64_V25,
+ [UNW_PPC64_V26]=UNW_PPC64_V26,
+ [UNW_PPC64_V27]=UNW_PPC64_V27,
+ [UNW_PPC64_V28]=UNW_PPC64_V28,
+ [UNW_PPC64_V29]=UNW_PPC64_V29,
+ [UNW_PPC64_V30]=UNW_PPC64_V30,
+ [UNW_PPC64_V31]=UNW_PPC64_V31,
+
+ [UNW_PPC64_VRSAVE]=UNW_PPC64_VRSAVE,
+ [UNW_PPC64_VSCR]=UNW_PPC64_VSCR,
+ [UNW_PPC64_SPE_ACC]=UNW_PPC64_SPE_ACC,
+ [UNW_PPC64_SPEFSCR]=UNW_PPC64_SPEFSCR,
+
+ [UNW_PPC64_VSR0]=UNW_PPC64_VSR0,
+ [UNW_PPC64_VSR1]=UNW_PPC64_VSR1,
+ [UNW_PPC64_VSR2]=UNW_PPC64_VSR2,
+ [UNW_PPC64_VSR3]=UNW_PPC64_VSR3,
+ [UNW_PPC64_VSR4]=UNW_PPC64_VSR4,
+ [UNW_PPC64_VSR5]=UNW_PPC64_VSR5,
+ [UNW_PPC64_VSR6]=UNW_PPC64_VSR6,
+ [UNW_PPC64_VSR7]=UNW_PPC64_VSR7,
+ [UNW_PPC64_VSR8]=UNW_PPC64_VSR8,
+ [UNW_PPC64_VSR9]=UNW_PPC64_VSR9,
+ [UNW_PPC64_VSR10]=UNW_PPC64_VSR10,
+ [UNW_PPC64_VSR11]=UNW_PPC64_VSR11,
+ [UNW_PPC64_VSR12]=UNW_PPC64_VSR12,
+ [UNW_PPC64_VSR13]=UNW_PPC64_VSR13,
+ [UNW_PPC64_VSR14]=UNW_PPC64_VSR14,
+ [UNW_PPC64_VSR15]=UNW_PPC64_VSR15,
+ [UNW_PPC64_VSR16]=UNW_PPC64_VSR16,
+ [UNW_PPC64_VSR17]=UNW_PPC64_VSR17,
+ [UNW_PPC64_VSR18]=UNW_PPC64_VSR18,
+ [UNW_PPC64_VSR19]=UNW_PPC64_VSR19,
+ [UNW_PPC64_VSR20]=UNW_PPC64_VSR20,
+ [UNW_PPC64_VSR21]=UNW_PPC64_VSR21,
+ [UNW_PPC64_VSR22]=UNW_PPC64_VSR22,
+ [UNW_PPC64_VSR23]=UNW_PPC64_VSR23,
+ [UNW_PPC64_VSR24]=UNW_PPC64_VSR24,
+ [UNW_PPC64_VSR25]=UNW_PPC64_VSR25,
+ [UNW_PPC64_VSR26]=UNW_PPC64_VSR26,
+ [UNW_PPC64_VSR27]=UNW_PPC64_VSR27,
+ [UNW_PPC64_VSR28]=UNW_PPC64_VSR28,
+ [UNW_PPC64_VSR29]=UNW_PPC64_VSR29,
+ [UNW_PPC64_VSR30]=UNW_PPC64_VSR30,
+ [UNW_PPC64_VSR31]=UNW_PPC64_VSR31,
};
HIDDEN void
diff --git a/src/ppc64/Ginit.c b/src/ppc64/Ginit.c
index 1606c10..ab08210 100644
--- a/src/ppc64/Ginit.c
+++ b/src/ppc64/Ginit.c
@@ -74,7 +74,7 @@ uc_addr (ucontext_t *uc, int reg)
case UNW_PPC64_XER:
gregs_idx = XER_IDX;
break;
- case UNW_PPC64_CR0:
+ case UNW_PPC64_CCR:
gregs_idx = CCR_IDX;
break;
default:
diff --git a/src/ppc64/Gresume.c b/src/ppc64/Gresume.c
index 8ff93bd..497166c 100644
--- a/src/ppc64/Gresume.c
+++ b/src/ppc64/Gresume.c
@@ -38,14 +38,33 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
static NORETURN inline long
my_rt_sigreturn (void *new_sp)
{
- /* XXX: empty stub. */
+ Debug (8, "resuming at ip=... via sigreturn(...)\n");
abort ();
}
HIDDEN inline int
ppc64_local_resume (unw_addr_space_t as, unw_cursor_t *cursor, void *arg)
{
- /* XXX: empty stub. */
+ struct cursor *c = (struct cursor *) cursor;
+ ucontext_t *uc = c->uc;
+
+ /* Ensure c->pi is up-to-date. On x86-64, it's relatively common to
+ * be missing DWARF unwind info. We don't want to fail in that
+ * case, because the frame-chain still would let us do a backtrace
+ * at least. */
+ dwarf_make_proc_info (&c->dwarf);
+
+ if (unlikely (c->sigcontext_format != PPC_SCF_NONE))
+ {
+ my_rt_sigreturn(cursor);
+ abort();
+ }
+ else
+ {
+ Debug (8, "resuming at ip=%llx via setcontext()\n",
+ (unsigned long long) c->dwarf.ip);
+ setcontext (uc);
+ }
return -UNW_EINVAL;
}
@@ -57,7 +76,35 @@ ppc64_local_resume (unw_addr_space_t as, unw_cursor_t *cursor, void *arg)
static inline int
establish_machine_state (struct cursor *c)
{
- /* XXX: empty stub. */
+ int (*access_reg) (unw_addr_space_t, unw_regnum_t, unw_word_t *,
+ int write, void *);
+ int (*access_fpreg) (unw_addr_space_t, unw_regnum_t, unw_fpreg_t *,
+ int write, void *);
+ unw_addr_space_t as = c->dwarf.as;
+ void *arg = c->dwarf.as_arg;
+ unw_fpreg_t fpval;
+ unw_word_t val;
+ int reg;
+
+ access_reg = as->acc.access_reg;
+ access_fpreg = as->acc.access_fpreg;
+
+ Debug (8, "copying out cursor state\n");
+
+ for (reg = 0; reg <= UNW_REG_LAST; ++reg)
+ {
+ Debug (16, "copying %s %d\n", unw_regname (reg), reg);
+ if (unw_is_fpreg (reg))
+ {
+ if (tdep_access_fpreg (c, reg, &fpval, 0) >= 0)
+ (*access_fpreg) (as, reg, &fpval, 1, arg);
+ }
+ else
+ {
+ if (tdep_access_reg (c, reg, &val, 0) >= 0)
+ (*access_reg) (as, reg, &val, 1, arg);
+ }
+ }
return 0;
}
diff --git a/src/ppc64/Gstep.c b/src/ppc64/Gstep.c
index 038510f..70b9080 100644
--- a/src/ppc64/Gstep.c
+++ b/src/ppc64/Gstep.c
@@ -133,304 +133,327 @@ unw_step (unw_cursor_t * cursor)
following code will likely cause a seg fault or other crash
condition. */
- unw_word_t ucontext = c->dwarf.cfa + __SIGNAL_FRAMESIZE;
-
- Debug (1, "signal frame, skip over trampoline\n");
-
- c->sigcontext_format = PPC_SCF_LINUX_RT_SIGFRAME;
- c->sigcontext_addr = ucontext;
-
- sp_loc = DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R1, 0);
- ip_loc = DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_NIP, 0);
-
- ret = dwarf_get (&c->dwarf, sp_loc, &c->dwarf.cfa);
- if (ret < 0)
- {
- Debug (2, "returning %d\n", ret);
- return ret;
- }
- ret = dwarf_get (&c->dwarf, ip_loc, &c->dwarf.ip);
- if (ret < 0)
- {
- Debug (2, "returning %d\n", ret);
- return ret;
- }
-
- /* Instead of just restoring the non-volatile registers, do all
- of the registers for now. This will incur a performance hit,
- but it's rare enough not to cause too much of a problem, and
- might be useful in some cases. */
- c->dwarf.loc[UNW_PPC64_R0] =
- DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R0, 0);
- c->dwarf.loc[UNW_PPC64_R1] =
- DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R1, 0);
- c->dwarf.loc[UNW_PPC64_R2] =
- DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R2, 0);
- c->dwarf.loc[UNW_PPC64_R3] =
- DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R3, 0);
- c->dwarf.loc[UNW_PPC64_R4] =
- DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R4, 0);
- c->dwarf.loc[UNW_PPC64_R5] =
- DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R5, 0);
- c->dwarf.loc[UNW_PPC64_R6] =
- DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R6, 0);
- c->dwarf.loc[UNW_PPC64_R7] =
- DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R7, 0);
- c->dwarf.loc[UNW_PPC64_R8] =
- DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R8, 0);
- c->dwarf.loc[UNW_PPC64_R9] =
- DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R9, 0);
- c->dwarf.loc[UNW_PPC64_R10] =
- DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R10, 0);
- c->dwarf.loc[UNW_PPC64_R11] =
- DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R11, 0);
- c->dwarf.loc[UNW_PPC64_R12] =
- DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R12, 0);
- c->dwarf.loc[UNW_PPC64_R13] =
- DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R13, 0);
- c->dwarf.loc[UNW_PPC64_R14] =
- DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R14, 0);
- c->dwarf.loc[UNW_PPC64_R15] =
- DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R15, 0);
- c->dwarf.loc[UNW_PPC64_R16] =
- DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R16, 0);
- c->dwarf.loc[UNW_PPC64_R17] =
- DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R17, 0);
- c->dwarf.loc[UNW_PPC64_R18] =
- DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R18, 0);
- c->dwarf.loc[UNW_PPC64_R19] =
- DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R19, 0);
- c->dwarf.loc[UNW_PPC64_R20] =
- DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R20, 0);
- c->dwarf.loc[UNW_PPC64_R21] =
- DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R21, 0);
- c->dwarf.loc[UNW_PPC64_R22] =
- DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R22, 0);
- c->dwarf.loc[UNW_PPC64_R23] =
- DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R23, 0);
- c->dwarf.loc[UNW_PPC64_R24] =
- DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R24, 0);
- c->dwarf.loc[UNW_PPC64_R25] =
- DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R25, 0);
- c->dwarf.loc[UNW_PPC64_R26] =
- DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R26, 0);
- c->dwarf.loc[UNW_PPC64_R27] =
- DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R27, 0);
- c->dwarf.loc[UNW_PPC64_R28] =
- DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R28, 0);
- c->dwarf.loc[UNW_PPC64_R29] =
- DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R29, 0);
- c->dwarf.loc[UNW_PPC64_R30] =
- DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R30, 0);
- c->dwarf.loc[UNW_PPC64_R31] =
- DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R31, 0);
-
- c->dwarf.loc[UNW_PPC64_LR] =
- DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_LINK, 0);
- c->dwarf.loc[UNW_PPC64_CTR] =
- DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_CTR, 0);
- /* This CR0 assignment is probably wrong. There are 8 dwarf columns
- assigned to the CR registers, but only one CR register in the
- mcontext structure */
- c->dwarf.loc[UNW_PPC64_CR0] =
- DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_CCR, 0);
- c->dwarf.loc[UNW_PPC64_XER] =
- DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_XER, 0);
- c->dwarf.loc[UNW_PPC64_NIP] =
- DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_NIP, 0);
-
- /* TODO: Is there a way of obtaining the value of the
- pseudo frame pointer (which is sp + some fixed offset, I
- assume), based on the contents of the ucontext record
- structure? For now, set this loc to null. */
- c->dwarf.loc[UNW_PPC64_FRAME_POINTER] = DWARF_NULL_LOC;
-
- c->dwarf.loc[UNW_PPC64_F0] =
- DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R0, 0);
- c->dwarf.loc[UNW_PPC64_F1] =
- DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R1, 0);
- c->dwarf.loc[UNW_PPC64_F2] =
- DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R2, 0);
- c->dwarf.loc[UNW_PPC64_F3] =
- DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R3, 0);
- c->dwarf.loc[UNW_PPC64_F4] =
- DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R4, 0);
- c->dwarf.loc[UNW_PPC64_F5] =
- DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R5, 0);
- c->dwarf.loc[UNW_PPC64_F6] =
- DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R6, 0);
- c->dwarf.loc[UNW_PPC64_F7] =
- DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R7, 0);
- c->dwarf.loc[UNW_PPC64_F8] =
- DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R8, 0);
- c->dwarf.loc[UNW_PPC64_F9] =
- DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R9, 0);
- c->dwarf.loc[UNW_PPC64_F10] =
- DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R10, 0);
- c->dwarf.loc[UNW_PPC64_F11] =
- DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R11, 0);
- c->dwarf.loc[UNW_PPC64_F12] =
- DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R12, 0);
- c->dwarf.loc[UNW_PPC64_F13] =
- DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R13, 0);
- c->dwarf.loc[UNW_PPC64_F14] =
- DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R14, 0);
- c->dwarf.loc[UNW_PPC64_F15] =
- DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R15, 0);
- c->dwarf.loc[UNW_PPC64_F16] =
- DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R16, 0);
- c->dwarf.loc[UNW_PPC64_F17] =
- DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R17, 0);
- c->dwarf.loc[UNW_PPC64_F18] =
- DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R18, 0);
- c->dwarf.loc[UNW_PPC64_F19] =
- DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R19, 0);
- c->dwarf.loc[UNW_PPC64_F20] =
- DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R20, 0);
- c->dwarf.loc[UNW_PPC64_F21] =
- DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R21, 0);
- c->dwarf.loc[UNW_PPC64_F22] =
- DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R22, 0);
- c->dwarf.loc[UNW_PPC64_F23] =
- DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R23, 0);
- c->dwarf.loc[UNW_PPC64_F24] =
- DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R24, 0);
- c->dwarf.loc[UNW_PPC64_F25] =
- DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R25, 0);
- c->dwarf.loc[UNW_PPC64_F26] =
- DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R26, 0);
- c->dwarf.loc[UNW_PPC64_F27] =
- DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R27, 0);
- c->dwarf.loc[UNW_PPC64_F28] =
- DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R28, 0);
- c->dwarf.loc[UNW_PPC64_F29] =
- DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R29, 0);
- c->dwarf.loc[UNW_PPC64_F30] =
- DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R30, 0);
- c->dwarf.loc[UNW_PPC64_F31] =
- DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R31, 0);
- /* Note that there is no .eh_section register column for the
- FPSCR register. I don't know why this is. */
-
- v_regs_loc = DWARF_LOC (ucontext + UC_MCONTEXT_V_REGS, 0);
- ret = dwarf_get (&c->dwarf, v_regs_loc, &v_regs_ptr);
- if (ret < 0)
- {
- Debug (2, "returning %d\n", ret);
- return ret;
- }
- if (v_regs_ptr != 0)
- {
- /* The v_regs_ptr is not null. Set all of the AltiVec locs */
-
- c->dwarf.loc[UNW_PPC64_V0] =
- DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R0, 0);
- c->dwarf.loc[UNW_PPC64_V1] =
- DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R1, 0);
- c->dwarf.loc[UNW_PPC64_V2] =
- DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R2, 0);
- c->dwarf.loc[UNW_PPC64_V3] =
- DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R3, 0);
- c->dwarf.loc[UNW_PPC64_V4] =
- DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R4, 0);
- c->dwarf.loc[UNW_PPC64_V5] =
- DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R5, 0);
- c->dwarf.loc[UNW_PPC64_V6] =
- DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R6, 0);
- c->dwarf.loc[UNW_PPC64_V7] =
- DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R7, 0);
- c->dwarf.loc[UNW_PPC64_V8] =
- DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R8, 0);
- c->dwarf.loc[UNW_PPC64_V9] =
- DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R9, 0);
- c->dwarf.loc[UNW_PPC64_V10] =
- DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R10, 0);
- c->dwarf.loc[UNW_PPC64_V11] =
- DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R11, 0);
- c->dwarf.loc[UNW_PPC64_V12] =
- DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R12, 0);
- c->dwarf.loc[UNW_PPC64_V13] =
- DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R13, 0);
- c->dwarf.loc[UNW_PPC64_V14] =
- DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R14, 0);
- c->dwarf.loc[UNW_PPC64_V15] =
- DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R15, 0);
- c->dwarf.loc[UNW_PPC64_V16] =
- DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R16, 0);
- c->dwarf.loc[UNW_PPC64_V17] =
- DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R17, 0);
- c->dwarf.loc[UNW_PPC64_V18] =
- DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R18, 0);
- c->dwarf.loc[UNW_PPC64_V19] =
- DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R19, 0);
- c->dwarf.loc[UNW_PPC64_V20] =
- DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R20, 0);
- c->dwarf.loc[UNW_PPC64_V21] =
- DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R21, 0);
- c->dwarf.loc[UNW_PPC64_V22] =
- DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R22, 0);
- c->dwarf.loc[UNW_PPC64_V23] =
- DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R23, 0);
- c->dwarf.loc[UNW_PPC64_V24] =
- DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R24, 0);
- c->dwarf.loc[UNW_PPC64_V25] =
- DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R25, 0);
- c->dwarf.loc[UNW_PPC64_V26] =
- DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R26, 0);
- c->dwarf.loc[UNW_PPC64_V27] =
- DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R27, 0);
- c->dwarf.loc[UNW_PPC64_V28] =
- DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R28, 0);
- c->dwarf.loc[UNW_PPC64_V29] =
- DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R29, 0);
- c->dwarf.loc[UNW_PPC64_V30] =
- DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R30, 0);
- c->dwarf.loc[UNW_PPC64_V31] =
- DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R31, 0);
- c->dwarf.loc[UNW_PPC64_VRSAVE] =
- DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_VRSAVE, 0);
- c->dwarf.loc[UNW_PPC64_VSCR] =
- DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_VSCR, 0);
- }
- else
- {
- c->dwarf.loc[UNW_PPC64_V0] = DWARF_NULL_LOC;
- c->dwarf.loc[UNW_PPC64_V1] = DWARF_NULL_LOC;
- c->dwarf.loc[UNW_PPC64_V2] = DWARF_NULL_LOC;
- c->dwarf.loc[UNW_PPC64_V3] = DWARF_NULL_LOC;
- c->dwarf.loc[UNW_PPC64_V4] = DWARF_NULL_LOC;
- c->dwarf.loc[UNW_PPC64_V5] = DWARF_NULL_LOC;
- c->dwarf.loc[UNW_PPC64_V6] = DWARF_NULL_LOC;
- c->dwarf.loc[UNW_PPC64_V7] = DWARF_NULL_LOC;
- c->dwarf.loc[UNW_PPC64_V8] = DWARF_NULL_LOC;
- c->dwarf.loc[UNW_PPC64_V9] = DWARF_NULL_LOC;
- c->dwarf.loc[UNW_PPC64_V10] = DWARF_NULL_LOC;
- c->dwarf.loc[UNW_PPC64_V11] = DWARF_NULL_LOC;
- c->dwarf.loc[UNW_PPC64_V12] = DWARF_NULL_LOC;
- c->dwarf.loc[UNW_PPC64_V13] = DWARF_NULL_LOC;
- c->dwarf.loc[UNW_PPC64_V14] = DWARF_NULL_LOC;
- c->dwarf.loc[UNW_PPC64_V15] = DWARF_NULL_LOC;
- c->dwarf.loc[UNW_PPC64_V16] = DWARF_NULL_LOC;
- c->dwarf.loc[UNW_PPC64_V17] = DWARF_NULL_LOC;
- c->dwarf.loc[UNW_PPC64_V18] = DWARF_NULL_LOC;
- c->dwarf.loc[UNW_PPC64_V19] = DWARF_NULL_LOC;
- c->dwarf.loc[UNW_PPC64_V20] = DWARF_NULL_LOC;
- c->dwarf.loc[UNW_PPC64_V21] = DWARF_NULL_LOC;
- c->dwarf.loc[UNW_PPC64_V22] = DWARF_NULL_LOC;
- c->dwarf.loc[UNW_PPC64_V23] = DWARF_NULL_LOC;
- c->dwarf.loc[UNW_PPC64_V24] = DWARF_NULL_LOC;
- c->dwarf.loc[UNW_PPC64_V25] = DWARF_NULL_LOC;
- c->dwarf.loc[UNW_PPC64_V26] = DWARF_NULL_LOC;
- c->dwarf.loc[UNW_PPC64_V27] = DWARF_NULL_LOC;
- c->dwarf.loc[UNW_PPC64_V28] = DWARF_NULL_LOC;
- c->dwarf.loc[UNW_PPC64_V29] = DWARF_NULL_LOC;
- c->dwarf.loc[UNW_PPC64_V30] = DWARF_NULL_LOC;
- c->dwarf.loc[UNW_PPC64_V31] = DWARF_NULL_LOC;
- c->dwarf.loc[UNW_PPC64_VRSAVE] = DWARF_NULL_LOC;
- c->dwarf.loc[UNW_PPC64_VSCR] = DWARF_NULL_LOC;
- }
- ret = 1;
- }
+ unw_word_t ucontext = c->dwarf.cfa + __SIGNAL_FRAMESIZE;
+
+ Debug (1, "signal frame, skip over trampoline\n");
+
+ c->sigcontext_format = PPC_SCF_LINUX_RT_SIGFRAME;
+ c->sigcontext_addr = ucontext;
+
+ sp_loc = DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R1, 0);
+ ip_loc = DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_NIP, 0);
+
+ ret = dwarf_get (&c->dwarf, sp_loc, &c->dwarf.cfa);
+ if (ret < 0)
+ {
+ Debug (2, "returning %d\n", ret);
+ return ret;
+ }
+ ret = dwarf_get (&c->dwarf, ip_loc, &c->dwarf.ip);
+ if (ret < 0)
+ {
+ Debug (2, "returning %d\n", ret);
+ return ret;
+ }
+
+ /* Instead of just restoring the non-volatile registers, do all
+ of the registers for now. This will incur a performance hit,
+ but it's rare enough not to cause too much of a problem, and
+ might be useful in some cases. */
+ c->dwarf.loc[UNW_PPC64_R0] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R0, 0);
+ c->dwarf.loc[UNW_PPC64_R1] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R1, 0);
+ c->dwarf.loc[UNW_PPC64_R2] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R2, 0);
+ c->dwarf.loc[UNW_PPC64_R3] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R3, 0);
+ c->dwarf.loc[UNW_PPC64_R4] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R4, 0);
+ c->dwarf.loc[UNW_PPC64_R5] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R5, 0);
+ c->dwarf.loc[UNW_PPC64_R6] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R6, 0);
+ c->dwarf.loc[UNW_PPC64_R7] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R7, 0);
+ c->dwarf.loc[UNW_PPC64_R8] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R8, 0);
+ c->dwarf.loc[UNW_PPC64_R9] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R9, 0);
+ c->dwarf.loc[UNW_PPC64_R10] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R10, 0);
+ c->dwarf.loc[UNW_PPC64_R11] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R11, 0);
+ c->dwarf.loc[UNW_PPC64_R12] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R12, 0);
+ c->dwarf.loc[UNW_PPC64_R13] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R13, 0);
+ c->dwarf.loc[UNW_PPC64_R14] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R14, 0);
+ c->dwarf.loc[UNW_PPC64_R15] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R15, 0);
+ c->dwarf.loc[UNW_PPC64_R16] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R16, 0);
+ c->dwarf.loc[UNW_PPC64_R17] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R17, 0);
+ c->dwarf.loc[UNW_PPC64_R18] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R18, 0);
+ c->dwarf.loc[UNW_PPC64_R19] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R19, 0);
+ c->dwarf.loc[UNW_PPC64_R20] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R20, 0);
+ c->dwarf.loc[UNW_PPC64_R21] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R21, 0);
+ c->dwarf.loc[UNW_PPC64_R22] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R22, 0);
+ c->dwarf.loc[UNW_PPC64_R23] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R23, 0);
+ c->dwarf.loc[UNW_PPC64_R24] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R24, 0);
+ c->dwarf.loc[UNW_PPC64_R25] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R25, 0);
+ c->dwarf.loc[UNW_PPC64_R26] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R26, 0);
+ c->dwarf.loc[UNW_PPC64_R27] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R27, 0);
+ c->dwarf.loc[UNW_PPC64_R28] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R28, 0);
+ c->dwarf.loc[UNW_PPC64_R29] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R29, 0);
+ c->dwarf.loc[UNW_PPC64_R30] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R30, 0);
+ c->dwarf.loc[UNW_PPC64_R31] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R31, 0);
+
+ c->dwarf.loc[UNW_PPC64_LR] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_LINK, 0);
+ c->dwarf.loc[UNW_PPC64_CTR] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_CTR, 0);
+ /* This CR0 assignment is probably wrong. There are 8 dwarf columns
+ assigned to the CR registers, but only one CR register in the
+ mcontext structure */
+ // Thats all right, accordingly to A2 Processor manual, "2.4.2.3 Condition Register"
+ // The Condition Register (CR) is a 32-bit register of its own unique type
+ // and is divided up into eight, independent 4-bit fields (CR0-CR7).
+ c->dwarf.loc[UNW_PPC64_CCR] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_CCR, 0);
+ c->dwarf.loc[UNW_PPC64_XER] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_XER, 0);
+ c->dwarf.loc[UNW_PPC64_NIP] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_NIP, 0);
+
+ /* TODO: Is there a way of obtaining the value of the
+ pseudo frame pointer (which is sp + some fixed offset, I
+ assume), based on the contents of the ucontext record
+ structure? For now, set this loc to null. */
+ /*
+ wtf is physical FRAME_POINTER? ABI declares it logically as R1
+ c->dwarf.loc[UNW_PPC64_FRAME_POINTER] = DWARF_NULL_LOC;
+ */
+
+ /* It seems the following registers doesnt need to be restored
+ * UNW_PPC64_MSR,
+ * UNW_PPC64_ORIG_R3,
+ * UNW_PPC64_SOFTE,
+ * UNW_PPC64_TRAP,
+ * UNW_PPC64_DAR,
+ * UNW_PPC64_DSISR,
+ * UNW_PPC64_RESULT,
+ * UNW_PPC64_REGS_COUNT,
+ * UNW_PPC64_ARG_POINTER,
+ * UNW_PPC64_FPSCR
+ * UNW_PPC64_VSCR
+ * UNW_PPC64_VRSAVE
+ * UNW_PPC64_SPE_ACC
+ * UNW_PPC64_SPEFSCR
+ */
+ c->dwarf.loc[UNW_PPC64_F0] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R0, 0);
+ c->dwarf.loc[UNW_PPC64_F1] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R1, 0);
+ c->dwarf.loc[UNW_PPC64_F2] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R2, 0);
+ c->dwarf.loc[UNW_PPC64_F3] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R3, 0);
+ c->dwarf.loc[UNW_PPC64_F4] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R4, 0);
+ c->dwarf.loc[UNW_PPC64_F5] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R5, 0);
+ c->dwarf.loc[UNW_PPC64_F6] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R6, 0);
+ c->dwarf.loc[UNW_PPC64_F7] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R7, 0);
+ c->dwarf.loc[UNW_PPC64_F8] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R8, 0);
+ c->dwarf.loc[UNW_PPC64_F9] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R9, 0);
+ c->dwarf.loc[UNW_PPC64_F10] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R10, 0);
+ c->dwarf.loc[UNW_PPC64_F11] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R11, 0);
+ c->dwarf.loc[UNW_PPC64_F12] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R12, 0);
+ c->dwarf.loc[UNW_PPC64_F13] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R13, 0);
+ c->dwarf.loc[UNW_PPC64_F14] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R14, 0);
+ c->dwarf.loc[UNW_PPC64_F15] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R15, 0);
+ c->dwarf.loc[UNW_PPC64_F16] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R16, 0);
+ c->dwarf.loc[UNW_PPC64_F17] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R17, 0);
+ c->dwarf.loc[UNW_PPC64_F18] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R18, 0);
+ c->dwarf.loc[UNW_PPC64_F19] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R19, 0);
+ c->dwarf.loc[UNW_PPC64_F20] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R20, 0);
+ c->dwarf.loc[UNW_PPC64_F21] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R21, 0);
+ c->dwarf.loc[UNW_PPC64_F22] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R22, 0);
+ c->dwarf.loc[UNW_PPC64_F23] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R23, 0);
+ c->dwarf.loc[UNW_PPC64_F24] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R24, 0);
+ c->dwarf.loc[UNW_PPC64_F25] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R25, 0);
+ c->dwarf.loc[UNW_PPC64_F26] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R26, 0);
+ c->dwarf.loc[UNW_PPC64_F27] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R27, 0);
+ c->dwarf.loc[UNW_PPC64_F28] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R28, 0);
+ c->dwarf.loc[UNW_PPC64_F29] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R29, 0);
+ c->dwarf.loc[UNW_PPC64_F30] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R30, 0);
+ c->dwarf.loc[UNW_PPC64_F31] =
+ DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R31, 0);
+ /* Note that there is no .eh_section register column for the
+ FPSCR register. I don't know why this is. */
+
+ v_regs_loc = DWARF_LOC (ucontext + UC_MCONTEXT_V_REGS, 0);
+ ret = dwarf_get (&c->dwarf, v_regs_loc, &v_regs_ptr);
+ if (ret < 0)
+ {
+ Debug (2, "returning %d\n", ret);
+ return ret;
+ }
+ if (v_regs_ptr != 0)
+ {
+ /* The v_regs_ptr is not null. Set all of the AltiVec locs */
+
+ c->dwarf.loc[UNW_PPC64_V0] =
+ DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R0, 0);
+ c->dwarf.loc[UNW_PPC64_V1] =
+ DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R1, 0);
+ c->dwarf.loc[UNW_PPC64_V2] =
+ DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R2, 0);
+ c->dwarf.loc[UNW_PPC64_V3] =
+ DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R3, 0);
+ c->dwarf.loc[UNW_PPC64_V4] =
+ DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R4, 0);
+ c->dwarf.loc[UNW_PPC64_V5] =
+ DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R5, 0);
+ c->dwarf.loc[UNW_PPC64_V6] =
+ DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R6, 0);
+ c->dwarf.loc[UNW_PPC64_V7] =
+ DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R7, 0);
+ c->dwarf.loc[UNW_PPC64_V8] =
+ DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R8, 0);
+ c->dwarf.loc[UNW_PPC64_V9] =
+ DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R9, 0);
+ c->dwarf.loc[UNW_PPC64_V10] =
+ DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R10, 0);
+ c->dwarf.loc[UNW_PPC64_V11] =
+ DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R11, 0);
+ c->dwarf.loc[UNW_PPC64_V12] =
+ DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R12, 0);
+ c->dwarf.loc[UNW_PPC64_V13] =
+ DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R13, 0);
+ c->dwarf.loc[UNW_PPC64_V14] =
+ DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R14, 0);
+ c->dwarf.loc[UNW_PPC64_V15] =
+ DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R15, 0);
+ c->dwarf.loc[UNW_PPC64_V16] =
+ DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R16, 0);
+ c->dwarf.loc[UNW_PPC64_V17] =
+ DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R17, 0);
+ c->dwarf.loc[UNW_PPC64_V18] =
+ DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R18, 0);
+ c->dwarf.loc[UNW_PPC64_V19] =
+ DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R19, 0);
+ c->dwarf.loc[UNW_PPC64_V20] =
+ DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R20, 0);
+ c->dwarf.loc[UNW_PPC64_V21] =
+ DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R21, 0);
+ c->dwarf.loc[UNW_PPC64_V22] =
+ DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R22, 0);
+ c->dwarf.loc[UNW_PPC64_V23] =
+ DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R23, 0);
+ c->dwarf.loc[UNW_PPC64_V24] =
+ DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R24, 0);
+ c->dwarf.loc[UNW_PPC64_V25] =
+ DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R25, 0);
+ c->dwarf.loc[UNW_PPC64_V26] =
+ DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R26, 0);
+ c->dwarf.loc[UNW_PPC64_V27] =
+ DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R27, 0);
+ c->dwarf.loc[UNW_PPC64_V28] =
+ DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R28, 0);
+ c->dwarf.loc[UNW_PPC64_V29] =
+ DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R29, 0);
+ c->dwarf.loc[UNW_PPC64_V30] =
+ DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R30, 0);
+ c->dwarf.loc[UNW_PPC64_V31] =
+ DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R31, 0);
+ c->dwarf.loc[UNW_PPC64_VRSAVE] =
+ DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_VRSAVE, 0);
+ c->dwarf.loc[UNW_PPC64_VSCR] =
+ DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_VSCR, 0);
+ }
+ else
+ {
+ c->dwarf.loc[UNW_PPC64_V0] = DWARF_NULL_LOC;
+ c->dwarf.loc[UNW_PPC64_V1] = DWARF_NULL_LOC;
+ c->dwarf.loc[UNW_PPC64_V2] = DWARF_NULL_LOC;
+ c->dwarf.loc[UNW_PPC64_V3] = DWARF_NULL_LOC;
+ c->dwarf.loc[UNW_PPC64_V4] = DWARF_NULL_LOC;
+ c->dwarf.loc[UNW_PPC64_V5] = DWARF_NULL_LOC;
+ c->dwarf.loc[UNW_PPC64_V6] = DWARF_NULL_LOC;
+ c->dwarf.loc[UNW_PPC64_V7] = DWARF_NULL_LOC;
+ c->dwarf.loc[UNW_PPC64_V8] = DWARF_NULL_LOC;
+ c->dwarf.loc[UNW_PPC64_V9] = DWARF_NULL_LOC;
+ c->dwarf.loc[UNW_PPC64_V10] = DWARF_NULL_LOC;
+ c->dwarf.loc[UNW_PPC64_V11] = DWARF_NULL_LOC;
+ c->dwarf.loc[UNW_PPC64_V12] = DWARF_NULL_LOC;
+ c->dwarf.loc[UNW_PPC64_V13] = DWARF_NULL_LOC;
+ c->dwarf.loc[UNW_PPC64_V14] = DWARF_NULL_LOC;
+ c->dwarf.loc[UNW_PPC64_V15] = DWARF_NULL_LOC;
+ c->dwarf.loc[UNW_PPC64_V16] = DWARF_NULL_LOC;
+ c->dwarf.loc[UNW_PPC64_V17] = DWARF_NULL_LOC;
+ c->dwarf.loc[UNW_PPC64_V18] = DWARF_NULL_LOC;
+ c->dwarf.loc[UNW_PPC64_V19] = DWARF_NULL_LOC;
+ c->dwarf.loc[UNW_PPC64_V20] = DWARF_NULL_LOC;
+ c->dwarf.loc[UNW_PPC64_V21] = DWARF_NULL_LOC;
+ c->dwarf.loc[UNW_PPC64_V22] = DWARF_NULL_LOC;
+ c->dwarf.loc[UNW_PPC64_V23] = DWARF_NULL_LOC;
+ c->dwarf.loc[UNW_PPC64_V24] = DWARF_NULL_LOC;
+ c->dwarf.loc[UNW_PPC64_V25] = DWARF_NULL_LOC;
+ c->dwarf.loc[UNW_PPC64_V26] = DWARF_NULL_LOC;
+ c->dwarf.loc[UNW_PPC64_V27] = DWARF_NULL_LOC;
+ c->dwarf.loc[UNW_PPC64_V28] = DWARF_NULL_LOC;
+ c->dwarf.loc[UNW_PPC64_V29] = DWARF_NULL_LOC;
+ c->dwarf.loc[UNW_PPC64_V30] = DWARF_NULL_LOC;
+ c->dwarf.loc[UNW_PPC64_V31] = DWARF_NULL_LOC;
+ c->dwarf.loc[UNW_PPC64_VRSAVE] = DWARF_NULL_LOC;
+ c->dwarf.loc[UNW_PPC64_VSCR] = DWARF_NULL_LOC;
+ }
+ ret = 1;
+ }
}
+ Debug (2, "returning %d with last return statement\n", ret);
return ret;
}
diff --git a/src/ppc64/init.h b/src/ppc64/init.h
index 22376e7..34b62f1 100644
--- a/src/ppc64/init.h
+++ b/src/ppc64/init.h
@@ -42,16 +42,25 @@ common_init_ppc64 (struct cursor *c, unsigned use_prev_instr)
for (i = UNW_PPC64_V0; i <= UNW_PPC64_V31; i++) {
c->dwarf.loc[i] = DWARF_VREG_LOC (&c->dwarf, i);
}
-
- for (i = UNW_PPC64_CR0; i <= UNW_PPC64_CR7; i++) {
- c->dwarf.loc[i] = DWARF_REG_LOC (&c->dwarf, i);
+ for (i = UNW_PPC64_VSR0; i <= UNW_PPC64_VSR31; i++) {
+ c->dwarf.loc[i] = DWARF_VREG_LOC (&c->dwarf, i);
}
- c->dwarf.loc[UNW_PPC64_ARG_POINTER] = DWARF_REG_LOC (&c->dwarf, UNW_PPC64_ARG_POINTER);
- c->dwarf.loc[UNW_PPC64_CTR] = DWARF_REG_LOC (&c->dwarf, UNW_PPC64_CTR);
- c->dwarf.loc[UNW_PPC64_VSCR] = DWARF_REG_LOC (&c->dwarf, UNW_PPC64_VSCR);
- c->dwarf.loc[UNW_PPC64_XER] = DWARF_REG_LOC (&c->dwarf, UNW_PPC64_XER);
+ c->dwarf.loc[UNW_PPC64_MSR] = DWARF_REG_LOC (&c->dwarf, UNW_PPC64_MSR);
+ c->dwarf.loc[UNW_PPC64_ORIG_R3] = DWARF_REG_LOC (&c->dwarf, UNW_PPC64_ORIG_R3);
+ c->dwarf.loc[UNW_PPC64_CTR] = DWARF_REG_LOC (&c->dwarf, UNW_PPC64_CTR);
c->dwarf.loc[UNW_PPC64_LR] = DWARF_REG_LOC (&c->dwarf, UNW_PPC64_LR);
+ c->dwarf.loc[UNW_PPC64_XER] = DWARF_REG_LOC (&c->dwarf, UNW_PPC64_XER);
+ c->dwarf.loc[UNW_PPC64_CCR] = DWARF_REG_LOC (&c->dwarf, UNW_PPC64_CCR);
+ c->dwarf.loc[UNW_PPC64_SOFTE] = DWARF_REG_LOC (&c->dwarf, UNW_PPC64_SOFTE);
+ c->dwarf.loc[UNW_PPC64_TRAP] = DWARF_REG_LOC (&c->dwarf, UNW_PPC64_TRAP);
+ c->dwarf.loc[UNW_PPC64_DAR] = DWARF_REG_LOC (&c->dwarf, UNW_PPC64_DAR);
+ c->dwarf.loc[UNW_PPC64_DSISR] = DWARF_REG_LOC (&c->dwarf, UNW_PPC64_DSISR);
+ c->dwarf.loc[UNW_PPC64_RESULT] = DWARF_REG_LOC (&c->dwarf, UNW_PPC64_RESULT);
+ c->dwarf.loc[UNW_PPC64_REGS_COUNT] = DWARF_REG_LOC (&c->dwarf, UNW_PPC64_REGS_COUNT);
+ c->dwarf.loc[UNW_PPC64_ARG_POINTER] = DWARF_REG_LOC (&c->dwarf, UNW_PPC64_ARG_POINTER);
+ c->dwarf.loc[UNW_PPC64_FPSCR] = DWARF_REG_LOC (&c->dwarf, UNW_PPC64_FPSCR);
+ c->dwarf.loc[UNW_PPC64_VSCR] = DWARF_REG_LOC (&c->dwarf, UNW_PPC64_VSCR);
c->dwarf.loc[UNW_PPC64_VRSAVE] = DWARF_REG_LOC (&c->dwarf, UNW_PPC64_VRSAVE);
c->dwarf.loc[UNW_PPC64_SPEFSCR] = DWARF_REG_LOC (&c->dwarf, UNW_PPC64_SPEFSCR);
c->dwarf.loc[UNW_PPC64_SPE_ACC] = DWARF_REG_LOC (&c->dwarf, UNW_PPC64_SPE_ACC);
diff --git a/src/ppc64/regname.c b/src/ppc64/regname.c
index 3e3a141..6248d51 100644
--- a/src/ppc64/regname.c
+++ b/src/ppc64/regname.c
@@ -62,6 +62,21 @@ static const char *regname[] =
[UNW_PPC64_R30]="GPR30",
[UNW_PPC64_R31]="GPR31",
+ [UNW_PPC64_NIP] = "NIP",
+ [UNW_PPC64_MSR] = "MSR",
+ [UNW_PPC64_ORIG_R3] = "ORIG_R3",
+ [UNW_PPC64_CTR] = "CTR",
+ [UNW_PPC64_LR] = "LR",
+ [UNW_PPC64_XER] = "XER",
+ [UNW_PPC64_CCR] = "CCR",
+ [UNW_PPC64_SOFTE] = "SOFTE",
+ [UNW_PPC64_TRAP] = "TRAP",
+ [UNW_PPC64_DAR] = "DAR",
+ [UNW_PPC64_DSISR] = "DSISR",
+ [UNW_PPC64_RESULT] = "RESULT",
+ [UNW_PPC64_REGS_COUNT] = "REGS_COUNT",
+ [UNW_PPC64_ARG_POINTER] = "ARG_POINTER",
+
[UNW_PPC64_F0]="FPR0",
[UNW_PPC64_F1]="FPR1",
[UNW_PPC64_F2]="FPR2",
@@ -95,20 +110,7 @@ static const char *regname[] =
[UNW_PPC64_F30]="FPR30",
[UNW_PPC64_F31]="FPR31",
- [UNW_PPC64_LR]="LR",
- [UNW_PPC64_CTR]="CTR",
- [UNW_PPC64_ARG_POINTER]="ARG_POINTER",
-
- [UNW_PPC64_CR0]="CR0",
- [UNW_PPC64_CR1]="CR1",
- [UNW_PPC64_CR2]="CR2",
- [UNW_PPC64_CR3]="CR3",
- [UNW_PPC64_CR4]="CR4",
- [UNW_PPC64_CR5]="CR5",
- [UNW_PPC64_CR6]="CR6",
- [UNW_PPC64_CR7]="CR7",
-
- [UNW_PPC64_XER]="XER",
+ [UNW_PPC64_FPSCR]="UNW_PPC64_FPSCR",
[UNW_PPC64_V0]="VR0",
[UNW_PPC64_V1]="VR1",
diff --git a/src/ppc64/setcontext.S b/src/ppc64/setcontext.S
index b54378a..a72f81f 100644
--- a/src/ppc64/setcontext.S
+++ b/src/ppc64/setcontext.S
@@ -1,7 +1,7 @@
.global _UI_setcontext
_UI_setcontext:
- retq
+ blr
#ifdef __linux__
/* We do not need executable stack. */
diff --git a/src/ptrace/_UPT_reg_offset.c b/src/ptrace/_UPT_reg_offset.c
index 68461a2..0de1735 100644
--- a/src/ptrace/_UPT_reg_offset.c
+++ b/src/ptrace/_UPT_reg_offset.c
@@ -428,16 +428,20 @@ const int _UPT_reg_offset[UNW_REG_LAST + 1] =
#define UNW_PPC64_REGS \
[UNW_PPC64_NIP] = UNW_PPC_PT(NIP), \
- [UNW_PPC64_FRAME_POINTER] = -1, \
+ [UNW_PPC64_MSR] = -1, \
+ [UNW_PPC64_ORIG_R3] = -1, \
+ [UNW_PPC64_CTR] = -1, \
+ [UNW_PPC64_LR] = -1, \
+ [UNW_PPC64_XER] = -1, \
+ [UNW_PPC64_CCR] = -1, \
+ [UNW_PPC64_SOFTE] = -1, \
+ [UNW_PPC64_TRAP] = -1, \
+ [UNW_PPC64_DAR] = -1, \
+ [UNW_PPC64_DAR] = -1, \
+ [UNW_PPC64_DSISR] = -1, \
+ [UNW_PPC64_RESULT] = -1, \
+ [UNW_PPC64_REGS_COUNT] = -1, \
[UNW_PPC64_ARG_POINTER] = -1, \
- [UNW_PPC64_CR0] = -1, \
- [UNW_PPC64_CR1] = -1, \
- [UNW_PPC64_CR2] = -1, \
- [UNW_PPC64_CR3] = -1, \
- [UNW_PPC64_CR4] = -1, \
- [UNW_PPC64_CR5] = -1, \
- [UNW_PPC64_CR6] = -1, \
- [UNW_PPC64_CR7] = -1, \
[UNW_PPC64_VRSAVE] = UNW_PPC_PT(VRSAVE), \
[UNW_PPC64_VSCR] = UNW_PPC_PT(VSCR), \
[UNW_PPC64_SPE_ACC] = -1, \
diff --git a/src/unwind/RaiseException.c b/src/unwind/RaiseException.c
index cdf134a..203978b 100644
--- a/src/unwind/RaiseException.c
+++ b/src/unwind/RaiseException.c
@@ -37,11 +37,11 @@ _Unwind_RaiseException (struct _Unwind_Exception *exception_object)
unw_word_t ip;
int ret;
- Debug (1, "(exception_object=%p)\n", exception_object);
-
if (_Unwind_InitContext (&context, &uc) < 0)
return _URC_FATAL_PHASE1_ERROR;
+ Debug (1, "(exception_object=%p)\n", exception_object);
+
/* Phase 1 (search phase) */
while (1)
diff --git a/src/unwind/Resume.c b/src/unwind/Resume.c
index dd0a44b..0b91de6 100644
--- a/src/unwind/Resume.c
+++ b/src/unwind/Resume.c
@@ -34,6 +34,8 @@ _Unwind_Resume (struct _Unwind_Exception *exception_object)
if (_Unwind_InitContext (&context, &uc) < 0)
abort ();
+ Debug (1, "(exception_object=%p private_2=%lx)\n", exception_object, exception_object->private_2);
+
_Unwind_Phase2 (exception_object, &context);
abort ();
}
_______________________________________________
Libunwind-devel mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/libunwind-devel