Clarify logic of RSEQ_ASM*_CMP* macros
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 22 Feb 2024 15:42:08 +0000 (10:42 -0500)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 22 Feb 2024 15:42:08 +0000 (10:42 -0500)
The RSEQ_ASM*_CMP* macros come from the x86 implementation which has
"RSEQ_ASM_CMP_CPU_ID()" and static inline functions such as
"rseq_cmpeqv_storev()". The meaning of the "cmp" here is that the
critical section does _not_ abort (does not branch) if the comparison
matches.

But I understand how the ASM helpers that were contributed for other
architectures such as "RSEQ_ASM_OP_CMPEQ()", with the same semantic
of "do not branch to abort if the comparison matches" can be misleading
for someone used to reading assembler on pretty much any architecture,
where the conditional branch is expected to be taken if the condition
matches. So what I have here in librseq is backwards.

Fortunately, librseq is still just a master branch (no releases yet),
and the copy in the Linux kernel selftests is internal to that selftest,
so there are no stable API expectations at this stage.

So I don't think the semantic of e.g. "rseq_cmpeqv_storev()" is
misleading: it proceeds to do the store if the comparison matches.

However, the ASM macros would benefit from a logic flip.

Introduce this in a way that will allow users of the API to catch the
change at compile-time.

This commit applies the following remapping of the macros for added
clarity:

RSEQ_ASM_OP_CMPNE becomes RSEQ_ASM_OP_CBEQ (compare and branch if equal)
RSEQ_ASM_OP_CMPEQ becomes RSEQ_ASM_OP_CBNE (compare and branch if not equal)
RSEQ_ASM_CMP_CPU_ID becomes RSEQ_ASM_CBNE_CPU_ID (compare and branch if cpu id is not equal)

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I13bff7e22569b11565a23aca87cf571431d57106

14 files changed:
include/rseq/rseq-arm-bits.h
include/rseq/rseq-arm.h
include/rseq/rseq-arm64-bits.h
include/rseq/rseq-arm64.h
include/rseq/rseq-mips-bits.h
include/rseq/rseq-mips.h
include/rseq/rseq-ppc-bits.h
include/rseq/rseq-ppc.h
include/rseq/rseq-riscv-bits.h
include/rseq/rseq-riscv.h
include/rseq/rseq-s390-bits.h
include/rseq/rseq-s390.h
include/rseq/rseq-x86-bits.h
include/rseq/rseq-x86.h

index 1adb1106d162d6be92d965e4d30bfe1a78446713..2cff022f379429e2d0911481522ebfb38944ccbb 100644 (file)
@@ -24,14 +24,14 @@ int RSEQ_TEMPLATE_IDENTIFIER(rseq_cmpeqv_storev)(intptr_t *v, intptr_t expect, i
 #endif
                /* Start rseq by storing table entry pointer into rseq_cs. */
                RSEQ_ASM_STORE_RSEQ_CS(1, 3f, rseq_cs)
-               RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, 4f)
+               RSEQ_ASM_CBNE_CPU_ID(cpu_id, current_cpu_id, 4f)
                RSEQ_INJECT_ASM(3)
                "ldr r0, %[v]\n\t"
                "cmp %[expect], r0\n\t"
                "bne %l[cmpfail]\n\t"
                RSEQ_INJECT_ASM(4)
 #ifdef RSEQ_COMPARE_TWICE
-               RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, %l[error1])
+               RSEQ_ASM_CBNE_CPU_ID(cpu_id, current_cpu_id, %l[error1])
                "ldr r0, %[v]\n\t"
                "cmp %[expect], r0\n\t"
                "bne %l[error2]\n\t"
@@ -92,14 +92,14 @@ int RSEQ_TEMPLATE_IDENTIFIER(rseq_cmpnev_storeoffp_load)(intptr_t *v, intptr_t e
 #endif
                /* Start rseq by storing table entry pointer into rseq_cs. */
                RSEQ_ASM_STORE_RSEQ_CS(1, 3f, rseq_cs)
-               RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, 4f)
+               RSEQ_ASM_CBNE_CPU_ID(cpu_id, current_cpu_id, 4f)
                RSEQ_INJECT_ASM(3)
                "ldr r0, %[v]\n\t"
                "cmp %[expectnot], r0\n\t"
                "beq %l[cmpfail]\n\t"
                RSEQ_INJECT_ASM(4)
 #ifdef RSEQ_COMPARE_TWICE
-               RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, %l[error1])
+               RSEQ_ASM_CBNE_CPU_ID(cpu_id, current_cpu_id, %l[error1])
                "ldr r0, %[v]\n\t"
                "cmp %[expectnot], r0\n\t"
                "beq %l[error2]\n\t"
@@ -162,10 +162,10 @@ int RSEQ_TEMPLATE_IDENTIFIER(rseq_addv)(intptr_t *v, intptr_t count, int cpu)
 #endif
                /* Start rseq by storing table entry pointer into rseq_cs. */
                RSEQ_ASM_STORE_RSEQ_CS(1, 3f, rseq_cs)
-               RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, 4f)
+               RSEQ_ASM_CBNE_CPU_ID(cpu_id, current_cpu_id, 4f)
                RSEQ_INJECT_ASM(3)
 #ifdef RSEQ_COMPARE_TWICE
-               RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, %l[error1])
+               RSEQ_ASM_CBNE_CPU_ID(cpu_id, current_cpu_id, %l[error1])
 #endif
                "ldr r0, %[v]\n\t"
                "add r0, %[count]\n\t"
@@ -220,7 +220,7 @@ int RSEQ_TEMPLATE_IDENTIFIER(rseq_cmpeqv_cmpeqv_storev)(intptr_t *v, intptr_t ex
 #endif
                /* Start rseq by storing table entry pointer into rseq_cs. */
                RSEQ_ASM_STORE_RSEQ_CS(1, 3f, rseq_cs)
-               RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, 4f)
+               RSEQ_ASM_CBNE_CPU_ID(cpu_id, current_cpu_id, 4f)
                RSEQ_INJECT_ASM(3)
                "ldr r0, %[v]\n\t"
                "cmp %[expect], r0\n\t"
@@ -231,7 +231,7 @@ int RSEQ_TEMPLATE_IDENTIFIER(rseq_cmpeqv_cmpeqv_storev)(intptr_t *v, intptr_t ex
                "bne %l[cmpfail]\n\t"
                RSEQ_INJECT_ASM(5)
 #ifdef RSEQ_COMPARE_TWICE
-               RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, %l[error1])
+               RSEQ_ASM_CBNE_CPU_ID(cpu_id, current_cpu_id, %l[error1])
                "ldr r0, %[v]\n\t"
                "cmp %[expect], r0\n\t"
                "bne %l[error2]\n\t"
@@ -309,14 +309,14 @@ int RSEQ_TEMPLATE_IDENTIFIER(rseq_cmpeqv_trystorev_storev)(intptr_t *v, intptr_t
 #endif
                /* Start rseq by storing table entry pointer into rseq_cs. */
                RSEQ_ASM_STORE_RSEQ_CS(1, 3f, rseq_cs)
-               RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, 4f)
+               RSEQ_ASM_CBNE_CPU_ID(cpu_id, current_cpu_id, 4f)
                RSEQ_INJECT_ASM(3)
                "ldr r0, %[v]\n\t"
                "cmp %[expect], r0\n\t"
                "bne %l[cmpfail]\n\t"
                RSEQ_INJECT_ASM(4)
 #ifdef RSEQ_COMPARE_TWICE
-               RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, %l[error1])
+               RSEQ_ASM_CBNE_CPU_ID(cpu_id, current_cpu_id, %l[error1])
                "ldr r0, %[v]\n\t"
                "cmp %[expect], r0\n\t"
                "bne %l[error2]\n\t"
@@ -394,14 +394,14 @@ int RSEQ_TEMPLATE_IDENTIFIER(rseq_cmpeqv_trymemcpy_storev)(intptr_t *v, intptr_t
                "str %[len], %[rseq_scratch2]\n\t"
                /* Start rseq by storing table entry pointer into rseq_cs. */
                RSEQ_ASM_STORE_RSEQ_CS(1, 3f, rseq_cs)
-               RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, 4f)
+               RSEQ_ASM_CBNE_CPU_ID(cpu_id, current_cpu_id, 4f)
                RSEQ_INJECT_ASM(3)
                "ldr r0, %[v]\n\t"
                "cmp %[expect], r0\n\t"
                "bne 5f\n\t"
                RSEQ_INJECT_ASM(4)
 #ifdef RSEQ_COMPARE_TWICE
-               RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, 6f)
+               RSEQ_ASM_CBNE_CPU_ID(cpu_id, current_cpu_id, 6f)
                "ldr r0, %[v]\n\t"
                "cmp %[expect], r0\n\t"
                "bne 7f\n\t"
index c4e3f552b41f4cac5741071e61b685555fbdd6d8..9f4f2975e8dc26297a2420ca5b492c88108a6842 100644 (file)
@@ -114,7 +114,7 @@ do {                                                                        \
                "str r0, %[" __rseq_str(rseq_cs) "]\n\t"                \
                __rseq_str(label) ":\n\t"
 
-#define RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, label)             \
+#define RSEQ_ASM_CBNE_CPU_ID(cpu_id, current_cpu_id, label)            \
                RSEQ_INJECT_ASM(2)                                      \
                "ldr r0, %[" __rseq_str(current_cpu_id) "]\n\t" \
                "cmp %[" __rseq_str(cpu_id) "], r0\n\t"         \
index 771525182fd4fc0e2254fa7e79b4ada9a56ac344..279b0164585bcf8fd0d5f06be2829cc2719f3479 100644 (file)
@@ -24,13 +24,13 @@ int RSEQ_TEMPLATE_IDENTIFIER(rseq_cmpeqv_storev)(intptr_t *v, intptr_t expect, i
                RSEQ_ASM_DEFINE_EXIT_POINT(2f, %l[error2])
 #endif
                RSEQ_ASM_STORE_RSEQ_CS(2, 1b, rseq_cs)
-               RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, 4f)
+               RSEQ_ASM_CBNE_CPU_ID(cpu_id, current_cpu_id, 4f)
                RSEQ_INJECT_ASM(3)
-               RSEQ_ASM_OP_CMPEQ(v, expect, %l[cmpfail])
+               RSEQ_ASM_OP_CBNE(v, expect, %l[cmpfail])
                RSEQ_INJECT_ASM(4)
 #ifdef RSEQ_COMPARE_TWICE
-               RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, %l[error1])
-               RSEQ_ASM_OP_CMPEQ(v, expect, %l[error2])
+               RSEQ_ASM_CBNE_CPU_ID(cpu_id, current_cpu_id, %l[error1])
+               RSEQ_ASM_OP_CBNE(v, expect, %l[error2])
 #endif
                RSEQ_ASM_OP_FINAL_STORE(newv, v, 3)
                RSEQ_INJECT_ASM(5)
@@ -82,13 +82,13 @@ int RSEQ_TEMPLATE_IDENTIFIER(rseq_cmpnev_storeoffp_load)(intptr_t *v, intptr_t e
                RSEQ_ASM_DEFINE_EXIT_POINT(2f, %l[error2])
 #endif
                RSEQ_ASM_STORE_RSEQ_CS(2, 1b, rseq_cs)
-               RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, 4f)
+               RSEQ_ASM_CBNE_CPU_ID(cpu_id, current_cpu_id, 4f)
                RSEQ_INJECT_ASM(3)
-               RSEQ_ASM_OP_CMPNE(v, expectnot, %l[cmpfail])
+               RSEQ_ASM_OP_CBEQ(v, expectnot, %l[cmpfail])
                RSEQ_INJECT_ASM(4)
 #ifdef RSEQ_COMPARE_TWICE
-               RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, %l[error1])
-               RSEQ_ASM_OP_CMPNE(v, expectnot, %l[error2])
+               RSEQ_ASM_CBNE_CPU_ID(cpu_id, current_cpu_id, %l[error1])
+               RSEQ_ASM_OP_CBEQ(v, expectnot, %l[error2])
 #endif
                RSEQ_ASM_OP_R_LOAD(v)
                RSEQ_ASM_OP_R_STORE(load)
@@ -141,10 +141,10 @@ int RSEQ_TEMPLATE_IDENTIFIER(rseq_addv)(intptr_t *v, intptr_t count, int cpu)
                RSEQ_ASM_DEFINE_EXIT_POINT(2f, %l[error1])
 #endif
                RSEQ_ASM_STORE_RSEQ_CS(2, 1b, rseq_cs)
-               RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, 4f)
+               RSEQ_ASM_CBNE_CPU_ID(cpu_id, current_cpu_id, 4f)
                RSEQ_INJECT_ASM(3)
 #ifdef RSEQ_COMPARE_TWICE
-               RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, %l[error1])
+               RSEQ_ASM_CBNE_CPU_ID(cpu_id, current_cpu_id, %l[error1])
 #endif
                RSEQ_ASM_OP_R_LOAD(v)
                RSEQ_ASM_OP_R_ADD(count)
@@ -193,16 +193,16 @@ int RSEQ_TEMPLATE_IDENTIFIER(rseq_cmpeqv_cmpeqv_storev)(intptr_t *v, intptr_t ex
                RSEQ_ASM_DEFINE_EXIT_POINT(2f, %l[error3])
 #endif
                RSEQ_ASM_STORE_RSEQ_CS(2, 1b, rseq_cs)
-               RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, 4f)
+               RSEQ_ASM_CBNE_CPU_ID(cpu_id, current_cpu_id, 4f)
                RSEQ_INJECT_ASM(3)
-               RSEQ_ASM_OP_CMPEQ(v, expect, %l[cmpfail])
+               RSEQ_ASM_OP_CBNE(v, expect, %l[cmpfail])
                RSEQ_INJECT_ASM(4)
-               RSEQ_ASM_OP_CMPEQ(v2, expect2, %l[cmpfail])
+               RSEQ_ASM_OP_CBNE(v2, expect2, %l[cmpfail])
                RSEQ_INJECT_ASM(5)
 #ifdef RSEQ_COMPARE_TWICE
-               RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, %l[error1])
-               RSEQ_ASM_OP_CMPEQ(v, expect, %l[error2])
-               RSEQ_ASM_OP_CMPEQ(v2, expect2, %l[error3])
+               RSEQ_ASM_CBNE_CPU_ID(cpu_id, current_cpu_id, %l[error1])
+               RSEQ_ASM_OP_CBNE(v, expect, %l[error2])
+               RSEQ_ASM_OP_CBNE(v2, expect2, %l[error3])
 #endif
                RSEQ_ASM_OP_FINAL_STORE(newv, v, 3)
                RSEQ_INJECT_ASM(6)
@@ -266,13 +266,13 @@ int RSEQ_TEMPLATE_IDENTIFIER(rseq_cmpeqv_trystorev_storev)(intptr_t *v, intptr_t
                RSEQ_ASM_DEFINE_EXIT_POINT(2f, %l[error2])
 #endif
                RSEQ_ASM_STORE_RSEQ_CS(2, 1b, rseq_cs)
-               RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, 4f)
+               RSEQ_ASM_CBNE_CPU_ID(cpu_id, current_cpu_id, 4f)
                RSEQ_INJECT_ASM(3)
-               RSEQ_ASM_OP_CMPEQ(v, expect, %l[cmpfail])
+               RSEQ_ASM_OP_CBNE(v, expect, %l[cmpfail])
                RSEQ_INJECT_ASM(4)
 #ifdef RSEQ_COMPARE_TWICE
-               RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, %l[error1])
-               RSEQ_ASM_OP_CMPEQ(v, expect, %l[error2])
+               RSEQ_ASM_CBNE_CPU_ID(cpu_id, current_cpu_id, %l[error1])
+               RSEQ_ASM_OP_CBNE(v, expect, %l[error2])
 #endif
                RSEQ_ASM_OP_STORE(newv2, v2)
                RSEQ_INJECT_ASM(5)
@@ -333,13 +333,13 @@ int RSEQ_TEMPLATE_IDENTIFIER(rseq_cmpeqv_trymemcpy_storev)(intptr_t *v, intptr_t
                RSEQ_ASM_DEFINE_EXIT_POINT(2f, %l[error2])
 #endif
                RSEQ_ASM_STORE_RSEQ_CS(2, 1b, rseq_cs)
-               RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, 4f)
+               RSEQ_ASM_CBNE_CPU_ID(cpu_id, current_cpu_id, 4f)
                RSEQ_INJECT_ASM(3)
-               RSEQ_ASM_OP_CMPEQ(v, expect, %l[cmpfail])
+               RSEQ_ASM_OP_CBNE(v, expect, %l[cmpfail])
                RSEQ_INJECT_ASM(4)
 #ifdef RSEQ_COMPARE_TWICE
-               RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, %l[error1])
-               RSEQ_ASM_OP_CMPEQ(v, expect, %l[error2])
+               RSEQ_ASM_CBNE_CPU_ID(cpu_id, current_cpu_id, %l[error1])
+               RSEQ_ASM_OP_CBNE(v, expect, %l[error2])
 #endif
                RSEQ_ASM_OP_R_BAD_MEMCPY(dst, src, len)
                RSEQ_INJECT_ASM(5)
index c9d32fabc0f9b9d79d8339a0978a2cf745c48614..dc3b23b9ff91988b20dade420e03e083a3086cdf 100644 (file)
@@ -151,27 +151,27 @@ do {                                                                              \
        RSEQ_ASM_OP_STORE_RELEASE(value, var)                                   \
        __rseq_str(post_commit_label) ":\n"
 
-#define RSEQ_ASM_OP_CMPEQ(var, expect, label)                                  \
+#define RSEQ_ASM_OP_CBNE(var, expect, label)                                   \
        "       ldr     " RSEQ_ASM_TMP_REG ", %[" __rseq_str(var) "]\n"         \
        "       sub     " RSEQ_ASM_TMP_REG ", " RSEQ_ASM_TMP_REG                \
                        ", %[" __rseq_str(expect) "]\n"                         \
        "       cbnz    " RSEQ_ASM_TMP_REG ", " __rseq_str(label) "\n"
 
-#define RSEQ_ASM_OP_CMPEQ32(var, expect, label)                                        \
+#define RSEQ_ASM_OP_CBNE32(var, expect, label)                                 \
        "       ldr     " RSEQ_ASM_TMP_REG32 ", %[" __rseq_str(var) "]\n"       \
        "       sub     " RSEQ_ASM_TMP_REG32 ", " RSEQ_ASM_TMP_REG32            \
                        ", %w[" __rseq_str(expect) "]\n"                        \
        "       cbnz    " RSEQ_ASM_TMP_REG32 ", " __rseq_str(label) "\n"
 
-#define RSEQ_ASM_OP_CMPNE(var, expect, label)                                  \
+#define RSEQ_ASM_OP_CBEQ(var, expect, label)                                   \
        "       ldr     " RSEQ_ASM_TMP_REG ", %[" __rseq_str(var) "]\n"         \
        "       sub     " RSEQ_ASM_TMP_REG ", " RSEQ_ASM_TMP_REG                \
                        ", %[" __rseq_str(expect) "]\n"                         \
        "       cbz     " RSEQ_ASM_TMP_REG ", " __rseq_str(label) "\n"
 
-#define RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, label)                     \
+#define RSEQ_ASM_CBNE_CPU_ID(cpu_id, current_cpu_id, label)                    \
        RSEQ_INJECT_ASM(2)                                                      \
-       RSEQ_ASM_OP_CMPEQ32(current_cpu_id, cpu_id, label)
+       RSEQ_ASM_OP_CBNE32(current_cpu_id, cpu_id, label)
 
 #define RSEQ_ASM_OP_R_LOAD(var)                                                        \
        "       ldr     " RSEQ_ASM_TMP_REG ", %[" __rseq_str(var) "]\n"
index c2f7a682e44a37166c91014c81bd67865a86ff53..a025bde1a023c771325cc25828beb516b1d858aa 100644 (file)
@@ -25,13 +25,13 @@ int RSEQ_TEMPLATE_IDENTIFIER(rseq_cmpeqv_storev)(intptr_t *v, intptr_t expect, i
 #endif
                /* Start rseq by storing table entry pointer into rseq_cs. */
                RSEQ_ASM_STORE_RSEQ_CS(1, 3f, rseq_cs)
-               RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, 4f)
+               RSEQ_ASM_CBNE_CPU_ID(cpu_id, current_cpu_id, 4f)
                RSEQ_INJECT_ASM(3)
                LONG_L " $4, %[v]\n\t"
                "bne $4, %[expect], %l[cmpfail]\n\t"
                RSEQ_INJECT_ASM(4)
 #ifdef RSEQ_COMPARE_TWICE
-               RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, %l[error1])
+               RSEQ_ASM_CBNE_CPU_ID(cpu_id, current_cpu_id, %l[error1])
                LONG_L " $4, %[v]\n\t"
                "bne $4, %[expect], %l[error2]\n\t"
 #endif
@@ -86,13 +86,13 @@ int RSEQ_TEMPLATE_IDENTIFIER(rseq_cmpnev_storeoffp_load)(intptr_t *v, intptr_t e
 #endif
                /* Start rseq by storing table entry pointer into rseq_cs. */
                RSEQ_ASM_STORE_RSEQ_CS(1, 3f, rseq_cs)
-               RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, 4f)
+               RSEQ_ASM_CBNE_CPU_ID(cpu_id, current_cpu_id, 4f)
                RSEQ_INJECT_ASM(3)
                LONG_L " $4, %[v]\n\t"
                "beq $4, %[expectnot], %l[cmpfail]\n\t"
                RSEQ_INJECT_ASM(4)
 #ifdef RSEQ_COMPARE_TWICE
-               RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, %l[error1])
+               RSEQ_ASM_CBNE_CPU_ID(cpu_id, current_cpu_id, %l[error1])
                LONG_L " $4, %[v]\n\t"
                "beq $4, %[expectnot], %l[error2]\n\t"
 #endif
@@ -149,10 +149,10 @@ int RSEQ_TEMPLATE_IDENTIFIER(rseq_addv)(intptr_t *v, intptr_t count, int cpu)
 #endif
                /* Start rseq by storing table entry pointer into rseq_cs. */
                RSEQ_ASM_STORE_RSEQ_CS(1, 3f, rseq_cs)
-               RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, 4f)
+               RSEQ_ASM_CBNE_CPU_ID(cpu_id, current_cpu_id, 4f)
                RSEQ_INJECT_ASM(3)
 #ifdef RSEQ_COMPARE_TWICE
-               RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, %l[error1])
+               RSEQ_ASM_CBNE_CPU_ID(cpu_id, current_cpu_id, %l[error1])
 #endif
                LONG_L " $4, %[v]\n\t"
                LONG_ADDI " $4, %[count]\n\t"
@@ -204,7 +204,7 @@ int RSEQ_TEMPLATE_IDENTIFIER(rseq_cmpeqv_cmpeqv_storev)(intptr_t *v, intptr_t ex
 #endif
                /* Start rseq by storing table entry pointer into rseq_cs. */
                RSEQ_ASM_STORE_RSEQ_CS(1, 3f, rseq_cs)
-               RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, 4f)
+               RSEQ_ASM_CBNE_CPU_ID(cpu_id, current_cpu_id, 4f)
                RSEQ_INJECT_ASM(3)
                LONG_L " $4, %[v]\n\t"
                "bne $4, %[expect], %l[cmpfail]\n\t"
@@ -213,7 +213,7 @@ int RSEQ_TEMPLATE_IDENTIFIER(rseq_cmpeqv_cmpeqv_storev)(intptr_t *v, intptr_t ex
                "bne $4, %[expect2], %l[cmpfail]\n\t"
                RSEQ_INJECT_ASM(5)
 #ifdef RSEQ_COMPARE_TWICE
-               RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, %l[error1])
+               RSEQ_ASM_CBNE_CPU_ID(cpu_id, current_cpu_id, %l[error1])
                LONG_L " $4, %[v]\n\t"
                "bne $4, %[expect], %l[error2]\n\t"
                LONG_L " $4, %[v2]\n\t"
@@ -283,13 +283,13 @@ int RSEQ_TEMPLATE_IDENTIFIER(rseq_cmpeqv_trystorev_storev)(intptr_t *v, intptr_t
 #endif
                /* Start rseq by storing table entry pointer into rseq_cs. */
                RSEQ_ASM_STORE_RSEQ_CS(1, 3f, rseq_cs)
-               RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, 4f)
+               RSEQ_ASM_CBNE_CPU_ID(cpu_id, current_cpu_id, 4f)
                RSEQ_INJECT_ASM(3)
                LONG_L " $4, %[v]\n\t"
                "bne $4, %[expect], %l[cmpfail]\n\t"
                RSEQ_INJECT_ASM(4)
 #ifdef RSEQ_COMPARE_TWICE
-               RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, %l[error1])
+               RSEQ_ASM_CBNE_CPU_ID(cpu_id, current_cpu_id, %l[error1])
                LONG_L " $4, %[v]\n\t"
                "bne $4, %[expect], %l[error2]\n\t"
 #endif
@@ -360,13 +360,13 @@ int RSEQ_TEMPLATE_IDENTIFIER(rseq_cmpeqv_trymemcpy_storev)(intptr_t *v, intptr_t
                LONG_S " %[len], %[rseq_scratch2]\n\t"
                /* Start rseq by storing table entry pointer into rseq_cs. */
                RSEQ_ASM_STORE_RSEQ_CS(1, 3f, rseq_cs)
-               RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, 4f)
+               RSEQ_ASM_CBNE_CPU_ID(cpu_id, current_cpu_id, 4f)
                RSEQ_INJECT_ASM(3)
                LONG_L " $4, %[v]\n\t"
                "bne $4, %[expect], 5f\n\t"
                RSEQ_INJECT_ASM(4)
 #ifdef RSEQ_COMPARE_TWICE
-               RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, 6f)
+               RSEQ_ASM_CBNE_CPU_ID(cpu_id, current_cpu_id, 6f)
                LONG_L " $4, %[v]\n\t"
                "bne $4, %[expect], 7f\n\t"
 #endif
index 0d47e82f10c226ed1e843198751adb87cc0b80a4..41ea3aaac10063e0a278ee7cf029f0aaa900bb2f 100644 (file)
@@ -119,7 +119,7 @@ do {                                                                        \
                LONG_S  " $4, %[" __rseq_str(rseq_cs) "]\n\t" \
                __rseq_str(label) ":\n\t"
 
-#define RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, label) \
+#define RSEQ_ASM_CBNE_CPU_ID(cpu_id, current_cpu_id, label) \
                RSEQ_INJECT_ASM(2) \
                "lw  $4, %[" __rseq_str(current_cpu_id) "]\n\t" \
                "bne $4, %[" __rseq_str(cpu_id) "], " __rseq_str(label) "\n\t"
index bbc0e0adbda06ee0fe88a32a557fe6fc22cd1bcb..b6a5903fb72c1ec36a373ce9f7e7aed0cdd880f9 100644 (file)
@@ -26,16 +26,16 @@ int RSEQ_TEMPLATE_IDENTIFIER(rseq_cmpeqv_storev)(intptr_t *v, intptr_t expect, i
                /* Start rseq by storing table entry pointer into rseq_cs. */
                RSEQ_ASM_STORE_RSEQ_CS(1, 3b, rseq_cs)
                /* cmp cpuid */
-               RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, 4f)
+               RSEQ_ASM_CBNE_CPU_ID(cpu_id, current_cpu_id, 4f)
                RSEQ_INJECT_ASM(3)
                /* cmp @v equal to @expect */
-               RSEQ_ASM_OP_CMPEQ(v, expect, %l[cmpfail])
+               RSEQ_ASM_OP_CBNE(v, expect, %l[cmpfail])
                RSEQ_INJECT_ASM(4)
 #ifdef RSEQ_COMPARE_TWICE
                /* cmp cpuid */
-               RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, %l[error1])
+               RSEQ_ASM_CBNE_CPU_ID(cpu_id, current_cpu_id, %l[error1])
                /* cmp @v equal to @expect */
-               RSEQ_ASM_OP_CMPEQ(v, expect, %l[error2])
+               RSEQ_ASM_OP_CBNE(v, expect, %l[error2])
 #endif
                /* final store */
                RSEQ_ASM_OP_FINAL_STORE(newv, v, 2)
@@ -91,16 +91,16 @@ int RSEQ_TEMPLATE_IDENTIFIER(rseq_cmpnev_storeoffp_load)(intptr_t *v, intptr_t e
                /* Start rseq by storing table entry pointer into rseq_cs. */
                RSEQ_ASM_STORE_RSEQ_CS(1, 3b, rseq_cs)
                /* cmp cpuid */
-               RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, 4f)
+               RSEQ_ASM_CBNE_CPU_ID(cpu_id, current_cpu_id, 4f)
                RSEQ_INJECT_ASM(3)
                /* cmp @v not equal to @expectnot */
-               RSEQ_ASM_OP_CMPNE(v, expectnot, %l[cmpfail])
+               RSEQ_ASM_OP_CBEQ(v, expectnot, %l[cmpfail])
                RSEQ_INJECT_ASM(4)
 #ifdef RSEQ_COMPARE_TWICE
                /* cmp cpuid */
-               RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, %l[error1])
+               RSEQ_ASM_CBNE_CPU_ID(cpu_id, current_cpu_id, %l[error1])
                /* cmp @v not equal to @expectnot */
-               RSEQ_ASM_OP_CMPNE(v, expectnot, %l[error2])
+               RSEQ_ASM_OP_CBEQ(v, expectnot, %l[error2])
 #endif
                /* load the value of @v */
                RSEQ_ASM_OP_R_LOAD(v)
@@ -161,11 +161,11 @@ int RSEQ_TEMPLATE_IDENTIFIER(rseq_addv)(intptr_t *v, intptr_t count, int cpu)
                /* Start rseq by storing table entry pointer into rseq_cs. */
                RSEQ_ASM_STORE_RSEQ_CS(1, 3b, rseq_cs)
                /* cmp cpuid */
-               RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, 4f)
+               RSEQ_ASM_CBNE_CPU_ID(cpu_id, current_cpu_id, 4f)
                RSEQ_INJECT_ASM(3)
 #ifdef RSEQ_COMPARE_TWICE
                /* cmp cpuid */
-               RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, %l[error1])
+               RSEQ_ASM_CBNE_CPU_ID(cpu_id, current_cpu_id, %l[error1])
 #endif
                /* load the value of @v */
                RSEQ_ASM_OP_R_LOAD(v)
@@ -221,21 +221,21 @@ int RSEQ_TEMPLATE_IDENTIFIER(rseq_cmpeqv_cmpeqv_storev)(intptr_t *v, intptr_t ex
                /* Start rseq by storing table entry pointer into rseq_cs. */
                RSEQ_ASM_STORE_RSEQ_CS(1, 3b, rseq_cs)
                /* cmp cpuid */
-               RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, 4f)
+               RSEQ_ASM_CBNE_CPU_ID(cpu_id, current_cpu_id, 4f)
                RSEQ_INJECT_ASM(3)
                /* cmp @v equal to @expect */
-               RSEQ_ASM_OP_CMPEQ(v, expect, %l[cmpfail])
+               RSEQ_ASM_OP_CBNE(v, expect, %l[cmpfail])
                RSEQ_INJECT_ASM(4)
                /* cmp @v2 equal to @expct2 */
-               RSEQ_ASM_OP_CMPEQ(v2, expect2, %l[cmpfail])
+               RSEQ_ASM_OP_CBNE(v2, expect2, %l[cmpfail])
                RSEQ_INJECT_ASM(5)
 #ifdef RSEQ_COMPARE_TWICE
                /* cmp cpuid */
-               RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, %l[error1])
+               RSEQ_ASM_CBNE_CPU_ID(cpu_id, current_cpu_id, %l[error1])
                /* cmp @v equal to @expect */
-               RSEQ_ASM_OP_CMPEQ(v, expect, %l[error2])
+               RSEQ_ASM_OP_CBNE(v, expect, %l[error2])
                /* cmp @v2 equal to @expct2 */
-               RSEQ_ASM_OP_CMPEQ(v2, expect2, %l[error3])
+               RSEQ_ASM_OP_CBNE(v2, expect2, %l[error3])
 #endif
                /* final store */
                RSEQ_ASM_OP_FINAL_STORE(newv, v, 2)
@@ -305,16 +305,16 @@ int RSEQ_TEMPLATE_IDENTIFIER(rseq_cmpeqv_trystorev_storev)(intptr_t *v, intptr_t
                /* Start rseq by storing table entry pointer into rseq_cs. */
                RSEQ_ASM_STORE_RSEQ_CS(1, 3b, rseq_cs)
                /* cmp cpuid */
-               RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, 4f)
+               RSEQ_ASM_CBNE_CPU_ID(cpu_id, current_cpu_id, 4f)
                RSEQ_INJECT_ASM(3)
                /* cmp @v equal to @expect */
-               RSEQ_ASM_OP_CMPEQ(v, expect, %l[cmpfail])
+               RSEQ_ASM_OP_CBNE(v, expect, %l[cmpfail])
                RSEQ_INJECT_ASM(4)
 #ifdef RSEQ_COMPARE_TWICE
                /* cmp cpuid */
-               RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, %l[error1])
+               RSEQ_ASM_CBNE_CPU_ID(cpu_id, current_cpu_id, %l[error1])
                /* cmp @v equal to @expect */
-               RSEQ_ASM_OP_CMPEQ(v, expect, %l[error2])
+               RSEQ_ASM_OP_CBNE(v, expect, %l[error2])
 #endif
                /* try store */
                RSEQ_ASM_OP_STORE(newv2, v2)
@@ -386,16 +386,16 @@ int RSEQ_TEMPLATE_IDENTIFIER(rseq_cmpeqv_trymemcpy_storev)(intptr_t *v, intptr_t
                /* Start rseq by storing table entry pointer into rseq_cs. */
                RSEQ_ASM_STORE_RSEQ_CS(1, 3b, rseq_cs)
                /* cmp cpuid */
-               RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, 4f)
+               RSEQ_ASM_CBNE_CPU_ID(cpu_id, current_cpu_id, 4f)
                RSEQ_INJECT_ASM(3)
                /* cmp @v equal to @expect */
-               RSEQ_ASM_OP_CMPEQ(v, expect, %l[cmpfail])
+               RSEQ_ASM_OP_CBNE(v, expect, %l[cmpfail])
                RSEQ_INJECT_ASM(4)
 #ifdef RSEQ_COMPARE_TWICE
                /* cmp cpuid */
-               RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, %l[error1])
+               RSEQ_ASM_CBNE_CPU_ID(cpu_id, current_cpu_id, %l[error1])
                /* cmp @v equal to @expect */
-               RSEQ_ASM_OP_CMPEQ(v, expect, %l[error2])
+               RSEQ_ASM_OP_CBNE(v, expect, %l[error2])
 #endif
                /* try memcpy */
                RSEQ_ASM_OP_R_MEMCPY()
index ac39dfdde251c0934547e302e36ced21a67336e5..9105e21484acdc69b6e16bc850fc914c735d919e 100644 (file)
@@ -136,7 +136,7 @@ do {                                                                        \
                __RSEQ_ASM_DEFINE_TABLE(label, 0x0, 0x0, start_ip,              \
                                        (post_commit_ip - start_ip), abort_ip)
 
-#define RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, label)                     \
+#define RSEQ_ASM_CBNE_CPU_ID(cpu_id, current_cpu_id, label)                    \
                RSEQ_INJECT_ASM(2)                                              \
                RSEQ_LOAD_INT(current_cpu_id) "%%r17, %[" __rseq_str(current_cpu_id) "]\n\t" \
                "cmpw cr7, %[" __rseq_str(cpu_id) "], %%r17\n\t"                \
@@ -154,12 +154,12 @@ do {                                                                      \
  *     RSEQ_ASM_OP_R_*: has hard-code registers in it
  *     RSEQ_ASM_OP_* (else): doesn't have hard-code registers(unless cr7)
  */
-#define RSEQ_ASM_OP_CMPEQ(var, expect, label)                                  \
+#define RSEQ_ASM_OP_CBNE(var, expect, label)                                   \
                RSEQ_LOAD_LONG(var) "%%r17, %[" __rseq_str(var) "]\n\t"         \
                RSEQ_CMP_LONG "cr7, %%r17, %[" __rseq_str(expect) "]\n\t"               \
                "bne- cr7, " __rseq_str(label) "\n\t"
 
-#define RSEQ_ASM_OP_CMPNE(var, expectnot, label)                               \
+#define RSEQ_ASM_OP_CBEQ(var, expectnot, label)                                \
                RSEQ_LOAD_LONG(var) "%%r17, %[" __rseq_str(var) "]\n\t"         \
                RSEQ_CMP_LONG "cr7, %%r17, %[" __rseq_str(expectnot) "]\n\t"            \
                "beq- cr7, " __rseq_str(label) "\n\t"
index 578b7de4a746a77c324a08f30ec0d8fab3aff9f2..83cd637e90020e003e7d58eef49c75f6ec906f4c 100644 (file)
@@ -18,13 +18,13 @@ int RSEQ_TEMPLATE_IDENTIFIER(rseq_cmpeqv_storev)(intptr_t *v, intptr_t expect, i
                                  RSEQ_ASM_DEFINE_EXIT_POINT(2f, "%l[error2]")
 #endif
                                  RSEQ_ASM_STORE_RSEQ_CS(2, 1b, rseq_cs)
-                                 RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, 4f)
+                                 RSEQ_ASM_CBNE_CPU_ID(cpu_id, current_cpu_id, 4f)
                                  RSEQ_INJECT_ASM(3)
-                                 RSEQ_ASM_OP_CMPEQ(v, expect, "%l[cmpfail]")
+                                 RSEQ_ASM_OP_CBNE(v, expect, "%l[cmpfail]")
                                  RSEQ_INJECT_ASM(4)
 #ifdef RSEQ_COMPARE_TWICE
-                                 RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, "%l[error1]")
-                                 RSEQ_ASM_OP_CMPEQ(v, expect, "%l[error2]")
+                                 RSEQ_ASM_CBNE_CPU_ID(cpu_id, current_cpu_id, "%l[error1]")
+                                 RSEQ_ASM_OP_CBNE(v, expect, "%l[error2]")
 #endif
                                  RSEQ_ASM_OP_FINAL_STORE(newv, v, 3)
                                  RSEQ_INJECT_ASM(5)
@@ -72,13 +72,13 @@ int RSEQ_TEMPLATE_IDENTIFIER(rseq_cmpnev_storeoffp_load)(intptr_t *v, intptr_t e
                                  RSEQ_ASM_DEFINE_EXIT_POINT(2f, "%l[error2]")
 #endif
                                  RSEQ_ASM_STORE_RSEQ_CS(2, 1b, rseq_cs)
-                                 RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, 4f)
+                                 RSEQ_ASM_CBNE_CPU_ID(cpu_id, current_cpu_id, 4f)
                                  RSEQ_INJECT_ASM(3)
-                                 RSEQ_ASM_OP_CMPNE(v, expectnot, "%l[cmpfail]")
+                                 RSEQ_ASM_OP_CBEQ(v, expectnot, "%l[cmpfail]")
                                  RSEQ_INJECT_ASM(4)
 #ifdef RSEQ_COMPARE_TWICE
-                                 RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, "%l[error1]")
-                                 RSEQ_ASM_OP_CMPNE(v, expectnot, "%l[error2]")
+                                 RSEQ_ASM_CBNE_CPU_ID(cpu_id, current_cpu_id, "%l[error1]")
+                                 RSEQ_ASM_OP_CBEQ(v, expectnot, "%l[error2]")
 #endif
                                  RSEQ_ASM_OP_R_LOAD(v)
                                  RSEQ_ASM_OP_R_STORE(load)
@@ -126,10 +126,10 @@ int RSEQ_TEMPLATE_IDENTIFIER(rseq_addv)(intptr_t *v, intptr_t count, int cpu)
                                  RSEQ_ASM_DEFINE_EXIT_POINT(2f, "%l[error1]")
 #endif
                                  RSEQ_ASM_STORE_RSEQ_CS(2, 1b, rseq_cs)
-                                 RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, 4f)
+                                 RSEQ_ASM_CBNE_CPU_ID(cpu_id, current_cpu_id, 4f)
                                  RSEQ_INJECT_ASM(3)
 #ifdef RSEQ_COMPARE_TWICE
-                                 RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, "%l[error1]")
+                                 RSEQ_ASM_CBNE_CPU_ID(cpu_id, current_cpu_id, "%l[error1]")
 #endif
                                  RSEQ_ASM_OP_R_LOAD(v)
                                  RSEQ_ASM_OP_R_ADD(count)
@@ -175,16 +175,16 @@ int RSEQ_TEMPLATE_IDENTIFIER(rseq_cmpeqv_cmpeqv_storev)(intptr_t *v, intptr_t ex
                                  RSEQ_ASM_DEFINE_EXIT_POINT(2f, "%l[error3]")
 #endif
                                  RSEQ_ASM_STORE_RSEQ_CS(2, 1b, rseq_cs)
-                                 RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, 4f)
+                                 RSEQ_ASM_CBNE_CPU_ID(cpu_id, current_cpu_id, 4f)
                                  RSEQ_INJECT_ASM(3)
-                                 RSEQ_ASM_OP_CMPEQ(v, expect, "%l[cmpfail]")
+                                 RSEQ_ASM_OP_CBNE(v, expect, "%l[cmpfail]")
                                  RSEQ_INJECT_ASM(4)
-                                 RSEQ_ASM_OP_CMPEQ(v2, expect2, "%l[cmpfail]")
+                                 RSEQ_ASM_OP_CBNE(v2, expect2, "%l[cmpfail]")
                                  RSEQ_INJECT_ASM(5)
 #ifdef RSEQ_COMPARE_TWICE
-                                 RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, "%l[error1]")
-                                 RSEQ_ASM_OP_CMPEQ(v, expect, "%l[error2]")
-                                 RSEQ_ASM_OP_CMPEQ(v2, expect2, "%l[error3]")
+                                 RSEQ_ASM_CBNE_CPU_ID(cpu_id, current_cpu_id, "%l[error1]")
+                                 RSEQ_ASM_OP_CBNE(v, expect, "%l[error2]")
+                                 RSEQ_ASM_OP_CBNE(v2, expect2, "%l[error3]")
 #endif
                                  RSEQ_ASM_OP_FINAL_STORE(newv, v, 3)
                                  RSEQ_INJECT_ASM(6)
@@ -239,10 +239,10 @@ int RSEQ_TEMPLATE_IDENTIFIER(rseq_offset_deref_addv)(intptr_t *ptr, off_t off, i
                                  RSEQ_ASM_DEFINE_EXIT_POINT(2f, "%l[error1]")
 #endif
                                  RSEQ_ASM_STORE_RSEQ_CS(2, 1b, rseq_cs)
-                                 RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, 4f)
+                                 RSEQ_ASM_CBNE_CPU_ID(cpu_id, current_cpu_id, 4f)
                                  RSEQ_INJECT_ASM(3)
 #ifdef RSEQ_COMPARE_TWICE
-                                 RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, "%l[error1]")
+                                 RSEQ_ASM_CBNE_CPU_ID(cpu_id, current_cpu_id, "%l[error1]")
 #endif
                                  RSEQ_ASM_OP_R_DEREF_ADDV(ptr, off, 3)
                                  RSEQ_INJECT_ASM(4)
@@ -292,13 +292,13 @@ int RSEQ_TEMPLATE_IDENTIFIER(rseq_cmpeqv_trystorev_storev)(intptr_t *v, intptr_t
                                  RSEQ_ASM_DEFINE_EXIT_POINT(2f, "%l[error2]")
 #endif
                                  RSEQ_ASM_STORE_RSEQ_CS(2, 1b, rseq_cs)
-                                 RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, 4f)
+                                 RSEQ_ASM_CBNE_CPU_ID(cpu_id, current_cpu_id, 4f)
                                  RSEQ_INJECT_ASM(3)
-                                 RSEQ_ASM_OP_CMPEQ(v, expect, "%l[cmpfail]")
+                                 RSEQ_ASM_OP_CBNE(v, expect, "%l[cmpfail]")
                                  RSEQ_INJECT_ASM(4)
 #ifdef RSEQ_COMPARE_TWICE
-                                 RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, "%l[error1]")
-                                 RSEQ_ASM_OP_CMPEQ(v, expect, "%l[error2]")
+                                 RSEQ_ASM_CBNE_CPU_ID(cpu_id, current_cpu_id, "%l[error1]")
+                                 RSEQ_ASM_OP_CBNE(v, expect, "%l[error2]")
 #endif
                                  RSEQ_ASM_OP_STORE(newv2, v2)
                                  RSEQ_INJECT_ASM(5)
@@ -354,13 +354,13 @@ int RSEQ_TEMPLATE_IDENTIFIER(rseq_cmpeqv_trymemcpy_storev)(intptr_t *v, intptr_t
                                  RSEQ_ASM_DEFINE_EXIT_POINT(2f, "%l[error2]")
 #endif
                                  RSEQ_ASM_STORE_RSEQ_CS(2, 1b, rseq_cs)
-                                 RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, 4f)
+                                 RSEQ_ASM_CBNE_CPU_ID(cpu_id, current_cpu_id, 4f)
                                  RSEQ_INJECT_ASM(3)
-                                 RSEQ_ASM_OP_CMPEQ(v, expect, "%l[cmpfail]")
+                                 RSEQ_ASM_OP_CBNE(v, expect, "%l[cmpfail]")
                                  RSEQ_INJECT_ASM(4)
 #ifdef RSEQ_COMPARE_TWICE
-                                 RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, "%l[error1]")
-                                 RSEQ_ASM_OP_CMPEQ(v, expect, "%l[error2]")
+                                 RSEQ_ASM_CBNE_CPU_ID(cpu_id, current_cpu_id, "%l[error1]")
+                                 RSEQ_ASM_OP_CBNE(v, expect, "%l[error2]")
 #endif
                                  RSEQ_ASM_OP_R_BAD_MEMCPY(dst, src, len)
                                  RSEQ_INJECT_ASM(5)
index 193995aa778e6ed3784c6cfa6e503a974219659a..3047b6e2534bd256b0ce3ef7b81df4124e29934a 100644 (file)
@@ -99,24 +99,24 @@ do {                                                                        \
 #define RSEQ_ASM_OP_STORE(value, var)                                  \
        REG_S   "%[" __rseq_str(value) "], %[" __rseq_str(var) "]\n"
 
-#define RSEQ_ASM_OP_CMPEQ(var, expect, label)                          \
+#define RSEQ_ASM_OP_CBNE(var, expect, label)                           \
        REG_L   RSEQ_ASM_TMP_REG_1 ", %[" __rseq_str(var) "]\n"         \
        "bne    " RSEQ_ASM_TMP_REG_1 ", %[" __rseq_str(expect) "] ,"    \
                  __rseq_str(label) "\n"
 
-#define RSEQ_ASM_OP_CMPEQ32(var, expect, label)                                \
+#define RSEQ_ASM_OP_CBNE32(var, expect, label)                         \
        "lw     " RSEQ_ASM_TMP_REG_1 ", %[" __rseq_str(var) "]\n"       \
        "bne    " RSEQ_ASM_TMP_REG_1 ", %[" __rseq_str(expect) "] ,"    \
                  __rseq_str(label) "\n"
 
-#define RSEQ_ASM_OP_CMPNE(var, expect, label)                          \
+#define RSEQ_ASM_OP_CBEQ(var, expect, label)                           \
        REG_L   RSEQ_ASM_TMP_REG_1 ", %[" __rseq_str(var) "]\n"         \
        "beq    " RSEQ_ASM_TMP_REG_1 ", %[" __rseq_str(expect) "] ,"    \
                  __rseq_str(label) "\n"
 
-#define RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, label)             \
+#define RSEQ_ASM_CBNE_CPU_ID(cpu_id, current_cpu_id, label)            \
        RSEQ_INJECT_ASM(2)                                              \
-       RSEQ_ASM_OP_CMPEQ32(current_cpu_id, cpu_id, label)
+       RSEQ_ASM_OP_CBNE32(current_cpu_id, cpu_id, label)
 
 #define RSEQ_ASM_OP_R_LOAD(var)                                                \
        REG_L   RSEQ_ASM_TMP_REG_1 ", %[" __rseq_str(var) "]\n"
index fe150ce10800475061fc77e107662ce5897af2ec..c3641b7dd49b8b87322db0e6d333f7cf803d23ca 100644 (file)
@@ -20,13 +20,13 @@ int RSEQ_TEMPLATE_IDENTIFIER(rseq_cmpeqv_storev)(intptr_t *v, intptr_t expect, i
 #endif
                /* Start rseq by storing table entry pointer into rseq_cs. */
                RSEQ_ASM_STORE_RSEQ_CS(1, 3b, rseq_cs)
-               RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, 4f)
+               RSEQ_ASM_CBNE_CPU_ID(cpu_id, current_cpu_id, 4f)
                RSEQ_INJECT_ASM(3)
                LONG_CMP " %[expect], %[v]\n\t"
                "jnz %l[cmpfail]\n\t"
                RSEQ_INJECT_ASM(4)
 #ifdef RSEQ_COMPARE_TWICE
-               RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, %l[error1])
+               RSEQ_ASM_CBNE_CPU_ID(cpu_id, current_cpu_id, %l[error1])
                LONG_CMP " %[expect], %[v]\n\t"
                "jnz %l[error2]\n\t"
 #endif
@@ -88,14 +88,14 @@ int RSEQ_TEMPLATE_IDENTIFIER(rseq_cmpnev_storeoffp_load)(intptr_t *v, intptr_t e
 #endif
                /* Start rseq by storing table entry pointer into rseq_cs. */
                RSEQ_ASM_STORE_RSEQ_CS(1, 3b, rseq_cs)
-               RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, 4f)
+               RSEQ_ASM_CBNE_CPU_ID(cpu_id, current_cpu_id, 4f)
                RSEQ_INJECT_ASM(3)
                LONG_L " %%r1, %[v]\n\t"
                LONG_CMP_R " %%r1, %[expectnot]\n\t"
                "je %l[cmpfail]\n\t"
                RSEQ_INJECT_ASM(4)
 #ifdef RSEQ_COMPARE_TWICE
-               RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, %l[error1])
+               RSEQ_ASM_CBNE_CPU_ID(cpu_id, current_cpu_id, %l[error1])
                LONG_L " %%r1, %[v]\n\t"
                LONG_CMP_R " %%r1, %[expectnot]\n\t"
                "je %l[error2]\n\t"
@@ -156,10 +156,10 @@ int RSEQ_TEMPLATE_IDENTIFIER(rseq_addv)(intptr_t *v, intptr_t count, int cpu)
 #endif
                /* Start rseq by storing table entry pointer into rseq_cs. */
                RSEQ_ASM_STORE_RSEQ_CS(1, 3b, rseq_cs)
-               RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, 4f)
+               RSEQ_ASM_CBNE_CPU_ID(cpu_id, current_cpu_id, 4f)
                RSEQ_INJECT_ASM(3)
 #ifdef RSEQ_COMPARE_TWICE
-               RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, %l[error1])
+               RSEQ_ASM_CBNE_CPU_ID(cpu_id, current_cpu_id, %l[error1])
 #endif
                LONG_L " %%r0, %[v]\n\t"
                LONG_ADD_R " %%r0, %[count]\n\t"
@@ -213,7 +213,7 @@ int RSEQ_TEMPLATE_IDENTIFIER(rseq_cmpeqv_cmpeqv_storev)(intptr_t *v, intptr_t ex
 #endif
                /* Start rseq by storing table entry pointer into rseq_cs. */
                RSEQ_ASM_STORE_RSEQ_CS(1, 3b, rseq_cs)
-               RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, 4f)
+               RSEQ_ASM_CBNE_CPU_ID(cpu_id, current_cpu_id, 4f)
                RSEQ_INJECT_ASM(3)
                LONG_CMP " %[expect], %[v]\n\t"
                "jnz %l[cmpfail]\n\t"
@@ -222,7 +222,7 @@ int RSEQ_TEMPLATE_IDENTIFIER(rseq_cmpeqv_cmpeqv_storev)(intptr_t *v, intptr_t ex
                "jnz %l[cmpfail]\n\t"
                RSEQ_INJECT_ASM(5)
 #ifdef RSEQ_COMPARE_TWICE
-               RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, %l[error1])
+               RSEQ_ASM_CBNE_CPU_ID(cpu_id, current_cpu_id, %l[error1])
                LONG_CMP " %[expect], %[v]\n\t"
                "jnz %l[error2]\n\t"
                LONG_CMP " %[expect2], %[v2]\n\t"
@@ -297,13 +297,13 @@ int RSEQ_TEMPLATE_IDENTIFIER(rseq_cmpeqv_trystorev_storev)(intptr_t *v, intptr_t
 #endif
                /* Start rseq by storing table entry pointer into rseq_cs. */
                RSEQ_ASM_STORE_RSEQ_CS(1, 3b, rseq_cs)
-               RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, 4f)
+               RSEQ_ASM_CBNE_CPU_ID(cpu_id, current_cpu_id, 4f)
                RSEQ_INJECT_ASM(3)
                LONG_CMP " %[expect], %[v]\n\t"
                "jnz %l[cmpfail]\n\t"
                RSEQ_INJECT_ASM(4)
 #ifdef RSEQ_COMPARE_TWICE
-               RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, %l[error1])
+               RSEQ_ASM_CBNE_CPU_ID(cpu_id, current_cpu_id, %l[error1])
                LONG_CMP " %[expect], %[v]\n\t"
                "jnz %l[error2]\n\t"
 #endif
@@ -375,13 +375,13 @@ int RSEQ_TEMPLATE_IDENTIFIER(rseq_cmpeqv_trymemcpy_storev)(intptr_t *v, intptr_t
                LONG_S " %[len], %[rseq_scratch2]\n\t"
                /* Start rseq by storing table entry pointer into rseq_cs. */
                RSEQ_ASM_STORE_RSEQ_CS(1, 3b, rseq_cs)
-               RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, 4f)
+               RSEQ_ASM_CBNE_CPU_ID(cpu_id, current_cpu_id, 4f)
                RSEQ_INJECT_ASM(3)
                LONG_CMP " %[expect], %[v]\n\t"
                "jnz 5f\n\t"
                RSEQ_INJECT_ASM(4)
 #ifdef RSEQ_COMPARE_TWICE
-               RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, 6f)
+               RSEQ_ASM_CBNE_CPU_ID(cpu_id, current_cpu_id, 6f)
                LONG_CMP " %[expect], %[v]\n\t"
                "jnz 7f\n\t"
 #endif
index 76ce74f18f41870bfe5de116b411f12705b94f12..8158826229d6a19c4abdb0b6b1af7309be3791f8 100644 (file)
@@ -111,7 +111,7 @@ do {                                                                        \
                LONG_S " %%r0, %[" __rseq_str(rseq_cs) "]\n\t"          \
                __rseq_str(label) ":\n\t"
 
-#define RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, label)             \
+#define RSEQ_ASM_CBNE_CPU_ID(cpu_id, current_cpu_id, label)            \
                RSEQ_INJECT_ASM(2)                                      \
                "c %[" __rseq_str(cpu_id) "], %[" __rseq_str(current_cpu_id) "]\n\t" \
                "jnz " __rseq_str(label) "\n\t"
index 8ee71cb87461c6a163eac1098428e527471aa1ae..fd3c6b8df0fa92eb2cef03861a6b16d3733c1d2f 100644 (file)
@@ -25,13 +25,13 @@ int RSEQ_TEMPLATE_IDENTIFIER(rseq_cmpeqv_storev)(intptr_t *v, intptr_t expect, i
 #endif
                /* Start rseq by storing table entry pointer into rseq_cs. */
                RSEQ_ASM_STORE_RSEQ_CS(1, 3b, RSEQ_ASM_TP_SEGMENT:RSEQ_CS_OFFSET(%[rseq_offset]))
-               RSEQ_ASM_CMP_CPU_ID(cpu_id, RSEQ_ASM_TP_SEGMENT:RSEQ_TEMPLATE_CPU_ID_OFFSET(%[rseq_offset]), 4f)
+               RSEQ_ASM_CBNE_CPU_ID(cpu_id, RSEQ_ASM_TP_SEGMENT:RSEQ_TEMPLATE_CPU_ID_OFFSET(%[rseq_offset]), 4f)
                RSEQ_INJECT_ASM(3)
                "cmpq %[v], %[expect]\n\t"
                "jnz %l[cmpfail]\n\t"
                RSEQ_INJECT_ASM(4)
 #ifdef RSEQ_COMPARE_TWICE
-               RSEQ_ASM_CMP_CPU_ID(cpu_id, RSEQ_ASM_TP_SEGMENT:RSEQ_TEMPLATE_CPU_ID_OFFSET(%[rseq_offset]), %l[error1])
+               RSEQ_ASM_CBNE_CPU_ID(cpu_id, RSEQ_ASM_TP_SEGMENT:RSEQ_TEMPLATE_CPU_ID_OFFSET(%[rseq_offset]), %l[error1])
                "cmpq %[v], %[expect]\n\t"
                "jnz %l[error2]\n\t"
 #endif
@@ -91,14 +91,14 @@ int RSEQ_TEMPLATE_IDENTIFIER(rseq_cmpnev_storeoffp_load)(intptr_t *v, intptr_t e
 #endif
                /* Start rseq by storing table entry pointer into rseq_cs. */
                RSEQ_ASM_STORE_RSEQ_CS(1, 3b, RSEQ_ASM_TP_SEGMENT:RSEQ_CS_OFFSET(%[rseq_offset]))
-               RSEQ_ASM_CMP_CPU_ID(cpu_id, RSEQ_ASM_TP_SEGMENT:RSEQ_TEMPLATE_CPU_ID_OFFSET(%[rseq_offset]), 4f)
+               RSEQ_ASM_CBNE_CPU_ID(cpu_id, RSEQ_ASM_TP_SEGMENT:RSEQ_TEMPLATE_CPU_ID_OFFSET(%[rseq_offset]), 4f)
                RSEQ_INJECT_ASM(3)
                "movq %[v], %%rbx\n\t"
                "cmpq %%rbx, %[expectnot]\n\t"
                "je %l[cmpfail]\n\t"
                RSEQ_INJECT_ASM(4)
 #ifdef RSEQ_COMPARE_TWICE
-               RSEQ_ASM_CMP_CPU_ID(cpu_id, RSEQ_ASM_TP_SEGMENT:RSEQ_TEMPLATE_CPU_ID_OFFSET(%[rseq_offset]), %l[error1])
+               RSEQ_ASM_CBNE_CPU_ID(cpu_id, RSEQ_ASM_TP_SEGMENT:RSEQ_TEMPLATE_CPU_ID_OFFSET(%[rseq_offset]), %l[error1])
                "movq %[v], %%rbx\n\t"
                "cmpq %%rbx, %[expectnot]\n\t"
                "je %l[error2]\n\t"
@@ -157,10 +157,10 @@ int RSEQ_TEMPLATE_IDENTIFIER(rseq_addv)(intptr_t *v, intptr_t count, int cpu)
 #endif
                /* Start rseq by storing table entry pointer into rseq_cs. */
                RSEQ_ASM_STORE_RSEQ_CS(1, 3b, RSEQ_ASM_TP_SEGMENT:RSEQ_CS_OFFSET(%[rseq_offset]))
-               RSEQ_ASM_CMP_CPU_ID(cpu_id, RSEQ_ASM_TP_SEGMENT:RSEQ_TEMPLATE_CPU_ID_OFFSET(%[rseq_offset]), 4f)
+               RSEQ_ASM_CBNE_CPU_ID(cpu_id, RSEQ_ASM_TP_SEGMENT:RSEQ_TEMPLATE_CPU_ID_OFFSET(%[rseq_offset]), 4f)
                RSEQ_INJECT_ASM(3)
 #ifdef RSEQ_COMPARE_TWICE
-               RSEQ_ASM_CMP_CPU_ID(cpu_id, RSEQ_ASM_TP_SEGMENT:RSEQ_TEMPLATE_CPU_ID_OFFSET(%[rseq_offset]), %l[error1])
+               RSEQ_ASM_CBNE_CPU_ID(cpu_id, RSEQ_ASM_TP_SEGMENT:RSEQ_TEMPLATE_CPU_ID_OFFSET(%[rseq_offset]), %l[error1])
 #endif
                /* final store */
                "addq %[count], %[v]\n\t"
@@ -211,10 +211,10 @@ int RSEQ_TEMPLATE_IDENTIFIER(rseq_offset_deref_addv)(intptr_t *ptr, long off, in
 #endif
                /* Start rseq by storing table entry pointer into rseq_cs. */
                RSEQ_ASM_STORE_RSEQ_CS(1, 3b, RSEQ_ASM_TP_SEGMENT:RSEQ_CS_OFFSET(%[rseq_offset]))
-               RSEQ_ASM_CMP_CPU_ID(cpu_id, RSEQ_ASM_TP_SEGMENT:RSEQ_TEMPLATE_CPU_ID_OFFSET(%[rseq_offset]), 4f)
+               RSEQ_ASM_CBNE_CPU_ID(cpu_id, RSEQ_ASM_TP_SEGMENT:RSEQ_TEMPLATE_CPU_ID_OFFSET(%[rseq_offset]), 4f)
                RSEQ_INJECT_ASM(3)
 #ifdef RSEQ_COMPARE_TWICE
-               RSEQ_ASM_CMP_CPU_ID(cpu_id, RSEQ_ASM_TP_SEGMENT:RSEQ_TEMPLATE_CPU_ID_OFFSET(%[rseq_offset]), %l[error1])
+               RSEQ_ASM_CBNE_CPU_ID(cpu_id, RSEQ_ASM_TP_SEGMENT:RSEQ_TEMPLATE_CPU_ID_OFFSET(%[rseq_offset]), %l[error1])
 #endif
                /* get p+v */
                "movq %[ptr], %%rbx\n\t"
@@ -267,7 +267,7 @@ int RSEQ_TEMPLATE_IDENTIFIER(rseq_cmpeqv_cmpeqv_storev)(intptr_t *v, intptr_t ex
 #endif
                /* Start rseq by storing table entry pointer into rseq_cs. */
                RSEQ_ASM_STORE_RSEQ_CS(1, 3b, RSEQ_ASM_TP_SEGMENT:RSEQ_CS_OFFSET(%[rseq_offset]))
-               RSEQ_ASM_CMP_CPU_ID(cpu_id, RSEQ_ASM_TP_SEGMENT:RSEQ_TEMPLATE_CPU_ID_OFFSET(%[rseq_offset]), 4f)
+               RSEQ_ASM_CBNE_CPU_ID(cpu_id, RSEQ_ASM_TP_SEGMENT:RSEQ_TEMPLATE_CPU_ID_OFFSET(%[rseq_offset]), 4f)
                RSEQ_INJECT_ASM(3)
                "cmpq %[v], %[expect]\n\t"
                "jnz %l[cmpfail]\n\t"
@@ -276,7 +276,7 @@ int RSEQ_TEMPLATE_IDENTIFIER(rseq_cmpeqv_cmpeqv_storev)(intptr_t *v, intptr_t ex
                "jnz %l[cmpfail]\n\t"
                RSEQ_INJECT_ASM(5)
 #ifdef RSEQ_COMPARE_TWICE
-               RSEQ_ASM_CMP_CPU_ID(cpu_id, RSEQ_ASM_TP_SEGMENT:RSEQ_TEMPLATE_CPU_ID_OFFSET(%[rseq_offset]), %l[error1])
+               RSEQ_ASM_CBNE_CPU_ID(cpu_id, RSEQ_ASM_TP_SEGMENT:RSEQ_TEMPLATE_CPU_ID_OFFSET(%[rseq_offset]), %l[error1])
                "cmpq %[v], %[expect]\n\t"
                "jnz %l[error2]\n\t"
                "cmpq %[v2], %[expect2]\n\t"
@@ -348,13 +348,13 @@ int RSEQ_TEMPLATE_IDENTIFIER(rseq_cmpeqv_trystorev_storev)(intptr_t *v, intptr_t
 #endif
                /* Start rseq by storing table entry pointer into rseq_cs. */
                RSEQ_ASM_STORE_RSEQ_CS(1, 3b, RSEQ_ASM_TP_SEGMENT:RSEQ_CS_OFFSET(%[rseq_offset]))
-               RSEQ_ASM_CMP_CPU_ID(cpu_id, RSEQ_ASM_TP_SEGMENT:RSEQ_TEMPLATE_CPU_ID_OFFSET(%[rseq_offset]), 4f)
+               RSEQ_ASM_CBNE_CPU_ID(cpu_id, RSEQ_ASM_TP_SEGMENT:RSEQ_TEMPLATE_CPU_ID_OFFSET(%[rseq_offset]), 4f)
                RSEQ_INJECT_ASM(3)
                "cmpq %[v], %[expect]\n\t"
                "jnz %l[cmpfail]\n\t"
                RSEQ_INJECT_ASM(4)
 #ifdef RSEQ_COMPARE_TWICE
-               RSEQ_ASM_CMP_CPU_ID(cpu_id, RSEQ_ASM_TP_SEGMENT:RSEQ_TEMPLATE_CPU_ID_OFFSET(%[rseq_offset]), %l[error1])
+               RSEQ_ASM_CBNE_CPU_ID(cpu_id, RSEQ_ASM_TP_SEGMENT:RSEQ_TEMPLATE_CPU_ID_OFFSET(%[rseq_offset]), %l[error1])
                "cmpq %[v], %[expect]\n\t"
                "jnz %l[error2]\n\t"
 #endif
@@ -423,13 +423,13 @@ int RSEQ_TEMPLATE_IDENTIFIER(rseq_cmpeqv_trymemcpy_storev)(intptr_t *v, intptr_t
                "movq %[len], %[rseq_scratch2]\n\t"
                /* Start rseq by storing table entry pointer into rseq_cs. */
                RSEQ_ASM_STORE_RSEQ_CS(1, 3b, RSEQ_ASM_TP_SEGMENT:RSEQ_CS_OFFSET(%[rseq_offset]))
-               RSEQ_ASM_CMP_CPU_ID(cpu_id, RSEQ_ASM_TP_SEGMENT:RSEQ_TEMPLATE_CPU_ID_OFFSET(%[rseq_offset]), 4f)
+               RSEQ_ASM_CBNE_CPU_ID(cpu_id, RSEQ_ASM_TP_SEGMENT:RSEQ_TEMPLATE_CPU_ID_OFFSET(%[rseq_offset]), 4f)
                RSEQ_INJECT_ASM(3)
                "cmpq %[v], %[expect]\n\t"
                "jnz 5f\n\t"
                RSEQ_INJECT_ASM(4)
 #ifdef RSEQ_COMPARE_TWICE
-               RSEQ_ASM_CMP_CPU_ID(cpu_id, RSEQ_ASM_TP_SEGMENT:RSEQ_TEMPLATE_CPU_ID_OFFSET(%[rseq_offset]), 6f)
+               RSEQ_ASM_CBNE_CPU_ID(cpu_id, RSEQ_ASM_TP_SEGMENT:RSEQ_TEMPLATE_CPU_ID_OFFSET(%[rseq_offset]), 6f)
                "cmpq %[v], %[expect]\n\t"
                "jnz 7f\n\t"
 #endif
@@ -537,13 +537,13 @@ int RSEQ_TEMPLATE_IDENTIFIER(rseq_cmpeqv_storev)(intptr_t *v, intptr_t expect, i
 #endif
                /* Start rseq by storing table entry pointer into rseq_cs. */
                RSEQ_ASM_STORE_RSEQ_CS(1, 3b, RSEQ_ASM_TP_SEGMENT:RSEQ_CS_OFFSET(%[rseq_offset]))
-               RSEQ_ASM_CMP_CPU_ID(cpu_id, RSEQ_ASM_TP_SEGMENT:RSEQ_TEMPLATE_CPU_ID_OFFSET(%[rseq_offset]), 4f)
+               RSEQ_ASM_CBNE_CPU_ID(cpu_id, RSEQ_ASM_TP_SEGMENT:RSEQ_TEMPLATE_CPU_ID_OFFSET(%[rseq_offset]), 4f)
                RSEQ_INJECT_ASM(3)
                "cmpl %[v], %[expect]\n\t"
                "jnz %l[cmpfail]\n\t"
                RSEQ_INJECT_ASM(4)
 #ifdef RSEQ_COMPARE_TWICE
-               RSEQ_ASM_CMP_CPU_ID(cpu_id, RSEQ_ASM_TP_SEGMENT:RSEQ_TEMPLATE_CPU_ID_OFFSET(%[rseq_offset]), %l[error1])
+               RSEQ_ASM_CBNE_CPU_ID(cpu_id, RSEQ_ASM_TP_SEGMENT:RSEQ_TEMPLATE_CPU_ID_OFFSET(%[rseq_offset]), %l[error1])
                "cmpl %[v], %[expect]\n\t"
                "jnz %l[error2]\n\t"
 #endif
@@ -603,14 +603,14 @@ int RSEQ_TEMPLATE_IDENTIFIER(rseq_cmpnev_storeoffp_load)(intptr_t *v, intptr_t e
 #endif
                /* Start rseq by storing table entry pointer into rseq_cs. */
                RSEQ_ASM_STORE_RSEQ_CS(1, 3b, RSEQ_ASM_TP_SEGMENT:RSEQ_CS_OFFSET(%[rseq_offset]))
-               RSEQ_ASM_CMP_CPU_ID(cpu_id, RSEQ_ASM_TP_SEGMENT:RSEQ_TEMPLATE_CPU_ID_OFFSET(%[rseq_offset]), 4f)
+               RSEQ_ASM_CBNE_CPU_ID(cpu_id, RSEQ_ASM_TP_SEGMENT:RSEQ_TEMPLATE_CPU_ID_OFFSET(%[rseq_offset]), 4f)
                RSEQ_INJECT_ASM(3)
                "movl %[v], %%ebx\n\t"
                "cmpl %%ebx, %[expectnot]\n\t"
                "je %l[cmpfail]\n\t"
                RSEQ_INJECT_ASM(4)
 #ifdef RSEQ_COMPARE_TWICE
-               RSEQ_ASM_CMP_CPU_ID(cpu_id, RSEQ_ASM_TP_SEGMENT:RSEQ_TEMPLATE_CPU_ID_OFFSET(%[rseq_offset]), %l[error1])
+               RSEQ_ASM_CBNE_CPU_ID(cpu_id, RSEQ_ASM_TP_SEGMENT:RSEQ_TEMPLATE_CPU_ID_OFFSET(%[rseq_offset]), %l[error1])
                "movl %[v], %%ebx\n\t"
                "cmpl %%ebx, %[expectnot]\n\t"
                "je %l[error2]\n\t"
@@ -669,10 +669,10 @@ int RSEQ_TEMPLATE_IDENTIFIER(rseq_addv)(intptr_t *v, intptr_t count, int cpu)
 #endif
                /* Start rseq by storing table entry pointer into rseq_cs. */
                RSEQ_ASM_STORE_RSEQ_CS(1, 3b, RSEQ_ASM_TP_SEGMENT:RSEQ_CS_OFFSET(%[rseq_offset]))
-               RSEQ_ASM_CMP_CPU_ID(cpu_id, RSEQ_ASM_TP_SEGMENT:RSEQ_TEMPLATE_CPU_ID_OFFSET(%[rseq_offset]), 4f)
+               RSEQ_ASM_CBNE_CPU_ID(cpu_id, RSEQ_ASM_TP_SEGMENT:RSEQ_TEMPLATE_CPU_ID_OFFSET(%[rseq_offset]), 4f)
                RSEQ_INJECT_ASM(3)
 #ifdef RSEQ_COMPARE_TWICE
-               RSEQ_ASM_CMP_CPU_ID(cpu_id, RSEQ_ASM_TP_SEGMENT:RSEQ_TEMPLATE_CPU_ID_OFFSET(%[rseq_offset]), %l[error1])
+               RSEQ_ASM_CBNE_CPU_ID(cpu_id, RSEQ_ASM_TP_SEGMENT:RSEQ_TEMPLATE_CPU_ID_OFFSET(%[rseq_offset]), %l[error1])
 #endif
                /* final store */
                "addl %[count], %[v]\n\t"
@@ -722,7 +722,7 @@ int RSEQ_TEMPLATE_IDENTIFIER(rseq_cmpeqv_cmpeqv_storev)(intptr_t *v, intptr_t ex
 #endif
                /* Start rseq by storing table entry pointer into rseq_cs. */
                RSEQ_ASM_STORE_RSEQ_CS(1, 3b, RSEQ_ASM_TP_SEGMENT:RSEQ_CS_OFFSET(%[rseq_offset]))
-               RSEQ_ASM_CMP_CPU_ID(cpu_id, RSEQ_ASM_TP_SEGMENT:RSEQ_TEMPLATE_CPU_ID_OFFSET(%[rseq_offset]), 4f)
+               RSEQ_ASM_CBNE_CPU_ID(cpu_id, RSEQ_ASM_TP_SEGMENT:RSEQ_TEMPLATE_CPU_ID_OFFSET(%[rseq_offset]), 4f)
                RSEQ_INJECT_ASM(3)
                "cmpl %[v], %[expect]\n\t"
                "jnz %l[cmpfail]\n\t"
@@ -731,7 +731,7 @@ int RSEQ_TEMPLATE_IDENTIFIER(rseq_cmpeqv_cmpeqv_storev)(intptr_t *v, intptr_t ex
                "jnz %l[cmpfail]\n\t"
                RSEQ_INJECT_ASM(5)
 #ifdef RSEQ_COMPARE_TWICE
-               RSEQ_ASM_CMP_CPU_ID(cpu_id, RSEQ_ASM_TP_SEGMENT:RSEQ_TEMPLATE_CPU_ID_OFFSET(%[rseq_offset]), %l[error1])
+               RSEQ_ASM_CBNE_CPU_ID(cpu_id, RSEQ_ASM_TP_SEGMENT:RSEQ_TEMPLATE_CPU_ID_OFFSET(%[rseq_offset]), %l[error1])
                "cmpl %[v], %[expect]\n\t"
                "jnz %l[error2]\n\t"
                "cmpl %[expect2], %[v2]\n\t"
@@ -804,14 +804,14 @@ int RSEQ_TEMPLATE_IDENTIFIER(rseq_cmpeqv_trystorev_storev)(intptr_t *v, intptr_t
 #endif
                /* Start rseq by storing table entry pointer into rseq_cs. */
                RSEQ_ASM_STORE_RSEQ_CS(1, 3b, RSEQ_ASM_TP_SEGMENT:RSEQ_CS_OFFSET(%[rseq_offset]))
-               RSEQ_ASM_CMP_CPU_ID(cpu_id, RSEQ_ASM_TP_SEGMENT:RSEQ_TEMPLATE_CPU_ID_OFFSET(%[rseq_offset]), 4f)
+               RSEQ_ASM_CBNE_CPU_ID(cpu_id, RSEQ_ASM_TP_SEGMENT:RSEQ_TEMPLATE_CPU_ID_OFFSET(%[rseq_offset]), 4f)
                RSEQ_INJECT_ASM(3)
                "movl %[expect], %%eax\n\t"
                "cmpl %[v], %%eax\n\t"
                "jnz %l[cmpfail]\n\t"
                RSEQ_INJECT_ASM(4)
 #ifdef RSEQ_COMPARE_TWICE
-               RSEQ_ASM_CMP_CPU_ID(cpu_id, RSEQ_ASM_TP_SEGMENT:RSEQ_TEMPLATE_CPU_ID_OFFSET(%[rseq_offset]), %l[error1])
+               RSEQ_ASM_CBNE_CPU_ID(cpu_id, RSEQ_ASM_TP_SEGMENT:RSEQ_TEMPLATE_CPU_ID_OFFSET(%[rseq_offset]), %l[error1])
                "movl %[expect], %%eax\n\t"
                "cmpl %[v], %%eax\n\t"
                "jnz %l[error2]\n\t"
@@ -886,14 +886,14 @@ int RSEQ_TEMPLATE_IDENTIFIER(rseq_cmpeqv_trymemcpy_storev)(intptr_t *v, intptr_t
                "movl %[len], %[rseq_scratch2]\n\t"
                /* Start rseq by storing table entry pointer into rseq_cs. */
                RSEQ_ASM_STORE_RSEQ_CS(1, 3b, RSEQ_ASM_TP_SEGMENT:RSEQ_CS_OFFSET(%[rseq_offset]))
-               RSEQ_ASM_CMP_CPU_ID(cpu_id, RSEQ_ASM_TP_SEGMENT:RSEQ_TEMPLATE_CPU_ID_OFFSET(%[rseq_offset]), 4f)
+               RSEQ_ASM_CBNE_CPU_ID(cpu_id, RSEQ_ASM_TP_SEGMENT:RSEQ_TEMPLATE_CPU_ID_OFFSET(%[rseq_offset]), 4f)
                RSEQ_INJECT_ASM(3)
                "movl %[expect], %%eax\n\t"
                "cmpl %%eax, %[v]\n\t"
                "jnz 5f\n\t"
                RSEQ_INJECT_ASM(4)
 #ifdef RSEQ_COMPARE_TWICE
-               RSEQ_ASM_CMP_CPU_ID(cpu_id, RSEQ_ASM_TP_SEGMENT:RSEQ_TEMPLATE_CPU_ID_OFFSET(%[rseq_offset]), 6f)
+               RSEQ_ASM_CBNE_CPU_ID(cpu_id, RSEQ_ASM_TP_SEGMENT:RSEQ_TEMPLATE_CPU_ID_OFFSET(%[rseq_offset]), 6f)
                "movl %[expect], %%eax\n\t"
                "cmpl %%eax, %[v]\n\t"
                "jnz 7f\n\t"
index 9672cb8b379c98655d8c5800d4f2ef2f169b30bc..ecd75608cd019edcc3bb9928d1c8b1b4b328f067 100644 (file)
@@ -91,7 +91,7 @@ do {                                                                  \
                "movq %%rax, " __rseq_str(rseq_cs) "\n\t"               \
                __rseq_str(label) ":\n\t"
 
-#define RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, label)             \
+#define RSEQ_ASM_CBNE_CPU_ID(cpu_id, current_cpu_id, label)            \
                RSEQ_INJECT_ASM(2)                                      \
                "cmpl %[" __rseq_str(cpu_id) "], " __rseq_str(current_cpu_id) "\n\t" \
                "jnz " __rseq_str(label) "\n\t"
@@ -177,7 +177,7 @@ do {                                                                        \
                "movl $" __rseq_str(cs_label) ", " __rseq_str(rseq_cs) "\n\t"   \
                __rseq_str(label) ":\n\t"
 
-#define RSEQ_ASM_CMP_CPU_ID(cpu_id, current_cpu_id, label)             \
+#define RSEQ_ASM_CBNE_CPU_ID(cpu_id, current_cpu_id, label)            \
                RSEQ_INJECT_ASM(2)                                      \
                "cmpl %[" __rseq_str(cpu_id) "], " __rseq_str(current_cpu_id) "\n\t" \
                "jnz " __rseq_str(label) "\n\t"
This page took 0.173261 seconds and 4 git commands to generate.