Commit 97eb5b14dcfad346fa79e95e0e020aced9973311
1 parent
7eee2a50
native FPU support in code copy mode
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@643 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
1 changed file
with
17 additions
and
1 deletions
cpu-exec.c
| ... | ... | @@ -380,6 +380,11 @@ int cpu_exec(CPUState *env1) |
| 380 | 380 | ) { |
| 381 | 381 | spin_lock(&tb_lock); |
| 382 | 382 | tb_add_jump((TranslationBlock *)(T0 & ~3), T0 & 3, tb); |
| 383 | +#if defined(USE_CODE_COPY) | |
| 384 | + /* propagates the FP use info */ | |
| 385 | + ((TranslationBlock *)(T0 & ~3))->cflags |= | |
| 386 | + (tb->cflags & CF_FP_USED); | |
| 387 | +#endif | |
| 383 | 388 | spin_unlock(&tb_lock); |
| 384 | 389 | } |
| 385 | 390 | tc_ptr = tb->tc_ptr; |
| ... | ... | @@ -402,8 +407,14 @@ int cpu_exec(CPUState *env1) |
| 402 | 407 | #elif defined(TARGET_I386) && defined(USE_CODE_COPY) |
| 403 | 408 | { |
| 404 | 409 | if (!(tb->cflags & CF_CODE_COPY)) { |
| 410 | + if ((tb->cflags & CF_FP_USED) && env->native_fp_regs) { | |
| 411 | + save_native_fp_state(env); | |
| 412 | + } | |
| 405 | 413 | gen_func(); |
| 406 | 414 | } else { |
| 415 | + if ((tb->cflags & CF_FP_USED) && !env->native_fp_regs) { | |
| 416 | + restore_native_fp_state(env); | |
| 417 | + } | |
| 407 | 418 | /* we work with native eflags */ |
| 408 | 419 | CC_SRC = cc_table[CC_OP].compute_all(); |
| 409 | 420 | CC_OP = CC_OP_EFLAGS; |
| ... | ... | @@ -487,6 +498,11 @@ int cpu_exec(CPUState *env1) |
| 487 | 498 | |
| 488 | 499 | |
| 489 | 500 | #if defined(TARGET_I386) |
| 501 | +#if defined(USE_CODE_COPY) | |
| 502 | + if (env->native_fp_regs) { | |
| 503 | + save_native_fp_state(env); | |
| 504 | + } | |
| 505 | +#endif | |
| 490 | 506 | /* restore flags in standard format */ |
| 491 | 507 | env->eflags = env->eflags | cc_table[CC_OP].compute_all() | (DF & DF_MASK); |
| 492 | 508 | |
| ... | ... | @@ -747,7 +763,7 @@ int cpu_signal_handler(int host_signum, struct siginfo *info, |
| 747 | 763 | struct ucontext *uc = puc; |
| 748 | 764 | unsigned long pc; |
| 749 | 765 | int trapno; |
| 750 | - | |
| 766 | + | |
| 751 | 767 | #ifndef REG_EIP |
| 752 | 768 | /* for glibc 2.1 */ |
| 753 | 769 | #define REG_EIP EIP | ... | ... |