* [PATCH] test: add test for btc instruction
@ 2010-08-05 6:09 Wei Yongjun
2010-08-05 8:51 ` Avi Kivity
0 siblings, 1 reply; 2+ messages in thread
From: Wei Yongjun @ 2010-08-05 6:09 UTC (permalink / raw)
To: Avi Kivity, Paolo Bonzini; +Cc: kvm
This patch add test for btc instruction.
Signed-off-by: Wei Yongjun<yjwei@cn.fujitsu.com>
---
x86/emulator.c | 16 ++++++++++++++++
1 files changed, 16 insertions(+), 0 deletions(-)
diff --git a/x86/emulator.c b/x86/emulator.c
index eefb764..e278812 100644
--- a/x86/emulator.c
+++ b/x86/emulator.c
@@ -360,6 +360,21 @@ void test_xchg(void *mem)
rax == 0x123456789abcdef && *memq == 0xfedcba9876543210);
}
+void test_btc(void *mem)
+{
+ unsigned int *a = mem;
+
+ memset(mem, 0, 3 * sizeof(unsigned int));
+
+ asm ("btcl $32, %0" :: "m"(a[0]) : "memory");
+ asm ("btcl $1, %0" :: "m"(a[1]) : "memory");
+ asm ("btcl %1, %0" :: "m"(a[0]), "r"(66) : "memory");
+ report("btcl imm8, r/m", a[0] == 1 && a[1] == 2 && a[2] == 4);
+
+ asm ("btcl %1, %0" :: "m"(a[3]), "r"(-1) : "memory");
+ report("btcl reg, r/m", a[0] == 1 && a[1] == 2 && a[2] == 0x80000004);
+}
+
int main()
{
void *mem;
@@ -391,6 +406,7 @@ int main()
test_ljmp(mem);
test_stringio();
test_incdecnotneg(mem);
+ test_btc(mem);
printf("\nSUMMARY: %d tests, %d failures\n", tests, fails);
return fails ? 1 : 0;
--
1.7.0.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] test: add test for btc instruction
2010-08-05 6:09 [PATCH] test: add test for btc instruction Wei Yongjun
@ 2010-08-05 8:51 ` Avi Kivity
0 siblings, 0 replies; 2+ messages in thread
From: Avi Kivity @ 2010-08-05 8:51 UTC (permalink / raw)
To: Wei Yongjun; +Cc: Paolo Bonzini, kvm
On 08/05/2010 09:09 AM, Wei Yongjun wrote:
> This patch add test for btc instruction.
>
Applied, thanks.
--
error compiling committee.c: too many arguments to function
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-08-05 8:51 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-05 6:09 [PATCH] test: add test for btc instruction Wei Yongjun
2010-08-05 8:51 ` Avi Kivity
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox