From 3d7b7f596614b780aa4f4f94de9ecf7b2687887d Mon Sep 17 00:00:00 2001
From: jdh8d <jdh8d@git.zephyr-software.com>
Date: Wed, 14 Oct 2015 15:04:10 +0000
Subject: [PATCH] Update to make a mov rax opcode obey the rex/vex bytes, which
 turns it into a mov r8

Former-commit-id: 81f06c38c683beaa994cb314d6d8018e6cc99c8a
---
 .../beaengineSources/Includes/instr_set/opcodes_A_M.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/beaengine/beaengineSources/Includes/instr_set/opcodes_A_M.c b/beaengine/beaengineSources/Includes/instr_set/opcodes_A_M.c
index 43228d32e..789c35e27 100644
--- a/beaengine/beaengineSources/Includes/instr_set/opcodes_A_M.c
+++ b/beaengine/beaengineSources/Includes/instr_set/opcodes_A_M.c
@@ -6243,7 +6243,16 @@ void __bea_callspec__ mov_EAX(PDISASM pMyDisasm)
     #ifndef BEA_LIGHT_DISASSEMBLY
        (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "mov ");
     #endif
-    (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG0;
+
+	// set Argument1 dest reg to eax/rax or r8w/r8d
+    	if(
+		GV.REX.B_==1 || 	// has rex prefix to specify an extra bit for the EAX reg.
+		(GV.VEX.has_vex && GV.VEX.notB==0)	// or has a VEX prefix that does it.
+          )
+    		(*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG8;
+	else
+    		(*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG0;
+
     (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_;
     if (GV.OperandSize == 64) {
         if (!Security(9, pMyDisasm)) return;
-- 
GitLab