diff --git a/tcg/tcg-op-ldst.c b/tcg/tcg-op-ldst.c index 4e94c064bf..03be92f9d0 100644 --- a/tcg/tcg-op-ldst.c +++ b/tcg/tcg-op-ldst.c @@ -31,6 +31,12 @@ #include "exec/plugin-gen.h" #include "tcg-internal.h" +//// --- Begin LibAFL code --- + +void libafl_gen_read(TCGTemp *addr, MemOpIdx oi); +void libafl_gen_write(TCGTemp *addr, MemOpIdx oi); + +//// --- End LibAFL code --- static void check_max_alignment(unsigned a_bits) { @@ -175,13 +181,6 @@ plugin_gen_mem_callbacks(TCGv_i64 copy_addr, TCGTemp *orig_addr, MemOpIdx oi, #endif } -//// --- Begin LibAFL code --- - -void libafl_gen_read(TCGTemp *addr, MemOpIdx oi); -void libafl_gen_write(TCGTemp *addr, MemOpIdx oi); - -//// --- End LibAFL code --- - static void tcg_gen_qemu_ld_i32_int(TCGv_i32 val, TCGTemp *addr, TCGArg idx, MemOp memop) { diff --git a/tcg/tcg-op-vec.c b/tcg/tcg-op-vec.c index 094298bb27..bcbb1e5139 100644 --- a/tcg/tcg-op-vec.c +++ b/tcg/tcg-op-vec.c @@ -24,6 +24,13 @@ #include "tcg/tcg-mo.h" #include "tcg-internal.h" +//// --- Begin LibAFL code --- + +void libafl_gen_read(TCGTemp *addr, MemOpIdx oi); +void libafl_gen_write(TCGTemp *addr, MemOpIdx oi); + +//// --- End LibAFL code --- + /* * Vector optional opcode tracking. * Except for the basic logical operations (and, or, xor), and @@ -276,12 +283,34 @@ static void vec_gen_ldst(TCGOpcode opc, TCGv_vec r, TCGv_ptr b, TCGArg o) void tcg_gen_ld_vec(TCGv_vec r, TCGv_ptr b, TCGArg o) { +//// --- Begin LibAFL code --- + TCGArg ri = tcgv_vec_arg(r); + TCGTemp *rt = arg_temp(ri); + TCGType type = rt->base_type; + MemOpIdx oi = make_memop_idx((type - TCG_TYPE_V64) + MO_64, 0); +//// --- End LibAFL code --- + vec_gen_ldst(INDEX_op_ld_vec, r, b, o); + +//// --- Begin LibAFL code --- + libafl_gen_read(tcgv_ptr_temp(b), oi); +//// --- End LibAFL code --- } void tcg_gen_st_vec(TCGv_vec r, TCGv_ptr b, TCGArg o) { +//// --- Begin LibAFL code --- + TCGArg ri = tcgv_vec_arg(r); + TCGTemp *rt = arg_temp(ri); + TCGType type = rt->base_type; + MemOpIdx oi = make_memop_idx((type - TCG_TYPE_V64) + MO_64, 0); +//// --- End LibAFL code --- + vec_gen_ldst(INDEX_op_st_vec, r, b, o); + +//// --- Begin LibAFL code --- + libafl_gen_write(tcgv_ptr_temp(b), oi); +//// --- End LibAFL code --- } void tcg_gen_stl_vec(TCGv_vec r, TCGv_ptr b, TCGArg o, TCGType low_type)