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 <cognet@freebsd>.
ck_pring
Samy Al Bahra 11 years ago
parent 45ddb96ecb
commit 5916485e9e

@ -1 +1 @@
CFLAGS+=-D__arm__ -marm CFLAGS+=-D__arm__

@ -151,6 +151,7 @@ ck_pr_cas_ptr_value(void *target, void *compare, void *set, void *value)
__asm__ __volatile__("1:" __asm__ __volatile__("1:"
"ldrex %0, [%2];" "ldrex %0, [%2];"
"cmp %0, %4;" "cmp %0, %4;"
"itt eq;"
"strexeq %1, %3, [%2];" "strexeq %1, %3, [%2];"
"cmpeq %1, #1;" "cmpeq %1, #1;"
"beq 1b;" "beq 1b;"
@ -171,6 +172,7 @@ ck_pr_cas_ptr(void *target, void *compare, void *set)
__asm__ __volatile__("1:" __asm__ __volatile__("1:"
"ldrex %0, [%2];" "ldrex %0, [%2];"
"cmp %0, %4;" "cmp %0, %4;"
"itt eq;"
"strexeq %1, %3, [%2];" "strexeq %1, %3, [%2];"
"cmpeq %1, #1;" "cmpeq %1, #1;"
"beq 1b;" "beq 1b;"
@ -191,6 +193,7 @@ ck_pr_cas_ptr(void *target, void *compare, void *set)
__asm__ __volatile__("1:" \ __asm__ __volatile__("1:" \
"ldrex" W " %0, [%2];" \ "ldrex" W " %0, [%2];" \
"cmp %0, %4;" \ "cmp %0, %4;" \
"itt eq;" \
"strex" W "eq %1, %3, [%2];" \ "strex" W "eq %1, %3, [%2];" \
"cmpeq %1, #1;" \ "cmpeq %1, #1;" \
"beq 1b;" \ "beq 1b;" \
@ -214,8 +217,9 @@ ck_pr_cas_ptr(void *target, void *compare, void *set)
__asm__ __volatile__("1:" \ __asm__ __volatile__("1:" \
"ldrex" W " %0, [%2];" \ "ldrex" W " %0, [%2];" \
"cmp %0, %4;" \ "cmp %0, %4;" \
"itt eq;" \
"strex" W "eq %1, %3, [%2];" \ "strex" W "eq %1, %3, [%2];" \
"cmp %1, #1;" \ "cmpeq %1, #1;" \
"beq 1b;" \ "beq 1b;" \
: "+&r" (previous), \ : "+&r" (previous), \
"+&r" (tmp) \ "+&r" (tmp) \

Loading…
Cancel
Save