public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Avi Kivity <avi@qumranet.com>
To: Mohammed Gamal <m.gamal005@gmail.com>
Cc: kvm@vger.kernel.org, riel@surriel.com
Subject: Re: [PATCH][RESEND] x86_emulator: Emulate cld and std instruction
Date: Thu, 31 Jul 2008 12:57:00 +0300	[thread overview]
Message-ID: <48918C6C.1000408@qumranet.com> (raw)
In-Reply-To: <20080730212727.GA7708@mohd-laptop>

Mohammed Gamal wrote:
> This patch adds 'cld' and 'std' instructions to the emulator
>
>   

I presume for big real mode?  Which guest wants it?

> @@ -1755,6 +1755,14 @@ special_insn:
>  		ctxt->eflags |= X86_EFLAGS_IF;
>  		c->dst.type = OP_NONE;	/* Disable writeback. */
>  		break;
> +	case 0xfc: /* cld */
> +		ctxt->eflags &= ~EFLG_DF;
> +		c->dst.type = OP_NONE;  /* Disable writeback. */
> +		break;
> +	case 0xfd: /* std */
> +		ctxt->eflags |= EFLG_DF;
> +		c->dst.type = OP_NONE;  /* Disable writeback. */
> +		break;
>   

You need to add non-zero entries in opcode_table[] for this to work.  
Also, why disable writeback?  If there is not DstSomething in 
opcode_table[], c->dst.type will be OP_NONE anyway.

I would like to see test cases for emulator changes.  See 
users/test/x86/emulator.c.  Of course, right now it is impossible to 
cause cld and std to execute in the emulator.  But with the proposed 
invalid_guest_state() change, it should be easy to to cause this state 
and force emulation.

So how about adding optional invalid_guest_state() support (controlled 
by a module parameter), then start adding instructions and test cases, 
then removing the module parameter when everything works?

-- 
error compiling committee.c: too many arguments to function


  reply	other threads:[~2008-07-31  9:57 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-30 21:27 [PATCH][RESEND] x86_emulator: Emulate cld and std instruction Mohammed Gamal
2008-07-31  9:57 ` Avi Kivity [this message]
2008-07-31 10:25   ` Mohammed Gamal
2008-07-31 10:50     ` Avi Kivity
2008-07-31 13:27       ` Mohammed Gamal
2008-07-31 18:16     ` Andrea Arcangeli

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=48918C6C.1000408@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