[5252] Move the active FPU registers into env again, and use more TCG registers
Revision: 5252
http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=5252 Author: ths Date: 2008-09-18 11:57:27 +0000 (Thu, 18 Sep 2008)
Log Message:
-----------
Move the active FPU registers into env again, and use more TCG registers to access them.
Modified Paths:
--------------
trunk/gdbstub.c
trunk/target-mips/TODO
trunk/target-mips/cpu.h
trunk/target-mips/exec.h
trunk/target-mips/op_helper.c
trunk/target-mips/translate.c
trunk/target-mips/translate_init.c
Modified: trunk/gdbstub.c
===================================================================
gdbstub.c +8 -8
@@ -731,16 +731,16 @@for (i =0 ; i <32 ; i++) {if (env->CP0_Status & (1 << CP0St_FR)) - *(target_ulong *)ptr =tswapl (env->fpu->fpr[i].d); + *(target_ulong *)ptr =tswapl (env->active_fpu.fpr[i].d);else - *(target_ulong *)ptr =tswap32 (env->fpu->fpr[i].w[FP_ENDIAN_IDX ]); + *(target_ulong *)ptr =tswap32 (env->active_fpu.fpr[i].w[FP_ENDIAN_IDX ]); ptr +=sizeof (target_ulong); } - *(target_ulong *)ptr = (int32_t )tswap32 (env->fpu->fcr31); + *(target_ulong *)ptr = (int32_t )tswap32 (env->active_fpu.fcr31); ptr +=sizeof (target_ulong); - *(target_ulong *)ptr = (int32_t )tswap32 (env->fpu->fcr0); + *(target_ulong *)ptr = (int32_t )tswap32 (env->active_fpu.fcr0); ptr +=sizeof (target_ulong); }
@@ -771,7 +771,7 @@ float_round_down };#define RESTORE_ROUNDING_MODE \ - set_float_rounding_mode(ieee_rm[env->fpu->fcr31 & 3], &env->fpu->fp_status) + set_float_rounding_mode(ieee_rm[env->active_fpu.fcr31 & 3], &env->active_fpu.fp_status)static void cpu_gdb_write_registers (CPUState *env,uint8_t *mem_buf,int size) {
@@ -808,13 +808,13 @@for (i =0 ; i <32 ; i++) {if (env->CP0_Status & (1 << CP0St_FR)) - env->fpu->fpr[i].d =tswapl (*(target_ulong *)ptr); + env->active_fpu.fpr[i].d =tswapl (*(target_ulong *)ptr);else - env->fpu->fpr[i].w[FP_ENDIAN_IDX ] =tswapl (*(target_ulong *)ptr); + env->active_fpu.fpr[i].w[FP_ENDIAN_IDX ] =tswapl (*(target_ulong *)ptr); ptr +=sizeof (target_ulong); } - env->fpu->fcr31 =tswapl (*(target_ulong *)ptr) &0xFF83FFFF ; + env->active_fpu.fcr31 =tswapl (*(target_ulong *)ptr) &0xFF83FFFF ; ptr +=sizeof (target_ulong);/* The remaining registers are assumed to be read-only. */
Modified: trunk/target-mips/TODO
===================================================================
target-mips/TODO +0 -5
@@ -30,11 +30,6 @@ each ASID change. Using the MMU modes to implement ASIDs hinges on implementing the global bit efficiently. - save/restore of the CPU state is not implemented (see machine.c). -- Improve cpu state handling: - Step 1) Collect all the TC state in a single struct, so we need only - a single global pointer for the active TC. - Step 2) Use only a single TC context as working context, and copy the - contexts on TC switch. Likewise for FPU contexts. MIPS64 ------
Modified: trunk/target-mips/cpu.h
===================================================================
target-mips/cpu.h +7 -4
@@ -84,9 +84,9 @@#define FCR0_REV 0/* fcsr */ uint32_t fcr31; -#define SET_FP_COND (num,env) do { ((env)->fcr31) |= ((num) ? (1 << ((num) + 24)) : (1 << 23)); } while(0) -#define CLEAR_FP_COND (num,env) do { ((env)->fcr31) &= ~((num) ? (1 << ((num) + 24)) : (1 << 23)); } while(0) -#define GET_FP_COND (env) ((((env)->fcr31 >> 24) & 0xfe) | (((env)->fcr31 >> 23) & 0x1)) +#define SET_FP_COND (num,env) do { ((env).fcr31) |= ((num) ? (1 << ((num) + 24)) : (1 << 23)); } while(0) +#define CLEAR_FP_COND (num,env) do { ((env).fcr31) &= ~((num) ? (1 << ((num) + 24)) : (1 << 23)); } while(0) +#define GET_FP_COND (env) ((((env).fcr31 >> 24) & 0xfe) | (((env).fcr31 >> 23) & 0x1))#define GET_FP_CAUSE (reg) (((reg) >> 12) & 0x3f)#define GET_FP_ENABLE (reg) (((reg) >> 7) & 0x1f)#define GET_FP_FLAGS (reg) (((reg) >> 2) & 0x1f)
@@ -132,6 +132,7 @@#define MIPS_SHADOW_SET_MAX 16#define MIPS_TC_MAX 5 +#define MIPS_FPU_MAX 1#define MIPS_DSP_ACC 4typedef struct TCState TCState ;
@@ -170,11 +171,12 @@typedef struct CPUMIPSState CPUMIPSState ;struct CPUMIPSState {TCState active_tc; +CPUMIPSFPUContext active_fpu;CPUMIPSMVPContext *mvp;CPUMIPSTLBContext *tlb; -CPUMIPSFPUContext *fpu;uint32_t current_tc; +uint32_t current_fpu;uint32_t SEGBITS;uint32_t PABITS;
@@ -404,6 +406,7 @@int32_t CP0_DESAVE ;/* We waste some space so we can handle shadow registers like TCs. */ TCState tcs[MIPS_SHADOW_SET_MAX ]; +CPUMIPSFPUContext fpus[MIPS_FPU_MAX ];/* Qemu */ int error_code;uint32_t hflags;/* CPU State */
Modified: trunk/target-mips/exec.h
===================================================================
target-mips/exec.h +1 -1
@@ -86,7 +86,7 @@if (env->CP0_Status & (1 << CP0St_FR)) env->hflags |=MIPS_HFLAG_F64 ;if (env->insn_flags &ISA_MIPS32R2 ) { -if (env->fpu->fcr0 & (1 <<FCR0_F64 )) +if (env->active_fpu.fcr0 & (1 <<FCR0_F64 )) env->hflags |=MIPS_HFLAG_COP1X ; }else if (env->insn_flags &ISA_MIPS32 ) {if (env->hflags &MIPS_HFLAG_64 )
Modified: trunk/target-mips/op_helper.c
===================================================================
target-mips/op_helper.c +261 -261
1,029 lines not on this page · raw message
Modified: trunk/target-mips/translate.c
===================================================================
target-mips/translate.c +55 -40
186 lines not on this page · raw message
Modified: trunk/target-mips/translate_init.c
===================================================================
target-mips/translate_init.c +6 -3
@@ -489,14 +489,17 @@static void fpu_init (CPUMIPSState *env,const mips_def_t *def) { - env->fpu =qemu_mallocz (sizeof (CPUMIPSFPUContext)); +int i; - env->fpu->fcr0 = def->CP1_fcr0; +for (i =0 ; i <MIPS_FPU_MAX ; i++) + env->fpus[i].fcr0 = def->CP1_fcr0; + +memcpy (&env->active_fpu, &env->fpus[0 ],sizeof (env->active_fpu));if (env->user_mode_only) {if (env->CP0_Config1 & (1 <<CP0C1_FP )) env->hflags |=MIPS_HFLAG_FPU ;#ifdef TARGET_MIPS64 -if (env->fpu->fcr0 & (1 <<FCR0_F64 )) +if (env->active_fpu.fcr0 & (1 <<FCR0_F64 )) env->hflags |=MIPS_HFLAG_F64 ;#endif }