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

Function CorePluginInit

platform/mac/platform_mac.cpp:283–346  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

281 bool MacPluginInit()
282#else
283 BINARYNINJAPLUGIN bool CorePluginInit()
284#endif
285 {
286 Ref<BinaryViewType> viewType = BinaryViewType::GetByName("Mach-O");
287 Ref<Architecture> x86 = Architecture::GetByName("x86");
288 if (x86)
289 {
290 g_macX86 = new MacX86Platform(x86);
291 Platform::Register("mac", g_macX86);
292 if (viewType)
293 viewType->RegisterPlatformRecognizer(7, LittleEndian, MacX86Platform::Recognize);
294 }
295
296 Ref<Architecture> x64 = Architecture::GetByName("x86_64");
297 if (x64)
298 {
299 g_macX64 = new MacX64Platform(x64);
300 Platform::Register("mac", g_macX64);
301 if (viewType)
302 viewType->RegisterPlatformRecognizer(0x01000007, LittleEndian, MacX64Platform::Recognize);
303 }
304
305 Ref<Architecture> armv7 = Architecture::GetByName("armv7");
306 Ref<Architecture> thumb2 = Architecture::GetByName("thumb2");
307 if (armv7 && thumb2)
308 {
309 g_macArmv7 = new MacArmv7Platform(armv7, "mac-armv7");
310 g_macThumb2 = new MacArmv7Platform(thumb2, "mac-thumb2");
311 g_iosArmv7 = new IOSArmv7Platform(armv7, "ios-armv7");
312 g_iosThumb2 = new IOSArmv7Platform(thumb2, "ios-thumb2");
313 g_macArmv7->AddRelatedPlatform(thumb2, g_macThumb2);
314 g_macThumb2->AddRelatedPlatform(armv7, g_macArmv7);
315 g_iosArmv7->AddRelatedPlatform(thumb2, g_iosThumb2);
316 g_iosThumb2->AddRelatedPlatform(armv7, g_iosArmv7);
317 Platform::Register("mac", g_macArmv7);
318 Platform::Register("ios", g_iosArmv7);
319 Platform::Register("mac", g_macThumb2);
320 Platform::Register("ios", g_iosThumb2);
321 if (viewType)
322 {
323 viewType->RegisterPlatformRecognizer(0xc, LittleEndian, MacArmv7Platform::Recognize);
324 viewType->RegisterPlatformRecognizer(0xc, LittleEndian, IOSArmv7Platform::Recognize);
325 }
326 }
327
328 Ref<Architecture> arm64 = Architecture::GetByName("aarch64");
329 if (arm64)
330 {
331 g_macArm64 = new MacArm64Platform(arm64);
332 g_iosArm64 = new IOSArm64Platform(arm64);
333 Platform::Register("mac", g_macArm64);
334 Platform::Register("ios", g_iosArm64);
335 if (viewType)
336 {
337 viewType->RegisterPlatformRecognizer(0, LittleEndian, MacArm64Platform::Recognize);
338 viewType->RegisterPlatformRecognizer(0x0100000c, LittleEndian, MacArm64Platform::Recognize);
339 viewType->RegisterPlatformRecognizer(0x0200000c, LittleEndian, MacArm64Platform::Recognize);
340 viewType->RegisterPlatformRecognizer(0, LittleEndian, IOSArm64Platform::Recognize);

Callers

nothing calls this directly

Calls 3

AddRelatedPlatformMethod · 0.80
RegisterEnum · 0.50

Tested by

no test coverage detected