Skip to content

Commit

Permalink
rseq/selftests: Add support for OpenRISC
Browse files Browse the repository at this point in the history
Add support for OpenRISC in the rseq selftests.  OpenRISC is 32-bit
only.

Tested this with:

    Compiler:  gcc version 14.2.0 (GCC)
    Binutils:  GNU assembler version 2.43.1 (or1k-smh-linux-gnu) using BFD version (GNU Binutils) 2.43.1.20241207
    Linux:     Linux buildroot 6.13.0-rc2-00005-g1fa73dd6c2d3-dirty torvalds#213 SMP Sat Dec 28 22:18:39 GMT 2024 openrisc GNU/Linux
    Glibc:     2024-12-13 e4e49583d9 Stafford Horne   or1k: Update libm-test-ulps

Signed-off-by: Stafford Horne <[email protected]>
Reviewed-by: Mathieu Desnoyers <[email protected]>
  • Loading branch information
stffrdhrn committed Jan 11, 2025
1 parent 25dafd9 commit 5484ebe
Show file tree
Hide file tree
Showing 6 changed files with 634 additions and 0 deletions.
24 changes: 24 additions & 0 deletions tools/testing/selftests/rseq/param_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,32 @@ unsigned int yield_mod_cnt, nr_abort;
"addi " INJECT_ASM_REG "," INJECT_ASM_REG ", -1\n\t" \
"bnez " INJECT_ASM_REG ", 222b\n\t" \
"333:\n\t"
#elif defined(__or1k__)

#define RSEQ_INJECT_INPUT \
, [loop_cnt_1]"m"(loop_cnt[1]) \
, [loop_cnt_2]"m"(loop_cnt[2]) \
, [loop_cnt_3]"m"(loop_cnt[3]) \
, [loop_cnt_4]"m"(loop_cnt[4]) \
, [loop_cnt_5]"m"(loop_cnt[5]) \
, [loop_cnt_6]"m"(loop_cnt[6])

#define INJECT_ASM_REG "r31"

#define RSEQ_INJECT_CLOBBER \
, INJECT_ASM_REG

#define RSEQ_INJECT_ASM(n) \
"l.lwz " INJECT_ASM_REG ", %[loop_cnt_" #n "]\n\t" \
"l.sfeqi " INJECT_ASM_REG ", 0\n\t" \
"l.bf 333f\n\t" \
" l.nop\n\t" \
"222:\n\t" \
"l.addi " INJECT_ASM_REG "," INJECT_ASM_REG ", -1\n\t" \
"l.sfeqi " INJECT_ASM_REG ", 0\n\t" \
"l.bf 222f\n\t" \
" l.nop\n\t" \
"333:\n\t"
#else
#error unsupported target
#endif
Expand Down
Loading

0 comments on commit 5484ebe

Please sign in to comment.