From: Aleksandar Rikalo Date: Fri, 17 Apr 2020 18:38:11 +0000 (+0000) Subject: mips: fix helgrind/tests/annotate_hbefore for nanoMIPS X-Git-Tag: VALGRIND_3_16_0~46 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6f84421546eaf0eae3c303a62ae133387fe1a706;p=thirdparty%2Fvalgrind.git mips: fix helgrind/tests/annotate_hbefore for nanoMIPS Implement do_acasW() function for nanoMIPS. --- diff --git a/helgrind/tests/annotate_hbefore.c b/helgrind/tests/annotate_hbefore.c index e53423b425..259d3b64c8 100644 --- a/helgrind/tests/annotate_hbefore.c +++ b/helgrind/tests/annotate_hbefore.c @@ -252,6 +252,35 @@ UWord do_acasW ( UWord* addr, UWord expected, UWord nyu ) return success; } +#elif defined(VGA_nanomips) + +/* return 1 if success, 0 if failure */ +UWord do_acasW ( UWord* addr, UWord expected, UWord nyu ) +{ + UWord success; + UWord block[3] = { (UWord)addr, nyu, expected}; + + __asm__ __volatile__( + "lw $t0, 0(%1)" "\n\t" + "lw $t2, 8(%1)" "\n\t" + "lw $t3, 4(%1)" "\n\t" + "ll $t1, 0($t0)" "\n\t" + "bnec $t1, $t2, 1f" "\n\t" + "sc $t3, 0($t0)" "\n\t" + "move %0, $t3" "\n\t" + "bc 2f" "\n\t" + "1:" "\n\t" + "move %0, $zero" "\n\t" + "2:" "\n\t" + : /*out*/ "=r"(success) + : /*in*/ "r"(&block[0]) + : /*trash*/ "t0", "t1", "t2", "t3", "memory" + ); + + assert(success == 0 || success == 1); + return success; +} + #elif defined(VGA_mips64) && !defined(VGABI_N32) // mips64