diff --git a/binaries/data/mods/public/gui/credits/texts/programming.json b/binaries/data/mods/public/gui/credits/texts/programming.json index e7d3a23939..fcf9360425 100644 --- a/binaries/data/mods/public/gui/credits/texts/programming.json +++ b/binaries/data/mods/public/gui/credits/texts/programming.json @@ -210,6 +210,7 @@ { "nick": "Raj", "name": "Raj Sharma" }, { "nick": "ramtzok1", "name": "Ram" }, { "nick": "rapidelectron", "name": "Christian Weihsbach" }, + { "nick": "r-a-sattarov", "name": "Ramil Sattarov" }, { "nick": "RedFox", "name": "Jorma Rebane" }, { "nick": "RefinedCode" }, { "nick": "Riemer" }, diff --git a/build/premake/premake5.lua b/build/premake/premake5.lua index ada18b4774..31fbfb9b91 100644 --- a/build/premake/premake5.lua +++ b/build/premake/premake5.lua @@ -83,6 +83,8 @@ else arch = "arm" elseif string.find(machine, "aarch64") == 1 then arch = "aarch64" + elseif string.find(machine, "e2k") == 1 then + arch = "e2k" else print("WARNING: Cannot determine architecture from GCC, assuming x86") end @@ -858,6 +860,8 @@ function setup_all_libs () table.insert(source_dirs, "lib/sysdep/arch/arm"); elseif arch == "aarch64" then table.insert(source_dirs, "lib/sysdep/arch/aarch64"); + elseif arch == "e2k" then + table.insert(source_dirs, "lib/sysdep/arch/e2k"); end -- OS-specific diff --git a/source/lib/byte_order.h b/source/lib/byte_order.h index c75be1384e..313ab5a6ce 100644 --- a/source/lib/byte_order.h +++ b/source/lib/byte_order.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2015 Wildfire Games. +/* Copyright (C) 2020 Wildfire Games. * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the @@ -33,7 +33,7 @@ #ifndef BYTE_ORDER # define LITTLE_ENDIAN 0x4321 # define BIG_ENDIAN 0x1234 -# if ARCH_IA32 || ARCH_IA64 || ARCH_AMD64 || ARCH_ALPHA || ARCH_ARM || ARCH_AARCH64 || ARCH_MIPS || defined(__LITTLE_ENDIAN__) +# if ARCH_IA32 || ARCH_IA64 || ARCH_AMD64 || ARCH_ALPHA || ARCH_ARM || ARCH_AARCH64 || ARCH_MIPS || ARCH_E2K || defined(__LITTLE_ENDIAN__) # define BYTE_ORDER LITTLE_ENDIAN # else # define BYTE_ORDER BIG_ENDIAN diff --git a/source/lib/sse.cpp b/source/lib/sse.cpp index aa02215460..f3826884ad 100644 --- a/source/lib/sse.cpp +++ b/source/lib/sse.cpp @@ -37,6 +37,8 @@ bool HostHasSSE() { #if ARCH_X86_X64 return x86_x64::Cap(x86_x64::CAP_SSE); +#elif ARCH_E2K + return true; #else return false; #endif diff --git a/source/lib/sysdep/arch.h b/source/lib/sysdep/arch.h index e3e520f2e1..371aadb55a 100644 --- a/source/lib/sysdep/arch.h +++ b/source/lib/sysdep/arch.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2015 Wildfire Games. +/* Copyright (C) 2020 Wildfire Games. * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the @@ -70,9 +70,15 @@ #else # define ARCH_MIPS 0 #endif +// .. E2K (MCST Elbrus 2000) +#if defined(__e2k__) +# define ARCH_E2K 1 +#else +# define ARCH_E2K 0 +#endif // ensure exactly one architecture has been detected -#if (ARCH_IA32+ARCH_IA64+ARCH_AMD64+ARCH_ALPHA+ARCH_ARM+ARCH_AARCH64+ARCH_MIPS) != 1 +#if (ARCH_IA32+ARCH_IA64+ARCH_AMD64+ARCH_ALPHA+ARCH_ARM+ARCH_AARCH64+ARCH_MIPS+ARCH_E2K) != 1 # error "architecture not correctly detected (either none or multiple ARCH_* defined)" #endif diff --git a/source/lib/sysdep/arch/e2k/e2k.cpp b/source/lib/sysdep/arch/e2k/e2k.cpp new file mode 100644 index 0000000000..39f9b5ef45 --- /dev/null +++ b/source/lib/sysdep/arch/e2k/e2k.cpp @@ -0,0 +1,49 @@ +/* Copyright (C) 2020 Wildfire Games. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +/** + * Routines specific to E2K (MCST Elbrus 2000) + */ + +#include "precompiled.h" + +#include "lib/sysdep/cpu.h" + +intptr_t cpu_AtomicAdd(volatile intptr_t* location, intptr_t increment) +{ + return __sync_fetch_and_add(location, increment); +} + +bool cpu_CAS(volatile intptr_t* location, intptr_t expected, intptr_t newValue) +{ + return __sync_bool_compare_and_swap(location, expected, newValue); +} + +bool cpu_CAS64(volatile i64* location, i64 expected, i64 newValue) +{ + return __sync_bool_compare_and_swap(location, expected, newValue); +} + +const char* cpu_IdentifierString() +{ + return __builtin_cpu_name(); +} diff --git a/source/lib/sysdep/compiler.h b/source/lib/sysdep/compiler.h index 0f14172982..e0fd7e21c4 100644 --- a/source/lib/sysdep/compiler.h +++ b/source/lib/sysdep/compiler.h @@ -42,12 +42,18 @@ #else # define ICC_VERSION 0 #endif -// .. LCC (VC-compatible) -#if defined(__LCC__) +// .. LCC (Win32) and MCST LCC (E2K) compilers define same identifier (__LCC__). +#if defined(__LCC__) && !defined(__e2k__) # define LCC_VERSION __LCC__ #else # define LCC_VERSION 0 #endif +// .. MCST LCC (eLbrus C/C++ Compiler) +#if defined(__LCC__) && defined(__e2k__) +# define MCST_LCC_VERSION (__LCC__*100 + __LCC_MINOR__) +#else +# define MCST_LCC_VERSION 0 +#endif // .. GCC #ifdef __GNUC__ # define GCC_VERSION (__GNUC__*100 + __GNUC_MINOR__) diff --git a/source/ps/GameSetup/HWDetect.cpp b/source/ps/GameSetup/HWDetect.cpp index 810c6a56b6..c53f77e804 100644 --- a/source/ps/GameSetup/HWDetect.cpp +++ b/source/ps/GameSetup/HWDetect.cpp @@ -181,6 +181,7 @@ void RunHardwareDetection() scriptInterface.SetProperty(settings, "arch_amd64", ARCH_AMD64); scriptInterface.SetProperty(settings, "arch_arm", ARCH_ARM); scriptInterface.SetProperty(settings, "arch_aarch64", ARCH_AARCH64); + scriptInterface.SetProperty(settings, "arch_e2k", ARCH_E2K); #ifdef NDEBUG scriptInterface.SetProperty(settings, "build_debug", 0);