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 | f5bb46a | 2008-03-29 13:18:02 +0000 | [diff] [blame] | 16 | /* args: start address, size in bytes */ |
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 | f5bb46a | 2008-03-29 13:18:02 +0000 | [diff] [blame] | 20 | /* args: start address, size in bytes */ |
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 | 005dc97 | 2008-03-29 14:42:59 +0000 | [diff] [blame^] | 28 | /* To ask the drd tool to trace all accesses to the specified range. */ |
| 29 | VG_USERREQ__DRD_START_TRACE_ADDR, |
| 30 | /* args: Addr, SizeT. */ |
| 31 | /* To ask the drd tool to stop tracing accesses to the specified range. */ |
| 32 | VG_USERREQ__DRD_STOP_TRACE_ADDR, |
| 33 | /* args: Addr, SizeT. */ |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 34 | |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 35 | /* Tell the core the pthread_t of the running thread */ |
| 36 | VG_USERREQ__SET_PTHREADID, |
| 37 | /* args: pthread_t. */ |
| 38 | /* Ask the core that a the thread's state transition from */ |
| 39 | /* VgTs_Zombie to VgTs_Empty is delayed until */ |
| 40 | /* VG_USERREQ__POST_THREAD_JOIN is performed. */ |
| 41 | VG_USERREQ__SET_JOINABLE, |
| 42 | /* args: pthread_t, Bool */ |
| 43 | |
| 44 | /* To notify drd that a thread finished because */ |
| 45 | /* pthread_thread_join() was called on it. */ |
| 46 | VG_USERREQ__POST_THREAD_JOIN, |
| 47 | /* args: pthread_t (joinee) */ |
| 48 | |
sewardj | 8564292 | 2008-01-14 11:54:56 +0000 | [diff] [blame] | 49 | /* to notify the drd tool of a pthread_mutex_init call. */ |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 50 | VG_USERREQ__PRE_MUTEX_INIT, |
sewardj | 721ad7b | 2007-11-30 08:30:29 +0000 | [diff] [blame] | 51 | /* args: Addr, MutexT */ |
bart | 0268dfa | 2008-03-11 20:10:21 +0000 | [diff] [blame] | 52 | /* to notify the drd tool of a pthread_mutex_init call. */ |
| 53 | VG_USERREQ__POST_MUTEX_INIT, |
| 54 | /* args: Addr */ |
| 55 | /* to notify the drd tool of a pthread_mutex_destroy call. */ |
| 56 | VG_USERREQ__PRE_MUTEX_DESTROY, |
| 57 | /* args: Addr */ |
sewardj | 8564292 | 2008-01-14 11:54:56 +0000 | [diff] [blame] | 58 | /* to notify the drd tool of a pthread_mutex_destroy call. */ |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 59 | VG_USERREQ__POST_MUTEX_DESTROY, |
bart | 0268dfa | 2008-03-11 20:10:21 +0000 | [diff] [blame] | 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__PRE_MUTEX_LOCK, |
bart | 2e3a3c1 | 2008-03-24 08:33:47 +0000 | [diff] [blame] | 63 | /* args: Addr, MutexT, Bool */ |
sewardj | 8564292 | 2008-01-14 11:54:56 +0000 | [diff] [blame] | 64 | /* to notify the drd tool of pthread_mutex_lock calls */ |
bart | 0268dfa | 2008-03-11 20:10:21 +0000 | [diff] [blame] | 65 | VG_USERREQ__POST_MUTEX_LOCK, |
bart | 0034464 | 2008-03-01 15:27:41 +0000 | [diff] [blame] | 66 | /* args: Addr, Bool */ |
sewardj | 8564292 | 2008-01-14 11:54:56 +0000 | [diff] [blame] | 67 | /* to notify the drd tool of pthread_mutex_unlock calls */ |
bart | 0268dfa | 2008-03-11 20:10:21 +0000 | [diff] [blame] | 68 | VG_USERREQ__PRE_MUTEX_UNLOCK, |
| 69 | /* args: Addr */ |
| 70 | /* to notify the drd tool of pthread_mutex_unlock calls */ |
| 71 | VG_USERREQ__POST_MUTEX_UNLOCK, |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 72 | /* args: Addr */ |
| 73 | VG_USERREQ__SPIN_INIT_OR_UNLOCK, |
bart | 0268dfa | 2008-03-11 20:10:21 +0000 | [diff] [blame] | 74 | /* args: Addr spinlock */ |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 75 | |
| 76 | |
sewardj | 8564292 | 2008-01-14 11:54:56 +0000 | [diff] [blame] | 77 | /* to notify the drd tool of a pthread_cond_init call. */ |
bart | 0268dfa | 2008-03-11 20:10:21 +0000 | [diff] [blame] | 78 | VG_USERREQ__PRE_COND_INIT, |
sewardj | 721ad7b | 2007-11-30 08:30:29 +0000 | [diff] [blame] | 79 | /* args: Addr */ |
sewardj | 8564292 | 2008-01-14 11:54:56 +0000 | [diff] [blame] | 80 | /* to notify the drd tool of a pthread_cond_destroy call. */ |
bart | 0268dfa | 2008-03-11 20:10:21 +0000 | [diff] [blame] | 81 | VG_USERREQ__POST_COND_DESTROY, |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 82 | /* args: Addr cond */ |
bart | 0268dfa | 2008-03-11 20:10:21 +0000 | [diff] [blame] | 83 | VG_USERREQ__PRE_COND_WAIT, |
| 84 | /* args: Addr cond, Addr mutex, MutexT mt */ |
| 85 | VG_USERREQ__POST_COND_WAIT, |
| 86 | /* args: Addr cond, Addr mutex, Bool took_lock*/ |
| 87 | VG_USERREQ__PRE_COND_SIGNAL, |
| 88 | /* args: Addr cond */ |
| 89 | VG_USERREQ__PRE_COND_BROADCAST, |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 90 | /* args: Addr cond */ |
| 91 | |
sewardj | 8564292 | 2008-01-14 11:54:56 +0000 | [diff] [blame] | 92 | /* To notify the drd tool of a sem_init call. */ |
bart | 0268dfa | 2008-03-11 20:10:21 +0000 | [diff] [blame] | 93 | VG_USERREQ__PRE_SEM_INIT, |
| 94 | /* args: Addr sem, Word pshared, Word value */ |
| 95 | /* To notify the drd tool of a sem_init call. */ |
| 96 | VG_USERREQ__POST_SEM_INIT, |
| 97 | /* args: Addr sem */ |
sewardj | 8564292 | 2008-01-14 11:54:56 +0000 | [diff] [blame] | 98 | /* To notify the drd tool of a sem_destroy call. */ |
bart | 0268dfa | 2008-03-11 20:10:21 +0000 | [diff] [blame] | 99 | VG_USERREQ__PRE_SEM_DESTROY, |
| 100 | /* args: Addr sem */ |
| 101 | /* To notify the drd tool of a sem_destroy call. */ |
| 102 | VG_USERREQ__POST_SEM_DESTROY, |
sewardj | 8564292 | 2008-01-14 11:54:56 +0000 | [diff] [blame] | 103 | /* args: Addr sem */ |
| 104 | /* To notify the drd tool of a sem_wait call. */ |
bart | 28230a3 | 2008-02-29 17:27:03 +0000 | [diff] [blame] | 105 | VG_USERREQ__PRE_SEM_WAIT, |
bart | 0268dfa | 2008-03-11 20:10:21 +0000 | [diff] [blame] | 106 | /* args: Addr sem */ |
bart | 28230a3 | 2008-02-29 17:27:03 +0000 | [diff] [blame] | 107 | /* To notify the drd tool of a sem_wait call. */ |
| 108 | VG_USERREQ__POST_SEM_WAIT, |
| 109 | /* args: Addr sem, Bool waited */ |
sewardj | 8564292 | 2008-01-14 11:54:56 +0000 | [diff] [blame] | 110 | /* To notify the drd tool before a sem_post call. */ |
| 111 | VG_USERREQ__PRE_SEM_POST, |
bart | 0268dfa | 2008-03-11 20:10:21 +0000 | [diff] [blame] | 112 | /* args: Addr sem */ |
sewardj | 8564292 | 2008-01-14 11:54:56 +0000 | [diff] [blame] | 113 | /* To notify the drd tool after a sem_post call. */ |
| 114 | VG_USERREQ__POST_SEM_POST, |
bart | 0268dfa | 2008-03-11 20:10:21 +0000 | [diff] [blame] | 115 | /* args: Addr sem, Bool waited */ |
sewardj | 8564292 | 2008-01-14 11:54:56 +0000 | [diff] [blame] | 116 | |
| 117 | /* To notify the drd tool of a pthread_barrier_init call. */ |
bart | 0268dfa | 2008-03-11 20:10:21 +0000 | [diff] [blame] | 118 | VG_USERREQ__PRE_BARRIER_INIT, |
| 119 | /* args: Addr barrier, BarrierT type, Word count, Bool reinit */ |
| 120 | /* To notify the drd tool of a pthread_barrier_init call. */ |
| 121 | VG_USERREQ__POST_BARRIER_INIT, |
| 122 | /* args: Addr barrier, BarrierT type */ |
sewardj | 8564292 | 2008-01-14 11:54:56 +0000 | [diff] [blame] | 123 | /* To notify the drd tool of a pthread_barrier_destroy call. */ |
bart | 0268dfa | 2008-03-11 20:10:21 +0000 | [diff] [blame] | 124 | VG_USERREQ__PRE_BARRIER_DESTROY, |
| 125 | /* args: Addr barrier, BarrierT type. */ |
| 126 | /* To notify the drd tool of a pthread_barrier_destroy call. */ |
| 127 | VG_USERREQ__POST_BARRIER_DESTROY, |
| 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__PRE_BARRIER_WAIT, |
bart | 0268dfa | 2008-03-11 20:10:21 +0000 | [diff] [blame] | 131 | /* args: Addr barrier, BarrierT type. */ |
sewardj | 8564292 | 2008-01-14 11:54:56 +0000 | [diff] [blame] | 132 | /* To notify the drd tool of a pthread_barrier_wait call. */ |
| 133 | VG_USERREQ__POST_BARRIER_WAIT, |
bart | 0268dfa | 2008-03-11 20:10:21 +0000 | [diff] [blame] | 134 | /* args: Addr barrier, BarrierT type, Word has_waited */ |
sewardj | 8564292 | 2008-01-14 11:54:56 +0000 | [diff] [blame] | 135 | |
bart | 0034464 | 2008-03-01 15:27:41 +0000 | [diff] [blame] | 136 | /* To notify the drd tool of a pthread_rwlock_init call. */ |
| 137 | VG_USERREQ__PRE_RWLOCK_INIT, |
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_destroy call. */ |
| 140 | VG_USERREQ__POST_RWLOCK_DESTROY, |
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__PRE_RWLOCK_RDLOCK, |
bart | 0268dfa | 2008-03-11 20:10:21 +0000 | [diff] [blame] | 144 | /* args: Addr rwlock */ |
bart | 0034464 | 2008-03-01 15:27:41 +0000 | [diff] [blame] | 145 | /* To notify the drd tool of a pthread_rwlock_rdlock call. */ |
| 146 | VG_USERREQ__POST_RWLOCK_RDLOCK, |
| 147 | /* args: Addr rwlock, Bool took_lock */ |
| 148 | /* To notify the drd tool of a pthread_rwlock_wrlock call. */ |
| 149 | VG_USERREQ__PRE_RWLOCK_WRLOCK, |
bart | 0268dfa | 2008-03-11 20:10:21 +0000 | [diff] [blame] | 150 | /* args: Addr rwlock */ |
bart | 0034464 | 2008-03-01 15:27:41 +0000 | [diff] [blame] | 151 | /* To notify the drd tool of a pthread_rwlock_wrlock call. */ |
| 152 | VG_USERREQ__POST_RWLOCK_WRLOCK, |
| 153 | /* args: Addr rwlock, Bool took_lock */ |
| 154 | /* To notify the drd tool of a pthread_rwlock_unlock call. */ |
bart | 777f7fe | 2008-03-02 17:43:18 +0000 | [diff] [blame] | 155 | VG_USERREQ__PRE_RWLOCK_UNLOCK, |
bart | 0268dfa | 2008-03-11 20:10:21 +0000 | [diff] [blame] | 156 | /* args: Addr rwlock */ |
| 157 | /* To notify the drd tool of a pthread_rwlock_unlock call. */ |
| 158 | VG_USERREQ__POST_RWLOCK_UNLOCK, |
bart | 0034464 | 2008-03-01 15:27:41 +0000 | [diff] [blame] | 159 | /* args: Addr rwlock, Bool unlocked */ |
| 160 | |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 161 | }; |
| 162 | |
sewardj | 721ad7b | 2007-11-30 08:30:29 +0000 | [diff] [blame] | 163 | typedef enum |
| 164 | { |
bart | 635cb16 | 2008-02-28 08:30:43 +0000 | [diff] [blame] | 165 | mutex_type_invalid_mutex = 0, |
bart | 5357fcb | 2008-02-27 15:46:00 +0000 | [diff] [blame] | 166 | mutex_type_recursive_mutex = 1, |
| 167 | mutex_type_errorcheck_mutex = 2, |
| 168 | mutex_type_default_mutex = 3, |
| 169 | mutex_type_spinlock = 4, |
sewardj | 721ad7b | 2007-11-30 08:30:29 +0000 | [diff] [blame] | 170 | } MutexT; |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 171 | |
bart | 0268dfa | 2008-03-11 20:10:21 +0000 | [diff] [blame] | 172 | typedef enum |
| 173 | { |
| 174 | pthread_barrier = 1, |
| 175 | gomp_barrier = 2, |
| 176 | } BarrierT; |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 177 | |
| 178 | #endif // __DRD_CLIENTREQ_H |