diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/hello-arm.c | 2 | ||||
-rw-r--r-- | tests/linux-test.c | 36 | ||||
-rw-r--r-- | tests/qruncom.c | 30 | ||||
-rw-r--r-- | tests/runcom.c | 10 | ||||
-rw-r--r-- | tests/test-i386-code16.S | 10 | ||||
-rw-r--r-- | tests/test-i386-muldiv.h | 16 | ||||
-rw-r--r-- | tests/test-i386-vm86.S | 25 | ||||
-rw-r--r-- | tests/test-i386.c | 124 | ||||
-rw-r--r-- | tests/test_path.c | 2 |
9 files changed, 127 insertions, 128 deletions
diff --git a/tests/hello-arm.c b/tests/hello-arm.c index f84e6cb368..e2759a1c72 100644 --- a/tests/hello-arm.c +++ b/tests/hello-arm.c @@ -83,7 +83,7 @@ type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4) { \ : "r0","r1","r2","r3","lr"); \ __syscall_return(type,__res); \ } - + #define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4,type5,arg5) \ type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5) { \ diff --git a/tests/linux-test.c b/tests/linux-test.c index 6ca9029650..31daa9f2bd 100644 --- a/tests/linux-test.c +++ b/tests/linux-test.c @@ -1,6 +1,6 @@ /* * linux and CPU test - * + * * Copyright (c) 2003 Fabrice Bellard * * This program is free software; you can redistribute it and/or modify @@ -58,7 +58,7 @@ void error1(const char *filename, int line, const char *fmt, ...) int __chk_error(const char *filename, int line, int ret) { if (ret < 0) { - error1(filename, line, "%m (ret=%d, errno=%d)", + error1(filename, line, "%m (ret=%d, errno=%d)", ret, errno); } return ret; @@ -93,11 +93,11 @@ void test_file(void) if (getcwd(cur_dir, sizeof(cur_dir)) == NULL) error("getcwd"); - + chk_error(mkdir(TESTPATH, 0755)); - + chk_error(chdir(TESTPATH)); - + /* open/read/write/close/readv/writev/lseek */ fd = chk_error(open("file1", O_WRONLY | O_TRUNC | O_CREAT, 0644)); @@ -124,7 +124,7 @@ void test_file(void) error("read"); if (memcmp(buf, buf2, FILE_BUF_SIZE) != 0) error("memcmp"); - + #define FOFFSET 16 ret = chk_error(lseek(fd, FOFFSET, SEEK_SET)); if (ret != 16) @@ -138,7 +138,7 @@ void test_file(void) error("readv"); if (memcmp(buf + FOFFSET, buf3, FILE_BUF_SIZE - FOFFSET) != 0) error("memcmp"); - + chk_error(close(fd)); /* access */ @@ -171,18 +171,18 @@ void test_file(void) chk_error(ftruncate(fd, 50)); chk_error(fstat(fd, &st)); chk_error(close(fd)); - + if (st.st_size != 50) error("stat size"); if (!S_ISREG(st.st_mode)) error("stat mode"); - + /* symlink/lstat */ chk_error(symlink("file2", "file3")); chk_error(lstat("file3", &st)); if (!S_ISLNK(st.st_mode)) error("stat mode"); - + /* getdents */ dir = opendir(TESTPATH); if (!dir) @@ -241,7 +241,7 @@ void test_time(void) ti = tv2.tv_sec - tv.tv_sec; if (ti >= 2) error("gettimeofday"); - + chk_error(getrusage(RUSAGE_SELF, &rusg1)); for(i = 0;i < 10000; i++); chk_error(getrusage(RUSAGE_SELF, &rusg2)); @@ -272,7 +272,7 @@ char *pstrcat(char *buf, int buf_size, const char *s) { int len; len = strlen(buf); - if (len < buf_size) + if (len < buf_size) pstrcpy(buf + len, buf_size - len, s); return buf; } @@ -327,7 +327,7 @@ void test_socket(void) chk_error(getsockopt(server_fd, SOL_SOCKET, SO_TYPE, &val, &len)); if (val != SOCK_STREAM) error("getsockopt"); - + pid = chk_error(fork()); if (pid == 0) { client_fd = client_socket(); @@ -419,11 +419,11 @@ void test_clone(void) int pid1, pid2, status1, status2; stack1 = malloc(STACK_SIZE); - pid1 = chk_error(clone(thread1_func, stack1 + STACK_SIZE, + pid1 = chk_error(clone(thread1_func, stack1 + STACK_SIZE, CLONE_VM | CLONE_FS | CLONE_FILES | SIGCHLD, "hello1")); stack2 = malloc(STACK_SIZE); - pid2 = chk_error(clone(thread2_func, stack2 + STACK_SIZE, + pid2 = chk_error(clone(thread2_func, stack2 + STACK_SIZE, CLONE_VM | CLONE_FS | CLONE_FILES | SIGCHLD, "hello2")); while (waitpid(pid1, &status1, 0) != pid1); @@ -465,7 +465,7 @@ void test_signal(void) sigemptyset(&act.sa_mask); act.sa_flags = 0; chk_error(sigaction(SIGALRM, &act, NULL)); - + it.it_interval.tv_sec = 0; it.it_interval.tv_usec = 10 * 1000; it.it_value.tv_sec = 0; @@ -475,7 +475,7 @@ void test_signal(void) if (oit.it_value.tv_sec != it.it_value.tv_sec || oit.it_value.tv_usec != it.it_value.tv_usec) error("itimer"); - + while (alarm_count < 5) { usleep(10 * 1000); } @@ -498,7 +498,7 @@ void test_signal(void) if (setjmp(jmp_env) == 0) { *(uint8_t *)0 = 0; } - + act.sa_handler = SIG_DFL; sigemptyset(&act.sa_mask); act.sa_flags = 0; diff --git a/tests/qruncom.c b/tests/qruncom.c index 421e6a99f2..9d8f16bfdf 100644 --- a/tests/qruncom.c +++ b/tests/qruncom.c @@ -59,7 +59,7 @@ uint64_t cpu_get_tsc(CPUState *env) return 0; } -static void set_gate(void *ptr, unsigned int type, unsigned int dpl, +static void set_gate(void *ptr, unsigned int type, unsigned int dpl, unsigned long addr, unsigned int sel) { unsigned int e1, e2; @@ -141,7 +141,7 @@ static inline void pushw(CPUState *env, int val) *(uint16_t *)seg_to_linear(env->segs[R_SS].selector, env->regs[R_ESP]) = val; } -static void host_segv_handler(int host_signum, siginfo_t *info, +static void host_segv_handler(int host_signum, siginfo_t *info, void *puc) { if (cpu_signal_handler(host_signum, info, puc)) { @@ -160,9 +160,9 @@ int main(int argc, char **argv) if (argc != 2) usage(); filename = argv[1]; - - vm86_mem = mmap((void *)0x00000000, 0x110000, - PROT_WRITE | PROT_READ | PROT_EXEC, + + vm86_mem = mmap((void *)0x00000000, 0x110000, + PROT_WRITE | PROT_READ | PROT_EXEC, MAP_FIXED | MAP_ANON | MAP_PRIVATE, -1, 0); if (vm86_mem == MAP_FAILED) { perror("mmap"); @@ -185,7 +185,7 @@ int main(int argc, char **argv) /* install exception handler for CPU emulator */ { struct sigaction act; - + sigfillset(&act.sa_mask); act.sa_flags = SA_SIGINFO; // act.sa_flags |= SA_ONSTACK; @@ -218,23 +218,23 @@ int main(int argc, char **argv) /* flags setup : we activate the IRQs by default as in user mode. We also activate the VM86 flag to run DOS code */ env->eflags |= IF_MASK | VM_MASK; - + /* init basic registers */ env->eip = 0x100; env->regs[R_ESP] = 0xfffe; seg = (COM_BASE_ADDR - 0x100) >> 4; - cpu_x86_load_seg_cache(env, R_CS, seg, + cpu_x86_load_seg_cache(env, R_CS, seg, (seg << 4), 0xffff, 0); - cpu_x86_load_seg_cache(env, R_SS, seg, + cpu_x86_load_seg_cache(env, R_SS, seg, (seg << 4), 0xffff, 0); - cpu_x86_load_seg_cache(env, R_DS, seg, + cpu_x86_load_seg_cache(env, R_DS, seg, (seg << 4), 0xffff, 0); - cpu_x86_load_seg_cache(env, R_ES, seg, + cpu_x86_load_seg_cache(env, R_ES, seg, (seg << 4), 0xffff, 0); - cpu_x86_load_seg_cache(env, R_FS, seg, + cpu_x86_load_seg_cache(env, R_FS, seg, (seg << 4), 0xffff, 0); - cpu_x86_load_seg_cache(env, R_GS, seg, + cpu_x86_load_seg_cache(env, R_GS, seg, (seg << 4), 0xffff, 0); /* exception support */ @@ -260,7 +260,7 @@ int main(int argc, char **argv) set_idt(17, 0); set_idt(18, 0); set_idt(19, 0); - + /* put return code */ *seg_to_linear(env->segs[R_CS].selector, 0) = 0xb4; /* mov ah, $0 */ *seg_to_linear(env->segs[R_CS].selector, 1) = 0x00; @@ -275,7 +275,7 @@ int main(int argc, char **argv) env->regs[R_EDI] = 0xfffe; /* inform the emulator of the mmaped memory */ - page_set_flags(0x00000000, 0x110000, + page_set_flags(0x00000000, 0x110000, PAGE_WRITE | PAGE_READ | PAGE_EXEC | PAGE_VALID); for(;;) { diff --git a/tests/runcom.c b/tests/runcom.c index 43deeca098..94d3a39ff2 100644 --- a/tests/runcom.c +++ b/tests/runcom.c @@ -51,7 +51,7 @@ static inline void pushw(struct vm86_regs *r, int val) void dump_regs(struct vm86_regs *r) { - fprintf(stderr, + fprintf(stderr, "EAX=%08lx EBX=%08lx ECX=%08lx EDX=%08lx\n" "ESI=%08lx EDI=%08lx EBP=%08lx ESP=%08lx\n" "EIP=%08lx EFL=%08lx\n" @@ -80,9 +80,9 @@ int main(int argc, char **argv) if (argc != 2) usage(); filename = argv[1]; - - vm86_mem = mmap((void *)0x00000000, 0x110000, - PROT_WRITE | PROT_READ | PROT_EXEC, + + vm86_mem = mmap((void *)0x00000000, 0x110000, + PROT_WRITE | PROT_READ | PROT_EXEC, MAP_FIXED | MAP_ANON | MAP_PRIVATE, -1, 0); if (vm86_mem == MAP_FAILED) { perror("mmap"); @@ -147,7 +147,7 @@ int main(int argc, char **argv) case VM86_INTx: { int int_num, ah; - + int_num = VM86_ARG(ret); if (int_num != 0x21) goto unknown_int; diff --git a/tests/test-i386-code16.S b/tests/test-i386-code16.S index e400e73fd9..6692fe5e78 100644 --- a/tests/test-i386-code16.S +++ b/tests/test-i386-code16.S @@ -7,7 +7,7 @@ CS_SEG = 0xf code16_start: .globl code16_func1 - + /* basic test */ code16_func1 = . - code16_start mov $1, %eax @@ -24,7 +24,7 @@ code16_func2 = . - code16_start pop %ax data32 lret -/* test various jmp opcodes */ +/* test various jmp opcodes */ .globl code16_func3 code16_func3 = . - code16_start jmp 1f @@ -36,9 +36,9 @@ code16_func3 = . - code16_start jz 2f add $2, %ax 2: - + call myfunc - + lcall $CS_SEG, $(myfunc2 - code16_start) ljmp $CS_SEG, $(myjmp1 - code16_start) @@ -50,7 +50,7 @@ myjmp1_next: myjmp2_next: data32 lret - + myfunc2_addr: .short myfunc2 - code16_start .short CS_SEG diff --git a/tests/test-i386-muldiv.h b/tests/test-i386-muldiv.h index fd0d991341..015f59e157 100644 --- a/tests/test-i386-muldiv.h +++ b/tests/test-i386-muldiv.h @@ -1,5 +1,5 @@ -void glue(glue(test_, OP), b)(long op0, long op1) +void glue(glue(test_, OP), b)(long op0, long op1) { long res, s1, s0, flags; s0 = op0; @@ -8,7 +8,7 @@ void glue(glue(test_, OP), b)(long op0, long op1) flags = 0; asm ("push %4\n\t" "popf\n\t" - stringify(OP)"b %b2\n\t" + stringify(OP)"b %b2\n\t" "pushf\n\t" "pop %1\n\t" : "=a" (res), "=g" (flags) @@ -17,7 +17,7 @@ void glue(glue(test_, OP), b)(long op0, long op1) stringify(OP) "b", s0, s1, res, flags & CC_MASK); } -void glue(glue(test_, OP), w)(long op0h, long op0, long op1) +void glue(glue(test_, OP), w)(long op0h, long op0, long op1) { long res, s1, flags, resh; s1 = op1; @@ -26,7 +26,7 @@ void glue(glue(test_, OP), w)(long op0h, long op0, long op1) flags = 0; asm ("push %5\n\t" "popf\n\t" - stringify(OP) "w %w3\n\t" + stringify(OP) "w %w3\n\t" "pushf\n\t" "pop %1\n\t" : "=a" (res), "=g" (flags), "=d" (resh) @@ -35,7 +35,7 @@ void glue(glue(test_, OP), w)(long op0h, long op0, long op1) stringify(OP) "w", op0h, op0, s1, resh, res, flags & CC_MASK); } -void glue(glue(test_, OP), l)(long op0h, long op0, long op1) +void glue(glue(test_, OP), l)(long op0h, long op0, long op1) { long res, s1, flags, resh; s1 = op1; @@ -44,7 +44,7 @@ void glue(glue(test_, OP), l)(long op0h, long op0, long op1) flags = 0; asm ("push %5\n\t" "popf\n\t" - stringify(OP) "l %k3\n\t" + stringify(OP) "l %k3\n\t" "pushf\n\t" "pop %1\n\t" : "=a" (res), "=g" (flags), "=d" (resh) @@ -54,7 +54,7 @@ void glue(glue(test_, OP), l)(long op0h, long op0, long op1) } #if defined(__x86_64__) -void glue(glue(test_, OP), q)(long op0h, long op0, long op1) +void glue(glue(test_, OP), q)(long op0h, long op0, long op1) { long res, s1, flags, resh; s1 = op1; @@ -63,7 +63,7 @@ void glue(glue(test_, OP), q)(long op0h, long op0, long op1) flags = 0; asm ("push %5\n\t" "popf\n\t" - stringify(OP) "q %3\n\t" + stringify(OP) "q %3\n\t" "pushf\n\t" "pop %1\n\t" : "=a" (res), "=g" (flags), "=d" (resh) diff --git a/tests/test-i386-vm86.S b/tests/test-i386-vm86.S index a972f1b81e..8575ae7ca2 100644 --- a/tests/test-i386-vm86.S +++ b/tests/test-i386-vm86.S @@ -14,7 +14,7 @@ vm86_code_start: movw %ax, %es es movw $GET_OFFSET(int90_test), 0x90 * 4 es movw %cs, 0x90 * 4 + 2 - + /* launch int 0x90 */ int $0x90 @@ -24,23 +24,23 @@ vm86_code_start: movb $0x09, %ah int $0x21 - pushf + pushf popw %dx movb $0xff, %ah int $0x21 cli - pushf + pushf popw %dx movb $0xff, %ah int $0x21 - sti - pushfl + sti + pushfl popl %edx movb $0xff, %ah int $0x21 - + #if 0 movw $GET_OFFSET(IF_msg1), %dx movb $0x09, %ah @@ -54,11 +54,11 @@ vm86_code_start: cli #endif - pushf + pushf popw %dx movb $0xff, %ah int $0x21 - + pushfl movw %sp, %bx orw $0x200, (%bx) @@ -73,7 +73,7 @@ vm86_code_start: int $0x21 int90_test: - pushf + pushf pop %dx movb $0xff, %ah int $0x21 @@ -82,15 +82,15 @@ int90_test: movw 4(%bx), %dx movb $0xff, %ah int $0x21 - + movw $GET_OFFSET(int90_msg), %dx movb $0x09, %ah int $0x21 iret - + int90_msg: .string "INT90 started\n$" - + hello_world: .string "Hello VM86 world\n$" @@ -101,4 +101,3 @@ IF_msg1: .string "If you see a diff here, your Linux kernel is buggy, please update to 2.4.20 kernel\n$" vm86_code_end: -
\ No newline at end of file diff --git a/tests/test-i386.c b/tests/test-i386.c index 267391575a..fbc6be639f 100644 --- a/tests/test-i386.c +++ b/tests/test-i386.c @@ -1,6 +1,6 @@ /* * x86 CPU test - * + * * Copyright (c) 2003 Fabrice Bellard * * This program is free software; you can redistribute it and/or modify @@ -470,7 +470,7 @@ void test_jcc(void) #define OP imul #include "test-i386-muldiv.h" -void test_imulw2(long op0, long op1) +void test_imulw2(long op0, long op1) { long res, s1, s0, flags; s0 = op0; @@ -479,7 +479,7 @@ void test_imulw2(long op0, long op1) flags = 0; asm volatile ("push %4\n\t" "popf\n\t" - "imulw %w2, %w0\n\t" + "imulw %w2, %w0\n\t" "pushf\n\t" "pop %1\n\t" : "=q" (res), "=g" (flags) @@ -488,7 +488,7 @@ void test_imulw2(long op0, long op1) "imulw", s0, s1, res, flags & CC_MASK); } -void test_imull2(long op0, long op1) +void test_imull2(long op0, long op1) { long res, s1, s0, flags; s0 = op0; @@ -497,7 +497,7 @@ void test_imull2(long op0, long op1) flags = 0; asm volatile ("push %4\n\t" "popf\n\t" - "imull %k2, %k0\n\t" + "imull %k2, %k0\n\t" "pushf\n\t" "pop %1\n\t" : "=q" (res), "=g" (flags) @@ -507,7 +507,7 @@ void test_imull2(long op0, long op1) } #if defined(__x86_64__) -void test_imulq2(long op0, long op1) +void test_imulq2(long op0, long op1) { long res, s1, s0, flags; s0 = op0; @@ -516,7 +516,7 @@ void test_imulq2(long op0, long op1) flags = 0; asm volatile ("push %4\n\t" "popf\n\t" - "imulq %2, %0\n\t" + "imulq %2, %0\n\t" "pushf\n\t" "pop %1\n\t" : "=q" (res), "=g" (flags) @@ -739,7 +739,7 @@ void fpu_clear_exceptions(void) uint32_t ignored[4]; long double fpregs[8]; } float_env32; - + asm volatile ("fnstenv %0\n" : : "m" (float_env32)); float_env32.fpus &= ~0x7f; asm volatile ("fldenv %0\n" : : "m" (float_env32)); @@ -758,14 +758,14 @@ void test_fcmp(double a, double b) "fstsw %%ax\n" : "=a" (fpus) : "t" (a), "u" (b)); - printf("fcom(%f %f)=%04lx \n", + printf("fcom(%f %f)=%04lx \n", a, b, fpus & (0x4500 | FPUS_EMASK)); fpu_clear_exceptions(); asm("fucom %2\n" "fstsw %%ax\n" : "=a" (fpus) : "t" (a), "u" (b)); - printf("fucom(%f %f)=%04lx\n", + printf("fucom(%f %f)=%04lx\n", a, b, fpus & (0x4500 | FPUS_EMASK)); if (TEST_FCOMI) { /* test f(u)comi instruction */ @@ -776,7 +776,7 @@ void test_fcmp(double a, double b) "pop %0\n" : "=r" (eflags), "=a" (fpus) : "t" (a), "u" (b)); - printf("fcomi(%f %f)=%04lx %02lx\n", + printf("fcomi(%f %f)=%04lx %02lx\n", a, b, fpus & FPUS_EMASK, eflags & (CC_Z | CC_P | CC_C)); fpu_clear_exceptions(); asm("fucomi %3, %2\n" @@ -785,7 +785,7 @@ void test_fcmp(double a, double b) "pop %0\n" : "=r" (eflags), "=a" (fpus) : "t" (a), "u" (b)); - printf("fucomi(%f %f)=%04lx %02lx\n", + printf("fucomi(%f %f)=%04lx %02lx\n", a, b, fpus & FPUS_EMASK, eflags & (CC_Z | CC_P | CC_C)); } fpu_clear_exceptions(); @@ -813,7 +813,7 @@ void test_fcvt(double a) printf("(float)%f = %f\n", a, fa); printf("(long double)%f = %Lf\n", a, la); printf("a=" FMT64X "\n", *(uint64_t *)&a); - printf("la=" FMT64X " %04x\n", *(uint64_t *)&la, + printf("la=" FMT64X " %04x\n", *(uint64_t *)&la, *(unsigned short *)((char *)(&la) + 8)); /* test all roundings */ @@ -855,7 +855,7 @@ void test_fbcd(double a) asm("fbstp %0" : "=m" (bcd[0]) : "t" (a) : "st"); asm("fbld %1" : "=t" (b) : "m" (bcd[0])); - printf("a=%f bcd=%04x%04x%04x%04x%04x b=%f\n", + printf("a=%f bcd=%04x%04x%04x%04x%04x b=%f\n", a, bcd[4], bcd[3], bcd[2], bcd[1], bcd[0], b); } @@ -1041,7 +1041,7 @@ void test_bcd(void) TEST_BCD(aaa, 0x12340306, 0, (CC_C | CC_A)); TEST_BCD(aaa, 0x1234040a, 0, (CC_C | CC_A)); TEST_BCD(aaa, 0x123405fa, 0, (CC_C | CC_A)); - + TEST_BCD(aas, 0x12340205, CC_A, (CC_C | CC_A)); TEST_BCD(aas, 0x12340306, CC_A, (CC_C | CC_A)); TEST_BCD(aas, 0x1234040a, CC_A, (CC_C | CC_A)); @@ -1157,12 +1157,12 @@ void test_xchg(void) else op1 = op0; op2 = 0x6532432432434; - asm("cmpxchg8b %1\n" + asm("cmpxchg8b %1\n" "pushf\n" "pop %2\n" : "=A" (op0), "=m" (op1), "=g" (eflags) : "0" (op0), "m" (op1), "b" ((int)op2), "c" ((int)(op2 >> 32))); - printf("cmpxchg8b: op0=" FMT64X " op1=" FMT64X " CC=%02lx\n", + printf("cmpxchg8b: op0=" FMT64X " op1=" FMT64X " CC=%02lx\n", op0, op1, eflags & CC_Z); } } @@ -1276,9 +1276,9 @@ void test_segs(void) segoff.seg = MK_SEL(2); segoff.offset = 0xabcdef12; - asm volatile("lfs %2, %0\n\t" + asm volatile("lfs %2, %0\n\t" "movl %%fs, %1\n\t" - : "=r" (res), "=g" (res2) + : "=r" (res), "=g" (res2) : "m" (segoff)); printf("FS:reg = %04x:%08x\n", res2, res); @@ -1317,15 +1317,15 @@ void test_code16(void) modify_ldt(1, &ldt, sizeof(ldt)); /* write ldt entry */ /* call the first function */ - asm volatile ("lcall %1, %2" + asm volatile ("lcall %1, %2" : "=a" (res) : "i" (MK_SEL(1)), "i" (&code16_func1): "memory", "cc"); printf("func1() = 0x%08x\n", res); - asm volatile ("lcall %2, %3" + asm volatile ("lcall %2, %3" : "=a" (res), "=c" (res2) : "i" (MK_SEL(1)), "i" (&code16_func2): "memory", "cc"); printf("func2() = 0x%08x spdec=%d\n", res, res2); - asm volatile ("lcall %1, %2" + asm volatile ("lcall %1, %2" : "=a" (res) : "i" (MK_SEL(1)), "i" (&code16_func3): "memory", "cc"); printf("func3() = 0x%08x\n", res); @@ -1373,7 +1373,7 @@ void test_misc(void) asm volatile ("mov %%cs, %0" : "=r" (cs_sel)); asm volatile ("push %1\n" - "call func_lret\n" + "call func_lret\n" : "=a" (res) : "r" (cs_sel) : "memory", "cc"); printf("func_lret=" FMTLX "\n", res); @@ -1381,11 +1381,11 @@ void test_misc(void) /* NOTE: we assume that &func_lret < 4GB */ desc.offset = (long)&func_lret; desc.seg = cs_sel; - + asm volatile ("xor %%rax, %%rax\n" "rex64 lcall %1\n" : "=a" (res) - : "m" (desc) + : "m" (desc) : "memory", "cc"); printf("func_lret2=" FMTLX "\n", res); @@ -1400,12 +1400,12 @@ void test_misc(void) printf("func_lret3=" FMTLX "\n", res); } #else - asm volatile ("push %%cs ; call %1" + asm volatile ("push %%cs ; call %1" : "=a" (res) : "m" (func_lret): "memory", "cc"); printf("func_lret=" FMTLX "\n", res); - asm volatile ("pushf ; push %%cs ; call %1" + asm volatile ("pushf ; push %%cs ; call %1" : "=a" (res) : "m" (func_iret): "memory", "cc"); printf("func_iret=" FMTLX "\n", res); @@ -1472,7 +1472,7 @@ void test_string(void) TEST_STRING(stos, ""); TEST_STRING(stos, "rep "); TEST_STRING(lods, ""); /* to verify stos */ - TEST_STRING(lods, "rep "); + TEST_STRING(lods, "rep "); TEST_STRING(movs, ""); TEST_STRING(movs, "rep "); TEST_STRING(lods, ""); /* to verify stos */ @@ -1526,8 +1526,8 @@ void test_vm86(void) uint8_t *vm86_mem; int seg, ret; - vm86_mem = mmap((void *)0x00000000, 0x110000, - PROT_WRITE | PROT_READ | PROT_EXEC, + vm86_mem = mmap((void *)0x00000000, 0x110000, + PROT_WRITE | PROT_READ | PROT_EXEC, MAP_FIXED | MAP_ANON | MAP_PRIVATE, -1, 0); if (vm86_mem == MAP_FAILED) { printf("ERROR: could not map vm86 memory"); @@ -1550,7 +1550,7 @@ void test_vm86(void) /* move code to proper address. We use the same layout as a .com dos program. */ - memcpy(vm86_mem + (VM86_CODE_CS << 4) + VM86_CODE_IP, + memcpy(vm86_mem + (VM86_CODE_CS << 4) + VM86_CODE_IP, &vm86_code_start, &vm86_code_end - &vm86_code_start); /* mark int 0x21 as being emulated */ @@ -1562,7 +1562,7 @@ void test_vm86(void) case VM86_INTx: { int int_num, ah, v; - + int_num = VM86_ARG(ret); if (int_num != 0x21) goto unknown_int; @@ -1665,7 +1665,7 @@ void test_exceptions(void) { struct sigaction act; volatile int val; - + act.sa_sigaction = sig_handler; sigemptyset(&act.sa_mask); act.sa_flags = SA_SIGINFO | SA_NODEFER; @@ -1718,7 +1718,7 @@ void test_exceptions(void) ldt.seg_not_present = 1; ldt.useable = 1; modify_ldt(1, &ldt, sizeof(ldt)); /* write ldt entry */ - + if (setjmp(jmp_env) == 0) { /* segment not present */ asm volatile ("movl %0, %%fs" : : "r" (MK_SEL(1))); @@ -1743,7 +1743,7 @@ void test_exceptions(void) /* read from an invalid address */ v1 = *(char *)0x1234; } - + /* test illegal instruction reporting */ printf("UD2 exception:\n"); if (setjmp(jmp_env) == 0) { @@ -1755,7 +1755,7 @@ void test_exceptions(void) /* now execute an invalid instruction */ asm volatile("lock nop"); } - + printf("INT exception:\n"); if (setjmp(jmp_env) == 0) { asm volatile ("int $0xfd"); @@ -1827,7 +1827,7 @@ void test_exceptions(void) asm volatile ("pushf\n" "orl $0x00100, (%%esp)\n" "popf\n" - "movl $0xabcd, %0\n" + "movl $0xabcd, %0\n" "movl $0x0, %0\n" : "=m" (val) : : "cc", "memory"); } printf("val=0x%x\n", val); @@ -1858,7 +1858,7 @@ void test_single_step(void) asm volatile ("pushf\n" "orl $0x00100, (%%esp)\n" "popf\n" - "movl $0xabcd, %0\n" + "movl $0xabcd, %0\n" /* jmp test */ "movl $3, %%ecx\n" @@ -1884,13 +1884,13 @@ void test_single_step(void) "rep cmpsb\n" "movl $4, %%ecx\n" "rep cmpsb\n" - + /* getpid() syscall: single step should skip one instruction */ "movl $20, %%eax\n" "int $0x80\n" "movl $0, %%eax\n" - + /* when modifying SS, trace is not done on the next instruction */ "movl %%ss, %%ecx\n" @@ -1906,12 +1906,12 @@ void test_single_step(void) "popl %%ss\n" "addl $1, %0\n" "movl $1, %%eax\n" - + "pushf\n" "andl $~0x00100, (%%esp)\n" "popf\n" - : "=m" (val) - : + : "=m" (val) + : : "cc", "memory", "eax", "ecx", "esi", "edi"); printf("val=%d\n", val); for(i = 0; i < 4; i++) @@ -2282,14 +2282,14 @@ void test_fxsave(void) " fxrstor %0\n" " fxsave %1\n" " fninit\n" - : "=m" (*(uint32_t *)fp2), "=m" (*(uint32_t *)fp) + : "=m" (*(uint32_t *)fp2), "=m" (*(uint32_t *)fp) : "m" (a), "m" (b)); printf("fpuc=%04x\n", fp->fpuc); printf("fpus=%04x\n", fp->fpus); printf("fptag=%04x\n", fp->fptag); for(i = 0; i < 3; i++) { printf("ST%d: " FMT64X " %04x\n", - i, + i, *(uint64_t *)&fp->fpregs1[i * 16], *(uint16_t *)&fp->fpregs1[i * 16 + 8]); } @@ -2301,7 +2301,7 @@ void test_fxsave(void) #endif for(i = 0; i < nb_xmm; i++) { printf("xmm%d: " FMT64X "" FMT64X "\n", - i, + i, *(uint64_t *)&fp->xmm_regs[i * 16], *(uint64_t *)&fp->xmm_regs[i * 16 + 8]); } @@ -2341,7 +2341,7 @@ void test_sse(void) MMX_OP2(pmulhuw); MMX_OP2(pmulhw); - + MMX_OP2(psubsb); MMX_OP2(psubsw); MMX_OP2(pminsw); @@ -2380,7 +2380,7 @@ void test_sse(void) asm volatile ("pmovmskb %1, %0" : "=r" (r.l[0]) : "y" (a.q[0])); printf("%-9s: r=%08x\n", "pmovmskb", r.l[0]); - + asm volatile ("pmovmskb %1, %0" : "=r" (r.l[0]) : "x" (a.dq)); printf("%-9s: r=%08x\n", "pmovmskb", r.l[0]); @@ -2392,21 +2392,21 @@ void test_sse(void) a.q[1] = test_values[0][1]; b.q[0] = test_values[1][0]; b.q[1] = test_values[1][1]; - asm volatile("maskmovq %1, %0" : + asm volatile("maskmovq %1, %0" : : "y" (a.q[0]), "y" (b.q[0]), "D" (&r) - : "memory"); - printf("%-9s: r=" FMT64X " a=" FMT64X " b=" FMT64X "\n", - "maskmov", - r.q[0], - a.q[0], + : "memory"); + printf("%-9s: r=" FMT64X " a=" FMT64X " b=" FMT64X "\n", + "maskmov", + r.q[0], + a.q[0], b.q[0]); - asm volatile("maskmovdqu %1, %0" : + asm volatile("maskmovdqu %1, %0" : : "x" (a.dq), "x" (b.dq), "D" (&r) - : "memory"); - printf("%-9s: r=" FMT64X "" FMT64X " a=" FMT64X "" FMT64X " b=" FMT64X "" FMT64X "\n", - "maskmov", - r.q[1], r.q[0], - a.q[1], a.q[0], + : "memory"); + printf("%-9s: r=" FMT64X "" FMT64X " a=" FMT64X "" FMT64X " b=" FMT64X "" FMT64X "\n", + "maskmov", + r.q[1], r.q[0], + a.q[1], a.q[0], b.q[1], b.q[0]); } @@ -2506,8 +2506,8 @@ void test_sse(void) SSE_OPS(cmpnlt); SSE_OPS(cmpnle); SSE_OPS(cmpord); - - + + a.d[0] = 2.7; a.d[1] = -3.4; b.d[0] = 45.7; diff --git a/tests/test_path.c b/tests/test_path.c index a9b52de378..7d6e831767 100644 --- a/tests/test_path.c +++ b/tests/test_path.c @@ -149,4 +149,4 @@ int main(int argc, char *argv[]) } return 0; } - + |