|
From: Petar J. <pe...@so...> - 2020-04-17 18:39:13
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=6f84421546eaf0eae3c303a62ae133387fe1a706 commit 6f84421546eaf0eae3c303a62ae133387fe1a706 Author: Aleksandar Rikalo <ale...@rt...> Date: Fri Apr 17 18:38:11 2020 +0000 mips: fix helgrind/tests/annotate_hbefore for nanoMIPS Implement do_acasW() function for nanoMIPS. Diff: --- helgrind/tests/annotate_hbefore.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) 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 |