bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 1 | /* -*- mode: C; c-basic-offset: 3; -*- */ |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 2 | /* |
bart | 86562bd | 2009-02-16 19:43:56 +0000 | [diff] [blame] | 3 | This file is part of drd, a thread error detector. |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 4 | |
bart | 86562bd | 2009-02-16 19:43:56 +0000 | [diff] [blame] | 5 | Copyright (C) 2006-2009 Bart Van Assche <bart.vanassche@gmail.com>. |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 6 | |
| 7 | This program is free software; you can redistribute it and/or |
| 8 | modify it under the terms of the GNU General Public License as |
| 9 | published by the Free Software Foundation; either version 2 of the |
| 10 | License, or (at your option) any later version. |
| 11 | |
| 12 | This program is distributed in the hope that it will be useful, but |
| 13 | WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 15 | General Public License for more details. |
| 16 | |
| 17 | You should have received a copy of the GNU General Public License |
| 18 | along with this program; if not, write to the Free Software |
| 19 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA |
| 20 | 02111-1307, USA. |
| 21 | |
| 22 | The GNU General Public License is contained in the file COPYING. |
| 23 | */ |
| 24 | |
| 25 | |
bart | 33e56c9 | 2008-03-24 06:41:30 +0000 | [diff] [blame] | 26 | #ifndef __DRD_BITMAP_H |
| 27 | #define __DRD_BITMAP_H |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 28 | |
| 29 | |
bart | 82a0c5d | 2009-02-14 14:49:23 +0000 | [diff] [blame] | 30 | #include "pub_tool_basics.h" |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 31 | #include "pub_tool_oset.h" |
bart | d59bb0f | 2008-06-08 08:08:31 +0000 | [diff] [blame] | 32 | #include "pub_tool_libcbase.h" |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 33 | |
| 34 | |
| 35 | /* |
| 36 | Bitmap representation. A bitmap is a data structure in which two bits are |
| 37 | reserved per 32 bit address: one bit that indicates that the data at the |
| 38 | specified address has been read, and one bit that indicates that the data has |
| 39 | been written to. |
| 40 | */ |
| 41 | |
| 42 | |
| 43 | /* Macro definitions. */ |
| 44 | |
bart | 8b4b2ee | 2008-06-11 13:17:56 +0000 | [diff] [blame] | 45 | #define ADDR0_BITS 14 |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 46 | |
bart | a79df6e | 2008-03-14 17:07:51 +0000 | [diff] [blame] | 47 | #define ADDR0_COUNT ((UWord)1 << ADDR0_BITS) |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 48 | |
| 49 | #define ADDR0_MASK (ADDR0_COUNT - 1) |
| 50 | |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 51 | #define SPLIT_ADDRESS(a) \ |
| 52 | UWord a##0 = ((a) & ADDR0_MASK); \ |
| 53 | UWord a##1 = ((a) >> ADDR0_BITS); |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 54 | |
| 55 | // Assumption: sizeof(Addr) == sizeof(UWord). |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 56 | #define MAKE_ADDRESS(a1, a0) \ |
| 57 | (Addr)(((UWord)(a1) << (ADDR0_BITS)) | ((UWord)(a0))) |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 58 | |
| 59 | #define BITS_PER_UWORD (8UL*sizeof(UWord)) |
| 60 | #if defined(VGA_x86) || defined(VGA_ppc32) |
| 61 | #define BITS_PER_BITS_PER_UWORD 5 |
| 62 | #elif defined(VGA_amd64) || defined(VGA_ppc64) |
| 63 | #define BITS_PER_BITS_PER_UWORD 6 |
| 64 | #else |
| 65 | #error Unknown platform. |
| 66 | #endif |
| 67 | |
| 68 | #define BITMAP1_UWORD_COUNT (ADDR0_COUNT >> BITS_PER_BITS_PER_UWORD) |
| 69 | |
| 70 | /* Highest bits of an address that fit into the same UWord of bm0[]. */ |
| 71 | #define UWORD_MSB(a) ((a) & ~(BITS_PER_UWORD - 1)) |
| 72 | |
| 73 | /* Lowest bits of an address that fit into the same UWord of bm0[]. */ |
| 74 | #define UWORD_LSB(a) ((a) & (BITS_PER_UWORD - 1)) |
| 75 | |
| 76 | /* Highest address that fits in the same UWord as a. */ |
| 77 | #define UWORD_HIGHEST_ADDRESS(a) ((a) | (BITS_PER_UWORD - 1)) |
| 78 | |
| 79 | |
bart | 33e56c9 | 2008-03-24 06:41:30 +0000 | [diff] [blame] | 80 | /* Local variables. */ |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 81 | |
| 82 | static ULong s_bitmap2_creation_count; |
bart | 3c9989f | 2008-06-11 19:17:01 +0000 | [diff] [blame] | 83 | static ULong s_bitmap2_node_creation_count; |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 84 | |
| 85 | |
bart | 0008f5b | 2008-03-22 17:07:39 +0000 | [diff] [blame] | 86 | |
| 87 | /*********************************************************************/ |
| 88 | /* Functions for manipulating a struct bitmap1. */ |
| 89 | /*********************************************************************/ |
| 90 | |
| 91 | |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 92 | /* Lowest level, corresponding to the lowest ADDR0_BITS of an address. */ |
| 93 | struct bitmap1 |
| 94 | { |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 95 | UWord bm0_r[BITMAP1_UWORD_COUNT]; |
| 96 | UWord bm0_w[BITMAP1_UWORD_COUNT]; |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 97 | }; |
| 98 | |
| 99 | static __inline__ UWord bm0_mask(const Addr a) |
| 100 | { |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 101 | return ((UWord)1 << UWORD_LSB(a)); |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 102 | } |
| 103 | |
| 104 | static __inline__ void bm0_set(UWord* bm0, const Addr a) |
| 105 | { |
bart | 3c9989f | 2008-06-11 19:17:01 +0000 | [diff] [blame] | 106 | #ifdef ENABLE_DRD_CONSISTENCY_CHECKS |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 107 | tl_assert(a < ADDR0_COUNT); |
bart | 3c9989f | 2008-06-11 19:17:01 +0000 | [diff] [blame] | 108 | #endif |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 109 | bm0[a >> BITS_PER_BITS_PER_UWORD] |= (UWord)1 << UWORD_LSB(a); |
bart | a79df6e | 2008-03-14 17:07:51 +0000 | [diff] [blame] | 110 | } |
| 111 | |
bart | f8bc71d | 2008-03-15 11:42:34 +0000 | [diff] [blame] | 112 | /** Set all of the addresses in range [ a1 .. a1 + size [ in bitmap bm0. */ |
| 113 | static __inline__ void bm0_set_range(UWord* bm0, |
| 114 | const Addr a1, const SizeT size) |
bart | a79df6e | 2008-03-14 17:07:51 +0000 | [diff] [blame] | 115 | { |
bart | 8b4b2ee | 2008-06-11 13:17:56 +0000 | [diff] [blame] | 116 | #ifdef ENABLE_DRD_CONSISTENCY_CHECKS |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 117 | tl_assert(a1 < ADDR0_COUNT); |
| 118 | tl_assert(size > 0); |
| 119 | tl_assert(a1 + size <= ADDR0_COUNT); |
| 120 | tl_assert(UWORD_MSB(a1) == UWORD_MSB(a1 + size - 1)); |
bart | a79df6e | 2008-03-14 17:07:51 +0000 | [diff] [blame] | 121 | #endif |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 122 | bm0[a1 >> BITS_PER_BITS_PER_UWORD] |
| 123 | |= (((UWord)1 << size) - 1) << UWORD_LSB(a1); |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 124 | } |
| 125 | |
| 126 | static __inline__ void bm0_clear(UWord* bm0, const Addr a) |
| 127 | { |
bart | 3c9989f | 2008-06-11 19:17:01 +0000 | [diff] [blame] | 128 | #ifdef ENABLE_DRD_CONSISTENCY_CHECKS |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 129 | tl_assert(a < ADDR0_COUNT); |
bart | 3c9989f | 2008-06-11 19:17:01 +0000 | [diff] [blame] | 130 | #endif |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 131 | bm0[a >> BITS_PER_BITS_PER_UWORD] &= ~((UWord)1 << UWORD_LSB(a)); |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 132 | } |
| 133 | |
bart | 5955f33 | 2008-03-25 17:19:20 +0000 | [diff] [blame] | 134 | /** Clear all of the addresses in range [ a1 .. a1 + size [ in bitmap bm0. */ |
| 135 | static __inline__ void bm0_clear_range(UWord* bm0, |
| 136 | const Addr a1, const SizeT size) |
| 137 | { |
bart | 8b4b2ee | 2008-06-11 13:17:56 +0000 | [diff] [blame] | 138 | #ifdef ENABLE_DRD_CONSISTENCY_CHECKS |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 139 | tl_assert(a1 < ADDR0_COUNT); |
| 140 | tl_assert(size > 0); |
| 141 | tl_assert(a1 + size <= ADDR0_COUNT); |
| 142 | tl_assert(UWORD_MSB(a1) == UWORD_MSB(a1 + size - 1)); |
bart | 5955f33 | 2008-03-25 17:19:20 +0000 | [diff] [blame] | 143 | #endif |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 144 | bm0[a1 >> BITS_PER_BITS_PER_UWORD] |
| 145 | &= ~(((UWord)1 << size) - 1) << UWORD_LSB(a1); |
bart | 5955f33 | 2008-03-25 17:19:20 +0000 | [diff] [blame] | 146 | } |
| 147 | |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 148 | static __inline__ UWord bm0_is_set(const UWord* bm0, const Addr a) |
| 149 | { |
bart | 3c9989f | 2008-06-11 19:17:01 +0000 | [diff] [blame] | 150 | #ifdef ENABLE_DRD_CONSISTENCY_CHECKS |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 151 | tl_assert(a < ADDR0_COUNT); |
bart | 3c9989f | 2008-06-11 19:17:01 +0000 | [diff] [blame] | 152 | #endif |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 153 | return (bm0[a >> BITS_PER_BITS_PER_UWORD] & ((UWord)1 << UWORD_LSB(a))); |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 154 | } |
| 155 | |
bart | f8bc71d | 2008-03-15 11:42:34 +0000 | [diff] [blame] | 156 | /** Return true if any of the bits [ a1 .. a1+size [ are set in bm0. */ |
bart | a79df6e | 2008-03-14 17:07:51 +0000 | [diff] [blame] | 157 | static __inline__ UWord bm0_is_any_set(const UWord* bm0, |
bart | f8bc71d | 2008-03-15 11:42:34 +0000 | [diff] [blame] | 158 | const Addr a1, const SizeT size) |
bart | a79df6e | 2008-03-14 17:07:51 +0000 | [diff] [blame] | 159 | { |
bart | 8b4b2ee | 2008-06-11 13:17:56 +0000 | [diff] [blame] | 160 | #ifdef ENABLE_DRD_CONSISTENCY_CHECKS |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 161 | tl_assert(a1 < ADDR0_COUNT); |
| 162 | tl_assert(size > 0); |
| 163 | tl_assert(a1 + size <= ADDR0_COUNT); |
| 164 | tl_assert(UWORD_MSB(a1) == UWORD_MSB(a1 + size - 1)); |
bart | a79df6e | 2008-03-14 17:07:51 +0000 | [diff] [blame] | 165 | #endif |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 166 | return (bm0[a1 >> BITS_PER_BITS_PER_UWORD] |
| 167 | & ((((UWord)1 << size) - 1) << UWORD_LSB(a1))); |
bart | a79df6e | 2008-03-14 17:07:51 +0000 | [diff] [blame] | 168 | } |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 169 | |
bart | adbdf14 | 2008-03-19 17:00:12 +0000 | [diff] [blame] | 170 | |
bart | 0008f5b | 2008-03-22 17:07:39 +0000 | [diff] [blame] | 171 | |
| 172 | /*********************************************************************/ |
| 173 | /* Functions for manipulating a struct bitmap. */ |
bart | adbdf14 | 2008-03-19 17:00:12 +0000 | [diff] [blame] | 174 | /*********************************************************************/ |
| 175 | |
| 176 | |
bart | 33e56c9 | 2008-03-24 06:41:30 +0000 | [diff] [blame] | 177 | /* Second level bitmap. */ |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 178 | struct bitmap2 |
| 179 | { |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 180 | Addr addr; ///< address >> ADDR0_BITS |
| 181 | int refcnt; |
| 182 | struct bitmap1 bm1; |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 183 | }; |
| 184 | |
bart | f647d34 | 2008-03-24 19:12:12 +0000 | [diff] [blame] | 185 | /* One node of bitmap::oset. */ |
| 186 | struct bitmap2ref |
| 187 | { |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 188 | Addr addr; ///< address >> ADDR0_BITS |
| 189 | struct bitmap2* bm2; |
bart | f647d34 | 2008-03-24 19:12:12 +0000 | [diff] [blame] | 190 | }; |
| 191 | |
bart | 33e56c9 | 2008-03-24 06:41:30 +0000 | [diff] [blame] | 192 | struct bm_cache_elem |
| 193 | { |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 194 | Addr a1; |
| 195 | struct bitmap2* bm2; |
bart | 33e56c9 | 2008-03-24 06:41:30 +0000 | [diff] [blame] | 196 | }; |
| 197 | |
| 198 | #define N_CACHE_ELEM 4 |
| 199 | |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 200 | /* Complete bitmap. */ |
| 201 | struct bitmap |
| 202 | { |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 203 | struct bm_cache_elem cache[N_CACHE_ELEM]; |
| 204 | OSet* oset; |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 205 | }; |
| 206 | |
bart | 33e56c9 | 2008-03-24 06:41:30 +0000 | [diff] [blame] | 207 | |
bart | f647d34 | 2008-03-24 19:12:12 +0000 | [diff] [blame] | 208 | static struct bitmap2* bm2_new(const UWord a1); |
| 209 | static struct bitmap2* bm2_make_exclusive(struct bitmap* const bm, |
| 210 | struct bitmap2ref* const bm2ref); |
| 211 | |
bart | 7e81a17 | 2008-06-09 19:50:51 +0000 | [diff] [blame] | 212 | /** Rotate elements cache[0..n-1] such that the element at position n-1 is |
| 213 | * moved to position 0. This allows to speed up future cache lookups. |
| 214 | */ |
| 215 | static __inline__ |
| 216 | void bm_cache_rotate(struct bm_cache_elem cache[], const int n) |
| 217 | { |
bart | 45af5ea | 2008-06-12 06:04:59 +0000 | [diff] [blame] | 218 | #if 0 |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 219 | struct bm_cache_elem t; |
bart | 7e81a17 | 2008-06-09 19:50:51 +0000 | [diff] [blame] | 220 | |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 221 | tl_assert(2 <= n && n <= 8); |
bart | ea2fa4c | 2008-06-10 06:32:49 +0000 | [diff] [blame] | 222 | |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 223 | t = cache[0]; |
| 224 | if (n > 1) |
| 225 | cache[0] = cache[1]; |
| 226 | if (n > 2) |
| 227 | cache[1] = cache[2]; |
| 228 | if (n > 3) |
| 229 | cache[2] = cache[3]; |
| 230 | if (n > 4) |
| 231 | cache[3] = cache[4]; |
| 232 | if (n > 5) |
| 233 | cache[4] = cache[5]; |
| 234 | if (n > 6) |
| 235 | cache[5] = cache[6]; |
| 236 | if (n > 7) |
| 237 | cache[6] = cache[7]; |
| 238 | cache[n - 1] = t; |
bart | ea2fa4c | 2008-06-10 06:32:49 +0000 | [diff] [blame] | 239 | #endif |
bart | 7e81a17 | 2008-06-09 19:50:51 +0000 | [diff] [blame] | 240 | } |
bart | f647d34 | 2008-03-24 19:12:12 +0000 | [diff] [blame] | 241 | |
bart | f647d34 | 2008-03-24 19:12:12 +0000 | [diff] [blame] | 242 | static __inline__ |
bart | 7e81a17 | 2008-06-09 19:50:51 +0000 | [diff] [blame] | 243 | Bool bm_cache_lookup(struct bitmap* const bm, const UWord a1, |
bart | f29205e | 2008-03-25 18:51:06 +0000 | [diff] [blame] | 244 | struct bitmap2** bm2) |
bart | 33e56c9 | 2008-03-24 06:41:30 +0000 | [diff] [blame] | 245 | { |
bart | 8b4b2ee | 2008-06-11 13:17:56 +0000 | [diff] [blame] | 246 | #ifdef ENABLE_DRD_CONSISTENCY_CHECKS |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 247 | tl_assert(bm); |
| 248 | tl_assert(bm2); |
bart | 7e81a17 | 2008-06-09 19:50:51 +0000 | [diff] [blame] | 249 | #endif |
bart | 33e56c9 | 2008-03-24 06:41:30 +0000 | [diff] [blame] | 250 | |
| 251 | #if N_CACHE_ELEM > 8 |
| 252 | #error Please update the code below. |
| 253 | #endif |
| 254 | #if N_CACHE_ELEM >= 1 |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 255 | if (a1 == bm->cache[0].a1) |
| 256 | { |
| 257 | *bm2 = bm->cache[0].bm2; |
| 258 | return True; |
| 259 | } |
bart | 33e56c9 | 2008-03-24 06:41:30 +0000 | [diff] [blame] | 260 | #endif |
| 261 | #if N_CACHE_ELEM >= 2 |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 262 | if (a1 == bm->cache[1].a1) |
| 263 | { |
| 264 | *bm2 = bm->cache[1].bm2; |
| 265 | return True; |
| 266 | } |
bart | 33e56c9 | 2008-03-24 06:41:30 +0000 | [diff] [blame] | 267 | #endif |
| 268 | #if N_CACHE_ELEM >= 3 |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 269 | if (a1 == bm->cache[2].a1) |
| 270 | { |
| 271 | *bm2 = bm->cache[2].bm2; |
| 272 | bm_cache_rotate(bm->cache, 3); |
| 273 | return True; |
| 274 | } |
bart | 33e56c9 | 2008-03-24 06:41:30 +0000 | [diff] [blame] | 275 | #endif |
| 276 | #if N_CACHE_ELEM >= 4 |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 277 | if (a1 == bm->cache[3].a1) |
| 278 | { |
| 279 | *bm2 = bm->cache[3].bm2; |
| 280 | bm_cache_rotate(bm->cache, 4); |
| 281 | return True; |
| 282 | } |
bart | 33e56c9 | 2008-03-24 06:41:30 +0000 | [diff] [blame] | 283 | #endif |
| 284 | #if N_CACHE_ELEM >= 5 |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 285 | if (a1 == bm->cache[4].a1) |
| 286 | { |
| 287 | *bm2 = bm->cache[4].bm2; |
| 288 | bm_cache_rotate(bm->cache, 5); |
| 289 | return True; |
| 290 | } |
bart | 33e56c9 | 2008-03-24 06:41:30 +0000 | [diff] [blame] | 291 | #endif |
| 292 | #if N_CACHE_ELEM >= 6 |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 293 | if (a1 == bm->cache[5].a1) |
| 294 | { |
| 295 | *bm2 = bm->cache[5].bm2; |
| 296 | bm_cache_rotate(bm->cache, 6); |
| 297 | return True; |
| 298 | } |
bart | 33e56c9 | 2008-03-24 06:41:30 +0000 | [diff] [blame] | 299 | #endif |
| 300 | #if N_CACHE_ELEM >= 7 |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 301 | if (a1 == bm->cache[6].a1) |
| 302 | { |
| 303 | *bm2 = bm->cache[6].bm2; |
| 304 | bm_cache_rotate(bm->cache, 7); |
| 305 | return True; |
| 306 | } |
bart | 33e56c9 | 2008-03-24 06:41:30 +0000 | [diff] [blame] | 307 | #endif |
| 308 | #if N_CACHE_ELEM >= 8 |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 309 | if (a1 == bm->cache[7].a1) |
| 310 | { |
| 311 | *bm2 = bm->cache[7].bm2; |
| 312 | bm_cache_rotate(bm->cache, 8); |
| 313 | return True; |
| 314 | } |
bart | 33e56c9 | 2008-03-24 06:41:30 +0000 | [diff] [blame] | 315 | #endif |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 316 | *bm2 = 0; |
| 317 | return False; |
bart | 33e56c9 | 2008-03-24 06:41:30 +0000 | [diff] [blame] | 318 | } |
| 319 | |
| 320 | static __inline__ |
| 321 | void bm_update_cache(struct bitmap* const bm, |
| 322 | const UWord a1, |
| 323 | struct bitmap2* const bm2) |
| 324 | { |
bart | 3c9989f | 2008-06-11 19:17:01 +0000 | [diff] [blame] | 325 | #ifdef ENABLE_DRD_CONSISTENCY_CHECKS |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 326 | tl_assert(bm); |
bart | 3c9989f | 2008-06-11 19:17:01 +0000 | [diff] [blame] | 327 | #endif |
bart | 33e56c9 | 2008-03-24 06:41:30 +0000 | [diff] [blame] | 328 | |
| 329 | #if N_CACHE_ELEM > 8 |
| 330 | #error Please update the code below. |
| 331 | #endif |
| 332 | #if N_CACHE_ELEM >= 8 |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 333 | bm->cache[7] = bm->cache[6]; |
bart | 33e56c9 | 2008-03-24 06:41:30 +0000 | [diff] [blame] | 334 | #endif |
| 335 | #if N_CACHE_ELEM >= 7 |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 336 | bm->cache[6] = bm->cache[5]; |
bart | 33e56c9 | 2008-03-24 06:41:30 +0000 | [diff] [blame] | 337 | #endif |
| 338 | #if N_CACHE_ELEM >= 6 |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 339 | bm->cache[5] = bm->cache[4]; |
bart | 33e56c9 | 2008-03-24 06:41:30 +0000 | [diff] [blame] | 340 | #endif |
| 341 | #if N_CACHE_ELEM >= 5 |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 342 | bm->cache[4] = bm->cache[3]; |
bart | 33e56c9 | 2008-03-24 06:41:30 +0000 | [diff] [blame] | 343 | #endif |
| 344 | #if N_CACHE_ELEM >= 4 |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 345 | bm->cache[3] = bm->cache[2]; |
bart | 33e56c9 | 2008-03-24 06:41:30 +0000 | [diff] [blame] | 346 | #endif |
| 347 | #if N_CACHE_ELEM >= 3 |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 348 | bm->cache[2] = bm->cache[1]; |
bart | 33e56c9 | 2008-03-24 06:41:30 +0000 | [diff] [blame] | 349 | #endif |
| 350 | #if N_CACHE_ELEM >= 2 |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 351 | bm->cache[1] = bm->cache[0]; |
bart | 33e56c9 | 2008-03-24 06:41:30 +0000 | [diff] [blame] | 352 | #endif |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 353 | bm->cache[0].a1 = a1; |
| 354 | bm->cache[0].bm2 = bm2; |
bart | 33e56c9 | 2008-03-24 06:41:30 +0000 | [diff] [blame] | 355 | } |
| 356 | |
bart | f647d34 | 2008-03-24 19:12:12 +0000 | [diff] [blame] | 357 | /** Look up the address a1 in bitmap bm and return a pointer to a potentially |
| 358 | * shared second level bitmap. The bitmap where the returned pointer points |
| 359 | * at may not be modified by the caller. |
| 360 | * |
bart | 0008f5b | 2008-03-22 17:07:39 +0000 | [diff] [blame] | 361 | * @param a1 client address shifted right by ADDR0_BITS. |
| 362 | * @param bm bitmap pointer. |
| 363 | */ |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 364 | static __inline__ |
bart | 7e81a17 | 2008-06-09 19:50:51 +0000 | [diff] [blame] | 365 | const struct bitmap2* bm2_lookup(struct bitmap* const bm, const UWord a1) |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 366 | { |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 367 | struct bitmap2* bm2; |
| 368 | struct bitmap2ref* bm2ref; |
bart | f647d34 | 2008-03-24 19:12:12 +0000 | [diff] [blame] | 369 | |
bart | 3c9989f | 2008-06-11 19:17:01 +0000 | [diff] [blame] | 370 | #ifdef ENABLE_DRD_CONSISTENCY_CHECKS |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 371 | tl_assert(bm); |
bart | 3c9989f | 2008-06-11 19:17:01 +0000 | [diff] [blame] | 372 | #endif |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 373 | if (! bm_cache_lookup(bm, a1, &bm2)) |
| 374 | { |
| 375 | bm2ref = VG_(OSetGen_Lookup)(bm->oset, &a1); |
| 376 | if (bm2ref) |
| 377 | { |
| 378 | bm2 = bm2ref->bm2; |
| 379 | } |
| 380 | bm_update_cache(*(struct bitmap**)&bm, a1, bm2); |
| 381 | } |
| 382 | return bm2; |
bart | f647d34 | 2008-03-24 19:12:12 +0000 | [diff] [blame] | 383 | } |
| 384 | |
| 385 | /** Look up the address a1 in bitmap bm and return a pointer to a second |
| 386 | * level bitmap that is not shared and hence may be modified. |
| 387 | * |
| 388 | * @param a1 client address shifted right by ADDR0_BITS. |
| 389 | * @param bm bitmap pointer. |
| 390 | */ |
| 391 | static __inline__ |
| 392 | struct bitmap2* |
bart | 7e81a17 | 2008-06-09 19:50:51 +0000 | [diff] [blame] | 393 | bm2_lookup_exclusive(struct bitmap* const bm, const UWord a1) |
bart | f647d34 | 2008-03-24 19:12:12 +0000 | [diff] [blame] | 394 | { |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 395 | struct bitmap2ref* bm2ref; |
| 396 | struct bitmap2* bm2; |
bart | f647d34 | 2008-03-24 19:12:12 +0000 | [diff] [blame] | 397 | |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 398 | bm2ref = 0; |
| 399 | if (bm_cache_lookup(bm, a1, &bm2)) |
| 400 | { |
| 401 | if (bm2 == 0) |
| 402 | return 0; |
| 403 | if (bm2->refcnt > 1) |
| 404 | { |
| 405 | bm2ref = VG_(OSetGen_Lookup)(bm->oset, &a1); |
| 406 | } |
| 407 | } |
| 408 | else |
| 409 | { |
bart | f647d34 | 2008-03-24 19:12:12 +0000 | [diff] [blame] | 410 | bm2ref = VG_(OSetGen_Lookup)(bm->oset, &a1); |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 411 | if (bm2ref == 0) |
| 412 | return 0; |
| 413 | bm2 = bm2ref->bm2; |
| 414 | } |
bart | f647d34 | 2008-03-24 19:12:12 +0000 | [diff] [blame] | 415 | |
bart | 3c9989f | 2008-06-11 19:17:01 +0000 | [diff] [blame] | 416 | #ifdef ENABLE_DRD_CONSISTENCY_CHECKS |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 417 | tl_assert(bm2); |
bart | 3c9989f | 2008-06-11 19:17:01 +0000 | [diff] [blame] | 418 | #endif |
bart | f647d34 | 2008-03-24 19:12:12 +0000 | [diff] [blame] | 419 | |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 420 | if (bm2->refcnt > 1) |
| 421 | { |
bart | 3c9989f | 2008-06-11 19:17:01 +0000 | [diff] [blame] | 422 | #ifdef ENABLE_DRD_CONSISTENCY_CHECKS |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 423 | tl_assert(bm2ref); |
bart | 3c9989f | 2008-06-11 19:17:01 +0000 | [diff] [blame] | 424 | #endif |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 425 | bm2 = bm2_make_exclusive(*(struct bitmap**)&bm, bm2ref); |
| 426 | } |
bart | f647d34 | 2008-03-24 19:12:12 +0000 | [diff] [blame] | 427 | |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 428 | return bm2; |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 429 | } |
| 430 | |
bart | f647d34 | 2008-03-24 19:12:12 +0000 | [diff] [blame] | 431 | /** Look up the address a1 in bitmap bm. The returned second level bitmap has |
| 432 | * reference count one and hence may be modified. |
| 433 | * |
| 434 | * @param a1 client address shifted right by ADDR0_BITS. |
| 435 | * @param bm bitmap pointer. |
| 436 | */ |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 437 | static __inline__ |
bart | 7e81a17 | 2008-06-09 19:50:51 +0000 | [diff] [blame] | 438 | struct bitmap2* bm2_insert(struct bitmap* const bm, const UWord a1) |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 439 | { |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 440 | struct bitmap2ref* bm2ref; |
| 441 | struct bitmap2* bm2; |
bart | 33e56c9 | 2008-03-24 06:41:30 +0000 | [diff] [blame] | 442 | |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 443 | s_bitmap2_node_creation_count++; |
| 444 | bm2ref = VG_(OSetGen_AllocNode)(bm->oset, sizeof(*bm2ref)); |
| 445 | bm2ref->addr = a1; |
| 446 | bm2 = bm2_new(a1); |
| 447 | bm2ref->bm2 = bm2; |
| 448 | VG_(memset)(&bm2->bm1, 0, sizeof(bm2->bm1)); |
| 449 | VG_(OSetGen_Insert)(bm->oset, bm2ref); |
bart | a79df6e | 2008-03-14 17:07:51 +0000 | [diff] [blame] | 450 | |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 451 | bm_update_cache(*(struct bitmap**)&bm, a1, bm2); |
bart | f647d34 | 2008-03-24 19:12:12 +0000 | [diff] [blame] | 452 | |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 453 | return bm2; |
bart | f647d34 | 2008-03-24 19:12:12 +0000 | [diff] [blame] | 454 | } |
| 455 | |
| 456 | /** Insert a new node in bitmap bm that points to the second level bitmap |
| 457 | * *bm2. This means that *bm2 becomes shared over two or more bitmaps. |
| 458 | */ |
| 459 | static __inline__ |
bart | 7e81a17 | 2008-06-09 19:50:51 +0000 | [diff] [blame] | 460 | struct bitmap2* bm2_insert_addref(struct bitmap* const bm, |
bart | f647d34 | 2008-03-24 19:12:12 +0000 | [diff] [blame] | 461 | struct bitmap2* const bm2) |
| 462 | { |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 463 | struct bitmap2ref* bm2ref; |
bart | f647d34 | 2008-03-24 19:12:12 +0000 | [diff] [blame] | 464 | |
bart | 3c9989f | 2008-06-11 19:17:01 +0000 | [diff] [blame] | 465 | #ifdef ENABLE_DRD_CONSISTENCY_CHECKS |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 466 | tl_assert(bm); |
| 467 | tl_assert(VG_(OSetGen_Lookup)(bm->oset, &bm2->addr) == 0); |
bart | 3c9989f | 2008-06-11 19:17:01 +0000 | [diff] [blame] | 468 | #endif |
bart | 588d90f | 2008-04-06 13:05:58 +0000 | [diff] [blame] | 469 | |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 470 | s_bitmap2_node_creation_count++; |
| 471 | bm2ref = VG_(OSetGen_AllocNode)(bm->oset, sizeof(*bm2ref)); |
| 472 | bm2ref->addr = bm2->addr; |
| 473 | bm2ref->bm2 = bm2; |
| 474 | bm2->refcnt++; |
| 475 | VG_(OSetGen_Insert)(bm->oset, bm2ref); |
bart | a79df6e | 2008-03-14 17:07:51 +0000 | [diff] [blame] | 476 | |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 477 | bm_update_cache(*(struct bitmap**)&bm, bm2->addr, bm2); |
bart | f647d34 | 2008-03-24 19:12:12 +0000 | [diff] [blame] | 478 | |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 479 | return bm2; |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 480 | } |
| 481 | |
bart | 0008f5b | 2008-03-22 17:07:39 +0000 | [diff] [blame] | 482 | /** Look up the address a1 in bitmap bm, and insert it if not found. |
bart | f647d34 | 2008-03-24 19:12:12 +0000 | [diff] [blame] | 483 | * The returned second level bitmap may not be modified. |
bart | 0008f5b | 2008-03-22 17:07:39 +0000 | [diff] [blame] | 484 | * |
| 485 | * @param a1 client address shifted right by ADDR0_BITS. |
| 486 | * @param bm bitmap pointer. |
| 487 | */ |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 488 | static __inline__ |
bart | 7e81a17 | 2008-06-09 19:50:51 +0000 | [diff] [blame] | 489 | struct bitmap2* bm2_lookup_or_insert(struct bitmap* const bm, const UWord a1) |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 490 | { |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 491 | struct bitmap2ref* bm2ref; |
| 492 | struct bitmap2* bm2; |
bart | a79df6e | 2008-03-14 17:07:51 +0000 | [diff] [blame] | 493 | |
bart | 3c9989f | 2008-06-11 19:17:01 +0000 | [diff] [blame] | 494 | #ifdef ENABLE_DRD_CONSISTENCY_CHECKS |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 495 | tl_assert(bm); |
bart | 3c9989f | 2008-06-11 19:17:01 +0000 | [diff] [blame] | 496 | #endif |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 497 | if (bm_cache_lookup(bm, a1, &bm2)) |
| 498 | { |
| 499 | if (bm2 == 0) |
| 500 | { |
| 501 | bm2 = bm2_insert(bm, a1); |
| 502 | } |
| 503 | } |
| 504 | else |
| 505 | { |
| 506 | bm2ref = VG_(OSetGen_Lookup)(bm->oset, &a1); |
| 507 | if (bm2ref) |
| 508 | { |
| 509 | bm2 = bm2ref->bm2; |
| 510 | } |
| 511 | else |
| 512 | { |
| 513 | bm2 = bm2_insert(bm, a1); |
| 514 | } |
| 515 | bm_update_cache(*(struct bitmap**)&bm, a1, bm2); |
| 516 | } |
| 517 | return bm2; |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 518 | } |
| 519 | |
bart | f647d34 | 2008-03-24 19:12:12 +0000 | [diff] [blame] | 520 | /** Look up the address a1 in bitmap bm, and insert it if not found. |
| 521 | * The returned second level bitmap may be modified. |
| 522 | * |
| 523 | * @param a1 client address shifted right by ADDR0_BITS. |
| 524 | * @param bm bitmap pointer. |
| 525 | */ |
| 526 | static __inline__ |
| 527 | struct bitmap2* bm2_lookup_or_insert_exclusive(struct bitmap* const bm, |
| 528 | const UWord a1) |
| 529 | { |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 530 | struct bitmap2* bm2; |
bart | f647d34 | 2008-03-24 19:12:12 +0000 | [diff] [blame] | 531 | |
bart | 3c9989f | 2008-06-11 19:17:01 +0000 | [diff] [blame] | 532 | #ifdef ENABLE_DRD_CONSISTENCY_CHECKS |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 533 | tl_assert(bm); |
bart | 3c9989f | 2008-06-11 19:17:01 +0000 | [diff] [blame] | 534 | #endif |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 535 | bm2 = (struct bitmap2*)bm2_lookup_or_insert(bm, a1); |
bart | 3c9989f | 2008-06-11 19:17:01 +0000 | [diff] [blame] | 536 | #ifdef ENABLE_DRD_CONSISTENCY_CHECKS |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 537 | tl_assert(bm2); |
bart | 3c9989f | 2008-06-11 19:17:01 +0000 | [diff] [blame] | 538 | #endif |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 539 | if (bm2->refcnt > 1) |
| 540 | { |
| 541 | struct bitmap2ref* bm2ref; |
| 542 | bm2ref = VG_(OSetGen_Lookup)(bm->oset, &a1); |
| 543 | bm2 = bm2_make_exclusive(bm, bm2ref); |
| 544 | } |
| 545 | return bm2; |
bart | f647d34 | 2008-03-24 19:12:12 +0000 | [diff] [blame] | 546 | } |
| 547 | |
bart | d59bb0f | 2008-06-08 08:08:31 +0000 | [diff] [blame] | 548 | static __inline__ |
| 549 | void bm_access_aligned_load(struct bitmap* const bm, |
| 550 | const Addr a1, const SizeT size) |
| 551 | { |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 552 | struct bitmap2* bm2; |
bart | d59bb0f | 2008-06-08 08:08:31 +0000 | [diff] [blame] | 553 | |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 554 | bm2 = bm2_lookup_or_insert_exclusive(bm, a1 >> ADDR0_BITS); |
| 555 | bm0_set_range(bm2->bm1.bm0_r, a1 & ADDR0_MASK, size); |
bart | d59bb0f | 2008-06-08 08:08:31 +0000 | [diff] [blame] | 556 | } |
| 557 | |
| 558 | static __inline__ |
| 559 | void bm_access_aligned_store(struct bitmap* const bm, |
| 560 | const Addr a1, const SizeT size) |
| 561 | { |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 562 | struct bitmap2* bm2; |
bart | d59bb0f | 2008-06-08 08:08:31 +0000 | [diff] [blame] | 563 | |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 564 | bm2 = bm2_lookup_or_insert_exclusive(bm, a1 >> ADDR0_BITS); |
| 565 | bm0_set_range(bm2->bm1.bm0_w, a1 & ADDR0_MASK, size); |
bart | d59bb0f | 2008-06-08 08:08:31 +0000 | [diff] [blame] | 566 | } |
| 567 | |
| 568 | static __inline__ |
bart | 7e81a17 | 2008-06-09 19:50:51 +0000 | [diff] [blame] | 569 | Bool bm_aligned_load_has_conflict_with(struct bitmap* const bm, |
bart | d59bb0f | 2008-06-08 08:08:31 +0000 | [diff] [blame] | 570 | const Addr a1, const SizeT size) |
| 571 | { |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 572 | const struct bitmap2* bm2; |
bart | d59bb0f | 2008-06-08 08:08:31 +0000 | [diff] [blame] | 573 | |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 574 | bm2 = bm2_lookup(bm, a1 >> ADDR0_BITS); |
bart | d59bb0f | 2008-06-08 08:08:31 +0000 | [diff] [blame] | 575 | |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 576 | return (bm2 && bm0_is_any_set(bm2->bm1.bm0_w, a1 & ADDR0_MASK, size)); |
bart | d59bb0f | 2008-06-08 08:08:31 +0000 | [diff] [blame] | 577 | } |
| 578 | |
| 579 | static __inline__ |
bart | 7e81a17 | 2008-06-09 19:50:51 +0000 | [diff] [blame] | 580 | Bool bm_aligned_store_has_conflict_with(struct bitmap* const bm, |
bart | d59bb0f | 2008-06-08 08:08:31 +0000 | [diff] [blame] | 581 | const Addr a1, const SizeT size) |
| 582 | { |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 583 | const struct bitmap2* bm2; |
bart | d59bb0f | 2008-06-08 08:08:31 +0000 | [diff] [blame] | 584 | |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 585 | bm2 = bm2_lookup(bm, a1 >> ADDR0_BITS); |
bart | d59bb0f | 2008-06-08 08:08:31 +0000 | [diff] [blame] | 586 | |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 587 | if (bm2) |
| 588 | { |
| 589 | if (bm0_is_any_set(bm2->bm1.bm0_r, a1 & ADDR0_MASK, size) |
| 590 | | bm0_is_any_set(bm2->bm1.bm0_w, a1 & ADDR0_MASK, size)) |
| 591 | { |
| 592 | return True; |
| 593 | } |
| 594 | } |
| 595 | return False; |
bart | d59bb0f | 2008-06-08 08:08:31 +0000 | [diff] [blame] | 596 | } |
sewardj | af44c82 | 2007-11-25 14:01:38 +0000 | [diff] [blame] | 597 | |
bart | 33e56c9 | 2008-03-24 06:41:30 +0000 | [diff] [blame] | 598 | #endif /* __DRD_BITMAP_H */ |