MCPcopy Create free account
hub / github.com/Vector35/binaryninja-api / ApplySlideInfoV3

Function ApplySlideInfoV3

view/sharedcache/core/SlideInfo.cpp:48–86  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

46}
47
48void ApplySlideInfoV3(MappedFileAccessor& accessor, const SlideMappingInfo& mapping)
49{
50 uint64_t pageStartsOffset = mapping.address + sizeof(dyld_cache_slide_info_v3);
51 uint64_t pageStartCount = mapping.slideInfoV3.page_starts_count;
52 uint64_t pageSize = mapping.slideInfoV3.page_size;
53
54 auto cursor = pageStartsOffset;
55 for (size_t i = 0; i < pageStartCount; i++)
56 {
57 uint16_t delta = accessor.ReadUInt16(cursor);
58 cursor += sizeof(uint16_t);
59 if (delta == DYLD_CACHE_SLIDE_V3_PAGE_ATTR_NO_REBASE)
60 continue;
61
62 delta = delta / sizeof(uint64_t); // initial offset is byte based
63 uint64_t loc = mapping.mappingInfo.fileOffset + (pageSize * i);
64 do
65 {
66 loc += delta * sizeof(dyld_cache_slide_pointer3);
67 dyld_cache_slide_pointer3 slideInfo = {accessor.ReadUInt64(loc)};
68 delta = slideInfo.plain.offsetToNextPointer;
69
70 if (slideInfo.auth.authenticated)
71 {
72 uint64_t value = slideInfo.auth.offsetFromSharedCacheBase;
73 value += mapping.slideInfoV3.auth_value_add;
74 accessor.WritePointer(loc, value);
75 }
76 else
77 {
78 uint64_t value51 = slideInfo.plain.pointerValue;
79 uint64_t top8Bits = value51 & 0x0007F80000000000;
80 uint64_t bottom43Bits = value51 & 0x000007FFFFFFFFFF;
81 uint64_t value = (uint64_t)top8Bits << 13 | bottom43Bits;
82 accessor.WritePointer(loc, value);
83 }
84 } while (delta != 0);
85 }
86}
87
88void ApplySlideInfoV2(MappedFileAccessor& accessor, const SlideMappingInfo& mapping)
89{

Callers 1

ApplyMappingsMethod · 0.85

Calls 3

ReadUInt16Method · 0.45
ReadUInt64Method · 0.45
WritePointerMethod · 0.45

Tested by

no test coverage detected