x86emitter: finally support 64 bits instructions

Note: a couple of instructions don't support REX prefix. Some
exception ought to be implemented later
This commit is contained in:
Gregory Hainaut 2016-01-17 17:02:38 +01:00
parent 40438cf2bd
commit 41a80fce20
2 changed files with 13 additions and 5 deletions

View File

@ -50,10 +50,10 @@ namespace x86Emitter {
template< typename T1, typename T2 > __emitinline
void xOpWrite( u8 prefix, u8 opcode, const T1& param1, const T2& param2 )
{
if( prefix != 0 )
xWrite16( (opcode<<8) | prefix );
else
xWrite8( opcode );
if( prefix != 0 ) xWrite8( prefix );
EmitRex( param1, param2 );
xWrite8( opcode );
EmitSibMagic( param1, param2 );
}
@ -62,6 +62,7 @@ namespace x86Emitter {
void xOpAccWrite( u8 prefix, u8 opcode, const T1& param1, const T2& param2 )
{
if( prefix != 0 ) xWrite8( prefix );
EmitRex( param1, param2 );
xWrite8( opcode );
}
@ -80,7 +81,11 @@ namespace x86Emitter {
template< typename T1, typename T2 > __emitinline
void xOpWrite0F( u8 prefix, u16 opcode, const T1& param1, const T2& param2 )
{
SimdPrefix( prefix, opcode );
if( prefix != 0 ) xWrite8( prefix );
EmitRex( param1, param2 );
SimdPrefix( 0, opcode );
EmitSibMagic( param1, param2 );
}

View File

@ -90,6 +90,9 @@ namespace x86Emitter {
//
__emitinline void SimdPrefix( u8 prefix, u16 opcode )
{
#ifdef __x86_64__
pxAssertMsg(prefix == 0, "REX prefix must be just before the opcode");
#endif
const bool is16BitOpcode = ((opcode & 0xff) == 0x38) || ((opcode & 0xff) == 0x3a);
// If the lower byte is not a valid prefix and the upper byte is non-zero it