qemu-kvm tests: merged stringio into emulator
PATCH 1/1 qemu-kvm tests: merged stringio into emulator
based on 'next' branch.
Changed test-case stringio into C code and merged into emulator test-case. Removed traces of stringio test-case.
Signed-off-by Naphtali Sprei <[email protected]>
--- kvm/user/config-x86-common.mak | 2 -- kvm/user/config-x86_64.mak | 4 ++-- kvm/user/test/x86/README | 1 - kvm/user/test/x86/emulator.c | 31 ++++++++++++++++++++++++++++--- kvm/user/test/x86/stringio.S | 36 ------------------------------------ 5 files changed, 30 insertions(+), 44 deletions(-) delete mode 100644 kvm/user/test/x86/stringio.S
kvm/user/config-x86-common.mak +0 -2
@@ -56,8 +56,6 @@ $(TEST_DIR)/realmode.flat: $(TEST_DIR)/realmode.o $(TEST_DIR)/realmode.o: bits = 32 -$(TEST_DIR)/stringio.flat: $(cstart.o) $(TEST_DIR)/stringio.o - $(TEST_DIR)/msr.flat: $(cstart.o) $(TEST_DIR)/msr.o arch_clean:
kvm/user/config-x86_64.mak +2 -2
@@ -5,7 +5,7 @@ ldarch = elf64-x86-64 CFLAGS += -D__x86_64__ tests = $(TEST_DIR)/access.flat $(TEST_DIR)/sieve.flat \ - $(TEST_DIR)/stringio.flat $(TEST_DIR)/emulator.flat \ - $(TEST_DIR)/hypercall.flat $(TEST_DIR)/apic.flat + $(TEST_DIR)/emulator.flat $(TEST_DIR)/hypercall.flat \ + $(TEST_DIR)/apic.flat include config-x86-common.mak
kvm/user/test/x86/README +0 -1
@@ -10,6 +10,5 @@ realmode: goes back to realmode, shld, push/pop, mov immediate, cmp immediate, a io, eflags instructions (clc, cli, etc.), jcc short, jcc near, call, long jmp, xchg sieve: heavy memory access with no paging and with paging static and with paging vmalloc'ed smptest: run smp_id() on every cpu and compares return value to number -stringio: outs forward and backward tsc: write to tsc(0) and write to tsc(100000000000) and read it back vmexit: long loops for each: cpuid, vmcall, mov_from_cr8, mov_to_cr8, inl_pmtimer, ipi, ipi+halt
kvm/user/test/x86/emulator.c +28 -3
@@ -3,6 +3,7 @@#include "libcflat.h" #define memset __builtin_memset +#define TESTDEV_IO_PORT 0xe0int fails, tests;
@@ -17,6 +18,29 @@ void report(const char *name, int result) } } +static char str[] ="abcdefghijklmnop" ; + +void test_stringio () +{ +unsigned char r =0 ; + asmvolatile ("cld \n\t" +"movw %0, %%dx \n\t" +"rep outsb \n\t" + : :"i" ((short )TESTDEV_IO_PORT ), +"S" (str),"c" (sizeof (str) -1 )); + asmvolatile ("inb %1, %0\n\t" :"=a" (r) :"i" ((short )TESTDEV_IO_PORT )); +report ("outsb up" , r == str[sizeof (str) -2 ]);/* last char */ + + asmvolatile ("std \n\t" +"movw %0, %%dx \n\t" +"rep outsb \n\t" + : :"i" ((short )TESTDEV_IO_PORT ), +"S" (str +sizeof (str) -2 ),"c" (sizeof (str) -1 )); + asmvolatile ("cld \n\t" : : ); + asmvolatile ("in %1, %0\n\t" :"=a" (r) :"i" ((short )TESTDEV_IO_PORT )); +report ("outsb down" , r == str[0 ]); +} +void test_cmps_one (unsigned char *m1,unsigned char *m3) {void *rsi, *rdi;
@@ -93,8 +117,8 @@ void test_cmps(void *mem) m1[i] = m2[i] = m3[i] = i;for (int i =100 ; i <200 ; ++i) m1[i] = (m3[i] = m2[i] = i) +1 ; -test_cmps_one (m1, m3); -test_cmps_one (m1, m2); +test_cmps_one (m1, m3); +test_cmps_one (m1, m2); }void test_cr8 (void )
@@ -271,7 +295,8 @@ int main()test_smsw ();test_lmsw (); -test_ljmp (mem); +test_ljmp (mem); +test_stringio ();printf ("\nSUMMARY: %d tests, %d failures\n" , tests, fails);return fails ?1 :0 ;
kvm/user/test/x86/stringio.S deleted +0 -36
@@ -1,36 +0,0 @@ - -.data - -.macro str name, value - -\name : .long 1f-2f -2: .ascii "\value" -1: -.endm - -TESTDEV_PORT = 0xf1 - - str "forward", "forward" - str "backward", "backward" - -.text - -.global main -main: - cld - movl forward, %ecx - lea 4+forward, %rsi - movw $TESTDEV_PORT, %dx - rep outsb - - std - movl backward, %ecx - lea 4+backward-1(%rcx), %rsi - movw $TESTDEV_PORT, %dx - rep outsb - - mov $0, %rsi - call exit - - -
Signature · 1 line
1.6.3.3
Avi Kivity
AppliedQuoted 6 lines · Naphtali Sprei
based on 'next' branch.
Changed test-case stringio into C code and merged into emulator test-case. Removed traces of stringio test-case.
Applied, thanks.
Signature · 1 line
error compiling committee.c: too many arguments to function