Mohammed Gamal wrote:
This patch adds instructions 'in' and 'out' to the x86 emulator.


+       SrcNone | ByteOp | ImplicitOps, SrcNone |ImplicitOps,

Missing blank.



        case 0xe8: /* call (near) */ {
                long int rel;
                switch (c->op_bytes) {
@@ -1732,6 +1744,26 @@ special_insn:
                jmp_rel(c, c->src.val);
                c->dst.type = OP_NONE; /* Disable writeback. */
                break;
+       case 0xec: /* in al,dx */
+       case 0xed: /* in (e/r)ax,dx */
+               port = c->regs[VCPU_REGS_RDX];
+       in:     if(kvm_emulate_pio(ctxt->vcpu, NULL, 1,

missing blank.

+                                  (c->d & ByteOp) ? 1 : c->op_bytes,
+ port) != 0) { + c->eip = saved_eip;
+                       return -1;
+               }
+               return 0;
+       case 0xee: /* out al,dx */
+       case 0xef: /* out (e/r)ax,dx */
+               port = c->regs[VCPU_REGS_RDX];
+       out:    if(kvm_emulate_pio(ctxt->vcpu, NULL, 0,
+                                  (c->d & ByteOp) ? 1 : c->op_bytes,
+ port) != 0) { + c->eip = saved_eip;
+                       return -1;


goto cannot_emulate?

+               }
+               return 0;

It would be simpler to fold the in and out implementations together (and extract the direction flag from the instruction byte).


--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to