MCPcopy Create free account
hub / github.com/Vector35/binaryninja-api / InitializeHeader

Method InitializeHeader

view/kernelcache/core/KernelCache.cpp:1394–1678  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1392}
1393
1394void KernelCache::InitializeHeader(Ref<BinaryView> view, KernelCacheMachOHeader header)
1395{
1396 Ref<Settings> settings = view->GetLoadSettings(KC_VIEW_NAME);
1397 bool applyFunctionStarts = true; // FIXME
1398
1399 view->AddAutoSection(header.identifierPrefix + "::__macho_header", header.textBase, header.ident.sizeofcmds + sizeof(mach_header_64), ReadOnlyDataSectionSemantics);
1400
1401 for (size_t i = 0; i < header.sections.size(); i++)
1402 {
1403 if (!header.sections[i].size)
1404 continue;
1405
1406 std::string type;
1407 BNSectionSemantics semantics = DefaultSectionSemantics;
1408 switch (header.sections[i].flags & 0xff)
1409 {
1410 case S_REGULAR:
1411 if (header.sections[i].flags & S_ATTR_PURE_INSTRUCTIONS)
1412 {
1413 type = "PURE_CODE";
1414 semantics = ReadOnlyCodeSectionSemantics;
1415 }
1416 else if (header.sections[i].flags & S_ATTR_SOME_INSTRUCTIONS)
1417 {
1418 type = "CODE";
1419 semantics = ReadOnlyCodeSectionSemantics;
1420 }
1421 else
1422 {
1423 type = "REGULAR";
1424 }
1425 break;
1426 case S_ZEROFILL:
1427 type = "ZEROFILL";
1428 semantics = ReadWriteDataSectionSemantics;
1429 break;
1430 case S_CSTRING_LITERALS:
1431 type = "CSTRING_LITERALS";
1432 semantics = ReadOnlyDataSectionSemantics;
1433 break;
1434 case S_4BYTE_LITERALS:
1435 type = "4BYTE_LITERALS";
1436 break;
1437 case S_8BYTE_LITERALS:
1438 type = "8BYTE_LITERALS";
1439 break;
1440 case S_LITERAL_POINTERS:
1441 type = "LITERAL_POINTERS";
1442 semantics = ReadOnlyDataSectionSemantics;
1443 break;
1444 case S_NON_LAZY_SYMBOL_POINTERS:
1445 type = "NON_LAZY_SYMBOL_POINTERS";
1446 semantics = ReadOnlyDataSectionSemantics;
1447 break;
1448 case S_LAZY_SYMBOL_POINTERS:
1449 type = "LAZY_SYMBOL_POINTERS";
1450 semantics = ReadOnlyDataSectionSemantics;
1451 break;

Callers

nothing calls this directly

Calls 15

ArrayTypeClass · 0.85
IntegerTypeClass · 0.85
GetLoadSettingsMethod · 0.80
AddAutoSectionMethod · 0.80
GetTypeLibraryMethod · 0.80
GetParentViewMethod · 0.80
DefineDataVariableMethod · 0.80
DefineAutoSymbolMethod · 0.80
GetDefaultPlatformMethod · 0.80
IsValidOffsetMethod · 0.80

Tested by

no test coverage detected