OSDN Git Service

2001-05-17 Andrew Haley <aph@redhat.com>
authoraph <aph@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 21 May 2001 12:31:14 +0000 (12:31 +0000)
committeraph <aph@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 21 May 2001 12:31:14 +0000 (12:31 +0000)
        * config/rs6000/linux.h (MD_FALLBACK_FRAME_STATE_FOR): New.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@42386 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/config/rs6000/linux.h

index 17baec6..01a4e4d 100644 (file)
@@ -1,3 +1,7 @@
+2001-05-17  Andrew Haley  <aph@redhat.com>
+
+       * config/rs6000/linux.h (MD_FALLBACK_FRAME_STATE_FOR): New.
+
 2001-05-21  Richard Henderson  <rth@redhat.com>
 
        * dwarf2out.c (DEBUG_FRAME_SECTION): Rename from FRAME_SECTION.
index f0cf9d1..285cf55 100644 (file)
@@ -66,3 +66,56 @@ Boston, MA 02111-1307, USA.  */
 #ifndef USE_GNULIBC_1
 #define DEFAULT_VTABLE_THUNKS 1
 #endif
+
+/* Do code reading to identify a signal frame, and set the frame
+   state data appropriately.  See unwind-dw2.c for the structs.  */
+
+#ifdef IN_LIBGCC2
+#include <signal.h>
+#include <sys/ucontext.h>
+#endif
+
+#define MD_FALLBACK_FRAME_STATE_FOR(CONTEXT, FS, SUCCESS)              \
+  do {                                                                 \
+    unsigned char *pc_ = (CONTEXT)->ra;                                        \
+    struct sigcontext *sc_;                                            \
+    long new_cfa_;                                                     \
+    int i_;                                                            \
+                                                                       \
+    /* li r0, 0x7777; sc  (rt_sigreturn)  */                           \
+    /* li r0, 0x6666; sc  (sigreturn)  */                              \
+    if (((*(unsigned int *) (pc_+0) == 0x38007777)                     \
+        || (*(unsigned int *) (pc_+0) == 0x38006666))                  \
+       && (*(unsigned int *) (pc_+4)  == 0x44000002))                  \
+       sc_ = (CONTEXT)->cfa + __SIGNAL_FRAMESIZE;                      \
+    else                                                               \
+      break;                                                           \
+                                                                       \
+    new_cfa_ = sc_->regs->gpr[STACK_POINTER_REGNUM];                   \
+    (FS)->cfa_how = CFA_REG_OFFSET;                                    \
+    (FS)->cfa_reg = STACK_POINTER_REGNUM;                              \
+    (FS)->cfa_offset = new_cfa_ - (long) (CONTEXT)->cfa;               \
+                                                                       \
+    for (i_ = 0; i_ < 32; i_++)                                                \
+      if (i_ != STACK_POINTER_REGNUM)                                  \
+       {                                                               \
+         (FS)->regs.reg[i_].how = REG_SAVED_OFFSET;                    \
+         (FS)->regs.reg[i_].loc.offset                                 \
+           = (long)&(sc_->regs->gpr[i_]) - new_cfa_;                   \
+       }                                                               \
+                                                                       \
+    (FS)->regs.reg[LINK_REGISTER_REGNUM].how = REG_SAVED_OFFSET;       \
+    (FS)->regs.reg[LINK_REGISTER_REGNUM].loc.offset                    \
+      = (long)&(sc_->regs->link) - new_cfa_;                           \
+                                                                       \
+    /* The unwinder expects the IP to point to the following insn,     \
+       whereas the kernel returns the address of the actual            \
+       faulting insn.  */                                              \
+    sc_->regs->nip += 4;                                               \
+    (FS)->regs.reg[CR0_REGNO].how = REG_SAVED_OFFSET;                  \
+    (FS)->regs.reg[CR0_REGNO].loc.offset                               \
+      = (long)&(sc_->regs->nip) - new_cfa_;                            \
+    (FS)->retaddr_column = CR0_REGNO;                                  \
+    goto SUCCESS;                                                      \
+  } while (0)
+