From a44b78355031ed429ac07f20a6439f07f9f47d9d Mon Sep 17 00:00:00 2001 From: Mark Rowe Date: Sun, 24 Nov 2024 22:34:40 -0800 Subject: [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. --- view/sharedcache/core/SharedCache.h | 31 ++++++++++--------------------- 1 file changed, 10 insertions(+), 21 deletions(-) (limited to 'view/sharedcache/core/SharedCache.h') 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 @@ -91,26 +90,6 @@ namespace SharedCacheCore { } }; - struct BackingCache : public MetadataSerializable - { - std::string path; - bool isPrimary = false; - std::vector>> 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 + { + std::string path; + bool isPrimary = false; + std::vector mappings; + + void Store(SerializationContext& context) const; + void Load(DeserializationContext& context); + }; + struct LoadedMapping { std::shared_ptr backingFile; -- cgit v1.3.1