There was a bug in older Cortex-A53, however in newer versions of Cortex-A53, webkit fails to build. The code is removed for newer versions of Cortex-A53. See https://bugs.webkit.org/show_bug.cgi?id=197192 From: Brian Woodcox Date: March 18, 2020 --- a/Source/JavaScriptCore/assembler/ARM64Assembler.h +++ a/Source/JavaScriptCore/assembler/ARM64Assembler.h @@ -740,7 +740,6 @@ { ASSERT(!(offset & 0xfff)); insn(pcRelative(true, offset >> 12, rd)); - nopCortexA53Fix843419(); } template @@ -1390,7 +1389,6 @@ ALWAYS_INLINE void madd(RegisterID rd, RegisterID rn, RegisterID rm, RegisterID ra) { CHECK_DATASIZE(); - nopCortexA53Fix835769(); insn(dataProcessing3Source(DATASIZE, DataOp_MADD, rm, ra, rn, rd)); } @@ -1443,7 +1441,6 @@ ALWAYS_INLINE void msub(RegisterID rd, RegisterID rn, RegisterID rm, RegisterID ra) { CHECK_DATASIZE(); - nopCortexA53Fix835769(); insn(dataProcessing3Source(DATASIZE, DataOp_MSUB, rm, ra, rn, rd)); } @@ -1691,7 +1688,6 @@ ALWAYS_INLINE void smaddl(RegisterID rd, RegisterID rn, RegisterID rm, RegisterID ra) { - nopCortexA53Fix835769<64>(); insn(dataProcessing3Source(Datasize_64, DataOp_SMADDL, rm, ra, rn, rd)); } @@ -1702,7 +1698,6 @@ ALWAYS_INLINE void smsubl(RegisterID rd, RegisterID rn, RegisterID rm, RegisterID ra) { - nopCortexA53Fix835769<64>(); insn(dataProcessing3Source(Datasize_64, DataOp_SMSUBL, rm, ra, rn, rd)); } @@ -1960,7 +1955,6 @@ ALWAYS_INLINE void umaddl(RegisterID rd, RegisterID rn, RegisterID rm, RegisterID ra) { - nopCortexA53Fix835769<64>(); insn(dataProcessing3Source(Datasize_64, DataOp_UMADDL, rm, ra, rn, rd)); } @@ -1971,7 +1965,6 @@ ALWAYS_INLINE void umsubl(RegisterID rd, RegisterID rn, RegisterID rm, RegisterID ra) { - nopCortexA53Fix835769<64>(); insn(dataProcessing3Source(Datasize_64, DataOp_UMSUBL, rm, ra, rn, rd)); } @@ -3691,37 +3684,6 @@ return 0x1e7e0000 | (dn << 5) | rd; } - // Workaround for Cortex-A53 erratum (835769). Emit an extra nop if the - // last instruction in the buffer is a load, store or prefetch. Needed - // before 64-bit multiply-accumulate instructions. - template - ALWAYS_INLINE void nopCortexA53Fix835769() - { -#if CPU(ARM64_CORTEXA53) - CHECK_DATASIZE(); - if (datasize == 64) { - if (LIKELY(m_buffer.codeSize() >= sizeof(int32_t))) { - // From ARMv8 Reference Manual, Section C4.1: the encoding of the - // instructions in the Loads and stores instruction group is: - // ---- 1-0- ---- ---- ---- ---- ---- ---- - if (UNLIKELY((*reinterpret_cast_ptr(reinterpret_cast_ptr(m_buffer.data()) + m_buffer.codeSize() - sizeof(int32_t)) & 0x0a000000) == 0x08000000)) - nop(); - } - } -#endif - } - - // Workaround for Cortex-A53 erratum (843419). Emit extra nops to avoid - // wrong address access after ADRP instruction. - ALWAYS_INLINE void nopCortexA53Fix843419() - { -#if CPU(ARM64_CORTEXA53) - nop(); - nop(); - nop(); -#endif - } - Vector m_jumpsToLink; int m_indexOfLastWatchpoint; int m_indexOfTailOfLastWatchpoint; --- a/Source/JavaScriptCore/offlineasm/arm64.rb +++ a/Source/JavaScriptCore/offlineasm/arm64.rb @@ -351,33 +351,6 @@ newList end -# Workaround for Cortex-A53 erratum (835769) -def arm64CortexA53Fix835769(list) - newList = [] - lastOpcodeUnsafe = false - - list.each { - | node | - if node.is_a? Instruction - case node.opcode - when /^store/, /^load/ - # List all macro instructions that can be lowered to a load, store or prefetch ARM64 assembly instruction - lastOpcodeUnsafe = true - when "muli", "mulp", "mulq", "smulli" - # List all macro instructions that can be lowered to a 64-bit multiply-accumulate ARM64 assembly instruction - # (defined as one of MADD, MSUB, SMADDL, SMSUBL, UMADDL or UMSUBL). - if lastOpcodeUnsafe - newList << Instruction.new(node.codeOrigin, "nopCortexA53Fix835769", []) - end - lastOpcodeUnsafe = false - else - lastOpcodeUnsafe = false - end - end - newList << node - } - newList -end class Sequence def getModifiedListARM64(result = @list) @@ -470,7 +443,6 @@ result = arm64FixSpecialRegisterArithmeticMode(result) result = assignRegistersToTemporaries(result, :gpr, ARM64_EXTRA_GPRS) result = assignRegistersToTemporaries(result, :fpr, ARM64_EXTRA_FPRS) - result = arm64CortexA53Fix835769(result) return result end end @@ -1115,10 +1087,6 @@ $asm.puts "bfi #{operands[3].arm64Operand(:quad)}, #{operands[0].arm64Operand(:quad)}, #{operands[1].value}, #{operands[2].value}" when "pcrtoaddr" $asm.puts "adr #{operands[1].arm64Operand(:quad)}, #{operands[0].value}" - when "nopCortexA53Fix835769" - $asm.putStr("#if CPU(ARM64_CORTEXA53)") - $asm.puts "nop" - $asm.putStr("#endif") when "globaladdr" uid = $asm.newUID --- a/Source/JavaScriptCore/offlineasm/instructions.rb +++ a/Source/JavaScriptCore/offlineasm/instructions.rb @@ -354,7 +354,6 @@ [ "bfiq", # Bit field insert "pcrtoaddr", # Address from PC relative offset - adr instruction - "nopFixCortexA53Err835769", # nop on Cortex-A53 (nothing otherwise) "globaladdr", "divi", "divis", --- a/Source/cmake/OptionsCommon.cmake +++ a/Source/cmake/OptionsCommon.cmake @@ -19,32 +19,6 @@ set_property(GLOBAL PROPERTY USE_FOLDERS ON) define_property(TARGET PROPERTY FOLDER INHERITED BRIEF_DOCS "folder" FULL_DOCS "IDE folder name") -# Detect Cortex-A53 core if CPU is ARM64 and OS is Linux. -# Query /proc/cpuinfo for each available core and check reported CPU part number: 0xd03 signals Cortex-A53. -# (see Main ID Register in ARM Cortex-A53 MPCore Processor Technical Reference Manual) -set(WTF_CPU_ARM64_CORTEXA53_INITIALVALUE OFF) -if (WTF_CPU_ARM64 AND (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")) - execute_process(COMMAND nproc OUTPUT_VARIABLE PROC_COUNT) - math(EXPR PROC_MAX ${PROC_COUNT}-1) - foreach (PROC_ID RANGE ${PROC_MAX}) - execute_process(COMMAND taskset -c ${PROC_ID} grep "^CPU part" /proc/cpuinfo OUTPUT_VARIABLE PROC_PART) - if (PROC_PART MATCHES "0xd03") - set(WTF_CPU_ARM64_CORTEXA53_INITIALVALUE ON) - break () - endif () - endforeach () -endif () -option(WTF_CPU_ARM64_CORTEXA53 "Enable Cortex-A53-specific code paths" ${WTF_CPU_ARM64_CORTEXA53_INITIALVALUE}) - -if (WTF_CPU_ARM64_CORTEXA53) - if (NOT WTF_CPU_ARM64) - message(FATAL_ERROR "WTF_CPU_ARM64_CORTEXA53 set without WTF_CPU_ARM64") - endif () - WEBKIT_PREPEND_GLOBAL_COMPILER_FLAGS(-mfix-cortex-a53-835769) -endif () - -EXPOSE_VARIABLE_TO_BUILD(WTF_CPU_ARM64_CORTEXA53) - set(ARM_TRADITIONAL_DETECTED FALSE) if (WTF_CPU_ARM) set(ARM_THUMB2_TEST_SOURCE