diff options
-rw-r--r-- | Makefile.target | 3 | ||||
-rw-r--r-- | cpu-exec.c | 126 | ||||
-rw-r--r-- | darwin-user/main.c | 8 | ||||
-rw-r--r-- | darwin-user/signal.c | 6 | ||||
-rw-r--r-- | exec.c | 5 | ||||
-rw-r--r-- | linux-user/main.c | 8 | ||||
-rw-r--r-- | linux-user/signal.c | 6 | ||||
-rw-r--r-- | target-i386/cpu.h | 11 | ||||
-rw-r--r-- | target-i386/helper2.c | 105 | ||||
-rw-r--r-- | target-i386/translate.c | 3 | ||||
-rw-r--r-- | tests/qruncom.c | 3 | ||||
-rw-r--r-- | translate-all.c | 45 | ||||
-rw-r--r-- | vl.c | 21 |
13 files changed, 23 insertions, 327 deletions
diff --git a/Makefile.target b/Makefile.target index e8ead7df53..ab925ad096 100644 --- a/Makefile.target +++ b/Makefile.target @@ -302,9 +302,6 @@ CPPFLAGS+=-I$(SRC_PATH)/fpu ifeq ($(TARGET_ARCH), i386) LIBOBJS+=helper.o helper2.o -ifeq ($(ARCH), i386) -LIBOBJS+=translate-copy.o -endif endif ifeq ($(TARGET_ARCH), x86_64) diff --git a/cpu-exec.c b/cpu-exec.c index 3bfa0bc1f2..4ba63fba31 100644 --- a/cpu-exec.c +++ b/cpu-exec.c @@ -612,19 +612,9 @@ int cpu_exec(CPUState *env1) #if USE_KQEMU (env->kqemu_enabled != 2) && #endif - tb->page_addr[1] == -1 -#if defined(TARGET_I386) && defined(USE_CODE_COPY) - && (tb->cflags & CF_CODE_COPY) == - (((TranslationBlock *)(T0 & ~3))->cflags & CF_CODE_COPY) -#endif - ) { + tb->page_addr[1] == -1) { spin_lock(&tb_lock); tb_add_jump((TranslationBlock *)(long)(T0 & ~3), T0 & 3, tb); -#if defined(USE_CODE_COPY) - /* propagates the FP use info */ - ((TranslationBlock *)(T0 & ~3))->cflags |= - (tb->cflags & CF_FP_USED); -#endif spin_unlock(&tb_lock); } } @@ -648,80 +638,6 @@ int cpu_exec(CPUState *env1) : /* no outputs */ : "r" (gen_func) : "r1", "r2", "r3", "r8", "r9", "r10", "r12", "r14"); -#elif defined(TARGET_I386) && defined(USE_CODE_COPY) -{ - if (!(tb->cflags & CF_CODE_COPY)) { - if ((tb->cflags & CF_FP_USED) && env->native_fp_regs) { - save_native_fp_state(env); - } - gen_func(); - } else { - if ((tb->cflags & CF_FP_USED) && !env->native_fp_regs) { - restore_native_fp_state(env); - } - /* we work with native eflags */ - CC_SRC = cc_table[CC_OP].compute_all(); - CC_OP = CC_OP_EFLAGS; - asm(".globl exec_loop\n" - "\n" - "debug1:\n" - " pushl %%ebp\n" - " fs movl %10, %9\n" - " fs movl %11, %%eax\n" - " andl $0x400, %%eax\n" - " fs orl %8, %%eax\n" - " pushl %%eax\n" - " popf\n" - " fs movl %%esp, %12\n" - " fs movl %0, %%eax\n" - " fs movl %1, %%ecx\n" - " fs movl %2, %%edx\n" - " fs movl %3, %%ebx\n" - " fs movl %4, %%esp\n" - " fs movl %5, %%ebp\n" - " fs movl %6, %%esi\n" - " fs movl %7, %%edi\n" - " fs jmp *%9\n" - "exec_loop:\n" - " fs movl %%esp, %4\n" - " fs movl %12, %%esp\n" - " fs movl %%eax, %0\n" - " fs movl %%ecx, %1\n" - " fs movl %%edx, %2\n" - " fs movl %%ebx, %3\n" - " fs movl %%ebp, %5\n" - " fs movl %%esi, %6\n" - " fs movl %%edi, %7\n" - " pushf\n" - " popl %%eax\n" - " movl %%eax, %%ecx\n" - " andl $0x400, %%ecx\n" - " shrl $9, %%ecx\n" - " andl $0x8d5, %%eax\n" - " fs movl %%eax, %8\n" - " movl $1, %%eax\n" - " subl %%ecx, %%eax\n" - " fs movl %%eax, %11\n" - " fs movl %9, %%ebx\n" /* get T0 value */ - " popl %%ebp\n" - : - : "m" (*(uint8_t *)offsetof(CPUState, regs[0])), - "m" (*(uint8_t *)offsetof(CPUState, regs[1])), - "m" (*(uint8_t *)offsetof(CPUState, regs[2])), - "m" (*(uint8_t *)offsetof(CPUState, regs[3])), - "m" (*(uint8_t *)offsetof(CPUState, regs[4])), - "m" (*(uint8_t *)offsetof(CPUState, regs[5])), - "m" (*(uint8_t *)offsetof(CPUState, regs[6])), - "m" (*(uint8_t *)offsetof(CPUState, regs[7])), - "m" (*(uint8_t *)offsetof(CPUState, cc_src)), - "m" (*(uint8_t *)offsetof(CPUState, tmp0)), - "a" (gen_func), - "m" (*(uint8_t *)offsetof(CPUState, df)), - "m" (*(uint8_t *)offsetof(CPUState, saved_esp)) - : "%ecx", "%edx" - ); - } -} #elif defined(__ia64) struct fptr { void *ip; @@ -759,11 +675,6 @@ int cpu_exec(CPUState *env1) #if defined(TARGET_I386) -#if defined(USE_CODE_COPY) - if (env->native_fp_regs) { - save_native_fp_state(env); - } -#endif /* restore flags in standard format */ env->eflags = env->eflags | cc_table[CC_OP].compute_all() | (DF & DF_MASK); #elif defined(TARGET_ARM) @@ -1275,26 +1186,6 @@ static inline int handle_cpu_signal(unsigned long pc, unsigned long address, # define ERROR_sig(context) ((context)->uc_mcontext.gregs[REG_ERR]) #endif -#if defined(USE_CODE_COPY) -static void cpu_send_trap(unsigned long pc, int trap, - struct ucontext *uc) -{ - TranslationBlock *tb; - - if (cpu_single_env) - env = cpu_single_env; /* XXX: find a correct solution for multithread */ - /* now we have a real cpu fault */ - tb = tb_find_pc(pc); - if (tb) { - /* the PC is inside the translated code. It means that we have - a virtual CPU fault */ - cpu_restore_state(tb, env, pc, uc); - } - sigprocmask(SIG_SETMASK, &uc->uc_sigmask, NULL); - raise_exception_err(trap, env->error_code); -} -#endif - int cpu_signal_handler(int host_signum, void *pinfo, void *puc) { @@ -1311,17 +1202,10 @@ int cpu_signal_handler(int host_signum, void *pinfo, #endif pc = EIP_sig(uc); trapno = TRAP_sig(uc); -#if defined(TARGET_I386) && defined(USE_CODE_COPY) - if (trapno == 0x00 || trapno == 0x05) { - /* send division by zero or bound exception */ - cpu_send_trap(pc, trapno, uc); - return 1; - } else -#endif - return handle_cpu_signal(pc, (unsigned long)info->si_addr, - trapno == 0xe ? - (ERROR_sig(uc) >> 1) & 1 : 0, - &uc->uc_sigmask, puc); + return handle_cpu_signal(pc, (unsigned long)info->si_addr, + trapno == 0xe ? + (ERROR_sig(uc) >> 1) & 1 : 0, + &uc->uc_sigmask, puc); } #elif defined(__x86_64__) diff --git a/darwin-user/main.c b/darwin-user/main.c index 70328ec8ee..f240f35a66 100644 --- a/darwin-user/main.c +++ b/darwin-user/main.c @@ -757,9 +757,6 @@ void usage(void) "-s size set the stack size in bytes (default=%ld)\n" "\n" "debug options:\n" -#ifdef USE_CODE_COPY - "-no-code-copy disable code copy acceleration\n" -#endif "-d options activate log (logfile='%s')\n" "-g wait for gdb on port 1234\n" "-p pagesize set the host page size to 'pagesize'\n", @@ -845,11 +842,6 @@ int main(int argc, char **argv) if (!strcmp(r, "g")) { use_gdbstub = 1; } else -#ifdef USE_CODE_COPY - if (!strcmp(r, "no-code-copy")) { - code_copy_enabled = 0; - } else -#endif { usage(); } diff --git a/darwin-user/signal.c b/darwin-user/signal.c index a0b9f89dcc..8dbfa931e1 100644 --- a/darwin-user/signal.c +++ b/darwin-user/signal.c @@ -198,11 +198,7 @@ static void host_signal_handler(int host_signum, siginfo_t *info, /* the CPU emulator uses some host signals to detect exceptions, we we forward to it some signals */ - if (host_signum == SIGSEGV || host_signum == SIGBUS -#if defined(TARGET_I386) && defined(USE_CODE_COPY) - || host_signum == SIGFPE -#endif - ) { + if (host_signum == SIGSEGV || host_signum == SIGBUS) { if (cpu_signal_handler(host_signum, (void*)info, puc)) return; } @@ -944,11 +944,6 @@ void tb_link_phys(TranslationBlock *tb, tb->jmp_first = (TranslationBlock *)((long)tb | 2); tb->jmp_next[0] = NULL; tb->jmp_next[1] = NULL; -#ifdef USE_CODE_COPY - tb->cflags &= ~CF_FP_USED; - if (tb->cflags & CF_TB_FP_USED) - tb->cflags |= CF_FP_USED; -#endif /* init original jump addresses */ if (tb->tb_next_offset[0] != 0xffff) diff --git a/linux-user/main.c b/linux-user/main.c index 716348cff8..b480a9ca28 100644 --- a/linux-user/main.c +++ b/linux-user/main.c @@ -1855,9 +1855,6 @@ void usage(void) "-drop-ld-preload drop LD_PRELOAD for target process\n" "\n" "debug options:\n" -#ifdef USE_CODE_COPY - "-no-code-copy disable code copy acceleration\n" -#endif "-d options activate log (logfile=%s)\n" "-p pagesize set the host page size to 'pagesize'\n", TARGET_ARCH, @@ -1956,11 +1953,6 @@ int main(int argc, char **argv) } else if (!strcmp(r, "drop-ld-preload")) { drop_ld_preload = 1; } else -#ifdef USE_CODE_COPY - if (!strcmp(r, "no-code-copy")) { - code_copy_enabled = 0; - } else -#endif { usage(); } diff --git a/linux-user/signal.c b/linux-user/signal.c index 0c5944abab..984c598f26 100644 --- a/linux-user/signal.c +++ b/linux-user/signal.c @@ -415,11 +415,7 @@ static void host_signal_handler(int host_signum, siginfo_t *info, /* the CPU emulator uses some host signals to detect exceptions, we we forward to it some signals */ - if (host_signum == SIGSEGV || host_signum == SIGBUS -#if defined(TARGET_I386) && defined(USE_CODE_COPY) - || host_signum == SIGFPE -#endif - ) { + if (host_signum == SIGSEGV || host_signum == SIGBUS) { if (cpu_signal_handler(host_signum, info, puc)) return; } diff --git a/target-i386/cpu.h b/target-i386/cpu.h index e92fc31048..c8fb125916 100644 --- a/target-i386/cpu.h +++ b/target-i386/cpu.h @@ -46,10 +46,6 @@ #include "softfloat.h" -#if defined(__i386__) && !defined(CONFIG_SOFTMMU) && !defined(__APPLE__) -#define USE_CODE_COPY -#endif - #define R_EAX 0 #define R_ECX 1 #define R_EDX 2 @@ -552,13 +548,6 @@ typedef struct CPUX86State { uint64_t pat; - /* temporary data for USE_CODE_COPY mode */ -#ifdef USE_CODE_COPY - uint32_t tmp0; - uint32_t saved_esp; - int native_fp_regs; /* if true, the FPU state is in the native CPU regs */ -#endif - /* exception/interrupt handling */ jmp_buf jmp_env; int exception_index; diff --git a/target-i386/helper2.c b/target-i386/helper2.c index 87788d7214..065532049a 100644 --- a/target-i386/helper2.c +++ b/target-i386/helper2.c @@ -31,22 +31,6 @@ //#define DEBUG_MMU -#ifdef USE_CODE_COPY -#include <unistd.h> -#include <asm/ldt.h> -#include <linux/unistd.h> -#include <linux/version.h> - -int modify_ldt(int func, void *ptr, unsigned long bytecount) -{ - return syscall(__NR_modify_ldt, func, ptr, bytecount); -} - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5, 66) -#define modify_ldt_ldt_s user_desc -#endif -#endif /* USE_CODE_COPY */ - static struct x86_def_t *x86_cpu_def; typedef struct x86_def_t x86_def_t; static int cpu_x86_register (CPUX86State *env, const x86_def_t *def); @@ -123,25 +107,6 @@ CPUX86State *cpu_x86_init(void) inited = 1; optimize_flags_init(); } -#ifdef USE_CODE_COPY - /* testing code for code copy case */ - { - struct modify_ldt_ldt_s ldt; - - ldt.entry_number = 1; - ldt.base_addr = (unsigned long)env; - ldt.limit = (sizeof(CPUState) + 0xfff) >> 12; - ldt.seg_32bit = 1; - ldt.contents = MODIFY_LDT_CONTENTS_DATA; - ldt.read_exec_only = 0; - ldt.limit_in_pages = 1; - ldt.seg_not_present = 0; - ldt.useable = 1; - modify_ldt(1, &ldt, sizeof(ldt)); /* write ldt entry */ - - asm volatile ("movl %0, %%fs" : : "r" ((1 << 3) | 7)); - } -#endif cpu_x86_register(env, x86_cpu_def); cpu_reset(env); #ifdef USE_KQEMU @@ -1186,73 +1151,3 @@ target_phys_addr_t cpu_get_phys_page_debug(CPUState *env, target_ulong addr) return paddr; } #endif /* !CONFIG_USER_ONLY */ - -#if defined(USE_CODE_COPY) -struct fpstate { - uint16_t fpuc; - uint16_t dummy1; - uint16_t fpus; - uint16_t dummy2; - uint16_t fptag; - uint16_t dummy3; - - uint32_t fpip; - uint32_t fpcs; - uint32_t fpoo; - uint32_t fpos; - uint8_t fpregs1[8 * 10]; -}; - -void restore_native_fp_state(CPUState *env) -{ - int fptag, i, j; - struct fpstate fp1, *fp = &fp1; - - fp->fpuc = env->fpuc; - fp->fpus = (env->fpus & ~0x3800) | (env->fpstt & 0x7) << 11; - fptag = 0; - for (i=7; i>=0; i--) { - fptag <<= 2; - if (env->fptags[i]) { - fptag |= 3; - } else { - /* the FPU automatically computes it */ - } - } - fp->fptag = fptag; - j = env->fpstt; - for(i = 0;i < 8; i++) { - memcpy(&fp->fpregs1[i * 10], &env->fpregs[j].d, 10); - j = (j + 1) & 7; - } - asm volatile ("frstor %0" : "=m" (*fp)); - env->native_fp_regs = 1; -} - -void save_native_fp_state(CPUState *env) -{ - int fptag, i, j; - uint16_t fpuc; - struct fpstate fp1, *fp = &fp1; - - asm volatile ("fsave %0" : : "m" (*fp)); - env->fpuc = fp->fpuc; - env->fpstt = (fp->fpus >> 11) & 7; - env->fpus = fp->fpus & ~0x3800; - fptag = fp->fptag; - for(i = 0;i < 8; i++) { - env->fptags[i] = ((fptag & 3) == 3); - fptag >>= 2; - } - j = env->fpstt; - for(i = 0;i < 8; i++) { - memcpy(&env->fpregs[j].d, &fp->fpregs1[i * 10], 10); - j = (j + 1) & 7; - } - /* we must restore the default rounding state */ - /* XXX: we do not restore the exception state */ - fpuc = 0x037f | (env->fpuc & (3 << 10)); - asm volatile("fldcw %0" : : "m" (fpuc)); - env->native_fp_regs = 0; -} -#endif diff --git a/target-i386/translate.c b/target-i386/translate.c index 7ab8f4b69f..02dc6cf61c 100644 --- a/target-i386/translate.c +++ b/target-i386/translate.c @@ -4888,9 +4888,6 @@ static target_ulong disas_insn(DisasContext *s, target_ulong pc_start) goto illegal_op; } } -#ifdef USE_CODE_COPY - s->tb->cflags |= CF_TB_FP_USED; -#endif break; /************************/ /* string ops */ diff --git a/tests/qruncom.c b/tests/qruncom.c index ad0d938ee1..1f2b63e3c7 100644 --- a/tests/qruncom.c +++ b/tests/qruncom.c @@ -193,9 +193,6 @@ int main(int argc, char **argv) act.sa_sigaction = host_segv_handler; sigaction(SIGSEGV, &act, NULL); sigaction(SIGBUS, &act, NULL); -#if defined (TARGET_I386) && defined(USE_CODE_COPY) - sigaction(SIGFPE, &act, NULL); -#endif } // cpu_set_log(CPU_LOG_TB_IN_ASM | CPU_LOG_TB_OUT_ASM | CPU_LOG_EXEC); diff --git a/translate-all.c b/translate-all.c index 197c48c54b..c42fedf7f6 100644 --- a/translate-all.c +++ b/translate-all.c @@ -144,35 +144,27 @@ int cpu_gen_code(CPUState *env, TranslationBlock *tb, uint8_t *gen_code_buf; int gen_code_size; -#ifdef USE_CODE_COPY - if (code_copy_enabled && - cpu_gen_code_copy(env, tb, max_code_size, &gen_code_size) == 0) { - /* nothing more to do */ - } else -#endif - { - if (gen_intermediate_code(env, tb) < 0) - return -1; - - /* generate machine code */ - tb->tb_next_offset[0] = 0xffff; - tb->tb_next_offset[1] = 0xffff; - gen_code_buf = tb->tc_ptr; + if (gen_intermediate_code(env, tb) < 0) + return -1; + + /* generate machine code */ + tb->tb_next_offset[0] = 0xffff; + tb->tb_next_offset[1] = 0xffff; + gen_code_buf = tb->tc_ptr; #ifdef USE_DIRECT_JUMP - /* the following two entries are optional (only used for string ops) */ - tb->tb_jmp_offset[2] = 0xffff; - tb->tb_jmp_offset[3] = 0xffff; + /* the following two entries are optional (only used for string ops) */ + tb->tb_jmp_offset[2] = 0xffff; + tb->tb_jmp_offset[3] = 0xffff; #endif - dyngen_labels(gen_labels, nb_gen_labels, gen_code_buf, gen_opc_buf); - - gen_code_size = dyngen_code(gen_code_buf, tb->tb_next_offset, + dyngen_labels(gen_labels, nb_gen_labels, gen_code_buf, gen_opc_buf); + + gen_code_size = dyngen_code(gen_code_buf, tb->tb_next_offset, #ifdef USE_DIRECT_JUMP - tb->tb_jmp_offset, + tb->tb_jmp_offset, #else - NULL, + NULL, #endif - gen_opc_buf, gen_opparam_buf, gen_labels); - } + gen_opc_buf, gen_opparam_buf, gen_labels); *gen_code_size_ptr = gen_code_size; #ifdef DEBUG_DISAS if (loglevel & CPU_LOG_TB_OUT_ASM) { @@ -195,11 +187,6 @@ int cpu_restore_state(TranslationBlock *tb, unsigned long tc_ptr; uint16_t *opc_ptr; -#ifdef USE_CODE_COPY - if (tb->cflags & CF_CODE_COPY) { - return cpu_restore_state_copy(tb, env, searched_pc, puc); - } -#endif if (gen_intermediate_code_pc(env, tb) < 0) return -1; @@ -1222,9 +1222,6 @@ static void enable_sigio_timer(int fd) /* timer signal */ sigfillset(&act.sa_mask); act.sa_flags = 0; -#if defined (TARGET_I386) && defined(USE_CODE_COPY) - act.sa_flags |= SA_ONSTACK; -#endif act.sa_handler = host_alarm_handler; sigaction(SIGIO, &act, NULL); @@ -1322,9 +1319,6 @@ static int dynticks_start_timer(struct qemu_alarm_timer *t) sigfillset(&act.sa_mask); act.sa_flags = 0; -#if defined(TARGET_I386) && defined(USE_CODE_COPY) - act.sa_flags |= SA_ONSTACK; -#endif act.sa_handler = host_alarm_handler; sigaction(SIGALRM, &act, NULL); @@ -1399,9 +1393,6 @@ static int unix_start_timer(struct qemu_alarm_timer *t) /* timer signal */ sigfillset(&act.sa_mask); act.sa_flags = 0; -#if defined(TARGET_I386) && defined(USE_CODE_COPY) - act.sa_flags |= SA_ONSTACK; -#endif act.sa_handler = host_alarm_handler; sigaction(SIGALRM, &act, NULL); @@ -7093,9 +7084,6 @@ static void help(int exitcode) "-kernel-kqemu enable KQEMU full virtualization (default is user mode only)\n" "-no-kqemu disable KQEMU kernel module usage\n" #endif -#ifdef USE_CODE_COPY - "-no-code-copy disable code copy acceleration\n" -#endif #ifdef TARGET_I386 "-std-vga simulate a standard VGA card with VESA Bochs Extensions\n" " (default is CL-GD5446 PCI VGA)\n" @@ -7324,15 +7312,6 @@ const QEMUOption qemu_options[] = { { NULL }, }; -#if defined (TARGET_I386) && defined(USE_CODE_COPY) - -/* this stack is only used during signal handling */ -#define SIGNAL_STACK_SIZE 32768 - -static uint8_t *signal_stack; - -#endif - /* password input */ int qemu_key_check(BlockDriverState *bs, const char *name) |