version 1.35, 2007/03/14 21:09:01 |
version 1.35.2.2, 2007/08/15 13:46:54 |
Line 42 __RCSID("$NetBSD$"); |
|
Line 42 __RCSID("$NetBSD$"); |
|
|
|
#include <sys/param.h> |
#include <sys/param.h> |
#include <sys/types.h> |
#include <sys/types.h> |
|
#include <sys/lock.h> |
|
|
#include <stddef.h> |
#include <stddef.h> |
#include <stdlib.h> |
#include <stdlib.h> |
Line 200 td_thr_iter(td_proc_t *proc, int (*call) |
|
Line 201 td_thr_iter(td_proc_t *proc, int (*call) |
|
{ |
{ |
int val; |
int val; |
caddr_t next; |
caddr_t next; |
struct pthread_queue_t allq; |
pthread_queue_t allq; |
td_thread_t *thread; |
td_thread_t *thread; |
|
|
val = READ(proc, proc->allqaddr, &allq, sizeof(allq)); |
val = READ(proc, proc->allqaddr, &allq, sizeof(allq)); |
|
|
td_thr_info(td_thread_t *thread, td_thread_info_t *info) |
td_thr_info(td_thread_t *thread, td_thread_info_t *info) |
{ |
{ |
int tmp, val; |
int tmp, val; |
struct pthread_queue_t queue; |
pthread_queue_t queue; |
|
|
val = READ(thread->proc, thread->addr, &tmp, sizeof(tmp)); |
val = READ(thread->proc, thread->addr, &tmp, sizeof(tmp)); |
if (val != 0) |
if (val != 0) |
Line 403 td_thr_join_iter(td_thread_t *thread, in |
|
Line 404 td_thr_join_iter(td_thread_t *thread, in |
|
int val; |
int val; |
caddr_t next; |
caddr_t next; |
td_thread_t *thread2; |
td_thread_t *thread2; |
struct pthread_queue_t queue; |
pthread_queue_t queue; |
|
|
if ((val = READ(thread->proc, |
if ((val = READ(thread->proc, |
thread->addr + offsetof(struct __pthread_st, pt_joiners), |
thread->addr + offsetof(struct __pthread_st, pt_joiners), |
|
|
td_sync_info(td_sync_t *s, td_sync_info_t *info) |
td_sync_info(td_sync_t *s, td_sync_info_t *info) |
{ |
{ |
int val, magic, n; |
int val, magic, n; |
struct pthread_queue_t queue; |
pthread_queue_t queue; |
pthread_spin_t slock; |
pthread_spin_t slock; |
pthread_t taddr; |
pthread_t taddr; |
td_proc_t *proc = s->proc; |
td_proc_t *proc = s->proc; |
Line 465 td_sync_info(td_sync_t *s, td_sync_info_ |
|
Line 466 td_sync_info(td_sync_t *s, td_sync_info_ |
|
s->addr + offsetof(struct __pthread_mutex_st, ptm_lock), |
s->addr + offsetof(struct __pthread_mutex_st, ptm_lock), |
(void *)&slock, sizeof(slock))) != 0) |
(void *)&slock, sizeof(slock))) != 0) |
return val; |
return val; |
if (slock == __SIMPLELOCK_LOCKED) { |
if (__SIMPLELOCK_LOCKED_P(&slock)) { |
info->sync_data.mutex.locked = 1; |
info->sync_data.mutex.locked = 1; |
if ((val = READ(proc, |
if ((val = READ(proc, |
s->addr + offsetof(struct __pthread_mutex_st, |
s->addr + offsetof(struct __pthread_mutex_st, |
Line 497 td_sync_info(td_sync_t *s, td_sync_info_ |
|
Line 498 td_sync_info(td_sync_t *s, td_sync_info_ |
|
s->addr + offsetof(struct __pthread_spinlock_st, pts_spin), |
s->addr + offsetof(struct __pthread_spinlock_st, pts_spin), |
(void *)&slock, sizeof(slock))) != 0) |
(void *)&slock, sizeof(slock))) != 0) |
return val; |
return val; |
if (slock == __SIMPLELOCK_LOCKED) |
if (__SIMPLELOCK_LOCKED_P(&slock)) |
info->sync_data.spin.locked = 1; |
info->sync_data.spin.locked = 1; |
else |
else |
info->sync_data.spin.locked = 0; |
info->sync_data.spin.locked = 0; |
Line 568 td_sync_waiters_iter(td_sync_t *s, int ( |
|
Line 569 td_sync_waiters_iter(td_sync_t *s, int ( |
|
{ |
{ |
int val, magic; |
int val, magic; |
caddr_t next; |
caddr_t next; |
struct pthread_queue_t queue; |
pthread_queue_t queue; |
td_thread_t *thread; |
td_thread_t *thread; |
|
|
val = READ(s->proc, s->addr, &magic, sizeof(magic)); |
val = READ(s->proc, s->addr, &magic, sizeof(magic)); |
Line 666 td_map_id2thr(td_proc_t *proc, int threa |
|
Line 667 td_map_id2thr(td_proc_t *proc, int threa |
|
{ |
{ |
int val, num; |
int val, num; |
caddr_t next; |
caddr_t next; |
struct pthread_queue_t allq; |
pthread_queue_t allq; |
td_thread_t *thread; |
td_thread_t *thread; |
|
|
|
|
Line 837 td_thr_sleepinfo(td_thread_t *thread, td |
|
Line 838 td_thr_sleepinfo(td_thread_t *thread, td |
|
return _val; \ |
return _val; \ |
} else { \ |
} else { \ |
_val = WRITE(thread->proc, (head) + \ |
_val = WRITE(thread->proc, (head) + \ |
offsetof(struct pthread_queue_t, ptqh_last), \ |
offsetof(pthread_queue_t, ptqh_last), \ |
&_qent.ptqe_prev, sizeof(_qent.ptqe_prev)); \ |
&_qent.ptqe_prev, sizeof(_qent.ptqe_prev)); \ |
if (_val != 0) \ |
if (_val != 0) \ |
return _val; \ |
return _val; \ |
Line 850 td_thr_sleepinfo(td_thread_t *thread, td |
|
Line 851 td_thr_sleepinfo(td_thread_t *thread, td |
|
|
|
#define DPTQ_INSERT_TAIL(head, elm, field) do { \ |
#define DPTQ_INSERT_TAIL(head, elm, field) do { \ |
int _val; \ |
int _val; \ |
struct pthread_queue_t _qhead; \ |
pthread_queue_t _qhead; \ |
PTQ_ENTRY(__pthread_st) _qent; \ |
PTQ_ENTRY(__pthread_st) _qent; \ |
\ |
\ |
/* if ((head)->ptqh_last == NULL) */ \ |
/* if ((head)->ptqh_last == NULL) */ \ |
Line 885 td_thr_sleepinfo(td_thread_t *thread, td |
|
Line 886 td_thr_sleepinfo(td_thread_t *thread, td |
|
if (_val != 0) \ |
if (_val != 0) \ |
return _val; \ |
return _val; \ |
_val = WRITE(thread->proc, \ |
_val = WRITE(thread->proc, \ |
(head) + offsetof(struct pthread_queue_t, ptqh_last), \ |
(head) + offsetof(pthread_queue_t, ptqh_last), \ |
&_qhead.ptqh_last, sizeof(_qhead.ptqh_last)); \ |
&_qhead.ptqh_last, sizeof(_qhead.ptqh_last)); \ |
if (_val != 0) \ |
if (_val != 0) \ |
return _val; \ |
return _val; \ |