Skip to content

Commit 141d520

Browse files
committed
feat(riscv): add libafl support
1 parent 4cafaa9 commit 141d520

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

linux-user/riscv/cpu_loop.c

+21
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,34 @@ void cpu_loop(CPURISCVState *env)
3232
int trapnr;
3333
target_ulong ret;
3434

35+
//// --- Begin LibAFL code ---
36+
37+
libafl_exit_signal_vm_start();
38+
39+
//// --- End LibAFL code ---
40+
3541
for (;;) {
42+
43+
//// --- Begin LibAFL code ---
44+
45+
if (libafl_exit_asap()) return;
46+
47+
//// --- End LibAFL code ---
48+
3649
cpu_exec_start(cs);
3750
trapnr = cpu_exec(cs);
3851
cpu_exec_end(cs);
3952
process_queued_cpu_work(cs);
4053

4154
switch (trapnr) {
55+
56+
//// --- Begin LibAFL code ---
57+
58+
case EXCP_LIBAFL_EXIT:
59+
return;
60+
61+
//// --- End LibAFL code ---
62+
4263
case EXCP_INTERRUPT:
4364
/* just indicate that signals should be handled asap */
4465
break;

0 commit comments

Comments
 (0)