From 878096eeb278a8ac1ccd6667af73e026f29b4cf5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20F=C3=A4rber?= Date: Mon, 27 May 2013 01:33:50 +0200 Subject: cpu: Turn cpu_dump_{state,statistics}() into CPUState hooks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Make cpustats monitor command available unconditionally. Prepares for changing kvm_handle_internal_error() and kvm_cpu_exec() arguments to CPUState. Signed-off-by: Andreas Färber --- target-moxie/cpu.c | 3 ++- target-moxie/cpu.h | 2 ++ target-moxie/helper.c | 4 +++- target-moxie/translate.c | 6 ++++-- 4 files changed, 11 insertions(+), 4 deletions(-) (limited to 'target-moxie') diff --git a/target-moxie/cpu.c b/target-moxie/cpu.c index f2b0791b91..3c3932c129 100644 --- a/target-moxie/cpu.c +++ b/target-moxie/cpu.c @@ -97,8 +97,9 @@ static void moxie_cpu_class_init(ObjectClass *oc, void *data) cc->class_by_name = moxie_cpu_class_by_name; - cpu_class_set_vmsd(cc, &vmstate_moxie_cpu); cc->do_interrupt = moxie_cpu_do_interrupt; + cc->dump_state = moxie_cpu_dump_state; + cpu_class_set_vmsd(cc, &vmstate_moxie_cpu); } static void moxielite_initfn(Object *obj) diff --git a/target-moxie/cpu.h b/target-moxie/cpu.h index a9d9ace303..374b24af52 100644 --- a/target-moxie/cpu.h +++ b/target-moxie/cpu.h @@ -116,6 +116,8 @@ static inline MoxieCPU *moxie_env_get_cpu(CPUMoxieState *env) MoxieCPU *cpu_moxie_init(const char *cpu_model); int cpu_moxie_exec(CPUMoxieState *s); void moxie_cpu_do_interrupt(CPUState *cs); +void moxie_cpu_dump_state(CPUState *cpu, FILE *f, + fprintf_function cpu_fprintf, int flags); void moxie_translate_init(void); int cpu_moxie_signal_handler(int host_signum, void *pinfo, void *puc); diff --git a/target-moxie/helper.c b/target-moxie/helper.c index 5cfe889ad4..ea0788fcea 100644 --- a/target-moxie/helper.c +++ b/target-moxie/helper.c @@ -110,9 +110,11 @@ void moxie_cpu_do_interrupt(CPUState *env) int cpu_moxie_handle_mmu_fault(CPUMoxieState *env, target_ulong address, int rw, int mmu_idx) { + MoxieCPU *cpu = moxie_env_get_cpu(env); + env->exception_index = 0xaa; env->debug1 = address; - cpu_dump_state(env, stderr, fprintf, 0); + cpu_dump_state(CPU(cpu), stderr, fprintf, 0); return 1; } diff --git a/target-moxie/translate.c b/target-moxie/translate.c index cc02bd36f2..b0ae38a4d5 100644 --- a/target-moxie/translate.c +++ b/target-moxie/translate.c @@ -74,9 +74,11 @@ static int extract_branch_offset(int opcode) return (((signed short)((opcode & ((1 << 10) - 1)) << 6)) >> 6) << 1; } -void cpu_dump_state(CPUArchState *env, FILE *f, fprintf_function cpu_fprintf, - int flags) +void moxie_cpu_dump_state(CPUState *cs, FILE *f, fprintf_function cpu_fprintf, + int flags) { + MoxieCPU *cpu = MOXIE_CPU(cs); + CPUMoxieState *env = &cpu->env; int i; cpu_fprintf(f, "pc=0x%08x\n", env->pc); cpu_fprintf(f, "$fp=0x%08x $sp=0x%08x $r0=0x%08x $r1=0x%08x\n", -- cgit v1.2.1