Skip to content

Commit 6d1a6f4

Browse files
VincentZWCpalmer-dabbelt
authored andcommitted
rseq/selftests: Add support for RISC-V
Add support for RISC-V in the rseq selftests, which covers both 64-bit and 32-bit ISA with little endian mode. Signed-off-by: Vincent Chen <[email protected]> Tested-by: Eric Lin <[email protected]> Reviewed-by: Mathieu Desnoyers <[email protected]> Signed-off-by: Palmer Dabbelt <[email protected]>
1 parent 93917ad commit 6d1a6f4

File tree

3 files changed

+702
-0
lines changed

3 files changed

+702
-0
lines changed

tools/testing/selftests/rseq/param_test.c

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,29 @@ unsigned int yield_mod_cnt, nr_abort;
207207
"addiu " INJECT_ASM_REG ", -1\n\t" \
208208
"bnez " INJECT_ASM_REG ", 222b\n\t" \
209209
"333:\n\t"
210+
#elif defined(__riscv)
211+
212+
#define RSEQ_INJECT_INPUT \
213+
, [loop_cnt_1]"m"(loop_cnt[1]) \
214+
, [loop_cnt_2]"m"(loop_cnt[2]) \
215+
, [loop_cnt_3]"m"(loop_cnt[3]) \
216+
, [loop_cnt_4]"m"(loop_cnt[4]) \
217+
, [loop_cnt_5]"m"(loop_cnt[5]) \
218+
, [loop_cnt_6]"m"(loop_cnt[6])
219+
220+
#define INJECT_ASM_REG "t1"
221+
222+
#define RSEQ_INJECT_CLOBBER \
223+
, INJECT_ASM_REG
224+
225+
#define RSEQ_INJECT_ASM(n) \
226+
"lw " INJECT_ASM_REG ", %[loop_cnt_" #n "]\n\t" \
227+
"beqz " INJECT_ASM_REG ", 333f\n\t" \
228+
"222:\n\t" \
229+
"addi " INJECT_ASM_REG "," INJECT_ASM_REG ", -1\n\t" \
230+
"bnez " INJECT_ASM_REG ", 222b\n\t" \
231+
"333:\n\t"
232+
210233

211234
#else
212235
#error unsupported target

0 commit comments

Comments
 (0)