Пример #1
0
static bool dirFuncSpace( directive_t *dir, dir_table_enum parm )
//***************************************************************
{
    dir_operand                 *dirop;
    int_32                      count;

    /* unused parameters */ (void)parm;

    if( !dirNumOperandsVerify( dir->num_operands, 1 ) ) {
        return( true );
    }
    dirop = dir->operand_list;
    assert( dirop->type == DIROP_INTEGER );
    count = NUMBER_INTEGER( dirop );
    if( count < 0 ) {
        Error( OP_OUT_OF_RANGE, 0 );
        return( true );
    }
#ifdef _STANDALONE_
    ObjNullPad( CurrentSection, (uint_8)count );
#else
    ObjNullPad( (uint_8)count );
#endif
    return( true );
}
Пример #2
0
owl_offset ObjAlign( owl_section_handle section, uint_8 alignment ) {
//*******************************************************************
// Aligns the offset to 2^alignment boundary. Returns the offset for
// convenience.

    owl_offset  offset;

    offset = OWLTellOffset( section );
    if( alignment == 0 ) return( offset );    // alignment disabled
    alignment = 1 << alignment;
    alignment = ( alignment - ( offset % alignment ) ) % alignment;
    if( alignment == 0 ) return( offset );
    if( OWLTellSectionType( section ) & OWL_SEC_ATTR_CODE ) {
        ObjNopPad( section, alignment / 4 );
        _DBGMSG2( "Align: %d nops emitted\n", alignment / 4 );
        ObjNullPad( section, alignment % 4 );
        _DBGMSG2( "Align: %d nulls emitted\n", alignment % 4 );
    } else {
        ObjNullPad( section, alignment );
        _DBGMSG2( "Align: %d nulls emitted\n", alignment );
    }
    assert( offset + alignment == OWLTellOffset( section ) );
    return( offset + alignment );
}
Пример #3
0
extern owl_offset ObjAlign( uint_8 alignment ) {
//**********************************************
// Aligns the offset to 2^alignment boundary. Returns the offset for
// convenience.

    owl_offset  offset;

    offset = tellOffset();
    if( alignment == 0 ) return( offset );    // alignment disabled
    alignment = 1 << alignment;
    alignment = ( alignment - ( offset % alignment ) ) % alignment;
    if( alignment == 0 ) return( offset );
    ObjNopPad( alignment / 4 );
    ObjNullPad( alignment % 4 );
    assert( offset + alignment == tellOffset() );
    return( offset + alignment );
}