The value of "do_interrupt" member of CPUClass shoule be set to a
target-specific function, or it will lead to a segfault like below:
$ moxie-softmmu/qemu-system-moxie -M moxiesim
Segmentation fault
Cc: Anthony Green <green@moxielogic.com>
Cc: Blue Swirl <blauwirbel@gmail.com>
Cc: Andreas Färber <afaerber@suse.de>
Signed-off-by: Dunrong Huang <huangdr@cloud-times.com>
Signed-of-by: Anthony Green <green@moxielogic.com>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
cc->class_by_name = moxie_cpu_class_by_name;
dc->vmsd = &vmstate_moxie_cpu;
+ cc->do_interrupt = moxie_cpu_do_interrupt;
}
static void moxielite_initfn(Object *obj)
MoxieCPU *cpu_moxie_init(const char *cpu_model);
int cpu_moxie_exec(CPUMoxieState *s);
-void do_interrupt(CPUMoxieState *env);
+void moxie_cpu_do_interrupt(CPUState *cs);
void moxie_translate_init(void);
int cpu_moxie_signal_handler(int host_signum, void *pinfo,
void *puc);
#if defined(CONFIG_USER_ONLY)
-void do_interrupt(CPUState *env)
+void moxie_cpu_do_interrupt(CPUState *env)
{
env->exception_index = -1;
}
}
-void do_interrupt(CPUMoxieState *env)
+void moxie_cpu_do_interrupt(CPUState *cs)
{
+ MoxieCPU *cpu = MOXIE_CPU(cs);
+ CPUMoxieState *env = &cpu->env;
+
switch (env->exception_index) {
case MOXIE_EX_BREAK:
break;