diff options
author | The Android Open Source Project <initial-contribution@android.com> | 2008-10-21 07:00:00 -0700 |
---|---|---|
committer | The Android Open Source Project <initial-contribution@android.com> | 2008-10-21 07:00:00 -0700 |
commit | 55f4e4a5ec657a017e3bf75299ad71fd1c968dd3 (patch) | |
tree | 550ce922ea0e125ac6a9738210ce2939bf2fe901 /tests | |
parent | 413f05aaf54fa08c0ae7e997327a4f4a473c0a8d (diff) | |
download | external_qemu-55f4e4a5ec657a017e3bf75299ad71fd1c968dd3.zip external_qemu-55f4e4a5ec657a017e3bf75299ad71fd1c968dd3.tar.gz external_qemu-55f4e4a5ec657a017e3bf75299ad71fd1c968dd3.tar.bz2 |
Initial Contribution
Diffstat (limited to 'tests')
-rw-r--r-- | tests/.cvsignore | 23 | ||||
-rw-r--r-- | tests/qruncom.c | 32 | ||||
-rw-r--r-- | tests/runcom.c | 12 |
3 files changed, 22 insertions, 45 deletions
diff --git a/tests/.cvsignore b/tests/.cvsignore deleted file mode 100644 index 18a8298..0000000 --- a/tests/.cvsignore +++ /dev/null @@ -1,23 +0,0 @@ - gmon.out - testsig - hello-i386 - hello-arm - sha1.test.c - sha1.c - test-i386 - sha1 - testclone - .gdb_history - testthread - test-i386.s - test-i386.ref - sha1-i386 - runcom - debug.com - test-i386.out - speed.txt - test-i386.ref.P3 - pi_10.com - test-i386.ref.P4 - ldso.c - test_path diff --git a/tests/qruncom.c b/tests/qruncom.c index 421e6a9..8130a81 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"); @@ -170,7 +170,7 @@ int main(int argc, char **argv) } /* load the MSDOS .com executable */ - fd = open(filename, O_RDONLY); + fd = open(filename, O_BINARY | O_RDONLY); if (fd < 0) { perror(filename); exit(1); @@ -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 43deeca..f2781ce 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"); @@ -101,7 +101,7 @@ int main(int argc, char **argv) #endif /* load the MSDOS .com executable */ - fd = open(filename, O_RDONLY); + fd = open(filename, O_BINARY | O_RDONLY); if (fd < 0) { perror(filename); exit(1); @@ -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; |