示例#1
0
void
_Compile_MOVZX_REG ( int32 reg )
{
    _Compile_Int8 ( ( byte ) 0x0f ) ;
    _Compile_Int8 ( 0xb6 ) ;
    _Compile_Int8 ( _CalculateModRmByte ( REG, reg, reg, 0, 0 ) ) ;
}
示例#2
0
void
_Compile_SET_tttn_REG ( int32 ttt, int32 negFlag, int32 reg )
{
    _Compiler_Setup_BI_tttn ( _Context_->Compiler0, ttt, negFlag ) ;
    _Compile_Int8 ( ( byte ) 0x0f ) ;
    _Compile_Int8 ( ( 0x9 << 4 ) | ( ttt << 1 ) | negFlag ) ;
    _Compile_Int8 ( _CalculateModRmByte ( REG, 0x00, reg, 0, 0 ) ) ;
}
示例#3
0
void
_Compile_JCC ( int32 negFlag, int32 ttt, uint32 disp )
{
    _Set_SCA ( 0 ) ;
    _Compile_Int8 ( 0xf ) ; // little endian ordering
    _Compile_Int8 ( 0x8 << 4 | ttt << 1 | negFlag ) ; // little endian ordering
    _Compile_Int32 ( disp ) ;
}
示例#4
0
void
_Compile_JCC ( int32 negFlag, int32 ttt, byte * jmpToAddr )
{
    unsigned int disp ;
    if ( jmpToAddr )
    {
        disp = _CalculateOffsetForCallOrJump ( Here + 1, jmpToAddr, 1 ) ;
    }
    else disp = 0 ; // allow this function to be used to have a delayed compile of the actual address
    _Compile_Int8 ( 0xf ) ; // little endian ordering
    _Compile_Int8 ( 0x8 << 4 | ttt << 1 | negFlag ) ; // little endian ordering
    _Compile_Int32 ( disp ) ;
}
示例#5
0
void
_Compile_ModRmSibDisplacement ( int32 modRm, int32 modRmFlag, int32 sib, int disp )
{
    if ( modRmFlag )
        _Compile_Int8 ( modRm ) ;
    if ( sib )
        _Compile_Int8 ( sib ) ; // sib = sib_modFlag if sib_modFlag > 1
    if ( modRmFlag )
    {
        if ( disp )
            _Compile_Displacement ( modRm, disp ) ;
    }
    else if ( disp )
        _Compile_Int32 ( disp ) ;
}
示例#6
0
void
_Compile_IMUL ( int32 mod, int32 reg, int32 rm, int32 sib, int32 disp )
{
    _Compile_Int8 ( 0x0f ) ;
    // _Compile_InstructionX86 ( opCode, mod, reg, rm, modFlag, sib, disp, imm, immSize )
    _Compile_InstructionX86 ( 0xaf, mod, reg, rm, 1, sib, disp, 0, 0 ) ;
}
示例#7
0
void
_Compile_UninitializedJump ( ) // runtime
{
    //_Set_SCA ( 0 ) ;
    _Compile_Int8 ( JMPI32 ) ;
    _Compile_Cell ( 0 ) ;
}
示例#8
0
void
_Compile_UninitializedCall ( ) // runtime
{
    _Set_SCA ( 0 ) ;
    _Compile_Int8 ( CALLI32 ) ;
    _Compile_Cell ( 0 ) ;
}
示例#9
0
void
_Compile_JumpWithOffset ( int32 disp ) // runtime
{
    //_Set_SCA ( 0 ) ;
    _Compile_Int8 ( JMPI32 ) ;
    _Compile_Cell ( disp ) ;
}
示例#10
0
void
_Compile_ImmediateData ( int32 imm, int32 immSize )
{
    // to not compile an imm when imm is a parameter, set isize == 0 and imm == 0
    if ( immSize > 0 )
    {
        if ( immSize == BYTE )
            _Compile_Int8 ( ( byte ) imm ) ;
        else if ( immSize == CELL )
            _Compile_Cell ( imm ) ;
    }
    else // with operandSize == 0 let the compiler use the minimal size ; nb. can't be imm == 0
    {
        if ( imm >= 0x100 )
            _Compile_Int32 ( imm ) ;
        else if ( imm )
            _Compile_Int8 ( ( byte ) imm ) ;
    }
}
示例#11
0
void
_Compile_InstructionX86 ( int opCode, int mod, int reg, int rm, int modFlag, int sib, int32 disp,
    int32 imm, int immSize )
{
    D0 ( byte *here = Here ) ;
    _Compile_Int8 ( ( byte ) opCode ) ;
    int32 modRm = _CalculateModRmByte ( mod, reg, rm, disp, sib ) ;
    _Compile_ModRmSibDisplacement ( modRm, modFlag, sib, disp ) ;
    _Compile_ImmediateData ( imm, immSize ) ;
    PeepHole_Optimize ( ) ;
    D0 ( if ( _CfrTil_->Debugger0 ) Debugger_UdisOneInstruction ( _CfrTil_->Debugger0, here, ( byte* ) "", ( byte* ) "" ) ; )
    }
示例#12
0
void
_Compile_IncDecPushPopReg ( int32 op, int32 reg )
{
    byte opCode ;
    if ( op == INC )
        opCode = 0x40 ;
    else if ( op == DEC )
        opCode = 0x48 ;
    if ( op == PUSH )
        opCode = 0x40 ;
    else if ( op == POP )
        opCode = 0x48 ;
    opCode += reg ;
    _Compile_Int8 ( opCode ) ;
}
示例#13
0
void
_Compile_Displacement ( int32 modRm, int32 disp )
{
    int32 mod = modRm & 0xc0 ; // 1100 0000
    int32 reg = modRm & 0x38 ; // 0011 1000
    if ( ( ( ( mod == 0 ) && ( reg != ESP ) && disp ) ) || ( ( mod == 1 ) && ( disp >= 0x100 ) )
        || ( ( mod == 2 ) && ( disp <= 0xff ) ) )
    {
        CfrTil_Exception ( MACHINE_CODE_ERROR, 1 ) ;
    }
    else if ( disp )
    {
        if ( disp >= 0x100 )
            _Compile_Int32 ( disp ) ;
        else
            _Compile_Int8 ( ( byte ) disp ) ;
    }
}
示例#14
0
void
_Compile_PopToReg ( int32 reg )
{
    // only EAX ECX EDX EBX : 0 - 4
    _Compile_Int8 ( 0x58 + reg ) ;
}
示例#15
0
void
_Compile_Noop ( )
{
    _Compile_Int8 ( 0x90 ) ;
}
示例#16
0
void
_Compile_PushReg ( int32 reg )
{
    // only EAX ECX EDX EBX : 0 - 4
    _Compile_Int8 ( 0x50 + reg ) ;
}
示例#17
0
void
_Compile_INT3 ( )
{
    _Compile_Int8 ( 0xcc ) ;
}
示例#18
0
void
_Compile_INT80 ( )
{
    _Compile_Int8 ( 0xcd ) ;
    _Compile_Int8 ( 0x80 ) ;
}
示例#19
0
void
_Compile_Lahf ( )
{
    _Compile_Int8 ( 0x9f ) ;
}
示例#20
0
void
_Compile_IRET ( )
{
    _Compile_Int8 ( 0xcf ) ;
}
示例#21
0
void
_Compile_Sahf ( )
{
    _Compile_Int8 ( 0x9e ) ;
}
示例#22
0
void
_Compile_PushFD ( )
{
    _Compile_Int8 ( 0x9c ) ;
}
示例#23
0
void
_Compile_PopFD ( )
{
    _Compile_Int8 ( 0x9d ) ;
}
示例#24
0
void
_Compile_PushAD ( )
{
    _Compile_Int8 ( 0x60 ) ;
}
示例#25
0
void
_Compile_PopAD ( )
{
    _Compile_Int8 ( 0x61 ) ;
}