diff options
| author | Mark Rowe <mrowe@bdash.net.nz> | 2024-11-24 22:34:40 -0800 |
|---|---|---|
| committer | Mark Rowe <mrowe@bdash.net.nz> | 2025-01-10 11:52:37 -0800 |
| commit | a44b78355031ed429ac07f20a6439f07f9f47d9d (patch) | |
| tree | 88460c41150d37321b4ae63d0a82ad8a5837cb30 /view/sharedcache/core/SharedCache.h | |
| parent | 1f0be2385be2c796152e12ffebc229f10e3ffc28 (diff) | |
[SharedCache] Track whether non-image regions are data vs code
`BackingCache` now tracks the `dyld_cache_mapping_info` for its mappings
so it has access to the memory protections for the region. This means it
can avoid marking some regions as containing code when they don't,
reducing the amount of analysis work that has to be done.
Using `dyld_cache_mapping_info` also makes references to mappings easier
to understand due to its named fields vs the nested `std::pair`s that
were previously in use.
Diffstat (limited to 'view/sharedcache/core/SharedCache.h')
| -rw-r--r-- | view/sharedcache/core/SharedCache.h | 31 |
1 files changed, 10 insertions, 21 deletions
diff --git a/view/sharedcache/core/SharedCache.h b/view/sharedcache/core/SharedCache.h index 1dcc3033..a0d4e596 100644 --- a/view/sharedcache/core/SharedCache.h +++ b/view/sharedcache/core/SharedCache.h @@ -23,7 +23,6 @@ namespace SharedCacheCore { DSCViewStateLoadedWithImages, }; - const std::string SharedCacheMetadataTag = "SHAREDCACHE-SharedCacheData"; struct MemoryRegion : public MetadataSerializable<MemoryRegion> @@ -91,26 +90,6 @@ namespace SharedCacheCore { } }; - struct BackingCache : public MetadataSerializable<BackingCache> - { - std::string path; - bool isPrimary = false; - std::vector<std::pair<uint64_t, std::pair<uint64_t, uint64_t>>> mappings; - - void Store(SerializationContext& context) const - { - MSS(path); - MSS(isPrimary); - MSS(mappings); - } - void Load(DeserializationContext& context) - { - MSL(path); - MSL(isPrimary); - MSL(mappings); - } - }; - #if defined(__GNUC__) || defined(__clang__) #define PACKED_STRUCT __attribute__((packed)) #else @@ -132,6 +111,16 @@ namespace SharedCacheCore { uint32_t initProt; }; + struct BackingCache : public MetadataSerializable<BackingCache> + { + std::string path; + bool isPrimary = false; + std::vector<dyld_cache_mapping_info> mappings; + + void Store(SerializationContext& context) const; + void Load(DeserializationContext& context); + }; + struct LoadedMapping { std::shared_ptr<MMappedFileAccessor> backingFile; |
