core/x86/instr.c
/* this routine may upgrade a level 1 instr */
this routine may upgrade a level 1 instr
this routine may upgrade a level 1 instr
static bool
instr_check_mcontext_spill_restore(dcontext_t *dcontext, instr_t *instr,
                                   bool *spill, reg_id_t *reg, int *offs)
{
#ifdef X64
    return false;
#else
    opnd_t regop, memop;
    if (instr_get_opcode(instr) == OP_mov_st) {
        regop = instr_get_src(instr, 0);
        memop = instr_get_dst(instr, 0);
        if (spill != NULL)
            *spill = true;
    } else if (instr_get_opcode(instr) == OP_mov_ld) {
        regop = instr_get_dst(instr, 0);
        memop = instr_get_src(instr, 0);
        if (spill != NULL)
            *spill = false;
    } else if (instr_get_opcode(instr) == OP_xchg) {
        regop = instr_get_src(instr, 0);
        memop = instr_get_dst(instr, 0);
        if (spill != NULL)
            *spill = false;
    } else
        return false;
    if (opnd_is_near_base_disp(memop) &&
        opnd_is_abs_base_disp(memop) &&
        opnd_is_reg(regop)) {
        byte *pc = (byte *) opnd_get_disp(memop);
        byte *mc = (byte *) get_mcontext(dcontext);
        if (pc >= mc && pc < mc + sizeof(dr_mcontext_t)) {
            if (reg != NULL)
                *reg = opnd_get_reg(regop);
            if (offs != NULL)
                *offs = pc - (byte *)dcontext;
            return true;
        }
    }
    return false;
#endif
}
static bool instr_check_mcontext_spill_restore ( dcontext_t * dcontext , instr_t * instr , bool * spill , reg_id_t * reg , int * offs ) { #ifdef X64 return false ; #else opnd_t regop , memop ; if ( instr_get_opcode ( instr ) == OP_mov_st ) { regop = instr_get_src ( instr , 0 ) ; memop = instr_get_dst ( instr , 0 ) ; if ( spill != NULL ) * spill = true ; } else if ( instr_get_opcode ( instr ) == OP_mov_ld ) { regop = instr_get_dst ( instr , 0 ) ; memop = instr_get_src ( instr , 0 ) ; if ( spill != NULL ) * spill = false ; } else if ( instr_get_opcode ( instr ) == OP_xchg ) { regop = instr_get_src ( instr , 0 ) ; memop = instr_get_dst ( instr , 0 ) ; if ( spill != NULL ) * spill = false ; } else return false ; if ( opnd_is_near_base_disp ( memop ) && opnd_is_abs_base_disp ( memop ) && opnd_is_reg ( regop ) ) { byte * pc = ( byte * ) opnd_get_disp ( memop ) ; byte * mc = ( byte * ) get_mcontext ( dcontext ) ; if ( pc >= mc && pc < mc + sizeof ( dr_mcontext_t ) ) { if ( reg != NULL ) * reg = opnd_get_reg ( regop ) ; if ( offs != NULL ) * offs = pc - ( byte * ) dcontext ; return true ; } } return false ; #endif }
this routine may upgrade a level 1 instr
this routine may upgrade a level 1 instr
/* PR 244737: we always use tls for x64 */ /* we use xchg to restore in dr_insert_mbr_instrumentation */