All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] emulator: add movdqa tests
@ 2012-01-08 16:35 Stefan Hajnoczi
  2012-02-01  9:08 ` Takuya Yoshikawa
  0 siblings, 1 reply; 7+ messages in thread
From: Stefan Hajnoczi @ 2012-01-08 16:35 UTC (permalink / raw)
  To: kvm; +Cc: Avi Kivity, Stefan Hajnoczi

The movdqa instruction performs a 128-bit vector move and requires that
operands are aligned in memory.  Unlike the movdqu instruction, a #GP is
raised if operands are unaligned.

This patch does not exercise misalignment because the CPU detects
misalignment while still inside the guest and raises #GP.  The emulator
will therefore never meet unaligned movdqa instructions.

Also change "read"/"write" to "store"/"load" to make it obvious whether
the test transfers to or from memory.  Previous usage of "read" and
"write" was misleading.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
---
This test is expected to fail until a patch is merged that implements the
missing movdqa instruction.

 x86/emulator.c |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/x86/emulator.c b/x86/emulator.c
index b584122..327f871 100644
--- a/x86/emulator.c
+++ b/x86/emulator.c
@@ -598,12 +598,20 @@ static void test_sse(sse_union *mem)
 
     write_cr0(read_cr0() & ~6); /* EM, TS */
     write_cr4(read_cr4() | 0x200); /* OSFXSR */
+
     v.u[0] = 1; v.u[1] = 2; v.u[2] = 3; v.u[3] = 4;
     asm("movdqu %1, %0" : "=m"(*mem) : "x"(v.sse));
-    report("movdqu (read)", sseeq(&v, mem));
+    report("movdqu (store)", sseeq(&v, mem));
     mem->u[0] = 5; mem->u[1] = 6; mem->u[2] = 7; mem->u[3] = 8;
     asm("movdqu %1, %0" : "=x"(v.sse) : "m"(*mem));
-    report("movdqu (write)", sseeq(mem, &v));
+    report("movdqu (load)", sseeq(mem, &v));
+
+    v.u[0] = 1; v.u[1] = 2; v.u[2] = 3; v.u[3] = 4;
+    asm("movdqa %1, %0" : "=m"(*mem) : "x"(v.sse));
+    report("movdqa (store)", sseeq(&v, mem));
+    mem->u[0] = 5; mem->u[1] = 6; mem->u[2] = 7; mem->u[3] = 8;
+    asm("movdqa %1, %0" : "=x"(v.sse) : "m"(*mem));
+    report("movdqa (load)", sseeq(mem, &v));
 }
 
 static void test_rip_relative(unsigned *mem, char *insn_ram)
-- 
1.7.7.3


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] emulator: add movdqa tests
  2012-01-08 16:35 [PATCH] emulator: add movdqa tests Stefan Hajnoczi
@ 2012-02-01  9:08 ` Takuya Yoshikawa
  2012-02-01  9:13   ` Avi Kivity
  0 siblings, 1 reply; 7+ messages in thread
From: Takuya Yoshikawa @ 2012-02-01  9:08 UTC (permalink / raw)
  To: Stefan Hajnoczi; +Cc: kvm, Avi Kivity

(2012/01/09 1:35), Stefan Hajnoczi wrote:
> The movdqa instruction performs a 128-bit vector move and requires that
> operands are aligned in memory.  Unlike the movdqu instruction, a #GP is
> raised if operands are unaligned.
> 
> This patch does not exercise misalignment because the CPU detects
> misalignment while still inside the guest and raises #GP.  The emulator
> will therefore never meet unaligned movdqa instructions.
> 
> Also change "read"/"write" to "store"/"load" to make it obvious whether
> the test transfers to or from memory.  Previous usage of "read" and
> "write" was misleading.
> 
> Signed-off-by: Stefan Hajnoczi<stefanha@linux.vnet.ibm.com>
> ---
> This test is expected to fail until a patch is merged that implements the
> missing movdqa instruction.
> 

What is the status of Stefan's work?

	Takuya

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] emulator: add movdqa tests
  2012-02-01  9:08 ` Takuya Yoshikawa
@ 2012-02-01  9:13   ` Avi Kivity
  2012-02-01  9:17     ` Takuya Yoshikawa
  2012-02-06 12:00     ` Stefan Hajnoczi
  0 siblings, 2 replies; 7+ messages in thread
From: Avi Kivity @ 2012-02-01  9:13 UTC (permalink / raw)
  To: Takuya Yoshikawa; +Cc: Stefan Hajnoczi, kvm

On 02/01/2012 11:08 AM, Takuya Yoshikawa wrote:
> What is the status of Stefan's work?

Stefan's on vacation.

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


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] emulator: add movdqa tests
  2012-02-01  9:13   ` Avi Kivity
@ 2012-02-01  9:17     ` Takuya Yoshikawa
  2012-02-01  9:21       ` Avi Kivity
  2012-02-06 12:00     ` Stefan Hajnoczi
  1 sibling, 1 reply; 7+ messages in thread
From: Takuya Yoshikawa @ 2012-02-01  9:17 UTC (permalink / raw)
  To: Avi Kivity; +Cc: Stefan Hajnoczi, kvm

(2012/02/01 18:13), Avi Kivity wrote:
> On 02/01/2012 11:08 AM, Takuya Yoshikawa wrote:
>> What is the status of Stefan's work?
> 
> Stefan's on vacation.
> 

No no, about this unit-test patch.

Not applied yet?

	Takuya

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] emulator: add movdqa tests
  2012-02-01  9:17     ` Takuya Yoshikawa
@ 2012-02-01  9:21       ` Avi Kivity
  2012-02-01  9:28         ` Takuya Yoshikawa
  0 siblings, 1 reply; 7+ messages in thread
From: Avi Kivity @ 2012-02-01  9:21 UTC (permalink / raw)
  To: Takuya Yoshikawa; +Cc: Stefan Hajnoczi, kvm

On 02/01/2012 11:17 AM, Takuya Yoshikawa wrote:
> (2012/02/01 18:13), Avi Kivity wrote:
> > On 02/01/2012 11:08 AM, Takuya Yoshikawa wrote:
> >> What is the status of Stefan's work?
> > 
> > Stefan's on vacation.
> > 
>
> No no, about this unit-test patch.
>
> Not applied yet?
>

Well, movdqa is not emulated yet, and we don't have XFAIL support, so it
would just fail my unit tests.

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


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] emulator: add movdqa tests
  2012-02-01  9:21       ` Avi Kivity
@ 2012-02-01  9:28         ` Takuya Yoshikawa
  0 siblings, 0 replies; 7+ messages in thread
From: Takuya Yoshikawa @ 2012-02-01  9:28 UTC (permalink / raw)
  To: Avi Kivity; +Cc: Stefan Hajnoczi, kvm

(2012/02/01 18:21), Avi Kivity wrote:
> On 02/01/2012 11:17 AM, Takuya Yoshikawa wrote:
>> (2012/02/01 18:13), Avi Kivity wrote:
>>> On 02/01/2012 11:08 AM, Takuya Yoshikawa wrote:
>>>> What is the status of Stefan's work?
>>>
>>> Stefan's on vacation.
>>>
>>
>> No no, about this unit-test patch.
>>
>> Not applied yet?
>>
> 
> Well, movdqa is not emulated yet, and we don't have XFAIL support, so it
> would just fail my unit tests.
> 

I see,
(so unit-test, in general, must be with the corresponding emulator patch.)

Thanks,
	Takuya

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] emulator: add movdqa tests
  2012-02-01  9:13   ` Avi Kivity
  2012-02-01  9:17     ` Takuya Yoshikawa
@ 2012-02-06 12:00     ` Stefan Hajnoczi
  1 sibling, 0 replies; 7+ messages in thread
From: Stefan Hajnoczi @ 2012-02-06 12:00 UTC (permalink / raw)
  To: Avi Kivity; +Cc: Takuya Yoshikawa, Stefan Hajnoczi, kvm

2012/2/1 Avi Kivity <avi@redhat.com>:
> On 02/01/2012 11:08 AM, Takuya Yoshikawa wrote:
>> What is the status of Stefan's work?
>
> Stefan's on vacation.

Back now.  I will try to get back to movdqa soon.

Stefan

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2012-02-06 12:00 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-08 16:35 [PATCH] emulator: add movdqa tests Stefan Hajnoczi
2012-02-01  9:08 ` Takuya Yoshikawa
2012-02-01  9:13   ` Avi Kivity
2012-02-01  9:17     ` Takuya Yoshikawa
2012-02-01  9:21       ` Avi Kivity
2012-02-01  9:28         ` Takuya Yoshikawa
2012-02-06 12:00     ` Stefan Hajnoczi

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.