From: Avi Kivity <avi@qumranet.com>
To: Mohammed Gamal <m.gamal005@gmail.com>
Cc: kvm@vger.kernel.org, riel@surriel.com
Subject: Re: [PATCH] x86 emulator: Add in/out instructions, opcodes (0xe4-0xe7, 0xec-0xef)
Date: Mon, 11 Aug 2008 14:45:50 +0300 [thread overview]
Message-ID: <48A0266E.9020201@qumranet.com> (raw)
In-Reply-To: <20080804195719.GA7552@mohd-laptop>
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).
next prev parent reply other threads:[~2008-08-11 11:45 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-04 19:57 [PATCH] x86 emulator: Add in/out instructions, opcodes (0xe4-0xe7, 0xec-0xef) Mohammed Gamal
2008-08-11 11:45 ` Avi Kivity [this message]
-- strict thread matches above, loose matches on Subject: below --
2008-09-06 14:22 [PATCH] x86 emulator: Add in/out instructions (opcodes 0xe4-0xe7, 0xec-0xef) Mohammed Gamal
2008-09-07 7:27 ` Avi Kivity
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=48A0266E.9020201@qumranet.com \
--to=avi@qumranet.com \
--cc=kvm@vger.kernel.org \
--cc=m.gamal005@gmail.com \
--cc=riel@surriel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox