diff options
| author | noone <you@example.com> | 2024-06-11 04:44:24 -0500 |
|---|---|---|
| committer | Mason Reed <mason@vector35.com> | 2024-07-08 16:02:37 -0400 |
| commit | eed70ad4d270ca1d134d325362f23c831fe98b0b (patch) | |
| tree | 991fa3ba7f62bc57f42b3164529e6317b84f17ad /platform/linux/platform_linux.cpp | |
| parent | c3040ecfc43983af6f05da13cf2242d085b1e230 (diff) | |
Add Cavium Octeon MIPS Instructions and more general MIPS fixes
Diffstat (limited to 'platform/linux/platform_linux.cpp')
| -rw-r--r-- | platform/linux/platform_linux.cpp | 36 |
1 files changed, 34 insertions, 2 deletions
diff --git a/platform/linux/platform_linux.cpp b/platform/linux/platform_linux.cpp index e6f3ecb4..8377aad9 100644 --- a/platform/linux/platform_linux.cpp +++ b/platform/linux/platform_linux.cpp @@ -181,6 +181,28 @@ public: } }; +class LinuxMips64Platform: public Platform +{ +public: + LinuxMips64Platform(Architecture* arch, const std::string& name): Platform(arch, name) + { + Ref<CallingConvention> cc; + + cc = arch->GetCallingConventionByName("n64"); + if (cc) + { + RegisterDefaultCallingConvention(cc); + RegisterCdeclCallingConvention(cc); + RegisterFastcallCallingConvention(cc); + RegisterStdcallCallingConvention(cc); + } + + cc = arch->GetCallingConventionByName("linux-syscall"); + if (cc) + SetSystemCallConvention(cc); + } +}; + class LinuxRiscVPlatform : public Platform { @@ -329,19 +351,29 @@ extern "C" Ref<Architecture> mipsel = Architecture::GetByName("mipsel32"); Ref<Architecture> mipseb = Architecture::GetByName("mips32"); - if (mipsel && mipseb) + Ref<Architecture> mips64eb = Architecture::GetByName("mips64"); + Ref<Architecture> cnmips64eb = Architecture::GetByName("cavium-mips64"); + if (mipsel && mipseb && mips64eb && cnmips64eb) { - Ref<Platform> platformLE, platformBE; + Ref<Platform> platformLE, platformBE, platformBE64, platformBE64cn; platformLE = new LinuxMipsPlatform(mipsel, "linux-mipsel"); platformBE = new LinuxMipsPlatform(mipseb, "linux-mips"); + platformBE64 = new LinuxMips64Platform(mips64eb, "linux-mips64"); + platformBE64cn = new LinuxMips64Platform(cnmips64eb, "linux-cnmips64"); Platform::Register("linux", platformLE); Platform::Register("linux", platformBE); + Platform::Register("linux", platformBE64); + Platform::Register("linux", platformBE64cn); // Linux binaries sometimes have an OS identifier of zero, even though 3 is the correct one BinaryViewType::RegisterPlatform("ELF", 0, mipsel, platformLE); BinaryViewType::RegisterPlatform("ELF", 0, mipseb, platformBE); + BinaryViewType::RegisterPlatform("ELF", 0, mips64eb, platformBE64); + BinaryViewType::RegisterPlatform("ELF", 0, cnmips64eb, platformBE64cn); BinaryViewType::RegisterPlatform("ELF", 3, mipsel, platformLE); BinaryViewType::RegisterPlatform("ELF", 3, mipseb, platformBE); + BinaryViewType::RegisterPlatform("ELF", 3, mips64eb, platformBE64); + BinaryViewType::RegisterPlatform("ELF", 3, cnmips64eb, platformBE64cn); } Ref<Architecture> rv32 = Architecture::GetByName("rv32gc"); |
