00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 #define MD_FALLBACK_FRAME_STATE_FOR s390_fallback_frame_state
00033
00034 static _Unwind_Reason_Code
00035 s390_fallback_frame_state (struct _Unwind_Context *context,
00036 _Unwind_FrameState *fs)
00037 {
00038 unsigned char *pc = context->ra;
00039 long new_cfa;
00040 int i;
00041
00042 typedef struct
00043 {
00044 unsigned long psw_mask;
00045 unsigned long psw_addr;
00046 unsigned long gprs[16];
00047 unsigned int acrs[16];
00048 unsigned int fpc;
00049 unsigned int __pad;
00050 double fprs[16];
00051 } __attribute__ ((__aligned__ (8))) sigregs_;
00052
00053 sigregs_ *regs;
00054 int *signo = NULL;
00055
00056
00057 if (pc[0] != 0x0a || (pc[1] != 119 && pc[1] != 173))
00058 return _URC_END_OF_STACK;
00059
00060
00061
00062
00063
00064 if (context->ra == context->cfa)
00065 {
00066 struct ucontext_
00067 {
00068 unsigned long uc_flags;
00069 struct ucontext_ *uc_link;
00070 unsigned long uc_stack[3];
00071 sigregs_ uc_mcontext;
00072 } *uc = context->cfa + 8 + 128;
00073
00074 regs = &uc->uc_mcontext;
00075 signo = context->cfa + sizeof(long);
00076 }
00077
00078
00079
00080
00081 else
00082 {
00083 regs = *(sigregs_ **)(context->cfa + 8);
00084
00085
00086
00087
00088 if ((void *)(regs + 1) != context->ra)
00089 signo = (int *)(regs + 1);
00090 }
00091
00092 new_cfa = regs->gprs[15] + 16*sizeof(long) + 32;
00093 fs->cfa_how = CFA_REG_OFFSET;
00094 fs->cfa_reg = 15;
00095 fs->cfa_offset =
00096 new_cfa - (long) context->cfa + 16*sizeof(long) + 32;
00097
00098 for (i = 0; i < 16; i++)
00099 {
00100 fs->regs.reg[i].how = REG_SAVED_OFFSET;
00101 fs->regs.reg[i].loc.offset =
00102 (long)®s->gprs[i] - new_cfa;
00103 }
00104 for (i = 0; i < 16; i++)
00105 {
00106 fs->regs.reg[16+i].how = REG_SAVED_OFFSET;
00107 fs->regs.reg[16+i].loc.offset =
00108 (long)®s->fprs[i] - new_cfa;
00109 }
00110
00111
00112
00113 fs->regs.reg[32].how = REG_SAVED_OFFSET;
00114 fs->regs.reg[32].loc.offset = (long)®s->psw_addr - new_cfa;
00115 fs->retaddr_column = 32;
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130 if (signo && (*signo == 11 || *signo == 7))
00131 {
00132 fs->regs.reg[33].loc.exp =
00133 (unsigned char *)regs->psw_addr + 1;
00134 fs->regs.reg[32].loc.offset =
00135 (long)&fs->regs.reg[33].loc.exp - new_cfa;
00136 }
00137
00138 return _URC_NO_REASON;
00139 }