2025-04-29 11:55:01 +02:00

27 lines
961 B
C

#include "dr_api.h"
#include "dr_ir_opcodes_x86.h"
static dr_emit_flags_t event_basic_block(void *drcontext, void *tag,
instrlist_t *bb, bool for_trace, bool translating);
DR_EXPORT void dr_client_main(client_id_t id, int argc, const char *argv[]) {
dr_set_client_name("MOV-to-NOP Client (No drmgr)", "https://dynamorio.org/");
dr_register_bb_event(event_basic_block);
dr_printf("MOV-to-NOP client loaded (no drmgr).\n");
}
static dr_emit_flags_t event_basic_block(void *drcontext, void *tag,
instrlist_t *bb, bool for_trace, bool translating) {
for (instr_t *instr = instrlist_first_app(bb);
instr != NULL;
instr = instr_get_next_app(instr)) {
int opcode = instr_get_opcode(instr);
if (opcode == OP_mov_st || opcode == OP_mov_ld) {
instr_set_opcode(instr, OP_nop);
}
}
return DR_EMIT_DEFAULT;
}