Пример #1
0
DR_EXPORT
bool
drmgr_insert_write_tls_field(void *drcontext, int idx,
                             instrlist_t *ilist, instr_t *where, reg_id_t reg,
                             reg_id_t scratch)
{
    tls_array_t *tls = (tls_array_t *) dr_get_tls_field(drcontext);
    if (idx < 0 || idx > MAX_NUM_TLS || !tls_taken[idx] || tls == NULL)
        return false;
    if (!reg_is_gpr(reg) || !reg_is_pointer_sized(reg) ||
        !reg_is_gpr(scratch) || !reg_is_pointer_sized(scratch))
        return false;
    dr_insert_read_tls_field(drcontext, ilist, where, scratch);
    instrlist_meta_preinsert(ilist, where, INSTR_CREATE_mov_st
                             (drcontext,
                              OPND_CREATE_MEMPTR(scratch, offsetof(tls_array_t, tls) +
                                                 idx*sizeof(void*)),
                               opnd_create_reg(reg)));
    return true;
}
Пример #2
0
bool
reg_is_shadowed(int opc, reg_id_t reg)
{
    /* i#471: we don't yet shadow floating-point regs */
    return reg_is_gpr(reg);
}