-
Notifications
You must be signed in to change notification settings - Fork 283
Expand file tree
/
Copy pathplatform_decree.cpp
More file actions
66 lines (53 loc) · 1.25 KB
/
platform_decree.cpp
File metadata and controls
66 lines (53 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#include "binaryninjaapi.h"
using namespace BinaryNinja;
using namespace std;
class DecreeX86Platform: public Platform
{
public:
DecreeX86Platform(Architecture* arch): Platform(arch, "decree-x86")
{
Ref<CallingConvention> cc;
cc = arch->GetCallingConventionByName("cdecl");
if (cc)
{
RegisterDefaultCallingConvention(cc);
RegisterCdeclCallingConvention(cc);
}
cc = arch->GetCallingConventionByName("regparm");
if (cc)
RegisterFastcallCallingConvention(cc);
cc = arch->GetCallingConventionByName("stdcall");
if (cc)
RegisterStdcallCallingConvention(cc);
cc = arch->GetCallingConventionByName("linux-syscall");
if (cc)
SetSystemCallConvention(cc);
}
};
extern "C"
{
BN_DECLARE_CORE_ABI_VERSION
#ifndef DEMO_EDITION
BINARYNINJAPLUGIN void CorePluginDependencies()
{
AddOptionalPluginDependency("arch_x86");
AddOptionalPluginDependency("view_elf");
}
#endif
#ifdef DEMO_EDITION
bool DecreePluginInit()
#else
BINARYNINJAPLUGIN bool CorePluginInit()
#endif
{
Ref<Architecture> x86 = Architecture::GetByName("x86");
if (x86)
{
Ref<Platform> platform;
platform = new DecreeX86Platform(x86);
Platform::Register("decree", platform);
BinaryViewType::RegisterPlatform("ELF", 'C', platform);
}
return true;
}
}