Skip to content

Commit

Permalink
target-lm32: Use cpu_exec_interrupt qom hook
Browse files Browse the repository at this point in the history
Cc: Michael Walle <[email protected]>
Signed-off-by: Richard Henderson <[email protected]>
Acked-by: Michael Walle <[email protected]>
Message-id: [email protected]
Signed-off-by: Peter Maydell <[email protected]>
  • Loading branch information
rth7680 authored and pm215 committed Sep 25, 2014
1 parent 29cd33d commit e9854c3
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 7 deletions.
7 changes: 0 additions & 7 deletions cpu-exec.c
Original file line number Diff line number Diff line change
Expand Up @@ -498,13 +498,6 @@ int cpu_exec(CPUArchState *env)
}
next_tb = 0;
}
#elif defined(TARGET_LM32)
if ((interrupt_request & CPU_INTERRUPT_HARD)
&& (env->ie & IE_IE)) {
cpu->exception_index = EXCP_IRQ;
cc->do_interrupt(cpu);
next_tb = 0;
}
#endif
/* The target hook has 3 exit conditions:
False when the interrupt isn't processed,
Expand Down
1 change: 1 addition & 0 deletions target-lm32/cpu-qom.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ extern const struct VMStateDescription vmstate_lm32_cpu;
#endif

void lm32_cpu_do_interrupt(CPUState *cpu);
bool lm32_cpu_exec_interrupt(CPUState *cs, int int_req);
void lm32_cpu_dump_state(CPUState *cpu, FILE *f, fprintf_function cpu_fprintf,
int flags);
hwaddr lm32_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr);
Expand Down
1 change: 1 addition & 0 deletions target-lm32/cpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,7 @@ static void lm32_cpu_class_init(ObjectClass *oc, void *data)
cc->class_by_name = lm32_cpu_class_by_name;
cc->has_work = lm32_cpu_has_work;
cc->do_interrupt = lm32_cpu_do_interrupt;
cc->cpu_exec_interrupt = lm32_cpu_exec_interrupt;
cc->dump_state = lm32_cpu_dump_state;
cc->set_pc = lm32_cpu_set_pc;
cc->gdb_read_register = lm32_cpu_gdb_read_register;
Expand Down
13 changes: 13 additions & 0 deletions target-lm32/helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,19 @@ void lm32_cpu_do_interrupt(CPUState *cs)
}
}

bool lm32_cpu_exec_interrupt(CPUState *cs, int interrupt_request)
{
LM32CPU *cpu = LM32_CPU(cs);
CPULM32State *env = &cpu->env;

if ((interrupt_request & CPU_INTERRUPT_HARD) && (env->ie & IE_IE)) {
cs->exception_index = EXCP_IRQ;
lm32_cpu_do_interrupt(cs);
return true;
}
return false;
}

LM32CPU *cpu_lm32_init(const char *cpu_model)
{
return LM32_CPU(cpu_generic_init(TYPE_LM32_CPU, cpu_model));
Expand Down

0 comments on commit e9854c3

Please sign in to comment.