2 This file is part of drd, a thread error detector.
4 Copyright (C) 2006-2017 Bart Van Assche <bvanassche@acm.org>.
6 This program is free software; you can redistribute it and/or
7 modify it under the terms of the GNU General Public License as
8 published by the Free Software Foundation; either version 2 of the
9 License, or (at your option) any later version.
11 This program is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
21 The GNU General Public License is contained in the file COPYING.
25 #ifndef __DRD_THREAD_BITMAP_H
26 #define __DRD_THREAD_BITMAP_H
29 #include "drd_bitmap.h"
30 #include "drd_thread.h" /* running_thread_get_segment() */
31 #include "pub_drd_bitmap.h"
35 Bool
bm_access_load_1_triggers_conflict(const Addr a1
)
37 DRD_(bm_access_load_1
)(DRD_(sg_bm
)(DRD_(running_thread_get_segment
)()), a1
);
38 return DRD_(bm_load_1_has_conflict_with
)(DRD_(thread_get_conflict_set
)(),
43 Bool
bm_access_load_2_triggers_conflict(const Addr a1
)
47 bm_access_aligned_load(DRD_(sg_bm
)(DRD_(running_thread_get_segment
)()), a1
, 2);
48 return bm_aligned_load_has_conflict_with(DRD_(thread_get_conflict_set
)(),
53 DRD_(bm_access_range
)(DRD_(sg_bm
)(DRD_(running_thread_get_segment
)()),
55 return DRD_(bm_has_conflict_with
)(DRD_(thread_get_conflict_set
)(),
61 Bool
bm_access_load_4_triggers_conflict(const Addr a1
)
65 bm_access_aligned_load(DRD_(sg_bm
)(DRD_(running_thread_get_segment
)()), a1
, 4);
66 return bm_aligned_load_has_conflict_with(DRD_(thread_get_conflict_set
)(),
71 DRD_(bm_access_range
)(DRD_(sg_bm
)(DRD_(running_thread_get_segment
)()),
73 return DRD_(bm_has_conflict_with
)(DRD_(thread_get_conflict_set
)(),
79 Bool
bm_access_load_8_triggers_conflict(const Addr a1
)
83 bm_access_aligned_load(DRD_(sg_bm
)(DRD_(running_thread_get_segment
)()), a1
, 8);
84 return bm_aligned_load_has_conflict_with(DRD_(thread_get_conflict_set
)(),
87 else if ((a1
& 3) == 0)
89 bm_access_aligned_load(DRD_(sg_bm
)(DRD_(running_thread_get_segment
)()), a1
+ 0, 4);
90 bm_access_aligned_load(DRD_(sg_bm
)(DRD_(running_thread_get_segment
)()), a1
+ 4, 4);
91 return DRD_(bm_has_conflict_with
)(DRD_(thread_get_conflict_set
)(),
96 DRD_(bm_access_range
)(DRD_(sg_bm
)(DRD_(running_thread_get_segment
)()),
98 return DRD_(bm_has_conflict_with
)(DRD_(thread_get_conflict_set
)(),
104 Bool
bm_access_load_triggers_conflict(const Addr a1
, const Addr a2
)
106 DRD_(bm_access_range_load
)(DRD_(sg_bm
)(DRD_(running_thread_get_segment
)()), a1
, a2
);
107 return DRD_(bm_load_has_conflict_with
)(DRD_(thread_get_conflict_set
)(),
112 Bool
bm_access_store_1_triggers_conflict(const Addr a1
)
114 DRD_(bm_access_store_1
)(DRD_(sg_bm
)(DRD_(running_thread_get_segment
)()), a1
);
115 return DRD_(bm_store_1_has_conflict_with
)(DRD_(thread_get_conflict_set
)(),
120 Bool
bm_access_store_2_triggers_conflict(const Addr a1
)
124 bm_access_aligned_store(DRD_(sg_bm
)(DRD_(running_thread_get_segment
)()), a1
, 2);
125 return bm_aligned_store_has_conflict_with(DRD_(thread_get_conflict_set
)(),
130 DRD_(bm_access_range
)(DRD_(sg_bm
)(DRD_(running_thread_get_segment
)()),
132 return DRD_(bm_has_conflict_with
)(DRD_(thread_get_conflict_set
)(),
138 Bool
bm_access_store_4_triggers_conflict(const Addr a1
)
142 bm_access_aligned_store(DRD_(sg_bm
)(DRD_(running_thread_get_segment
)()), a1
, 4);
143 return bm_aligned_store_has_conflict_with(DRD_(thread_get_conflict_set
)(),
148 DRD_(bm_access_range
)(DRD_(sg_bm
)(DRD_(running_thread_get_segment
)()),
150 return DRD_(bm_has_conflict_with
)(DRD_(thread_get_conflict_set
)(),
156 Bool
bm_access_store_8_triggers_conflict(const Addr a1
)
160 bm_access_aligned_store(DRD_(sg_bm
)(DRD_(running_thread_get_segment
)()), a1
, 8);
161 return bm_aligned_store_has_conflict_with(DRD_(thread_get_conflict_set
)(),
164 else if ((a1
& 3) == 0)
166 bm_access_aligned_store(DRD_(sg_bm
)(DRD_(running_thread_get_segment
)()),
168 bm_access_aligned_store(DRD_(sg_bm
)(DRD_(running_thread_get_segment
)()),
170 return DRD_(bm_has_conflict_with
)(DRD_(thread_get_conflict_set
)(),
175 DRD_(bm_access_range
)(DRD_(sg_bm
)(DRD_(running_thread_get_segment
)()),
177 return DRD_(bm_has_conflict_with
)(DRD_(thread_get_conflict_set
)(),
183 Bool
bm_access_store_triggers_conflict(const Addr a1
, const Addr a2
)
185 DRD_(bm_access_range_store
)(DRD_(sg_bm
)(DRD_(running_thread_get_segment
)()), a1
, a2
);
186 return DRD_(bm_store_has_conflict_with
)(DRD_(thread_get_conflict_set
)(),
190 #endif // __DRD_THREAD_BITMAP_H