microblaze: linux-user support.
[qemu] / target-cris / translate.c
index 2ff6fe2..6a44281 100644 (file)
 #include <stdio.h>
 #include <string.h>
 #include <inttypes.h>
-#include <assert.h>
 
 #include "cpu.h"
 #include "exec-all.h"
 #include "disas.h"
 #include "tcg-op.h"
 #include "helper.h"
+#include "mmu.h"
 #include "crisv32-decode.h"
 #include "qemu-common.h"
 
@@ -956,7 +956,8 @@ static void gen_tst_cc (DisasContext *dc, TCGv cc, int cond)
                                else if (dc->cc_size == 2)
                                        bits = 15;      
 
-                               tcg_gen_shri_tl(cc, cc_result, 31);
+                               tcg_gen_shri_tl(cc, cc_result, bits);
+                               tcg_gen_andi_tl(cc, cc, 1);
                        }
                        else {
                                cris_evaluate_flags(dc);
@@ -2632,7 +2633,8 @@ static unsigned int dec_movem_mr(DisasContext *dc)
                tmp32 = tcg_temp_new_i32();
                tcg_gen_addi_tl(addr, cpu_R[dc->op1], i * 8);
                gen_load(dc, tmp32, addr, 4, 0);
-       }
+       } else
+               TCGV_UNUSED(tmp32);
        tcg_temp_free(addr);
 
        for (i = 0; i < (nr >> 1); i++) {
@@ -3270,6 +3272,7 @@ gen_intermediate_code_internal(CPUState *env, TranslationBlock *tb,
                        break;
        } while (!dc->is_jmp && !dc->cpustate_changed
                 && gen_opc_ptr < gen_opc_end
+                 && !singlestep
                 && (dc->pc < next_page_start)
                  && num_insns < max_insns);
 
@@ -3399,11 +3402,10 @@ CPUCRISState *cpu_cris_init (const char *cpu_model)
        int i;
 
        env = qemu_mallocz(sizeof(CPUCRISState));
-       if (!env)
-               return NULL;
 
        cpu_exec_init(env);
        cpu_reset(env);
+       qemu_init_vcpu(env);
 
        if (tcg_initialized)
                return env;
@@ -3458,6 +3460,11 @@ CPUCRISState *cpu_cris_init (const char *cpu_model)
 
 void cpu_reset (CPUCRISState *env)
 {
+       if (qemu_loglevel_mask(CPU_LOG_RESET)) {
+               qemu_log("CPU Reset (CPU %d)\n", env->cpu_index);
+               log_cpu_state(env, 0);
+       }
+
        memset(env, 0, offsetof(CPUCRISState, breakpoints));
        tlb_flush(env, 1);
 
@@ -3466,6 +3473,7 @@ void cpu_reset (CPUCRISState *env)
        /* start in user mode with interrupts enabled.  */
        env->pregs[PR_CCS] |= U_FLAG | I_FLAG;
 #else
+       cris_mmu_init(env);
        env->pregs[PR_CCS] = 0;
 #endif
 }