@@ -226,6 +226,52 @@ class LinuxRiscVPlatform : public Platform
226
226
}
227
227
};
228
228
229
+ #ifdef ULTIMATE_EDITION
230
+ class LinuxCSkyV1Platform : public Platform
231
+ {
232
+ public:
233
+ LinuxCSkyV1Platform (Architecture* arch, const std::string& name) : Platform(arch, name)
234
+ {
235
+ Ref<CallingConvention> cc;
236
+
237
+ cc = arch->GetCallingConventionByName (" default" );
238
+ if (cc)
239
+ {
240
+ RegisterDefaultCallingConvention (cc);
241
+ RegisterCdeclCallingConvention (cc);
242
+ RegisterFastcallCallingConvention (cc);
243
+ RegisterStdcallCallingConvention (cc);
244
+ }
245
+
246
+ cc = arch->GetCallingConventionByName (" syscall" );
247
+ if (cc)
248
+ SetSystemCallConvention (cc);
249
+ }
250
+ };
251
+
252
+ class LinuxCSkyV2Platform : public Platform
253
+ {
254
+ public:
255
+ LinuxCSkyV2Platform (Architecture* arch, const std::string& name) : Platform(arch, name)
256
+ {
257
+ Ref<CallingConvention> cc;
258
+
259
+ cc = arch->GetCallingConventionByName (" default" );
260
+ if (cc)
261
+ {
262
+ RegisterDefaultCallingConvention (cc);
263
+ RegisterCdeclCallingConvention (cc);
264
+ RegisterFastcallCallingConvention (cc);
265
+ RegisterStdcallCallingConvention (cc);
266
+ }
267
+
268
+ cc = arch->GetCallingConventionByName (" syscall" );
269
+ if (cc)
270
+ SetSystemCallConvention (cc);
271
+ }
272
+ };
273
+ #endif
274
+
229
275
230
276
extern " C"
231
277
{
@@ -240,7 +286,9 @@ extern "C"
240
286
AddOptionalPluginDependency (" arch_mips" );
241
287
AddOptionalPluginDependency (" arch_ppc" );
242
288
AddOptionalPluginDependency (" arch_riscv" );
243
- AddOptionalPluginDependency (" arch_msp430" );
289
+ #ifdef ULTIMATE_EDITION
290
+ AddOptionalPluginDependency (" arch_csky" );
291
+ #endif
244
292
AddOptionalPluginDependency (" view_elf" );
245
293
}
246
294
#endif
@@ -411,6 +459,32 @@ extern "C"
411
459
BinaryViewType::RegisterPlatform (" ELF" , 3 , rv64, platform);
412
460
}
413
461
462
+ #ifdef ULTIMATE_EDITION
463
+ Ref<Architecture> cskyv1 = Architecture::GetByName (" csky_le_v1" );
464
+ if (cskyv1)
465
+ {
466
+ Ref<Platform> platform;
467
+
468
+ platform = new LinuxCSkyV1Platform (cskyv1, " linux-csky_le_v1" );
469
+ Platform::Register (" linux" , platform);
470
+ // Linux binaries sometimes have an OS identifier of zero, even though 3 is the correct one
471
+ BinaryViewType::RegisterPlatform (" ELF" , 0 , cskyv1, platform);
472
+ BinaryViewType::RegisterPlatform (" ELF" , 3 , cskyv1, platform);
473
+ }
474
+
475
+ Ref<Architecture> cskyv2 = Architecture::GetByName (" csky_le" );
476
+ if (cskyv2)
477
+ {
478
+ Ref<Platform> platform;
479
+
480
+ platform = new LinuxCSkyV2Platform (cskyv2, " linux-csky_le" );
481
+ Platform::Register (" linux" , platform);
482
+ // Linux binaries sometimes have an OS identifier of zero, even though 3 is the correct one
483
+ BinaryViewType::RegisterPlatform (" ELF" , 0 , cskyv2, platform);
484
+ BinaryViewType::RegisterPlatform (" ELF" , 3 , cskyv2, platform);
485
+ }
486
+ #endif
487
+
414
488
return true ;
415
489
}
416
490
}
0 commit comments