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

Function CorePluginInit

platform/linux/platform_linux.cpp:299–513  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

297 bool LinuxPluginInit()
298#else
299 BINARYNINJAPLUGIN bool CorePluginInit()
300#endif
301 {
302 Ref<Architecture> x86 = Architecture::GetByName("x86");
303 if (x86)
304 {
305 Ref<Platform> platform;
306
307 platform = new LinuxX86Platform(x86);
308 Platform::Register("linux", platform);
309 // Linux binaries sometimes have an OS identifier of zero, even though 3 is the correct one
310 BinaryViewType::RegisterPlatform("ELF", 0, platform);
311 BinaryViewType::RegisterPlatform("ELF", 3, platform);
312 }
313
314 Ref<Architecture> x64 = Architecture::GetByName("x86_64");
315 if (x64)
316 {
317 Ref<Platform> platform;
318
319 platform = new LinuxX64Platform(x64);
320 Platform::Register("linux", platform);
321 // Linux binaries sometimes have an OS identifier of zero, even though 3 is the correct one
322 BinaryViewType::RegisterPlatform("ELF", 0, platform);
323 BinaryViewType::RegisterPlatform("ELF", 3, platform);
324 }
325
326 Ref<Architecture> armv7 = Architecture::GetByName("armv7");
327 Ref<Architecture> armv7eb = Architecture::GetByName("armv7eb");
328 Ref<Architecture> thumb2 = Architecture::GetByName("thumb2");
329 Ref<Architecture> thumb2eb = Architecture::GetByName("thumb2eb");
330 if (armv7 && armv7eb && thumb2 && thumb2eb)
331 {
332 Ref<Platform> armPlatform, armebPlatform, thumbPlatform, thumbebPlatform;
333
334 armPlatform = new LinuxArmv7Platform(armv7, "linux-armv7");
335 armebPlatform = new LinuxArmv7Platform(armv7eb, "linux-armv7eb");
336 thumbPlatform = new LinuxArmv7Platform(thumb2, "linux-thumb2");
337 thumbebPlatform = new LinuxArmv7Platform(thumb2eb, "linux-thumb2eb");
338 armPlatform->AddRelatedPlatform(thumb2, thumbPlatform);
339 armebPlatform->AddRelatedPlatform(thumb2eb, thumbebPlatform);
340 thumbPlatform->AddRelatedPlatform(armv7, armPlatform);
341 thumbebPlatform->AddRelatedPlatform(armv7eb, armebPlatform);
342 Platform::Register("linux", armPlatform);
343 Platform::Register("linux", thumbPlatform);
344 Platform::Register("linux", armebPlatform);
345 Platform::Register("linux", thumbebPlatform);
346 // Linux binaries sometimes have an OS identifier of zero, even though 3 is the correct one
347 BinaryViewType::RegisterPlatform("ELF", 0, armPlatform);
348 BinaryViewType::RegisterPlatform("ELF", 3, armPlatform);
349 BinaryViewType::RegisterPlatform("ELF", 0, armebPlatform);
350 BinaryViewType::RegisterPlatform("ELF", 3, armebPlatform);
351 }
352
353 Ref<Architecture> arm64 = Architecture::GetByName("aarch64");
354 if (arm64)
355 {
356 Ref<Platform> platform;

Callers

nothing calls this directly

Calls 2

AddRelatedPlatformMethod · 0.80
RegisterEnum · 0.50

Tested by

no test coverage detected