From 53b5ecf34abdc9d86e9cc437d176fcef98b18e31 Mon Sep 17 00:00:00 2001 From: Gregory Hainaut Date: Sat, 16 Jan 2016 20:26:53 +0100 Subject: [PATCH] x86emitter: add the new x86_64 registers set --- common/include/x86emitter/x86types.h | 18 ++++++++---- common/src/x86emitter/x86emitter.cpp | 44 +++++++++++++++++++++++----- 2 files changed, 50 insertions(+), 12 deletions(-) diff --git a/common/include/x86emitter/x86types.h b/common/include/x86emitter/x86types.h index 887141af53..aeec007d23 100644 --- a/common/include/x86emitter/x86types.h +++ b/common/include/x86emitter/x86types.h @@ -546,12 +546,20 @@ template< typename T > void xWrite( T val ); extern const xRegisterSSE xmm0, xmm1, xmm2, xmm3, - xmm4, xmm5, xmm6, xmm7; + xmm4, xmm5, xmm6, xmm7, + xmm8, xmm9, xmm10, xmm11, + xmm12, xmm13, xmm14, xmm15; extern const xRegisterMMX mm0, mm1, mm2, mm3, mm4, mm5, mm6, mm7; + extern const xAddressReg + rax, rbx, rcx, rdx, + rsi, rdi, rbp, rsp, + r8, r9, r10, r11, + r12, r13, r14, r15; + extern const xAddressReg eax, ebx, ecx, edx, esi, edi, ebp, esp; @@ -570,10 +578,10 @@ template< typename T > void xWrite( T val ); { static const xRegisterSSE *const m_tbl_xmmRegs[] = { - &xmm0, &xmm1, - &xmm2, &xmm3, - &xmm4, &xmm5, - &xmm6, &xmm7 + &xmm0, &xmm1, &xmm2, &xmm3, + &xmm4, &xmm5, &xmm6, &xmm7, + &xmm8, &xmm9, &xmm10, &xmm11, + &xmm12, &xmm13, &xmm14, &xmm15 }; pxAssert(id < iREGCNT_XMM); diff --git a/common/src/x86emitter/x86emitter.cpp b/common/src/x86emitter/x86emitter.cpp index 14bac7c647..fc2f906c1b 100644 --- a/common/src/x86emitter/x86emitter.cpp +++ b/common/src/x86emitter/x86emitter.cpp @@ -110,7 +110,11 @@ const xRegisterSSE xmm0( 0 ), xmm1( 1 ), xmm2( 2 ), xmm3( 3 ), xmm4( 4 ), xmm5( 5 ), - xmm6( 6 ), xmm7( 7 ); + xmm6( 6 ), xmm7( 7 ), + xmm8( 8 ), xmm9( 9 ), + xmm10( 10 ), xmm11( 11 ), + xmm12( 12 ), xmm13( 13 ), + xmm14( 14 ), xmm15( 15 ); const xRegisterMMX mm0( 0 ), mm1( 1 ), @@ -118,6 +122,16 @@ const xRegisterMMX mm4( 4 ), mm5( 5 ), mm6( 6 ), mm7( 7 ); +const xAddressReg + rax( 0 ), rbx( 3 ), + rcx( 1 ), rdx( 2 ), + rsp( 4 ), rbp( 5 ), + rsi( 6 ), rdi( 7 ), + r8( 8 ) , r9( 9 ) , + r10( 10 ), r11( 11 ), + r12( 12 ), r13( 13 ), + r14( 14 ), r15( 15 ); + const xAddressReg eax( 0 ), ebx( 3 ), ecx( 1 ), edx( 2 ), @@ -144,25 +158,37 @@ const char *const x86_regnames_gpr8[8] = "ah", "ch", "dh", "bh" }; -const char *const x86_regnames_gpr16[8] = +const char *const x86_regnames_gpr16[] = { "ax", "cx", "dx", "bx", "sp", "bp", "si", "di" }; -const char *const x86_regnames_gpr32[8] = +const char *const x86_regnames_gpr32[] = { "eax", "ecx", "edx", "ebx", - "esp", "ebp", "esi", "edi" + "esp", "ebp", "esi", "edi", + "e8", "e9", "e10", "e11", + "e12", "e13", "e14", "e15" }; -const char *const x86_regnames_sse[8] = +const char *const x86_regnames_gpr64[] = +{ + "rax", "rcx", "rdx", "rbx", + "rsp", "rbp", "rsi", "rdi", + "r8" , "r9" , "r10", "r11", + "r12", "r13", "r14", "r15" +}; + +const char *const x86_regnames_sse[] = { "xmm0", "xmm1", "xmm2", "xmm3", - "xmm4", "xmm5", "xmm6", "xmm7" + "xmm4", "xmm5", "xmm6", "xmm7", + "xmm8", "xmm9", "xmm10", "xmm11", + "xmm12", "xmm13", "xmm14", "xmm15" }; -const char *const x86_regnames_mmx[8] = +const char *const x86_regnames_mmx[] = { "mm0", "mm1", "mm2", "mm3", "mm4", "mm5", "mm6", "mm7" @@ -182,7 +208,11 @@ const char* xRegisterBase::GetName() case 1: return x86_regnames_gpr8[ Id ]; case 2: return x86_regnames_gpr16[ Id ]; case 4: return x86_regnames_gpr32[ Id ]; +#ifdef __x86_64__ + case 8: return x86_regnames_gpr64[ Id ]; +#else case 8: return x86_regnames_mmx[ Id ]; +#endif case 16: return x86_regnames_sse[ Id ]; }