| 259 | bool EFIPluginInit() |
| 260 | #else |
| 261 | BINARYNINJAPLUGIN bool CorePluginInit() |
| 262 | #endif |
| 263 | { |
| 264 | Ref<BinaryViewType> pe = BinaryViewType::GetByName("PE"); |
| 265 | if (pe) |
| 266 | { |
| 267 | Ref<Architecture> x86 = Architecture::GetByName("x86"); |
| 268 | if (x86) |
| 269 | { |
| 270 | g_efiX86 = new EFIX86Platform(x86); |
| 271 | Platform::Register("efi", g_efiX86); |
| 272 | pe->RegisterPlatformRecognizer(0x14c, LittleEndian, EFIX86Platform::Recognize); |
| 273 | |
| 274 | g_efiX86Windows = new EFIX86WindowsPlatform(x86); |
| 275 | Platform::Register("efi", g_efiX86Windows); |
| 276 | pe->RegisterPlatformRecognizer(0x14c, LittleEndian, EFIX86WindowsPlatform::Recognize); |
| 277 | } |
| 278 | |
| 279 | Ref<Architecture> x64 = Architecture::GetByName("x86_64"); |
| 280 | if (x64) |
| 281 | { |
| 282 | g_efiX64 = new EFIX64Platform(x64); |
| 283 | Platform::Register("efi", g_efiX64); |
| 284 | pe->RegisterPlatformRecognizer(0x8664, LittleEndian, EFIX64Platform::Recognize); |
| 285 | |
| 286 | g_efiX64Windows = new EFIX64WindowsPlatform(x64); |
| 287 | Platform::Register("efi", g_efiX64Windows); |
| 288 | pe->RegisterPlatformRecognizer(0x8664, LittleEndian, EFIX64WindowsPlatform::Recognize); |
| 289 | } |
| 290 | |
| 291 | Ref<Architecture> armv7 = Architecture::GetByName("armv7"); |
| 292 | Ref<Architecture> thumb2 = Architecture::GetByName("thumb2"); |
| 293 | if (armv7 && thumb2) |
| 294 | { |
| 295 | g_efiArm = new EFIArmv7Platform(armv7, "efi-armv7"); |
| 296 | g_efiThumb = new EFIArmv7Platform(thumb2, "efi-thumb2"); |
| 297 | g_efiArm->AddRelatedPlatform(thumb2, g_efiThumb); |
| 298 | g_efiThumb->AddRelatedPlatform(armv7, g_efiArm); |
| 299 | Platform::Register("efi", g_efiArm); |
| 300 | Platform::Register("efi", g_efiThumb); |
| 301 | pe->RegisterPlatformRecognizer(0x1c0, LittleEndian, EFIArmv7Platform::Recognize); |
| 302 | pe->RegisterPlatformRecognizer(0x1c2, LittleEndian, EFIArmv7Platform::Recognize); |
| 303 | pe->RegisterPlatformRecognizer(0x1c4, LittleEndian, EFIArmv7Platform::Recognize); |
| 304 | } |
| 305 | |
| 306 | Ref<Architecture> arm64 = Architecture::GetByName("aarch64"); |
| 307 | if (arm64) |
| 308 | { |
| 309 | g_efiArm64 = new EFIArm64Platform(arm64); |
| 310 | Platform::Register("efi", g_efiArm64); |
| 311 | pe->RegisterPlatformRecognizer(0xaa64, LittleEndian, EFIArm64Platform::Recognize); |
| 312 | |
| 313 | g_efiArm64Windows = new EFIArm64WindowsPlatform(arm64); |
| 314 | Platform::Register("efi", g_efiArm64Windows); |
| 315 | pe->RegisterPlatformRecognizer(0xaa64, LittleEndian, EFIArm64WindowsPlatform::Recognize); |
| 316 | } |
| 317 | } |
| 318 |
nothing calls this directly
no test coverage detected