All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Nadav Amit <namit@cs.technion.ac.il>
Cc: gleb@kernel.org, tglx@linutronix.de, mingo@redhat.com,
	hpa@zytor.com, x86@kernel.org, kvm@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH kvm-unit-tests] x86: test mov DR with ignored mod bits
Date: Tue, 27 May 2014 11:24:18 +0200	[thread overview]
Message-ID: <538459C2.90408@redhat.com> (raw)
In-Reply-To: <1401138417-29949-1-git-send-email-namit@cs.technion.ac.il>

Il 26/05/2014 23:06, Nadav Amit ha scritto:
> Tests whether the emulator ignores the mod bits on mov DR instruction.  The
> test performs regular mov to DR0 and reads back the data using custom mov from
> DR0 while mod bits are set to zero. The expected result is obviously the value
> which was written to DR0 before.
>
> The test is performed in realmode and is only expected to fail if the CPU does
> not support unrestricted mode. Note that mov-CR/DR in protected mode are
> usually not handled by the emulator, as their data is available in the exit
> information fields.
>
> Signed-off-by: Nadav Amit <namit@cs.technion.ac.il>
> ---
>  x86/realmode.c | 11 +++++++++++
>  1 file changed, 11 insertions(+)
>
> diff --git a/x86/realmode.c b/x86/realmode.c
> index 9c22d41..839ac34 100644
> --- a/x86/realmode.c
> +++ b/x86/realmode.c
> @@ -1636,6 +1636,16 @@ static void test_perf_memory_rmw(void)
>  	print_serial(" cycles/emulated memory RMW instruction\n");
>  }
>
> +void test_dr_mod(void)
> +{
> +	MK_INSN(drmod, "movl %ebx, %dr0\n\t"
> +		       ".byte 0x0f \n\t .byte 0x21 \n\t .byte 0x0\n\t");
> +	inregs.eax = 0xdead;
> +	inregs.ebx = 0xaced;
> +	exec_in_big_real_mode(&insn_drmod);
> +	report("mov dr with mod bits", R_AX | R_BX, outregs.eax == 0xaced);
> +}
> +
>  void realmode_start(void)
>  {
>  	test_null();
> @@ -1681,6 +1691,7 @@ void realmode_start(void)
>  	test_xlat();
>  	test_salc();
>  	test_fninit();
> +	test_dr_mod();
>  	test_nopl();
>  	test_perf_loop();
>  	test_perf_mov();
>

Thanks, applied.

Paolo

      reply	other threads:[~2014-05-27  9:24 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-25 20:05 [PATCH] KVM: x86: MOV CR/DR emulation should ignore mod Nadav Amit
2014-05-26 12:17 ` Paolo Bonzini
2014-05-26 21:06   ` [PATCH kvm-unit-tests] x86: test mov DR with ignored mod bits Nadav Amit
2014-05-27  9:24     ` Paolo Bonzini [this message]

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=538459C2.90408@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=gleb@kernel.org \
    --cc=hpa@zytor.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=namit@cs.technion.ac.il \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.