Home | History | Annotate | Download | only in msandr

Lines Matching refs:instr

215 bool WantToInstrument(instr_t *instr) {
217 switch (instr_get_opcode(instr)) {
225 if (instr_is_label(instr))
228 CHECK(instr_ok_to_mangle(instr) == true);
230 if (instr_writes_memory(instr)) {
231 for (int d = 0; d < instr_num_dsts(instr); d++) {
232 opnd_t op = instr_get_dst(instr, d);
244 void InstrumentMops(void *drcontext, instrlist_t *bb, instr_t *instr, opnd_t op,
247 uint flags = instr_get_arith_flags(instr);
259 dr_save_reg(drcontext, bb, instr, DR_REG_XAX, SPILL_SLOT_1);
260 dr_save_arith_flags_to_xax(drcontext, bb, instr);
261 dr_save_reg(drcontext, bb, instr, DR_REG_XAX, SPILL_SLOT_3);
262 dr_restore_reg(drcontext, bb, instr, DR_REG_XAX, SPILL_SLOT_1);
290 // It's OK if the instr uses R2 elsewhere, since we'll restore it before instr.
299 dr_save_reg(drcontext, bb, instr, R1, SPILL_SLOT_1);
301 dr_save_reg(drcontext, bb, instr, R2, SPILL_SLOT_2);
304 CHECK(drutil_insert_get_mem_addr(drcontext, bb, instr, op, R1, R2));
305 PRE(instr, mov_imm(drcontext, opnd_create_reg(R2),
307 PRE(instr, and(drcontext, opnd_create_reg(R1), opnd_create_reg(R2)));
309 PRE(instr, add(drcontext, opnd_create_reg(R1),
324 PRE(instr, cmp(drcontext,
327 PRE(instr, jcc(drcontext, OP_je, opnd_create_instr(label)));
328 PRE(instr, mov_st(drcontext,
331 PREF(instr, label);
337 PRE(instr, cmp(drcontext, OPND_CREATE_MEM32(R1, ofs), immed));
338 PRE(instr, jcc(drcontext, OP_je, opnd_create_instr(label)));
339 PRE(instr, mov_st(drcontext, OPND_CREATE_MEM32(R1, ofs), immed));
340 PREF(instr, label)
345 dr_restore_reg(drcontext, bb, instr, R1, SPILL_SLOT_1);
346 dr_restore_reg(drcontext, bb, instr, R2, SPILL_SLOT_2);
348 // TODO: move aflags save/restore to per instr instead of per opnd
353 dr_save_reg(drcontext, bb, instr, DR_REG_XAX, SPILL_SLOT_1);
354 dr_restore_reg(drcontext, bb, instr, DR_REG_XAX, SPILL_SLOT_3);
355 dr_restore_arith_flags_from_xax(drcontext, bb, instr);
356 dr_restore_reg(drcontext, bb, instr, DR_REG_XAX, SPILL_SLOT_1);
363 void InstrumentReturn(void *drcontext, instrlist_t *bb, instr_t *instr) {
365 PRE(instr,
377 PRE(instr,
386 dr_save_reg(drcontext, bb, instr, DR_REG_XAX, SPILL_SLOT_1);
390 dr_insert_get_seg_base(drcontext, bb, instr, DR_SEG_FS, DR_REG_XAX);
394 PRE(instr,
398 dr_restore_reg(drcontext, bb, instr, DR_REG_XAX, SPILL_SLOT_1);
406 instr_t *instr) {
409 PRE(instr,
422 PRE(instr,
433 dr_save_reg(drcontext, bb, instr, DR_REG_XAX, SPILL_SLOT_1);
437 dr_insert_get_seg_base(drcontext, bb, instr, DR_SEG_FS, DR_REG_XAX);
442 PRE(instr,
448 dr_restore_reg(drcontext, bb, instr, DR_REG_XAX, SPILL_SLOT_1);
556 instr_t *instr;
557 for (instr = instrlist_first(bb); instr; instr = instr_get_next(instr)) {
558 dr_printf("opcode: %d\n", instr_get_opcode(instr));