sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 1 | #ifndef __DRD_CLIENTREQ_H |
| 2 | #define __DRD_CLIENTREQ_H |
| 3 | |
| 4 | |
| 5 | #include "valgrind.h" // VG_USERREQ_TOOL_BASE() |
| 6 | |
| 7 | |
| 8 | enum { |
| 9 | /* Ask the core the thread ID assigned by Valgrind. */ |
| 10 | VG_USERREQ__GET_THREAD_SELF = VG_USERREQ_TOOL_BASE('D', 'R'), |
| 11 | /* args: none. */ |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 12 | |
| 13 | /* To tell the drd tool to suppress data race detection on the specified */ |
| 14 | /* address range. */ |
| 15 | VG_USERREQ__DRD_START_SUPPRESSION, |
bart | 5e85d26 | 2008-03-01 10:49:37 +0000 | [diff] [blame] | 16 | /* args: start address, end address */ |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 17 | /* To tell the drd tool no longer to suppress data race detection on the */ |
| 18 | /* specified address range. */ |
| 19 | VG_USERREQ__DRD_FINISH_SUPPRESSION, |
bart | 5e85d26 | 2008-03-01 10:49:37 +0000 | [diff] [blame] | 20 | /* args: start address, end address */ |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 21 | /* Ask drd to suppress data race reports on all currently allocated stack */ |
| 22 | /* data of the current thread. */ |
| 23 | VG_USERREQ__DRD_SUPPRESS_CURRENT_STACK, |
| 24 | /* args: none */ |
| 25 | /* To ask the drd tool to start a new segment in the specified thread. */ |
| 26 | VG_USERREQ__DRD_START_NEW_SEGMENT, |
| 27 | /* args: POSIX thread ID. */ |
bart | 5bd9f2d | 2008-03-03 20:31:58 +0000 | [diff] [blame] | 28 | /* To ask the drd tool to trace all accesses to the specified address. */ |
| 29 | VG_USERREQ__DRD_TRACE_ADDR, |
| 30 | /* args: Addr. */ |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 31 | |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 32 | /* Tell the core the pthread_t of the running thread */ |
| 33 | VG_USERREQ__SET_PTHREADID, |
| 34 | /* args: pthread_t. */ |
| 35 | /* Ask the core that a the thread's state transition from */ |
| 36 | /* VgTs_Zombie to VgTs_Empty is delayed until */ |
| 37 | /* VG_USERREQ__POST_THREAD_JOIN is performed. */ |
| 38 | VG_USERREQ__SET_JOINABLE, |
| 39 | /* args: pthread_t, Bool */ |
| 40 | |
| 41 | /* To notify drd that a thread finished because */ |
| 42 | /* pthread_thread_join() was called on it. */ |
| 43 | VG_USERREQ__POST_THREAD_JOIN, |
| 44 | /* args: pthread_t (joinee) */ |
| 45 | |
sewardj | 8564292 | 2008-01-14 11:54:56 +0000 | [diff] [blame] | 46 | /* to notify the drd tool of a pthread_mutex_init call. */ |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 47 | VG_USERREQ__PRE_MUTEX_INIT, |
sewardj | 721ad7b | 2007-11-30 08:30:29 +0000 | [diff] [blame] | 48 | /* args: Addr, MutexT */ |
bart | 0268dfa | 2008-03-11 20:10:21 +0000 | [diff] [blame] | 49 | /* to notify the drd tool of a pthread_mutex_init call. */ |
| 50 | VG_USERREQ__POST_MUTEX_INIT, |
| 51 | /* args: Addr */ |
| 52 | /* to notify the drd tool of a pthread_mutex_destroy call. */ |
| 53 | VG_USERREQ__PRE_MUTEX_DESTROY, |
| 54 | /* args: Addr */ |
sewardj | 8564292 | 2008-01-14 11:54:56 +0000 | [diff] [blame] | 55 | /* to notify the drd tool of a pthread_mutex_destroy call. */ |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 56 | VG_USERREQ__POST_MUTEX_DESTROY, |
bart | 0268dfa | 2008-03-11 20:10:21 +0000 | [diff] [blame] | 57 | /* args: Addr, MutexT */ |
sewardj | 8564292 | 2008-01-14 11:54:56 +0000 | [diff] [blame] | 58 | /* to notify the drd tool of pthread_mutex_lock calls */ |
bart | 0268dfa | 2008-03-11 20:10:21 +0000 | [diff] [blame] | 59 | VG_USERREQ__PRE_MUTEX_LOCK, |
| 60 | /* args: Addr, MutexT */ |
sewardj | 8564292 | 2008-01-14 11:54:56 +0000 | [diff] [blame] | 61 | /* to notify the drd tool of pthread_mutex_lock calls */ |
bart | 0268dfa | 2008-03-11 20:10:21 +0000 | [diff] [blame] | 62 | VG_USERREQ__POST_MUTEX_LOCK, |
bart | 0034464 | 2008-03-01 15:27:41 +0000 | [diff] [blame] | 63 | /* args: Addr, Bool */ |
sewardj | 8564292 | 2008-01-14 11:54:56 +0000 | [diff] [blame] | 64 | /* to notify the drd tool of pthread_mutex_unlock calls */ |
bart | 0268dfa | 2008-03-11 20:10:21 +0000 | [diff] [blame] | 65 | VG_USERREQ__PRE_MUTEX_UNLOCK, |
| 66 | /* args: Addr */ |
| 67 | /* to notify the drd tool of pthread_mutex_unlock calls */ |
| 68 | VG_USERREQ__POST_MUTEX_UNLOCK, |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 69 | /* args: Addr */ |
| 70 | VG_USERREQ__SPIN_INIT_OR_UNLOCK, |
bart | 0268dfa | 2008-03-11 20:10:21 +0000 | [diff] [blame] | 71 | /* args: Addr spinlock */ |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 72 | |
| 73 | |
sewardj | 8564292 | 2008-01-14 11:54:56 +0000 | [diff] [blame] | 74 | /* to notify the drd tool of a pthread_cond_init call. */ |
bart | 0268dfa | 2008-03-11 20:10:21 +0000 | [diff] [blame] | 75 | VG_USERREQ__PRE_COND_INIT, |
sewardj | 721ad7b | 2007-11-30 08:30:29 +0000 | [diff] [blame] | 76 | /* args: Addr */ |
sewardj | 8564292 | 2008-01-14 11:54:56 +0000 | [diff] [blame] | 77 | /* to notify the drd tool of a pthread_cond_destroy call. */ |
bart | 0268dfa | 2008-03-11 20:10:21 +0000 | [diff] [blame] | 78 | VG_USERREQ__POST_COND_DESTROY, |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 79 | /* args: Addr cond */ |
bart | 0268dfa | 2008-03-11 20:10:21 +0000 | [diff] [blame] | 80 | VG_USERREQ__PRE_COND_WAIT, |
| 81 | /* args: Addr cond, Addr mutex, MutexT mt */ |
| 82 | VG_USERREQ__POST_COND_WAIT, |
| 83 | /* args: Addr cond, Addr mutex, Bool took_lock*/ |
| 84 | VG_USERREQ__PRE_COND_SIGNAL, |
| 85 | /* args: Addr cond */ |
| 86 | VG_USERREQ__PRE_COND_BROADCAST, |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 87 | /* args: Addr cond */ |
| 88 | |
sewardj | 8564292 | 2008-01-14 11:54:56 +0000 | [diff] [blame] | 89 | /* To notify the drd tool of a sem_init call. */ |
bart | 0268dfa | 2008-03-11 20:10:21 +0000 | [diff] [blame] | 90 | VG_USERREQ__PRE_SEM_INIT, |
| 91 | /* args: Addr sem, Word pshared, Word value */ |
| 92 | /* To notify the drd tool of a sem_init call. */ |
| 93 | VG_USERREQ__POST_SEM_INIT, |
| 94 | /* args: Addr sem */ |
sewardj | 8564292 | 2008-01-14 11:54:56 +0000 | [diff] [blame] | 95 | /* To notify the drd tool of a sem_destroy call. */ |
bart | 0268dfa | 2008-03-11 20:10:21 +0000 | [diff] [blame] | 96 | VG_USERREQ__PRE_SEM_DESTROY, |
| 97 | /* args: Addr sem */ |
| 98 | /* To notify the drd tool of a sem_destroy call. */ |
| 99 | VG_USERREQ__POST_SEM_DESTROY, |
sewardj | 8564292 | 2008-01-14 11:54:56 +0000 | [diff] [blame] | 100 | /* args: Addr sem */ |
| 101 | /* To notify the drd tool of a sem_wait call. */ |
bart | 28230a3 | 2008-02-29 17:27:03 +0000 | [diff] [blame] | 102 | VG_USERREQ__PRE_SEM_WAIT, |
bart | 0268dfa | 2008-03-11 20:10:21 +0000 | [diff] [blame] | 103 | /* args: Addr sem */ |
bart | 28230a3 | 2008-02-29 17:27:03 +0000 | [diff] [blame] | 104 | /* To notify the drd tool of a sem_wait call. */ |
| 105 | VG_USERREQ__POST_SEM_WAIT, |
| 106 | /* args: Addr sem, Bool waited */ |
sewardj | 8564292 | 2008-01-14 11:54:56 +0000 | [diff] [blame] | 107 | /* To notify the drd tool before a sem_post call. */ |
| 108 | VG_USERREQ__PRE_SEM_POST, |
bart | 0268dfa | 2008-03-11 20:10:21 +0000 | [diff] [blame] | 109 | /* args: Addr sem */ |
sewardj | 8564292 | 2008-01-14 11:54:56 +0000 | [diff] [blame] | 110 | /* To notify the drd tool after a sem_post call. */ |
| 111 | VG_USERREQ__POST_SEM_POST, |
bart | 0268dfa | 2008-03-11 20:10:21 +0000 | [diff] [blame] | 112 | /* args: Addr sem, Bool waited */ |
sewardj | 8564292 | 2008-01-14 11:54:56 +0000 | [diff] [blame] | 113 | |
| 114 | /* To notify the drd tool of a pthread_barrier_init call. */ |
bart | 0268dfa | 2008-03-11 20:10:21 +0000 | [diff] [blame] | 115 | VG_USERREQ__PRE_BARRIER_INIT, |
| 116 | /* args: Addr barrier, BarrierT type, Word count, Bool reinit */ |
| 117 | /* To notify the drd tool of a pthread_barrier_init call. */ |
| 118 | VG_USERREQ__POST_BARRIER_INIT, |
| 119 | /* args: Addr barrier, BarrierT type */ |
sewardj | 8564292 | 2008-01-14 11:54:56 +0000 | [diff] [blame] | 120 | /* To notify the drd tool of a pthread_barrier_destroy call. */ |
bart | 0268dfa | 2008-03-11 20:10:21 +0000 | [diff] [blame] | 121 | VG_USERREQ__PRE_BARRIER_DESTROY, |
| 122 | /* args: Addr barrier, BarrierT type. */ |
| 123 | /* To notify the drd tool of a pthread_barrier_destroy call. */ |
| 124 | VG_USERREQ__POST_BARRIER_DESTROY, |
| 125 | /* args: Addr barrier, BarrierT type. */ |
sewardj | 8564292 | 2008-01-14 11:54:56 +0000 | [diff] [blame] | 126 | /* To notify the drd tool of a pthread_barrier_wait call. */ |
| 127 | VG_USERREQ__PRE_BARRIER_WAIT, |
bart | 0268dfa | 2008-03-11 20:10:21 +0000 | [diff] [blame] | 128 | /* args: Addr barrier, BarrierT type. */ |
sewardj | 8564292 | 2008-01-14 11:54:56 +0000 | [diff] [blame] | 129 | /* To notify the drd tool of a pthread_barrier_wait call. */ |
| 130 | VG_USERREQ__POST_BARRIER_WAIT, |
bart | 0268dfa | 2008-03-11 20:10:21 +0000 | [diff] [blame] | 131 | /* args: Addr barrier, BarrierT type, Word has_waited */ |
sewardj | 8564292 | 2008-01-14 11:54:56 +0000 | [diff] [blame] | 132 | |
bart | 0034464 | 2008-03-01 15:27:41 +0000 | [diff] [blame] | 133 | /* To notify the drd tool of a pthread_rwlock_init call. */ |
| 134 | VG_USERREQ__PRE_RWLOCK_INIT, |
bart | 0268dfa | 2008-03-11 20:10:21 +0000 | [diff] [blame] | 135 | /* args: Addr rwlock */ |
bart | 0034464 | 2008-03-01 15:27:41 +0000 | [diff] [blame] | 136 | /* To notify the drd tool of a pthread_rwlock_destroy call. */ |
| 137 | VG_USERREQ__POST_RWLOCK_DESTROY, |
bart | 0268dfa | 2008-03-11 20:10:21 +0000 | [diff] [blame] | 138 | /* args: Addr rwlock */ |
bart | 0034464 | 2008-03-01 15:27:41 +0000 | [diff] [blame] | 139 | /* To notify the drd tool of a pthread_rwlock_rdlock call. */ |
| 140 | VG_USERREQ__PRE_RWLOCK_RDLOCK, |
bart | 0268dfa | 2008-03-11 20:10:21 +0000 | [diff] [blame] | 141 | /* args: Addr rwlock */ |
bart | 0034464 | 2008-03-01 15:27:41 +0000 | [diff] [blame] | 142 | /* To notify the drd tool of a pthread_rwlock_rdlock call. */ |
| 143 | VG_USERREQ__POST_RWLOCK_RDLOCK, |
| 144 | /* args: Addr rwlock, Bool took_lock */ |
| 145 | /* To notify the drd tool of a pthread_rwlock_wrlock call. */ |
| 146 | VG_USERREQ__PRE_RWLOCK_WRLOCK, |
bart | 0268dfa | 2008-03-11 20:10:21 +0000 | [diff] [blame] | 147 | /* args: Addr rwlock */ |
bart | 0034464 | 2008-03-01 15:27:41 +0000 | [diff] [blame] | 148 | /* To notify the drd tool of a pthread_rwlock_wrlock call. */ |
| 149 | VG_USERREQ__POST_RWLOCK_WRLOCK, |
| 150 | /* args: Addr rwlock, Bool took_lock */ |
| 151 | /* To notify the drd tool of a pthread_rwlock_unlock call. */ |
bart | 777f7fe | 2008-03-02 17:43:18 +0000 | [diff] [blame] | 152 | VG_USERREQ__PRE_RWLOCK_UNLOCK, |
bart | 0268dfa | 2008-03-11 20:10:21 +0000 | [diff] [blame] | 153 | /* args: Addr rwlock */ |
| 154 | /* To notify the drd tool of a pthread_rwlock_unlock call. */ |
| 155 | VG_USERREQ__POST_RWLOCK_UNLOCK, |
bart | 0034464 | 2008-03-01 15:27:41 +0000 | [diff] [blame] | 156 | /* args: Addr rwlock, Bool unlocked */ |
| 157 | |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 158 | }; |
| 159 | |
sewardj | 721ad7b | 2007-11-30 08:30:29 +0000 | [diff] [blame] | 160 | typedef enum |
| 161 | { |
bart | 635cb16 | 2008-02-28 08:30:43 +0000 | [diff] [blame] | 162 | mutex_type_invalid_mutex = 0, |
bart | 5357fcb | 2008-02-27 15:46:00 +0000 | [diff] [blame] | 163 | mutex_type_recursive_mutex = 1, |
| 164 | mutex_type_errorcheck_mutex = 2, |
| 165 | mutex_type_default_mutex = 3, |
| 166 | mutex_type_spinlock = 4, |
sewardj | 721ad7b | 2007-11-30 08:30:29 +0000 | [diff] [blame] | 167 | } MutexT; |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 168 | |
bart | 0268dfa | 2008-03-11 20:10:21 +0000 | [diff] [blame] | 169 | typedef enum |
| 170 | { |
| 171 | pthread_barrier = 1, |
| 172 | gomp_barrier = 2, |
| 173 | } BarrierT; |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 174 | |
| 175 | #endif // __DRD_CLIENTREQ_H |