Commit a7cfbba0cf90e3a42f2fc05556dd5b1d614f4cad
1 parent
e72210e1
CRIS: Translator updates.
* RFN (Return From NMI) insn. * Avoid unnecessary T0 transfers. * Dont do tcg related init more than once. git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4717 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
1 changed file
with
14 additions
and
7 deletions
target-cris/translate.c
@@ -735,7 +735,7 @@ static void cris_evaluate_flags(DisasContext *dc) | @@ -735,7 +735,7 @@ static void cris_evaluate_flags(DisasContext *dc) | ||
735 | else | 735 | else |
736 | tcg_gen_andi_tl(cpu_PR[PR_CCS], | 736 | tcg_gen_andi_tl(cpu_PR[PR_CCS], |
737 | cpu_PR[PR_CCS], ~X_FLAG); | 737 | cpu_PR[PR_CCS], ~X_FLAG); |
738 | - } | 738 | + } |
739 | 739 | ||
740 | dc->flags_uptodate = 1; | 740 | dc->flags_uptodate = 1; |
741 | } | 741 | } |
@@ -1530,7 +1530,6 @@ static unsigned int dec_btstq(DisasContext *dc) | @@ -1530,7 +1530,6 @@ static unsigned int dec_btstq(DisasContext *dc) | ||
1530 | 1530 | ||
1531 | cris_cc_mask(dc, CC_MASK_NZ); | 1531 | cris_cc_mask(dc, CC_MASK_NZ); |
1532 | 1532 | ||
1533 | - t_gen_mov_TN_reg(cpu_T[0], dc->op2); | ||
1534 | cris_alu(dc, CC_OP_BTST, | 1533 | cris_alu(dc, CC_OP_BTST, |
1535 | cpu_T[0], cpu_R[dc->op2], tcg_const_tl(dc->op1), 4); | 1534 | cpu_T[0], cpu_R[dc->op2], tcg_const_tl(dc->op1), 4); |
1536 | cris_update_cc_op(dc, CC_OP_FLAGS, 4); | 1535 | cris_update_cc_op(dc, CC_OP_FLAGS, 4); |
@@ -1968,11 +1967,10 @@ static unsigned int dec_movs_r(DisasContext *dc) | @@ -1968,11 +1967,10 @@ static unsigned int dec_movs_r(DisasContext *dc) | ||
1968 | dc->op1, dc->op2)); | 1967 | dc->op1, dc->op2)); |
1969 | 1968 | ||
1970 | cris_cc_mask(dc, CC_MASK_NZ); | 1969 | cris_cc_mask(dc, CC_MASK_NZ); |
1971 | - t_gen_mov_TN_reg(cpu_T[0], dc->op1); | ||
1972 | /* Size can only be qi or hi. */ | 1970 | /* Size can only be qi or hi. */ |
1973 | t_gen_sext(cpu_T[1], cpu_R[dc->op1], size); | 1971 | t_gen_sext(cpu_T[1], cpu_R[dc->op1], size); |
1974 | cris_alu(dc, CC_OP_MOVE, | 1972 | cris_alu(dc, CC_OP_MOVE, |
1975 | - cpu_R[dc->op2], cpu_T[0], cpu_T[1], 4); | 1973 | + cpu_R[dc->op2], cpu_R[dc->op1], cpu_T[1], 4); |
1976 | return 2; | 1974 | return 2; |
1977 | } | 1975 | } |
1978 | 1976 | ||
@@ -2788,7 +2786,9 @@ static unsigned int dec_rfe_etc(DisasContext *dc) | @@ -2788,7 +2786,9 @@ static unsigned int dec_rfe_etc(DisasContext *dc) | ||
2788 | break; | 2786 | break; |
2789 | case 5: | 2787 | case 5: |
2790 | /* rfn. */ | 2788 | /* rfn. */ |
2791 | - BUG(); | 2789 | + cris_evaluate_flags(dc); |
2790 | + tcg_gen_helper_0_0(helper_rfn); | ||
2791 | + dc->is_jmp = DISAS_UPDATE; | ||
2792 | break; | 2792 | break; |
2793 | case 6: | 2793 | case 6: |
2794 | /* break. */ | 2794 | /* break. */ |
@@ -3271,12 +3271,20 @@ void cpu_dump_state (CPUState *env, FILE *f, | @@ -3271,12 +3271,20 @@ void cpu_dump_state (CPUState *env, FILE *f, | ||
3271 | CPUCRISState *cpu_cris_init (const char *cpu_model) | 3271 | CPUCRISState *cpu_cris_init (const char *cpu_model) |
3272 | { | 3272 | { |
3273 | CPUCRISState *env; | 3273 | CPUCRISState *env; |
3274 | + static int tcg_initialized = 0; | ||
3274 | int i; | 3275 | int i; |
3275 | 3276 | ||
3276 | env = qemu_mallocz(sizeof(CPUCRISState)); | 3277 | env = qemu_mallocz(sizeof(CPUCRISState)); |
3277 | if (!env) | 3278 | if (!env) |
3278 | return NULL; | 3279 | return NULL; |
3280 | + | ||
3279 | cpu_exec_init(env); | 3281 | cpu_exec_init(env); |
3282 | + cpu_reset(env); | ||
3283 | + | ||
3284 | + if (tcg_initialized) | ||
3285 | + return env; | ||
3286 | + | ||
3287 | + tcg_initialized = 1; | ||
3280 | 3288 | ||
3281 | cpu_env = tcg_global_reg_new(TCG_TYPE_PTR, TCG_AREG0, "env"); | 3289 | cpu_env = tcg_global_reg_new(TCG_TYPE_PTR, TCG_AREG0, "env"); |
3282 | #if TARGET_LONG_BITS > HOST_LONG_BITS | 3290 | #if TARGET_LONG_BITS > HOST_LONG_BITS |
@@ -3337,6 +3345,7 @@ CPUCRISState *cpu_cris_init (const char *cpu_model) | @@ -3337,6 +3345,7 @@ CPUCRISState *cpu_cris_init (const char *cpu_model) | ||
3337 | TCG_HELPER(helper_movl_sreg_reg); | 3345 | TCG_HELPER(helper_movl_sreg_reg); |
3338 | TCG_HELPER(helper_movl_reg_sreg); | 3346 | TCG_HELPER(helper_movl_reg_sreg); |
3339 | TCG_HELPER(helper_rfe); | 3347 | TCG_HELPER(helper_rfe); |
3348 | + TCG_HELPER(helper_rfn); | ||
3340 | 3349 | ||
3341 | TCG_HELPER(helper_evaluate_flags_muls); | 3350 | TCG_HELPER(helper_evaluate_flags_muls); |
3342 | TCG_HELPER(helper_evaluate_flags_mulu); | 3351 | TCG_HELPER(helper_evaluate_flags_mulu); |
@@ -3346,8 +3355,6 @@ CPUCRISState *cpu_cris_init (const char *cpu_model) | @@ -3346,8 +3355,6 @@ CPUCRISState *cpu_cris_init (const char *cpu_model) | ||
3346 | TCG_HELPER(helper_evaluate_flags_move_2); | 3355 | TCG_HELPER(helper_evaluate_flags_move_2); |
3347 | TCG_HELPER(helper_evaluate_flags); | 3356 | TCG_HELPER(helper_evaluate_flags); |
3348 | TCG_HELPER(helper_top_evaluate_flags); | 3357 | TCG_HELPER(helper_top_evaluate_flags); |
3349 | - | ||
3350 | - cpu_reset(env); | ||
3351 | return env; | 3358 | return env; |
3352 | } | 3359 | } |
3353 | 3360 |