Change the type of psaddr_t from void* to uintptr_t. A pointer

type cannot be made wider to allow ILP32 platforms to target
LP64 platforms.
This commit is contained in:
Marcel Moolenaar 2008-07-30 00:59:19 +00:00
parent 1f8287f868
commit 16b0c20c82
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=180982
6 changed files with 26 additions and 28 deletions

View File

@ -240,8 +240,7 @@ pt_ta_map_id2thr(const td_thragent_t *ta, thread_t id, td_thrhandle_t *th)
* mapped to user thread.
*/
while (pt != 0) {
ret = ps_pread(ta->ph,
pt + ta->thread_off_tcb,
ret = ps_pread(ta->ph, pt + ta->thread_off_tcb,
&tcb_addr, sizeof(tcb_addr));
if (ret != 0)
return (P2T(ret));
@ -1075,16 +1074,15 @@ pt_validate(const td_thrhandle_t *th)
}
td_err_e
pt_thr_tls_get_addr(const td_thrhandle_t *th, void *_linkmap, size_t offset,
void **address)
pt_thr_tls_get_addr(const td_thrhandle_t *th, psaddr_t _linkmap, size_t offset,
psaddr_t *address)
{
char *obj_entry;
const td_thragent_t *ta = th->th_ta;
psaddr_t tcb_addr, *dtv_addr;
psaddr_t dtv_addr, obj_entry, tcb_addr;
int tls_index, ret;
/* linkmap is a member of Obj_Entry */
obj_entry = (char *)_linkmap - ta->thread_off_linkmap;
obj_entry = _linkmap - ta->thread_off_linkmap;
/* get tlsindex of the object file */
ret = ps_pread(ta->ph,
@ -1106,8 +1104,8 @@ pt_thr_tls_get_addr(const td_thrhandle_t *th, void *_linkmap, size_t offset,
if (ret != 0)
return (P2T(ret));
/* now get the object's tls block base address */
ret = ps_pread(ta->ph, &dtv_addr[tls_index+1], address,
sizeof(*address));
ret = ps_pread(ta->ph, dtv_addr + sizeof(void *) * (tls_index + 1),
address, sizeof(*address));
if (ret != 0)
return (P2T(ret));

View File

@ -216,7 +216,7 @@ pt_ta_map_id2thr(const td_thragent_t *ta, thread_t id, td_thrhandle_t *th)
return (P2T(ret));
/* Iterate through thread list to find pthread */
pt = (psaddr_t)thread_list.tqh_first;
while (pt != NULL) {
while (pt != 0) {
ret = ps_pread(ta->ph, pt + ta->thread_off_tid,
&lwp, sizeof(lwp));
if (ret != 0)
@ -230,7 +230,7 @@ pt_ta_map_id2thr(const td_thragent_t *ta, thread_t id, td_thrhandle_t *th)
if (ret != 0)
return (P2T(ret));
}
if (pt == NULL)
if (pt == 0)
return (TD_NOTHR);
th->th_ta = ta;
th->th_tid = id;
@ -389,13 +389,13 @@ pt_ta_event_getmsg(const td_thragent_t *ta, td_event_msg_t *msg)
ret = ps_pread(ta->ph, ta->thread_last_event_addr, &pt, sizeof(pt));
if (ret != 0)
return (P2T(ret));
if (pt == NULL)
if (pt == 0)
return (TD_NOMSG);
/*
* Take the event pointer, at the time, libthr only reports event
* once a time, so it is not a link list.
*/
pt_temp = NULL;
pt_temp = 0;
ps_pwrite(ta->ph, ta->thread_last_event_addr, &pt_temp, sizeof(pt_temp));
/* Read event info */
@ -684,7 +684,7 @@ pt_thr_event_getmsg(const td_thrhandle_t *th, td_event_msg_t *msg)
* once a time, so it is not a link list.
*/
if (pt == pt_temp) {
pt_temp = NULL;
pt_temp = 0;
ps_pwrite(ta->ph, ta->thread_last_event_addr, &pt_temp, sizeof(pt_temp));
}
/* Clear event */
@ -714,22 +714,21 @@ static int
pt_validate(const td_thrhandle_t *th)
{
if (th->th_tid == 0 || th->th_thread == NULL)
if (th->th_tid == 0 || th->th_thread == 0)
return (TD_ERR);
return (TD_OK);
}
static td_err_e
pt_thr_tls_get_addr(const td_thrhandle_t *th, void *_linkmap, size_t offset,
void **address)
pt_thr_tls_get_addr(const td_thrhandle_t *th, psaddr_t _linkmap, size_t offset,
psaddr_t *address)
{
char *obj_entry;
const td_thragent_t *ta = th->th_ta;
psaddr_t tcb_addr, *dtv_addr;
psaddr_t dtv_addr, obj_entry, tcb_addr;
int tls_index, ret;
/* linkmap is a member of Obj_Entry */
obj_entry = (char *)_linkmap - ta->thread_off_linkmap;
obj_entry = _linkmap - ta->thread_off_linkmap;
/* get tlsindex of the object file */
ret = ps_pread(ta->ph,
@ -750,8 +749,8 @@ pt_thr_tls_get_addr(const td_thrhandle_t *th, void *_linkmap, size_t offset,
if (ret != 0)
return (P2T(ret));
/* now get the object's tls block base address */
ret = ps_pread(ta->ph, &dtv_addr[tls_index+1], address,
sizeof(*address));
ret = ps_pread(ta->ph, dtv_addr + sizeof(void *) * (tls_index+1),
address, sizeof(*address));
if (ret != 0)
return (P2T(ret));

View File

@ -244,8 +244,8 @@ td_thr_validate(const td_thrhandle_t *th)
}
td_err_e
td_thr_tls_get_addr(const td_thrhandle_t *th, void *linkmap, size_t offset,
void **address)
td_thr_tls_get_addr(const td_thrhandle_t *th, psaddr_t linkmap, size_t offset,
psaddr_t *address)
{
const td_thragent_t *ta = th->th_ta;
return (ta->ta_ops->to_thr_tls_get_addr(th, linkmap, offset, address));

View File

@ -239,7 +239,8 @@ td_err_e td_thr_setxmmregs(const td_thrhandle_t *, const char *);
td_err_e td_thr_setfpregs(const td_thrhandle_t *, const prfpregset_t *);
td_err_e td_thr_setgregs(const td_thrhandle_t *, const prgregset_t);
td_err_e td_thr_validate(const td_thrhandle_t *);
td_err_e td_thr_tls_get_addr(const td_thrhandle_t *, void *, size_t, void **);
td_err_e td_thr_tls_get_addr(const td_thrhandle_t *, psaddr_t, size_t,
psaddr_t *);
/* FreeBSD specific extensions. */
td_err_e td_thr_sstep(const td_thrhandle_t *, int);

View File

@ -74,8 +74,8 @@ struct ta_ops {
const prfpregset_t *);
td_err_e (*to_thr_setgregs)(const td_thrhandle_t *, const prgregset_t);
td_err_e (*to_thr_validate)(const td_thrhandle_t *);
td_err_e (*to_thr_tls_get_addr)(const td_thrhandle_t *,
void *, size_t, void **);
td_err_e (*to_thr_tls_get_addr)(const td_thrhandle_t *, psaddr_t,
size_t, psaddr_t *);
/* FreeBSD specific extensions. */
td_err_e (*to_thr_sstep)(const td_thrhandle_t *, int);

View File

@ -80,6 +80,6 @@ typedef struct prpsinfo {
char pr_psargs[PRARGSZ+1]; /* Arguments, null terminated (1) */
} prpsinfo_t;
typedef void *psaddr_t; /* An address in the target process. */
typedef uintptr_t psaddr_t; /* An address in the target process. */
#endif /* _SYS_PROCFS_H_ */