Example #1
0
dip_status hllLocationManyReg( imp_image_handle *iih, unsigned count,
                               const unsigned_8 *reg_list,
                               location_context *lc, location_list *ll )
{
    unsigned            i;
    byte                j;
    unsigned            idx;
    const reg_entry     *reg;
    location_list       reg_ll;
    dip_status          ds;

    j = 0;
    for( i = count; i-- > 0; ) {
        idx = reg_list[i];
        switch( iih->mad ) {
        case MAD_X86:
            if( idx >= CV_X86_AL && idx <= CV_X86_EFLAGS ) {
                reg = &X86_CPURegTable[idx-CV_X86_AL];
            } else if( idx >= CV_X86_ST0 && idx <= CV_X86_STATUS ) {
                reg = &X86_FPURegTable[idx-CV_X86_ST0];
            } else {
                DCStatus( DS_ERR | DS_FAIL );
                return( DS_ERR | DS_FAIL );
            }
            break;
        case MAD_AXP:
            if( !(idx >= CV_AXP_f0 && idx <= CV_AXP_fltfsr) ) {
                DCStatus( DS_ERR | DS_FAIL );
                return( DS_ERR | DS_FAIL );
            }
            reg = &AXP_RegTable[idx-CV_AXP_f0];
            if( reg->ci == CI_LAST ) {
                DCStatus( DS_ERR | DS_FAIL );
                return( DS_ERR | DS_FAIL );
            }
            break;
        default:
            DCStatus( DS_ERR | DS_FAIL );
            return( DS_ERR | DS_FAIL );
        }
        ds = DCItemLocation( lc, reg->ci, &reg_ll );
        if( ds != DS_OK ) {
            DCStatus( ds );
            return( ds );
        }
        memcpy( &ll->e[j], &reg_ll.e[0], reg_ll.num * sizeof( reg_ll.e[0] ) );
        ll->e[j].bit_start += BYTES2BITS( reg->start );
        ll->e[j].bit_length = BYTES2BITS( reg->len );
        j += reg_ll.num;
        ll->flags |= reg_ll.flags;
    }
    ll->num = j;
    return( DS_OK );
}
Example #2
0
dip_status hllDoIndirection( imp_image_handle *ii, type_info *ti,
                             location_context *lc, location_list *ll )
{
    union {
        unsigned_8      u8;
        unsigned_16     u16;
        unsigned_32     u32;
        addr32_off      ao32;
        addr48_off      ao48;
        addr32_ptr      ap32;
        addr48_ptr      ap48;
    }                   tmp;
    location_list       dst;
    dip_status          ds;

    ii = ii;
    hllLocationCreate( &dst, LT_INTERNAL, &tmp );
    ds = DCAssignLocation( &dst, ll, ti->size );
    if( ds != DS_OK ) return( ds );
    ds = DCItemLocation( lc, CI_DEF_ADDR_SPACE, ll );
    if( ds != DS_OK ) return( ds );
    if( ti->modifier == TM_NEAR ) {
        if( ti->size == sizeof( addr32_off ) ) {
            ll->e[0].u.addr.mach.offset = tmp.ao32;
        } else {
            ll->e[0].u.addr.mach.offset = tmp.ao48;
        }
    } else {
        if( ti->size == sizeof( addr32_ptr ) ) {
            ll->e[0].u.addr.mach.offset = tmp.ap32.offset;
            ll->e[0].u.addr.mach.segment = tmp.ap32.segment;
        } else {
            ll->e[0].u.addr.mach.offset = tmp.ap48.offset;
            ll->e[0].u.addr.mach.segment = tmp.ap48.segment;
        }
    }
    return( DS_OK );
}
Example #3
0
     if( acc & ACC_STATIC ) {
         a = DefDataAddr;
         switch( GetU8( sig ) ) {
         case SIGNATURE_LONG:
         case SIGNATURE_DOUBLE:
             a.mach.offset = GetPointer( is->u.fb
                         + offsetof( struct fieldblock, u.static_address ) );
             break;
         default:
             a.mach.offset = is->u.fb
                         + offsetof( struct fieldblock, u.static_value );
             break;
         }
         LocationCreate( ll, LT_ADDR, &a );
     } else {
         ds = DCItemLocation( lc, CI_OBJECT, ll );
         if( ds != DS_OK ) return( ds );
         off = GetU32( is->u.fb + offsetof( struct fieldblock, u.offset ) );
         LocationAdd( ll, off * 8 );
     }
     break;
 case JS_LOCAL:
     ds = DCItemLocation( lc, CI_JVM_vars, &var );
     if( ds != DS_OK ) return( ds );
     a = DefDataAddr;
     LocationCreate( ll, LT_INTERNAL, &a.mach.offset );
     ds = DCAssignLocation( ll, &var, sizeof( a.mach.offset ) );
     if( ds != DS_OK ) return( ds );
     a.mach.offset += GetU32( is->u.lv + offsetof( struct localvar, slot ) )
                             * sizeof( unsigned_32 );
     LocationCreate( ll, LT_ADDR, &a );