Skip to contentSkip to conversation

x86 emulator: Add opcodes 0xb9-0xbf (mov r,imm)

PATCH In review Mohammed Gamal 2 participants 3 messages Jul 31, 2008 – Aug 11, 2008

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86 emulator: Add opcodes 0xb9-0xbf (mov r,imm)

The emulator only supported opcode 0xb8 for mov r,imm. However 0xb9-0xbf are also mov r,imm. This patch adds support for these instructions.

---
 arch/x86/kvm/x86_emulate.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
arch/x86/kvm/x86_emulate.c +4 -2
index 005f1db..4c7ca7f 100644
@@ -156,7 +156,9 @@ static u16 opcode_table[256] = {
 	ByteOp | ImplicitOps | String, ImplicitOps | String,
 	/* 0xB0 - 0xBF */
 	0, 0, 0, 0, 0, 0, 0, 0,
-	DstReg | SrcImm | Mov, 0, 0, 0, 0, 0, 0, 0,
+	DstReg | SrcImm | Mov, DstReg | SrcImm | Mov, DstReg | SrcImm | Mov, 
+	DstReg | SrcImm | Mov, DstReg | SrcImm | Mov, DstReg | SrcImm | Mov, 
+	DstReg | SrcImm | Mov, DstReg | SrcImm | Mov,
 	/* 0xC0 - 0xC7 */
 	ByteOp | DstMem | SrcImm | ModRM, DstMem | SrcImmByte | ModRM,
 	0, ImplicitOps | Stack, 0, 0,
@@ -1660,7 +1662,7 @@ special_insn:
 	case 0xae ... 0xaf:	/* scas */
 		DPRINTF("Urk! I don't handle SCAS.\n");
 		goto cannot_emulate;
-	case 0xb8: /* mov r, imm */
+	case 0xb8 ... 0xbf: /* mov r, imm */
 		goto mov;
 	case 0xc0 ... 0xc1:
 		emulate_grp2(ctxt);
Signature · 1 line
1.5.4.3
#1 lore raw
Quoted 34 lines · Mohammed Gamal

The emulator only supported opcode 0xb8 for mov r,imm. However 0xb9-0xbf are also mov r,imm. This patch adds support for these instructions.

---
 arch/x86/kvm/x86_emulate.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
arch/x86/kvm/x86_emulate.c +4 -3
index 005f1db..4c7ca7f 100644
@@ -156,7 +156,9 @@ static u16 opcode_table[256] = {
       ByteOp | ImplicitOps | String, ImplicitOps | String,
       /* 0xB0 - 0xBF */
       0, 0, 0, 0, 0, 0, 0, 0,
-       DstReg | SrcImm | Mov, 0, 0, 0, 0, 0, 0, 0,
+       DstReg | SrcImm | Mov, DstReg | SrcImm | Mov, DstReg | SrcImm | Mov,
+       DstReg | SrcImm | Mov, DstReg | SrcImm | Mov, DstReg | SrcImm | Mov,
+       DstReg | SrcImm | Mov, DstReg | SrcImm | Mov,
       /* 0xC0 - 0xC7 */
       ByteOp | DstMem | SrcImm | ModRM, DstMem | SrcImmByte | ModRM,
       0, ImplicitOps | Stack, 0, 0,
@@ -1660,7 +1662,7 @@ special_insn:
       case 0xae ... 0xaf:     /* scas */
               DPRINTF("Urk! I don't handle SCAS.\n");
               goto cannot_emulate;
-       case 0xb8: /* mov r, imm */
+       case 0xb8 ... 0xbf: /* mov r, imm */
               goto mov;
       case 0xc0 ... 0xc1:
               emulate_grp2(ctxt);
--
Quoted 4 lines

1.5.4.3

Sorry for the typo, it adds instruction opcodes (0xb8-0xbf)

#2 lore raw
In reply to Mohammed Gamal
Quoted 2 lines · Mohammed Gamal

The emulator only supported opcode 0xb8 for mov r,imm. However 0xb9-0xbf are also mov r,imm. This patch adds support for these instructions.

Looks good, but I'd like to merge this together with a testcase.

Signature · 1 line
error compiling committee.c: too many arguments to function