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_tls_spill_restore(instr_t *instr, bool *spill, reg_id_t *reg, int *offs)
{
    opnd_t regop, memop;
    CLIENT_ASSERT(instr != NULL,
                  "internal error: tls spill/restore check: NULL argument");
    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_far_base_disp(memop) &&
        opnd_get_segment(memop) == SEG_TLS && 
        opnd_is_abs_base_disp(memop) &&
        opnd_is_reg(regop)) {
        if (reg != NULL)
            *reg = opnd_get_reg(regop);
        if (offs != NULL)
            *offs = opnd_get_disp(memop);
        return true;
    }
    return false;
}
static bool instr_check_tls_spill_restore ( instr_t * instr , bool * spill , reg_id_t * reg , int * offs ) { opnd_t regop , memop ; CLIENT_ASSERT ( instr != NULL , " " ) ; 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_far_base_disp ( memop ) && opnd_get_segment ( memop ) == SEG_TLS && opnd_is_abs_base_disp ( memop ) && opnd_is_reg ( regop ) ) { if ( reg != NULL ) * reg = opnd_get_reg ( regop ) ; if ( offs != NULL ) * offs = opnd_get_disp ( memop ) ; return true ; } return false ; }
this routine may upgrade a level 1 instr
this routine may upgrade a level 1 instr
/* we use xchg to restore in dr_insert_mbr_instrumentation */