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 <nsprei@xxxxxxxxxx> --- 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 diff --git a/kvm/user/config-x86-common.mak b/kvm/user/config-x86-common.mak index 61cc2f0..0ff9425 100644 --- a/kvm/user/config-x86-common.mak +++ b/kvm/user/config-x86-common.mak @@ -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: diff --git a/kvm/user/config-x86_64.mak b/kvm/user/config-x86_64.mak index 03c91f2..3403dc3 100644 --- a/kvm/user/config-x86_64.mak +++ b/kvm/user/config-x86_64.mak @@ -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 diff --git a/kvm/user/test/x86/README b/kvm/user/test/x86/README index e2ede5c..ab5a2ae 100644 --- a/kvm/user/test/x86/README +++ b/kvm/user/test/x86/README @@ -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 diff --git a/kvm/user/test/x86/emulator.c b/kvm/user/test/x86/emulator.c index 4967d1f..5406062 100644 --- a/kvm/user/test/x86/emulator.c +++ b/kvm/user/test/x86/emulator.c @@ -3,6 +3,7 @@ #include "libcflat.h" #define memset __builtin_memset +#define TESTDEV_IO_PORT 0xe0 int fails, tests; @@ -17,6 +18,29 @@ void report(const char *name, int result) } } +static char str[] = "abcdefghijklmnop"; + +void test_stringio() +{ + unsigned char r = 0; + asm volatile("cld \n\t" + "movw %0, %%dx \n\t" + "rep outsb \n\t" + : : "i"((short)TESTDEV_IO_PORT), + "S"(str), "c"(sizeof(str) - 1)); + asm volatile("inb %1, %0\n\t" : "=a"(r) : "i"((short)TESTDEV_IO_PORT)); + report("outsb up", r == str[sizeof(str) - 2]); /* last char */ + + asm volatile("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)); + asm volatile("cld \n\t" : : ); + asm volatile("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; diff --git a/kvm/user/test/x86/stringio.S b/kvm/user/test/x86/stringio.S deleted file mode 100644 index 461621c..0000000 --- a/kvm/user/test/x86/stringio.S +++ /dev/null @@ -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 - - - -- 1.6.3.3 -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html