summaryrefslogtreecommitdiff
path: root/view/sharedcache/core/SharedCacheController.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'view/sharedcache/core/SharedCacheController.cpp')
-rw-r--r--view/sharedcache/core/SharedCacheController.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/view/sharedcache/core/SharedCacheController.cpp b/view/sharedcache/core/SharedCacheController.cpp
index 41118d7a..ff688f3c 100644
--- a/view/sharedcache/core/SharedCacheController.cpp
+++ b/view/sharedcache/core/SharedCacheController.cpp
@@ -160,7 +160,10 @@ bool SharedCacheController::ApplyRegion(BinaryView& view, const CacheRegion& reg
// TODO: We can use the AddRemoteMemoryRegion if we want to reload on view init.
// TODO: ^ The above is only useful if we assume that all files will be available across database loads.
// TODO: we might allow a user to select non-persisted memory regions as an option.
- view.GetMemoryMap()->AddDataMemoryRegion(memoryRegionName, region.start, buffer, region.flags);
+ bool addedMemoryRegion = view.GetMemoryMap()->AddDataMemoryRegion(memoryRegionName, region.start, buffer, region.flags);
+ if (!addedMemoryRegion)
+ return false;
+
// TODO: We might want to make this auto if we decide to "reload" all loaded region in view init.
// If we are not associated with an image we can create a section here to set the semantics.
// This is important for stub regions, as they will deref non image data that we want to retrieve the value of.
@@ -195,10 +198,12 @@ bool SharedCacheController::ApplyImage(BinaryView& view, const CacheImage& image
{
// Load all regions of an image and mark the image as loaded.
// NOTE: The regions lock m_loadMutex themselves, so we do not hold it up here.
+ view.BeginBulkAddSegments();
bool loadedRegion = false;
for (const auto& regionStart : image.regionStarts)
if (ApplyRegionAtAddress(view, regionStart))
loadedRegion = true;
+ view.EndBulkAddSegments();
// The ApplyRegionAtAddress no longer holds the lock, we can take it now.
std::unique_lock<std::shared_mutex> lock(m_loadMutex);