summaryrefslogtreecommitdiff
path: root/view
diff options
context:
space:
mode:
authorMark Rowe <mark@vector35.com>2025-12-02 21:27:05 -0800
committerMark Rowe <mark@vector35.com>2025-12-08 14:03:38 -0800
commite1ad1aa09ce9e7760a68a8dc7c2dfe64c02aa100 (patch)
tree0068529d0ed41c20ac5bb5ef3b723afa3f96e35f /view
parent31c0faa9753601eb7d41965ce5d7f96dcef9b71c (diff)
[KernelCache] Wrap section creation within BeginBulkAddSegments / EndBulkAddSegments
This defers rebuilding of the section map until after all sections for an image have been added, rather than having the section map be rebuilt after adding each section.
Diffstat (limited to 'view')
-rw-r--r--view/kernelcache/core/MachOProcessor.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/view/kernelcache/core/MachOProcessor.cpp b/view/kernelcache/core/MachOProcessor.cpp
index 5731d80e..55afc408 100644
--- a/view/kernelcache/core/MachOProcessor.cpp
+++ b/view/kernelcache/core/MachOProcessor.cpp
@@ -31,12 +31,15 @@ void KernelCacheMachOProcessor::ApplyHeader(const KernelCache& cache, KernelCach
};
// Add a section for the header itself.
+ m_view->BeginBulkAddSegments();
std::string headerSection = fmt::format("{}::__macho_header", header.identifierPrefix);
uint64_t machHeaderSize = m_view->GetAddressSize() == 8 ? sizeof(mach_header_64) : sizeof(mach_header);
uint64_t headerSectionSize = machHeaderSize + header.ident.sizeofcmds;
m_view->AddUserSection(headerSection, header.textBase, headerSectionSize, ReadOnlyDataSectionSemantics);
ApplyHeaderSections(header);
+ m_view->EndBulkAddSegments();
+
ApplyHeaderDataVariables(header);
// Pull the available type library for the image we are loading, so we can apply known types.