From ef21a8dbd0947b2b2ef930e30f41a977666dd05d Mon Sep 17 00:00:00 2001 From: Gregory Hainaut Date: Sat, 16 Jan 2016 23:17:04 +0100 Subject: [PATCH] x86emitter: extend group8 type --- common/include/x86emitter/implement/test.h | 9 +++++---- common/src/x86emitter/groups.cpp | 15 +++++++++------ 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/common/include/x86emitter/implement/test.h b/common/include/x86emitter/implement/test.h index 9a43bc7c5e..0e99d81367 100644 --- a/common/include/x86emitter/implement/test.h +++ b/common/include/x86emitter/implement/test.h @@ -61,11 +61,12 @@ struct xImpl_Group8 { G8Type InstType; - void operator()( const xRegister32& bitbase, const xRegister32& bitoffset ) const; - void operator()( const xRegister16& bitbase, const xRegister16& bitoffset ) const; - void operator()( const xRegister16or32& bitbase, u8 bitoffset ) const; + void operator()( const xRegister16or32or64& bitbase, const xRegister16or32or64& bitoffset ) const; + void operator()( const xRegister16or32or64& bitbase, u8 bitoffset ) const; - void operator()( const xIndirectVoid& bitbase, const xRegister16or32& bitoffset ) const; + void operator()( const xIndirectVoid& bitbase, const xRegister16or32or64& bitoffset ) const; + + void operator()( const xIndirect64& bitbase, u8 bitoffset ) const; void operator()( const xIndirect32& bitbase, u8 bitoffset ) const; void operator()( const xIndirect16& bitbase, u8 bitoffset ) const; }; diff --git a/common/src/x86emitter/groups.cpp b/common/src/x86emitter/groups.cpp index 0517525c70..77aec28646 100644 --- a/common/src/x86emitter/groups.cpp +++ b/common/src/x86emitter/groups.cpp @@ -259,19 +259,22 @@ const xImpl_iMul xMUL = { { 0x00, 0x59 }, { 0x66, 0x59 }, { 0xf3, 0x59 }, { 0xf2 // Group 8 Instructions // ===================================================================================================== -void xImpl_Group8::operator()( const xRegister32& bitbase, const xRegister32& bitoffset ) const { xOpWrite0F( 0xa3 | (InstType << 3), bitbase, bitoffset ); } -void xImpl_Group8::operator()( const xRegister16& bitbase, const xRegister16& bitoffset ) const { xOpWrite0F( 0x66, 0xa3 | (InstType << 3), bitbase, bitoffset ); } +void xImpl_Group8::operator()( const xRegister16or32or64& bitbase, const xRegister16or32or64& bitoffset ) const { + pxAssert( bitbase->GetOperandSize() == bitoffset->GetOperandSize() ); + xOpWrite0F( bitbase->GetPrefix16(), 0xa3 | (InstType << 3), bitbase, bitoffset ); +} +void xImpl_Group8::operator()( const xIndirect64& bitbase, u8 bitoffset ) const { xOpWrite0F( 0xba, InstType, bitbase, bitoffset ); } void xImpl_Group8::operator()( const xIndirect32& bitbase, u8 bitoffset ) const { xOpWrite0F( 0xba, InstType, bitbase, bitoffset ); } void xImpl_Group8::operator()( const xIndirect16& bitbase, u8 bitoffset ) const { xOpWrite0F( 0x66, 0xba, InstType, bitbase, bitoffset ); } -void xImpl_Group8::operator()( const xRegister16or32& bitbase, u8 bitoffset ) const +void xImpl_Group8::operator()( const xRegister16or32or64& bitbase, u8 bitoffset ) const { - xOpWrite0F( (bitbase->GetOperandSize() == 2) ? 0x66 : 0x00, 0xba, InstType, bitbase, bitoffset ); + xOpWrite0F( bitbase->GetPrefix16(), 0xba, InstType, bitbase, bitoffset ); } -void xImpl_Group8::operator()( const xIndirectVoid& bitbase, const xRegister16or32& bitoffset ) const +void xImpl_Group8::operator()( const xIndirectVoid& bitbase, const xRegister16or32or64& bitoffset ) const { - xOpWrite0F( (bitoffset->GetOperandSize() == 2) ? 0x66 : 0x00, 0xa3 | (InstType << 3), bitoffset, bitbase ); + xOpWrite0F( bitoffset->GetPrefix16(), 0xa3 | (InstType << 3), bitoffset, bitbase ); } const xImpl_Group8 xBT = { G8Type_BT };