Skip to contentSkip to conversation

x86 emulator: Add pop es instruction (opcode 0x07)

PATCH In review Mohammed Gamal 2 participants 2 messages Feb 25, 2009 – Feb 26, 2009

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

PATCH 1/1 x86 emulator: Add pop es instruction (opcode 0x07)

Add pop es instruction

---
 arch/x86/kvm/x86_emulate.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
arch/x86/kvm/x86_emulate.c +4 -1
index ca91749..8c292b6 100644
@@ -87,7 +87,7 @@ static u32 opcode_table[256] = {
 	/* 0x00 - 0x07 */
 	ByteOp | DstMem | SrcReg | ModRM, DstMem | SrcReg | ModRM,
 	ByteOp | DstReg | SrcMem | ModRM, DstReg | SrcMem | ModRM,
-	ByteOp | DstAcc | SrcImm, DstAcc | SrcImm, 0, 0,
+	ByteOp | DstAcc | SrcImm, DstAcc | SrcImm, 0, DstReg | ModRM,
 	/* 0x08 - 0x0F */
 	ByteOp | DstMem | SrcReg | ModRM, DstMem | SrcReg | ModRM,
 	ByteOp | DstReg | SrcMem | ModRM, DstReg | SrcMem | ModRM,
@@ -1446,6 +1446,9 @@ special_insn:
 	      add:		/* add */
 		emulate_2op_SrcV("add", c->src, c->dst, ctxt->eflags);
 		break;
+	case 0x07:		/* pop es */
+		emulate_pop(ctxt, ops, &c->regs[VCPU_SREG_ES], c->op_bytes); 
+		break;
 	case 0x08 ... 0x0d:
 	      or:		/* or */
 		emulate_2op_SrcV("or", c->src, c->dst, ctxt->eflags);
Signature · 1 line
1.5.4.3
#1 lore raw
Quoted 3 lines · Mohammed Gamal

Add pop es instruction

Hi again...

arch/x86/kvm/x86_emulate.c special_insn: · line 1454

Quoted 11 lines
arch/x86/kvm/x86_emulate.c +3 -0
@@ -1446,6 +1446,9 @@ special_insn:
 	      add:		/* add */
 		emulate_2op_SrcV("add", c->src, c->dst, ctxt->eflags);
 		break;
+	case 0x07:		/* pop es */
+		emulate_pop(ctxt, ops, &c->regs[VCPU_SREG_ES], c->op_bytes); 
+		break;
 	case 0x08 ... 0x0d:
 	      or:		/* or */
 		emulate_2op_SrcV("or", c->src, c->dst, ctxt->eflags);

... but this is insufficient. You need to load the segment cache, see kvm_load_segment_descriptor().

Signature · 2 lines
I have a truly marvellous patch that fixes the bug which this
signature is too narrow to contain.