* Calculate the protections of a mapping. */
| 202 | * Calculate the protections of a mapping. |
| 203 | */ |
| 204 | static int calculateProtections(const Mapping *mapping) |
| 205 | { |
| 206 | int prot = PROT_NONE; |
| 207 | const size_t SIZE = mapping->size; |
| 208 | const intptr_t BASE = mapping->base; |
| 209 | const intptr_t END = BASE + SIZE; |
| 210 | auto iend = Allocator::end(); |
| 211 | for (auto i = mapping->i; i != iend; ++i) |
| 212 | { |
| 213 | const Alloc *a = *i; |
| 214 | if (a->lb >= END) |
| 215 | break; |
| 216 | if (a->T == nullptr) |
| 217 | continue; |
| 218 | prot |= a->T->prot; |
| 219 | } |
| 220 | return prot; |
| 221 | } |
| 222 | |
| 223 | /* |
| 224 | * Calculate the PRELOAD flag of a mapping. |