comparison gcc/config/rs6000/linux-unwind.h @ 55:77e2b8dfacca gcc-4.4.5

update it from 4.4.3 to 4.5.0
author ryoma <e075725@ie.u-ryukyu.ac.jp>
date Fri, 12 Feb 2010 23:39:51 +0900
parents a06113de4d67
children
comparison
equal deleted inserted replaced
52:c156f1bd5cd9 55:77e2b8dfacca
89 regs. Otherwise return NULL. */ 89 regs. Otherwise return NULL. */
90 90
91 static struct gcc_regs * 91 static struct gcc_regs *
92 get_regs (struct _Unwind_Context *context) 92 get_regs (struct _Unwind_Context *context)
93 { 93 {
94 const unsigned char *pc = context->ra; 94 const unsigned int *pc = context->ra;
95 95
96 /* addi r1, r1, 128; li r0, 0x0077; sc (sigreturn) */ 96 /* addi r1, r1, 128; li r0, 0x0077; sc (sigreturn) */
97 /* addi r1, r1, 128; li r0, 0x00AC; sc (rt_sigreturn) */ 97 /* addi r1, r1, 128; li r0, 0x00AC; sc (rt_sigreturn) */
98 if (*(unsigned int *) (pc + 0) != 0x38210000 + SIGNAL_FRAMESIZE 98 if (pc[0] != 0x38210000 + SIGNAL_FRAMESIZE || pc[2] != 0x44000002)
99 || *(unsigned int *) (pc + 8) != 0x44000002)
100 return NULL; 99 return NULL;
101 if (*(unsigned int *) (pc + 4) == 0x38000077) 100 if (pc[1] == 0x38000077)
102 { 101 {
103 struct sigframe { 102 struct sigframe {
104 char gap[SIGNAL_FRAMESIZE]; 103 char gap[SIGNAL_FRAMESIZE];
105 unsigned long pad[7]; 104 unsigned long pad[7];
106 struct gcc_regs *regs; 105 struct gcc_regs *regs;
107 } *frame = (struct sigframe *) context->cfa; 106 } *frame = (struct sigframe *) context->cfa;
108 return frame->regs; 107 return frame->regs;
109 } 108 }
110 else if (*(unsigned int *) (pc + 4) == 0x380000AC) 109 else if (pc[1] == 0x380000AC)
111 { 110 {
112 /* This works for 2.4 kernels, but not for 2.6 kernels with vdso 111 /* This works for 2.4 kernels, but not for 2.6 kernels with vdso
113 because pc isn't pointing into the stack. Can be removed when 112 because pc isn't pointing into the stack. Can be removed when
114 no one is running 2.4.19 or 2.4.20, the first two ppc64 113 no one is running 2.4.19 or 2.4.20, the first two ppc64
115 kernels released. */ 114 kernels released. */
116 struct rt_sigframe_24 { 115 const struct rt_sigframe_24 {
117 int tramp[6]; 116 int tramp[6];
118 void *pinfo; 117 void *pinfo;
119 struct gcc_ucontext *puc; 118 struct gcc_ucontext *puc;
120 } *frame24 = (struct rt_sigframe_24 *) pc; 119 } *frame24 = (const struct rt_sigframe_24 *) context->ra;
121 120
122 /* Test for magic value in *puc of vdso. */ 121 /* Test for magic value in *puc of vdso. */
123 if ((long) frame24->puc != -21 * 8) 122 if ((long) frame24->puc != -21 * 8)
124 return frame24->puc->regs; 123 return frame24->puc->regs;
125 else 124 else
144 enum { SIGNAL_FRAMESIZE = 64 }; 143 enum { SIGNAL_FRAMESIZE = 64 };
145 144
146 static struct gcc_regs * 145 static struct gcc_regs *
147 get_regs (struct _Unwind_Context *context) 146 get_regs (struct _Unwind_Context *context)
148 { 147 {
149 const unsigned char *pc = context->ra; 148 const unsigned int *pc = context->ra;
150 149
151 /* li r0, 0x7777; sc (sigreturn old) */ 150 /* li r0, 0x7777; sc (sigreturn old) */
152 /* li r0, 0x0077; sc (sigreturn new) */ 151 /* li r0, 0x0077; sc (sigreturn new) */
153 /* li r0, 0x6666; sc (rt_sigreturn old) */ 152 /* li r0, 0x6666; sc (rt_sigreturn old) */
154 /* li r0, 0x00AC; sc (rt_sigreturn new) */ 153 /* li r0, 0x00AC; sc (rt_sigreturn new) */
155 if (*(const unsigned int *) (pc + 4) != 0x44000002) 154 if (pc[1] != 0x44000002)
156 return NULL; 155 return NULL;
157 if (*(const unsigned int *) (pc + 0) == 0x38007777 156 if (pc[0] == 0x38007777 || pc[0] == 0x38000077)
158 || *(const unsigned int *) (pc + 0) == 0x38000077)
159 { 157 {
160 struct sigframe { 158 struct sigframe {
161 char gap[SIGNAL_FRAMESIZE]; 159 char gap[SIGNAL_FRAMESIZE];
162 unsigned long pad[7]; 160 unsigned long pad[7];
163 struct gcc_regs *regs; 161 struct gcc_regs *regs;
164 } *frame = (struct sigframe *) context->cfa; 162 } *frame = (struct sigframe *) context->cfa;
165 return frame->regs; 163 return frame->regs;
166 } 164 }
167 else if (*(const unsigned int *) (pc + 0) == 0x38006666 165 else if (pc[0] == 0x38006666 || pc[0] == 0x380000AC)
168 || *(const unsigned int *) (pc + 0) == 0x380000AC)
169 { 166 {
170 struct rt_sigframe { 167 struct rt_sigframe {
171 char gap[SIGNAL_FRAMESIZE + 16]; 168 char gap[SIGNAL_FRAMESIZE + 16];
172 char siginfo[128]; 169 char siginfo[128];
173 struct gcc_ucontext uc; 170 struct gcc_ucontext uc;