Deleted Added
sdiff udiff text old ( 121642 ) new ( 129059 )
full compact
1/*
2Copyright (c) 2003 Hewlett-Packard Development Company, L.P.
3Permission is hereby granted, free of charge, to any person
4obtaining a copy of this software and associated documentation
5files (the "Software"), to deal in the Software without
6restriction, including without limitation the rights to use,
7copy, modify, merge, publish, distribute, sublicense, and/or sell
8copies of the Software, and to permit persons to whom the

--- 8 unchanged lines hidden (view full) ---

17OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
19HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
20WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22OTHER DEALINGS IN THE SOFTWARE.
23*/
24
25#ifndef _KERNEL
26#include <stdlib.h>
27#include <crt0.h>
28#include <dlfcn.h>
29#include <sys/uc_access.h>
30#endif
31
32#include "uwx_env.h"
33#include "uwx_context.h"
34#include "uwx_trace.h"
35#include "uwx_self.h"
36
37#define UWX_ABI_HPUX_SIGCONTEXT 0x0101 /* abi = HP-UX, context = 1 */
38
39struct uwx_self_info {
40 ucontext_t *ucontext;
41 uint64_t bspstore;
42 uint64_t rvec[10];
43 uint64_t sendsig_start;
44 uint64_t sendsig_end;
45 alloc_cb allocate_cb;
46 free_cb free_cb;
47 int trace;

--- 7 unchanged lines hidden (view full) ---

55 info = (struct uwx_self_info *)
56 malloc(sizeof(struct uwx_self_info));
57 else
58 info = (struct uwx_self_info *)
59 (*env->allocate_cb)(sizeof(struct uwx_self_info));
60 if (info == 0)
61 return 0;
62
63 info->ucontext = 0;
64 info->bspstore = 0;
65 info->sendsig_start = __load_info->li_sendsig_txt;
66 info->sendsig_end = __load_info->li_sendsig_txt +
67 __load_info->li_sendsig_tsz;
68 info->allocate_cb = env->allocate_cb;
69 info->free_cb = env->free_cb;
70 info->trace = env->trace;

--- 79 unchanged lines hidden (view full) ---

150{
151 int status;
152 int regid;
153 unsigned int nat;
154 struct uwx_self_info *info = (struct uwx_self_info *) tok;
155 unsigned long *wp;
156 uint64_t *dp;
157
158 dp = (uint64_t *) loc;
159
160 if (request == UWX_COPYIN_UINFO ||
161 request == UWX_COPYIN_MSTACK) {
162 if (len == 4) {
163 wp = (unsigned long *) loc;
164 *wp = *(unsigned long *)rem;
165 TRACE_SELF_COPYIN4(rem, len, wp)
166 }
167 else if (len == 8) {
168 *dp = *(uint64_t *)rem;
169 TRACE_SELF_COPYIN4(rem, len, dp)
170 }
171 else
172 return 0;
173 }
174 else if (request == UWX_COPYIN_RSTACK && len == 8) {
175 if (info->ucontext == 0 || rem < info->bspstore) {
176 *dp = *(uint64_t *)rem;
177 TRACE_SELF_COPYIN4(rem, len, dp)
178 }
179 else {
180 status = __uc_get_rsebs(info->ucontext, (uint64_t *)rem, 1, dp);
181 if (status != 0)
182 return 0;
183 }
184 }
185 else if (request == UWX_COPYIN_REG && len == 8) {
186 if (info->ucontext == 0)
187 return 0;
188 regid = (int)rem;
189 if (rem < UWX_REG_GR(0)) {
190 switch (regid) {
191 case UWX_REG_PREDS:
192 status = __uc_get_prs(info->ucontext, dp);
193 break;
194 case UWX_REG_AR_PFS:
195 status = __uc_get_ar(info->ucontext, 64, dp);
196 break;
197 case UWX_REG_AR_RNAT:
198 status = __uc_get_ar(info->ucontext, 19, dp);
199 break;
200 case UWX_REG_AR_UNAT:
201 status = __uc_get_ar(info->ucontext, 36, dp);
202 break;
203 case UWX_REG_AR_FPSR:
204 status = __uc_get_ar(info->ucontext, 40, dp);
205 break;
206 case UWX_REG_AR_LC:
207 status = __uc_get_ar(info->ucontext, 65, dp);
208 break;
209 default:
210 return 0;
211 }
212 }
213 else if (regid >= UWX_REG_GR(1) && regid <= UWX_REG_GR(31)) {
214 status = __uc_get_grs(info->ucontext,
215 regid - UWX_REG_GR(0), 1, dp, &nat);
216 }
217 else if (regid >= UWX_REG_BR(0) && regid <= UWX_REG_BR(7)) {
218 status = __uc_get_brs(info->ucontext,
219 regid - UWX_REG_BR(0), 1, dp);
220 }
221 if (status != 0)
222 return 0;
223 }
224 return len;
225}
226
227
228int uwx_self_lookupip(
229 int request,
230 uint64_t ip,
231 intptr_t tok,

--- 47 unchanged lines hidden ---