Skip to contentSkip to conversation

test: add test for btc instruction

PATCH Applied Wei Yongjun 2 participants 2 messages Aug 5, 2010 KVM

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 test: add test for btc instruction

This patch add test for btc instruction.

---
 x86/emulator.c |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)
x86/emulator.c +16 -0
index eefb764..e278812 100644
@@ -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;
Signature · 1 line
1.7.0.4
Applied
#1 lore raw
Quoted 2 lines · Wei Yongjun

This patch add test for btc instruction.

Applied, thanks.

Signature · 1 line
error compiling committee.c: too many arguments to function