예제 #1
0
void DbgForgetScope(            // SCOPE is useless, so don't dump it
    SCOPE forget_me )
{
    SCOPE_DEFN *going_away;

    going_away = RingLookup( scopes, findScope, forget_me );
    RingDealloc( &scopes, going_away );
}
예제 #2
0
static void DoGroupLeader( void *_seg )
/*************************************/
{
    offset      start;
    seg_leader *seg = _seg;

    start = SEG_GROUP_DELTA( seg );
    RingLookup( seg->pieces, WriteSegData, &start );
}
예제 #3
0
void WriteStringTable( stringtable *strtab,
                              void (*fn)(void *, char *,unsigned), void *info )
/*****************************************************************************/
{
    strblkparam param;

    param.fn = fn;
    param.info = info;
    RingLookup( strtab->data, WriteStringBlock, &param );
}
예제 #4
0
static bool DoCOMGroup( void *_seg, void *chop )
/**********************************************************/
{
    seg_leader *seg = _seg;
    signed long newstart;

    newstart = *(signed long *)chop + GetLeaderDelta( seg );
    RingLookup( seg->pieces, WriteSegData, &newstart );
    return( FALSE );
}
예제 #5
0
static bool DoCOMGroup( void *_seg, void *chop )
/**********************************************/
{
    seg_leader  *seg = _seg;
    soffset     newstart;

    newstart = *(soffset *)chop + SEG_GROUP_DELTA( seg );
    RingLookup( seg->pieces, WriteSegData, &newstart );
    return( false );
}
예제 #6
0
static PC_SEGMENT *segmentDefine(// SEGMENT: DEFINE IF REQUIRED
    const char *seg_name,       // - segment name
    const char *class_name,     // - segment class name
    fe_seg_id seg_id,           // - segment id (if not SEG_NULL)
    unsigned attrs,             // - segment attributes
    unsigned control )          // - segmentAlloc control mask
{
    PC_SEGMENT *curr;           // - current segment
    struct seg_look lk;         // - look-up structure
#if _INTEL_CPU
    const char* pc_reg;         // - scans register bound to segment
    char pc_reg_name[8];        // - name of pc register

    for( pc_reg = seg_name; ; ++pc_reg ) {
        if( *pc_reg == '\0' ) {
            pc_reg_name[0] = '\0';
            break;
        }
        if( *pc_reg == ':' ) {
            stvcpy( pc_reg_name, seg_name, pc_reg - seg_name );
            seg_name = pc_reg + 1;
            break;
        }
    }
#endif
    lk.seg_id = seg_id;
    lk.use_seg_id = TRUE;
    lk.attrs = attrs;
    lk.use_attrs = TRUE;
    lk.use_align = FALSE;
    lk.use_sym_size_align = FALSE;
    lk.seg_name = seg_name;
    lk.class_name = class_name;
    lk.use_name = TRUE;
    lk.use_only_strings = FALSE;
    curr = RingLookup( seg_list, &same_segment, &lk );
    if( curr == NULL ) {
        curr = segmentAlloc( lk.seg_name, lk.class_name, lk.seg_id, lk.attrs, control );
#if _INTEL_CPU
        if( pc_reg_name[0] != '\0' ) {
            curr->binding = PragRegName( pc_reg_name );
        }
#endif
    }
    return curr;
}
예제 #7
0
static fe_seg_id findFarSegment(// SEGMENT: ADD SYMBOL TO FAR SEGMENT
    target_size_t size,         // - size of symbol
    target_offset_t align,      // - alignment of symbol
    unsigned ads_control )      // - addDefSeg control word
{
    PC_SEGMENT *curr;           // - new segment
    struct seg_look lk;         // - look-up structure

    lk.use_seg_id = FALSE;
    if( ads_control & ADS_CODE_SEGMENT ) {
        lk.attrs = SGAT_CODE_BASED;
    } else if( ads_control & ADS_CONST_SEGMENT ) {
        lk.attrs = SGAT_DATA_PRIVATE_RO;
    } else {
        lk.attrs = SGAT_DATA_PRIVATE_RW;
    }
    lk.use_attrs = TRUE;
    lk.use_align = FALSE;
    lk.sym_size = size;
    lk.sym_align = align;
    lk.use_sym_size_align = TRUE;
    lk.use_name = FALSE;
    lk.use_only_strings = FALSE;
    if( ads_control & ADS_STRING_SEGMENT ) {
        lk.use_only_strings = TRUE;
    }
    curr = RingLookup( seg_list, &same_segment, &lk );
    if( curr == NULL ) {
        if( ads_control & ADS_CODE_SEGMENT ) {
            curr = addDefSeg( &code_def_seg, ads_control );
            code_def_seg.ds_used = TRUE;
        } else {
            curr = addDefSeg( &data_def_seg, ads_control );
            data_def_seg.ds_used = TRUE;
        }
    }
    curr->offset += SegmentAdjust( curr->seg_id, curr->offset, align );
    curr->offset += size;
    accumAlignment( curr, align );
    _markUsed( curr, TRUE );
    curr->has_data = TRUE;
    return( curr->seg_id );
}
예제 #8
0
static void CleanAltDefs( symbol *sym )
/*************************************/
{
    symbol *    testring;
    symbol *    altsym;

    if( IS_SYM_ALIAS( sym ) || sym->info & SYM_DEAD || sym->u.altdefs == NULL )
        return;
    testring = NULL;
    while( (altsym = RingPop( &sym->u.altdefs)) != NULL ) {
        if( altsym->info & SYM_KILL ) {
            if( altsym->info & SYM_HAS_DATA ) {
                altsym->u.datasym = NULL;
                RingAppend( &testring, altsym );
            }
        } else if( !(altsym->info & SYM_HAS_DATA) ) {
            RingLookup( testring, SetNewDataSym, altsym );
        }
    }
}