diff options
| author | Mason Reed <mason@vector35.com> | 2025-03-10 11:05:40 -0400 |
|---|---|---|
| committer | Mason Reed <mason@vector35.com> | 2025-04-02 05:36:54 -0400 |
| commit | 25cc02431b61097b2adfc2fbc493b648b0300c3b (patch) | |
| tree | a79d9c4f4f67234d3bf9bda413e8608f479a4cc8 /view/sharedcache/core/SlideInfo.h | |
| parent | fa85bf28502286c4821427c5d0ed91a7ed46f8f6 (diff) | |
[SharedCache] Refactor Shared Cache
In absence of a better name, this commit refactors the shared cache code.
Diffstat (limited to 'view/sharedcache/core/SlideInfo.h')
| -rw-r--r-- | view/sharedcache/core/SlideInfo.h | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/view/sharedcache/core/SlideInfo.h b/view/sharedcache/core/SlideInfo.h new file mode 100644 index 00000000..bc165589 --- /dev/null +++ b/view/sharedcache/core/SlideInfo.h @@ -0,0 +1,42 @@ +#pragma once + +#include "binaryninjaapi.h" +#include "SharedCache.h" + +// Information required to apply slide (relocation) info to a mapping +struct SlideMappingInfo +{ + dyld_cache_mapping_info mappingInfo; + // NOTE: Offset is relative to the beginning of the entry file. + uint64_t address; + uint16_t slideInfoVersion; + + union + { + dyld_cache_slide_info_v2 slideInfoV2; + dyld_cache_slide_info_v3 slideInfoV3; + dyld_cache_slide_info_v5 slideInfoV5; + }; +}; + +// Current usages of the slide info are: +// - Reading export symbols requires slide info to be processed. +// - Reading objc stuff +// - Loading an image or region +// - Reading branch island mappings???? +class SlideInfoProcessor +{ + BinaryNinja::Ref<BinaryNinja::Logger> m_logger; + // Base address of the shared cache, NOT the base address of the entry. + uint64_t m_baseAddress; + +public: + explicit SlideInfoProcessor(uint64_t baseAddress); + + std::vector<SlideMappingInfo> ReadEntryInfo(VirtualMemory& vm, const CacheEntry& entry) const; + + // Write the slide information back to the entries memory mapped regions. + void ApplyMappings(VirtualMemory& vm, const std::vector<SlideMappingInfo>& mappings); + + void ProcessEntry(VirtualMemory& vm, const CacheEntry& entry); +}; |
