From 5916485e9ee38950f3d9a893fad6098af4cb2c78 Mon Sep 17 00:00:00 2001 From: Samy Al Bahra Date: Mon, 23 Sep 2013 23:34:28 -0400 Subject: [PATCH] ck_pr/arm: Implement support for Thumb 2 and fix incorrect CAS behavior. Besides implementing Thumb 2 supports, this fixes incorrect usage of "cmp" where "cmpeq" was meant. Patch submitted by Olivier Houchard . --- build/ck.build.arm | 2 +- include/gcc/arm/ck_pr.h | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/build/ck.build.arm b/build/ck.build.arm index 414a0b1..3fa739c 100644 --- a/build/ck.build.arm +++ b/build/ck.build.arm @@ -1 +1 @@ -CFLAGS+=-D__arm__ -marm +CFLAGS+=-D__arm__ diff --git a/include/gcc/arm/ck_pr.h b/include/gcc/arm/ck_pr.h index 8ebc205..3a8f566 100644 --- a/include/gcc/arm/ck_pr.h +++ b/include/gcc/arm/ck_pr.h @@ -151,6 +151,7 @@ ck_pr_cas_ptr_value(void *target, void *compare, void *set, void *value) __asm__ __volatile__("1:" "ldrex %0, [%2];" "cmp %0, %4;" + "itt eq;" "strexeq %1, %3, [%2];" "cmpeq %1, #1;" "beq 1b;" @@ -171,6 +172,7 @@ ck_pr_cas_ptr(void *target, void *compare, void *set) __asm__ __volatile__("1:" "ldrex %0, [%2];" "cmp %0, %4;" + "itt eq;" "strexeq %1, %3, [%2];" "cmpeq %1, #1;" "beq 1b;" @@ -191,6 +193,7 @@ ck_pr_cas_ptr(void *target, void *compare, void *set) __asm__ __volatile__("1:" \ "ldrex" W " %0, [%2];" \ "cmp %0, %4;" \ + "itt eq;" \ "strex" W "eq %1, %3, [%2];" \ "cmpeq %1, #1;" \ "beq 1b;" \ @@ -214,8 +217,9 @@ ck_pr_cas_ptr(void *target, void *compare, void *set) __asm__ __volatile__("1:" \ "ldrex" W " %0, [%2];" \ "cmp %0, %4;" \ + "itt eq;" \ "strex" W "eq %1, %3, [%2];" \ - "cmp %1, #1;" \ + "cmpeq %1, #1;" \ "beq 1b;" \ : "+&r" (previous), \ "+&r" (tmp) \