* [PATCH] test: emulator: test LOCK NEG and LOCK NOT
@ 2010-07-26 12:21 Avi Kivity
2010-07-27 23:21 ` Marcelo Tosatti
0 siblings, 1 reply; 2+ messages in thread
From: Avi Kivity @ 2010-07-26 12:21 UTC (permalink / raw)
To: Marcelo Tosatti, kvm
Signed-off-by: Avi Kivity <avi@redhat.com>
---
kvm/test/x86/emulator.c | 21 ++++++++++++++++++---
1 files changed, 18 insertions(+), 3 deletions(-)
diff --git a/kvm/test/x86/emulator.c b/kvm/test/x86/emulator.c
index db6a134..476f86f 100644
--- a/kvm/test/x86/emulator.c
+++ b/kvm/test/x86/emulator.c
@@ -220,9 +220,10 @@ jmpf:
report("ljmp", res);
}
-void test_incdec(void *mem)
+void test_incdecnotneg(void *mem)
{
- unsigned long *m = mem;
+ unsigned long *m = mem, v = 1234;
+ unsigned char *mb = mem, vb = 66;
*m = 0;
@@ -243,6 +244,20 @@ void test_incdec(void *mem)
report("lock incb", *m == 1);
asm volatile ("lock decb %0":"+m"(*m));
report("lock decb", *m == 0);
+
+ *m = v;
+
+ asm ("lock negq %0" : "+m"(*m)); v = -v;
+ report("lock negl", *m == v);
+ asm ("lock notq %0" : "+m"(*m)); v = ~v;
+ report("lock notl", *m == v);
+
+ *mb = vb;
+
+ asm ("lock negb %0" : "+m"(*mb)); vb = -vb;
+ report("lock negb", *mb == vb);
+ asm ("lock notb %0" : "+m"(*mb)); vb = ~vb;
+ report("lock notb", *mb == vb);
}
void test_smsw(void)
@@ -375,7 +390,7 @@ int main()
test_lmsw();
test_ljmp(mem);
test_stringio();
- test_incdec(mem);
+ test_incdecnotneg(mem);
printf("\nSUMMARY: %d tests, %d failures\n", tests, fails);
return fails ? 1 : 0;
--
1.7.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] test: emulator: test LOCK NEG and LOCK NOT
2010-07-26 12:21 [PATCH] test: emulator: test LOCK NEG and LOCK NOT Avi Kivity
@ 2010-07-27 23:21 ` Marcelo Tosatti
0 siblings, 0 replies; 2+ messages in thread
From: Marcelo Tosatti @ 2010-07-27 23:21 UTC (permalink / raw)
To: Avi Kivity; +Cc: kvm
On Mon, Jul 26, 2010 at 03:21:54PM +0300, Avi Kivity wrote:
> Signed-off-by: Avi Kivity <avi@redhat.com>
> ---
> kvm/test/x86/emulator.c | 21 ++++++++++++++++++---
> 1 files changed, 18 insertions(+), 3 deletions(-)
Applied, thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-07-28 15:05 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-26 12:21 [PATCH] test: emulator: test LOCK NEG and LOCK NOT Avi Kivity
2010-07-27 23:21 ` Marcelo Tosatti
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox