| 11 | } |
| 12 | |
| 13 | void ApplySlideInfoV5(MappedFileAccessor& accessor, const SlideMappingInfo& mapping) |
| 14 | { |
| 15 | uint64_t pageStartsOffset = mapping.address + sizeof(dyld_cache_slide_info_v5); |
| 16 | uint64_t pageStartCount = mapping.slideInfoV5.page_starts_count; |
| 17 | uint64_t pageSize = mapping.slideInfoV5.page_size; |
| 18 | |
| 19 | auto cursor = pageStartsOffset; |
| 20 | for (size_t i = 0; i < pageStartCount; i++) |
| 21 | { |
| 22 | uint16_t delta = accessor.ReadUInt16(cursor); |
| 23 | cursor += sizeof(uint16_t); |
| 24 | if (delta == DYLD_CACHE_SLIDE_V5_PAGE_ATTR_NO_REBASE) |
| 25 | continue; |
| 26 | |
| 27 | delta = delta / sizeof(uint64_t); // initial offset is byte based |
| 28 | uint64_t loc = mapping.mappingInfo.fileOffset + (pageSize * i); |
| 29 | do |
| 30 | { |
| 31 | loc += delta * sizeof(dyld_cache_slide_pointer5); |
| 32 | dyld_cache_slide_pointer5 slideInfo = {accessor.ReadUInt64(loc)}; |
| 33 | delta = slideInfo.regular.next; |
| 34 | if (slideInfo.auth.auth) |
| 35 | { |
| 36 | uint64_t value = mapping.slideInfoV5.value_add + slideInfo.auth.runtimeOffset; |
| 37 | accessor.WritePointer(loc, value); |
| 38 | } |
| 39 | else |
| 40 | { |
| 41 | uint64_t value = mapping.slideInfoV5.value_add + slideInfo.regular.runtimeOffset; |
| 42 | accessor.WritePointer(loc, value); |
| 43 | } |
| 44 | } while (delta != 0); |
| 45 | } |
| 46 | } |
| 47 | |
| 48 | void ApplySlideInfoV3(MappedFileAccessor& accessor, const SlideMappingInfo& mapping) |
| 49 | { |
no test coverage detected