@@ -86,6 +86,43 @@ class FreeBSDArm64Platform: public Platform
8686};
8787
8888
89+ class FreeBSDPpcPlatform : public Platform
90+ {
91+ public:
92+ FreeBSDPpcPlatform (Architecture* arch, const std::string& name): Platform(arch, name)
93+ {
94+ Ref<CallingConvention> cc;
95+
96+ cc = arch->GetCallingConventionByName (" svr4" );
97+ if (cc)
98+ RegisterDefaultCallingConvention (cc);
99+ }
100+ };
101+
102+
103+ class FreeBSDRiscVPlatform : public Platform
104+ {
105+ public:
106+ FreeBSDRiscVPlatform (Architecture* arch, const std::string& name): Platform(arch, name)
107+ {
108+ Ref<CallingConvention> cc;
109+
110+ cc = arch->GetCallingConventionByName (" default" );
111+ if (cc)
112+ {
113+ RegisterDefaultCallingConvention (cc);
114+ RegisterCdeclCallingConvention (cc);
115+ RegisterFastcallCallingConvention (cc);
116+ RegisterStdcallCallingConvention (cc);
117+ }
118+
119+ cc = arch->GetCallingConventionByName (" syscall" );
120+ if (cc)
121+ SetSystemCallConvention (cc);
122+ }
123+ };
124+
125+
89126extern " C"
90127{
91128 BN_DECLARE_CORE_ABI_VERSION
@@ -96,6 +133,8 @@ extern "C"
96133 AddOptionalPluginDependency (" arch_x86" );
97134 AddOptionalPluginDependency (" arch_armv7" );
98135 AddOptionalPluginDependency (" arch_arm64" );
136+ AddOptionalPluginDependency (" arch_powerpc" );
137+ AddOptionalPluginDependency (" arch_riscv" );
99138 AddOptionalPluginDependency (" view_elf" );
100139 }
101140#endif
@@ -151,6 +190,46 @@ extern "C"
151190 BinaryViewType::RegisterPlatform (" ELF" , 9 , platform);
152191 }
153192
193+ Ref<Architecture> ppc = Architecture::GetByName (" ppc" );
194+ if (ppc)
195+ {
196+ Ref<Platform> platform;
197+
198+ platform = new FreeBSDPpcPlatform (ppc, " freebsd-ppc32" );
199+ Platform::Register (" freebsd" , platform);
200+ BinaryViewType::RegisterPlatform (" ELF" , 9 , platform);
201+ }
202+
203+ Ref<Architecture> ppc64 = Architecture::GetByName (" ppc64" );
204+ if (ppc64)
205+ {
206+ Ref<Platform> platform;
207+
208+ platform = new FreeBSDPpcPlatform (ppc64, " freebsd-ppc64" );
209+ Platform::Register (" freebsd" , platform);
210+ BinaryViewType::RegisterPlatform (" ELF" , 9 , platform);
211+ }
212+
213+ Ref<Architecture> ppc64le = Architecture::GetByName (" ppc64_le" );
214+ if (ppc64le)
215+ {
216+ Ref<Platform> platform;
217+
218+ platform = new FreeBSDPpcPlatform (ppc64le, " freebsd-ppc64_le" );
219+ Platform::Register (" freebsd" , platform);
220+ BinaryViewType::RegisterPlatform (" ELF" , 9 , platform);
221+ }
222+
223+ Ref<Architecture> rv64 = Architecture::GetByName (" rv64gc" );
224+ if (rv64)
225+ {
226+ Ref<Platform> platform;
227+
228+ platform = new FreeBSDRiscVPlatform (rv64, " freebsd-rv64gc" );
229+ Platform::Register (" freebsd" , platform);
230+ BinaryViewType::RegisterPlatform (" ELF" , 9 , platform);
231+ }
232+
154233 return true ;
155234 }
156235}
0 commit comments