From b4f3c2989a4abc06a4abeff8dfb5fca39a929e89 Mon Sep 17 00:00:00 2001 From: Ubuntu Developers Date: Sat, 14 May 2022 01:55:17 +0800 Subject: [PATCH] riscv64 =================================================================== Gbp-Pq: Name riscv64.patch --- build/moz.configure/init.configure | 3 +++ js/src/jit/AtomicOperations.h | 3 ++- js/src/jit/shared/AtomicOperations-feeling-lucky-gcc.h | 5 +++++ mfbt/tests/TestPoisonArea.cpp | 3 +++ python/mozbuild/mozbuild/configure/constants.py | 2 ++ 5 files changed, 15 insertions(+), 1 deletion(-) diff --git a/build/moz.configure/init.configure b/build/moz.configure/init.configure index c77260403..ed4ecb3c9 100644 --- a/build/moz.configure/init.configure +++ b/build/moz.configure/init.configure @@ -733,6 +733,9 @@ def split_triplet(triplet, allow_unknown=False): elif cpu == 'sh4': canonical_cpu = 'sh4' endianness = 'little' + elif cpu == 'riscv64': + canonical_cpu = 'riscv64' + endianness = 'little' elif allow_unknown: canonical_cpu = cpu endianness = 'unknown' diff --git a/js/src/jit/AtomicOperations.h b/js/src/jit/AtomicOperations.h index 0486cbad1..d00e2769a 100644 --- a/js/src/jit/AtomicOperations.h +++ b/js/src/jit/AtomicOperations.h @@ -391,7 +391,8 @@ inline bool AtomicOperations::isLockfreeJS(int32_t size) { #elif defined(__ppc__) || defined(__PPC__) || defined(__sparc__) || \ defined(__ppc64__) || defined(__PPC64__) || defined(__ppc64le__) || \ defined(__PPC64LE__) || defined(__alpha__) || defined(__hppa__) || \ - defined(__sh__) || defined(__s390__) || defined(__s390x__) + defined(__sh__) || defined(__s390__) || defined(__s390x__) || \ + defined(__riscv) # include "jit/shared/AtomicOperations-feeling-lucky.h" #else # error "No AtomicOperations support provided for this platform" diff --git a/js/src/jit/shared/AtomicOperations-feeling-lucky-gcc.h b/js/src/jit/shared/AtomicOperations-feeling-lucky-gcc.h index f002cd46c..413591a38 100644 --- a/js/src/jit/shared/AtomicOperations-feeling-lucky-gcc.h +++ b/js/src/jit/shared/AtomicOperations-feeling-lucky-gcc.h @@ -70,6 +70,11 @@ # endif #endif +#if defined(__riscv) && __riscv_xlen == 64 +# define HAS_64BIT_ATOMICS +# define HAS_64BIT_LOCKFREE +#endif + #ifdef JS_CODEGEN_NONE # ifdef JS_64BIT # define HAS_64BIT_ATOMICS diff --git a/mfbt/tests/TestPoisonArea.cpp b/mfbt/tests/TestPoisonArea.cpp index 2834678ad..5c171323e 100644 --- a/mfbt/tests/TestPoisonArea.cpp +++ b/mfbt/tests/TestPoisonArea.cpp @@ -169,6 +169,9 @@ static const ia64_instr _return_instr = { # define RETURN_INSTR _return_instr # define RETURN_INSTR_TYPE ia64_instr +#elif defined(__riscv) +#define RETURN_INSTR 0x80828082 /* ret; ret */ + #else # error "Need return instruction for this architecture" #endif diff --git a/python/mozbuild/mozbuild/configure/constants.py b/python/mozbuild/mozbuild/configure/constants.py index 8b7d2261d..85b81c95c 100644 --- a/python/mozbuild/mozbuild/configure/constants.py +++ b/python/mozbuild/mozbuild/configure/constants.py @@ -50,6 +50,7 @@ CPU_bitness = { 'mips64': 64, 'ppc': 32, 'ppc64': 64, + 'riscv64': 64, 's390': 32, 's390x': 64, 'sh4': 32, @@ -89,6 +90,7 @@ CPU_preprocessor_checks = OrderedDict(( ('mips64', '__mips64'), ('mips32', '__mips__'), ('sh4', '__sh__'), + ('riscv64', '__riscv && __riscv_xlen == 64'), )) assert sorted(CPU_preprocessor_checks.keys()) == sorted(CPU.POSSIBLE_VALUES)