Commit 71fb7241c65ef2de8b55e6907e674b8f766b3061
1 parent
9f083493
Fix build of MIPS target without FPU support.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2233 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
2 changed files
with
26 additions
and
0 deletions
target-mips/op.c
| @@ -627,6 +627,7 @@ void op_movz (void) | @@ -627,6 +627,7 @@ void op_movz (void) | ||
| 627 | RETURN(); | 627 | RETURN(); |
| 628 | } | 628 | } |
| 629 | 629 | ||
| 630 | +#ifdef MIPS_USES_FPU | ||
| 630 | void op_movf (void) | 631 | void op_movf (void) |
| 631 | { | 632 | { |
| 632 | if (!(env->fcr31 & PARAM1)) | 633 | if (!(env->fcr31 & PARAM1)) |
| @@ -640,6 +641,7 @@ void op_movt (void) | @@ -640,6 +641,7 @@ void op_movt (void) | ||
| 640 | env->gpr[PARAM2] = env->gpr[PARAM3]; | 641 | env->gpr[PARAM2] = env->gpr[PARAM3]; |
| 641 | RETURN(); | 642 | RETURN(); |
| 642 | } | 643 | } |
| 644 | +#endif | ||
| 643 | 645 | ||
| 644 | /* Tests */ | 646 | /* Tests */ |
| 645 | #define OP_COND(name, cond) \ | 647 | #define OP_COND(name, cond) \ |
target-mips/translate.c
| @@ -390,6 +390,8 @@ GEN32(gen_op_load_gpr_T2, gen_op_load_gpr_T2_gpr); | @@ -390,6 +390,8 @@ GEN32(gen_op_load_gpr_T2, gen_op_load_gpr_T2_gpr); | ||
| 390 | GEN32(gen_op_store_T0_gpr, gen_op_store_T0_gpr_gpr); | 390 | GEN32(gen_op_store_T0_gpr, gen_op_store_T0_gpr_gpr); |
| 391 | GEN32(gen_op_store_T1_gpr, gen_op_store_T1_gpr_gpr); | 391 | GEN32(gen_op_store_T1_gpr, gen_op_store_T1_gpr_gpr); |
| 392 | 392 | ||
| 393 | +#ifdef MIPS_USES_FPU | ||
| 394 | + | ||
| 393 | static const char *fregnames[] = | 395 | static const char *fregnames[] = |
| 394 | { "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", | 396 | { "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", |
| 395 | "f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15", | 397 | "f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15", |
| @@ -473,6 +475,8 @@ static inline void gen_cmp_ ## fmt(int n) \ | @@ -473,6 +475,8 @@ static inline void gen_cmp_ ## fmt(int n) \ | ||
| 473 | FOP_CONDS(d) | 475 | FOP_CONDS(d) |
| 474 | FOP_CONDS(s) | 476 | FOP_CONDS(s) |
| 475 | 477 | ||
| 478 | +#endif /* MIPS_USES_FPU */ | ||
| 479 | + | ||
| 476 | typedef struct DisasContext { | 480 | typedef struct DisasContext { |
| 477 | struct TranslationBlock *tb; | 481 | struct TranslationBlock *tb; |
| 478 | target_ulong pc, saved_pc; | 482 | target_ulong pc, saved_pc; |
| @@ -633,10 +637,12 @@ OP_LD_TABLE(bu); | @@ -633,10 +637,12 @@ OP_LD_TABLE(bu); | ||
| 633 | OP_ST_TABLE(b); | 637 | OP_ST_TABLE(b); |
| 634 | OP_LD_TABLE(l); | 638 | OP_LD_TABLE(l); |
| 635 | OP_ST_TABLE(c); | 639 | OP_ST_TABLE(c); |
| 640 | +#ifdef MIPS_USES_FPU | ||
| 636 | OP_LD_TABLE(wc1); | 641 | OP_LD_TABLE(wc1); |
| 637 | OP_ST_TABLE(wc1); | 642 | OP_ST_TABLE(wc1); |
| 638 | OP_LD_TABLE(dc1); | 643 | OP_LD_TABLE(dc1); |
| 639 | OP_ST_TABLE(dc1); | 644 | OP_ST_TABLE(dc1); |
| 645 | +#endif | ||
| 640 | 646 | ||
| 641 | /* Load and store */ | 647 | /* Load and store */ |
| 642 | static void gen_ldst (DisasContext *ctx, uint32_t opc, int rt, | 648 | static void gen_ldst (DisasContext *ctx, uint32_t opc, int rt, |
| @@ -785,6 +791,8 @@ static void gen_ldst (DisasContext *ctx, uint32_t opc, int rt, | @@ -785,6 +791,8 @@ static void gen_ldst (DisasContext *ctx, uint32_t opc, int rt, | ||
| 785 | MIPS_DEBUG("%s %s, %d(%s)", opn, regnames[rt], offset, regnames[base]); | 791 | MIPS_DEBUG("%s %s, %d(%s)", opn, regnames[rt], offset, regnames[base]); |
| 786 | } | 792 | } |
| 787 | 793 | ||
| 794 | +#ifdef MIPS_USES_FPU | ||
| 795 | + | ||
| 788 | /* Load and store */ | 796 | /* Load and store */ |
| 789 | static void gen_flt_ldst (DisasContext *ctx, uint32_t opc, int ft, | 797 | static void gen_flt_ldst (DisasContext *ctx, uint32_t opc, int ft, |
| 790 | int base, int16_t offset) | 798 | int base, int16_t offset) |
| @@ -832,6 +840,8 @@ static void gen_flt_ldst (DisasContext *ctx, uint32_t opc, int ft, | @@ -832,6 +840,8 @@ static void gen_flt_ldst (DisasContext *ctx, uint32_t opc, int ft, | ||
| 832 | MIPS_DEBUG("%s %s, %d(%s)", opn, fregnames[ft], offset, regnames[base]); | 840 | MIPS_DEBUG("%s %s, %d(%s)", opn, fregnames[ft], offset, regnames[base]); |
| 833 | } | 841 | } |
| 834 | 842 | ||
| 843 | +#endif /* MIPS_USES_FPU */ | ||
| 844 | + | ||
| 835 | /* Arithmetic with immediate operand */ | 845 | /* Arithmetic with immediate operand */ |
| 836 | static void gen_arith_imm (DisasContext *ctx, uint32_t opc, int rt, | 846 | static void gen_arith_imm (DisasContext *ctx, uint32_t opc, int rt, |
| 837 | int rs, int16_t imm) | 847 | int rs, int16_t imm) |
| @@ -2903,6 +2913,8 @@ static void gen_cp0 (DisasContext *ctx, uint32_t opc, int rt, int rd) | @@ -2903,6 +2913,8 @@ static void gen_cp0 (DisasContext *ctx, uint32_t opc, int rt, int rd) | ||
| 2903 | MIPS_DEBUG("%s %s %d", opn, regnames[rt], rd); | 2913 | MIPS_DEBUG("%s %s %d", opn, regnames[rt], rd); |
| 2904 | } | 2914 | } |
| 2905 | 2915 | ||
| 2916 | +#ifdef MIPS_USES_FPU | ||
| 2917 | + | ||
| 2906 | /* CP1 Branches (before delay slot) */ | 2918 | /* CP1 Branches (before delay slot) */ |
| 2907 | static void gen_compute_branch1 (DisasContext *ctx, uint32_t op, | 2919 | static void gen_compute_branch1 (DisasContext *ctx, uint32_t op, |
| 2908 | int32_t offset) | 2920 | int32_t offset) |
| @@ -3331,6 +3343,8 @@ static void gen_movci (DisasContext *ctx, int rd, int rs, int cc, int tf) | @@ -3331,6 +3343,8 @@ static void gen_movci (DisasContext *ctx, int rd, int rs, int cc, int tf) | ||
| 3331 | gen_op_movt(ccbit, rd, rs); | 3343 | gen_op_movt(ccbit, rd, rs); |
| 3332 | } | 3344 | } |
| 3333 | 3345 | ||
| 3346 | +#endif /* MIPS_USES_FPU */ | ||
| 3347 | + | ||
| 3334 | /* ISA extensions (ASEs) */ | 3348 | /* ISA extensions (ASEs) */ |
| 3335 | /* MIPS16 extension to MIPS32 */ | 3349 | /* MIPS16 extension to MIPS32 */ |
| 3336 | /* SmartMIPS extension to MIPS32 */ | 3350 | /* SmartMIPS extension to MIPS32 */ |
| @@ -3453,11 +3467,13 @@ static void decode_opc (DisasContext *ctx) | @@ -3453,11 +3467,13 @@ static void decode_opc (DisasContext *ctx) | ||
| 3453 | /* Treat as a noop. */ | 3467 | /* Treat as a noop. */ |
| 3454 | break; | 3468 | break; |
| 3455 | 3469 | ||
| 3470 | +#ifdef MIPS_USES_FPU | ||
| 3456 | case OPC_MOVCI: | 3471 | case OPC_MOVCI: |
| 3457 | gen_op_cp1_enabled(); | 3472 | gen_op_cp1_enabled(); |
| 3458 | gen_movci(ctx, rd, rs, (ctx->opcode >> 18) & 0x7, | 3473 | gen_movci(ctx, rd, rs, (ctx->opcode >> 18) & 0x7, |
| 3459 | (ctx->opcode >> 16) & 1); | 3474 | (ctx->opcode >> 16) & 1); |
| 3460 | break; | 3475 | break; |
| 3476 | +#endif | ||
| 3461 | 3477 | ||
| 3462 | #ifdef MIPS_HAS_MIPS64 | 3478 | #ifdef MIPS_HAS_MIPS64 |
| 3463 | /* MIPS64 specific opcodes */ | 3479 | /* MIPS64 specific opcodes */ |
| @@ -3737,6 +3753,7 @@ static void decode_opc (DisasContext *ctx) | @@ -3737,6 +3753,7 @@ static void decode_opc (DisasContext *ctx) | ||
| 3737 | generate_exception_err(ctx, EXCP_CpU, 2); | 3753 | generate_exception_err(ctx, EXCP_CpU, 2); |
| 3738 | break; | 3754 | break; |
| 3739 | 3755 | ||
| 3756 | +#ifdef MIPS_USES_FPU | ||
| 3740 | case OPC_CP3: | 3757 | case OPC_CP3: |
| 3741 | gen_op_cp1_enabled(); | 3758 | gen_op_cp1_enabled(); |
| 3742 | op1 = MASK_CP3(ctx->opcode); | 3759 | op1 = MASK_CP3(ctx->opcode); |
| @@ -3747,6 +3764,7 @@ static void decode_opc (DisasContext *ctx) | @@ -3747,6 +3764,7 @@ static void decode_opc (DisasContext *ctx) | ||
| 3747 | break; | 3764 | break; |
| 3748 | } | 3765 | } |
| 3749 | break; | 3766 | break; |
| 3767 | +#endif | ||
| 3750 | 3768 | ||
| 3751 | #ifdef MIPS_HAS_MIPS64 | 3769 | #ifdef MIPS_HAS_MIPS64 |
| 3752 | /* MIPS64 opcodes */ | 3770 | /* MIPS64 opcodes */ |
| @@ -3962,6 +3980,8 @@ int gen_intermediate_code_pc (CPUState *env, struct TranslationBlock *tb) | @@ -3962,6 +3980,8 @@ int gen_intermediate_code_pc (CPUState *env, struct TranslationBlock *tb) | ||
| 3962 | return gen_intermediate_code_internal(env, tb, 1); | 3980 | return gen_intermediate_code_internal(env, tb, 1); |
| 3963 | } | 3981 | } |
| 3964 | 3982 | ||
| 3983 | +#ifdef MIPS_USES_FPU | ||
| 3984 | + | ||
| 3965 | void fpu_dump_state(CPUState *env, FILE *f, | 3985 | void fpu_dump_state(CPUState *env, FILE *f, |
| 3966 | int (*fpu_fprintf)(FILE *f, const char *fmt, ...), | 3986 | int (*fpu_fprintf)(FILE *f, const char *fmt, ...), |
| 3967 | int flags) | 3987 | int flags) |
| @@ -3996,6 +4016,8 @@ void dump_fpu (CPUState *env) | @@ -3996,6 +4016,8 @@ void dump_fpu (CPUState *env) | ||
| 3996 | } | 4016 | } |
| 3997 | } | 4017 | } |
| 3998 | 4018 | ||
| 4019 | +#endif /* MIPS_USES_FPU */ | ||
| 4020 | + | ||
| 3999 | void cpu_dump_state (CPUState *env, FILE *f, | 4021 | void cpu_dump_state (CPUState *env, FILE *f, |
| 4000 | int (*cpu_fprintf)(FILE *f, const char *fmt, ...), | 4022 | int (*cpu_fprintf)(FILE *f, const char *fmt, ...), |
| 4001 | int flags) | 4023 | int flags) |
| @@ -4025,8 +4047,10 @@ void cpu_dump_state (CPUState *env, FILE *f, | @@ -4025,8 +4047,10 @@ void cpu_dump_state (CPUState *env, FILE *f, | ||
| 4025 | c0_status, env->CP0_Cause, env->CP0_EPC); | 4047 | c0_status, env->CP0_Cause, env->CP0_EPC); |
| 4026 | cpu_fprintf(f, " Config0 0x%08x Config1 0x%08x LLAddr 0x%08x\n", | 4048 | cpu_fprintf(f, " Config0 0x%08x Config1 0x%08x LLAddr 0x%08x\n", |
| 4027 | env->CP0_Config0, env->CP0_Config1, env->CP0_LLAddr); | 4049 | env->CP0_Config0, env->CP0_Config1, env->CP0_LLAddr); |
| 4050 | +#ifdef MIPS_USES_FPU | ||
| 4028 | if (c0_status & (1 << CP0St_CU1)) | 4051 | if (c0_status & (1 << CP0St_CU1)) |
| 4029 | fpu_dump_state(env, f, cpu_fprintf, flags); | 4052 | fpu_dump_state(env, f, cpu_fprintf, flags); |
| 4053 | +#endif | ||
| 4030 | } | 4054 | } |
| 4031 | 4055 | ||
| 4032 | CPUMIPSState *cpu_mips_init (void) | 4056 | CPUMIPSState *cpu_mips_init (void) |