[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 11/23] target-alpha: Use cpu_exec_interrupt qom hook
From: |
Richard Henderson |
Subject: |
[Qemu-devel] [PATCH 11/23] target-alpha: Use cpu_exec_interrupt qom hook |
Date: |
Sat, 13 Sep 2014 09:45:22 -0700 |
Signed-off-by: Richard Henderson <address@hidden>
---
cpu-exec.c | 32 --------------------------------
target-alpha/cpu-qom.h | 1 +
target-alpha/cpu.c | 1 +
target-alpha/helper.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 46 insertions(+), 32 deletions(-)
diff --git a/cpu-exec.c b/cpu-exec.c
index 7efcf27..2f73be4 100644
--- a/cpu-exec.c
+++ b/cpu-exec.c
@@ -597,38 +597,6 @@ int cpu_exec(CPUArchState *env)
cc->do_interrupt(cpu);
next_tb = 0;
}
-#elif defined(TARGET_ALPHA)
- {
- int idx = -1;
- /* ??? This hard-codes the OSF/1 interrupt levels. */
- switch (env->pal_mode ? 7 : env->ps & PS_INT_MASK) {
- case 0 ... 3:
- if (interrupt_request & CPU_INTERRUPT_HARD) {
- idx = EXCP_DEV_INTERRUPT;
- }
- /* FALLTHRU */
- case 4:
- if (interrupt_request & CPU_INTERRUPT_TIMER) {
- idx = EXCP_CLK_INTERRUPT;
- }
- /* FALLTHRU */
- case 5:
- if (interrupt_request & CPU_INTERRUPT_SMP) {
- idx = EXCP_SMP_INTERRUPT;
- }
- /* FALLTHRU */
- case 6:
- if (interrupt_request & CPU_INTERRUPT_MCHK) {
- idx = EXCP_MCHK;
- }
- }
- if (idx >= 0) {
- cpu->exception_index = idx;
- env->error_code = 0;
- cc->do_interrupt(cpu);
- next_tb = 0;
- }
- }
#endif
/* The target hook has 3 exit conditions:
False when the interrupt isn't processed,
diff --git a/target-alpha/cpu-qom.h b/target-alpha/cpu-qom.h
index 0caa362..b01c6c8 100644
--- a/target-alpha/cpu-qom.h
+++ b/target-alpha/cpu-qom.h
@@ -79,6 +79,7 @@ extern const struct VMStateDescription vmstate_alpha_cpu;
#endif
void alpha_cpu_do_interrupt(CPUState *cpu);
+bool alpha_cpu_exec_interrupt(CPUState *cpu, int int_req);
void alpha_cpu_dump_state(CPUState *cs, FILE *f, fprintf_function cpu_fprintf,
int flags);
hwaddr alpha_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr);
diff --git a/target-alpha/cpu.c b/target-alpha/cpu.c
index 2491f0a..a98b7d8 100644
--- a/target-alpha/cpu.c
+++ b/target-alpha/cpu.c
@@ -284,6 +284,7 @@ static void alpha_cpu_class_init(ObjectClass *oc, void
*data)
cc->class_by_name = alpha_cpu_class_by_name;
cc->has_work = alpha_cpu_has_work;
cc->do_interrupt = alpha_cpu_do_interrupt;
+ cc->cpu_exec_interrupt = alpha_cpu_exec_interrupt;
cc->dump_state = alpha_cpu_dump_state;
cc->set_pc = alpha_cpu_set_pc;
cc->gdb_read_register = alpha_cpu_gdb_read_register;
diff --git a/target-alpha/helper.c b/target-alpha/helper.c
index 7c053a3..a8aa782 100644
--- a/target-alpha/helper.c
+++ b/target-alpha/helper.c
@@ -470,6 +470,50 @@ void alpha_cpu_do_interrupt(CPUState *cs)
#endif /* !USER_ONLY */
}
+bool alpha_cpu_exec_interrupt(CPUState *cs, int interrupt_request)
+{
+ AlphaCPU *cpu = ALPHA_CPU(cs);
+ CPUAlphaState *env = &cpu->env;
+ int idx = -1;
+
+ /* We never take interrupts while in PALmode. */
+ if (env->pal_mode) {
+ return false;
+ }
+
+ /* Fall through the switch, collecting the highest priority
+ interrupt that isn't masked by the processor status IPL. */
+ /* ??? This hard-codes the OSF/1 interrupt levels. */
+ switch (env->ps & PS_INT_MASK) {
+ case 0 ... 3:
+ if (interrupt_request & CPU_INTERRUPT_HARD) {
+ idx = EXCP_DEV_INTERRUPT;
+ }
+ /* FALLTHRU */
+ case 4:
+ if (interrupt_request & CPU_INTERRUPT_TIMER) {
+ idx = EXCP_CLK_INTERRUPT;
+ }
+ /* FALLTHRU */
+ case 5:
+ if (interrupt_request & CPU_INTERRUPT_SMP) {
+ idx = EXCP_SMP_INTERRUPT;
+ }
+ /* FALLTHRU */
+ case 6:
+ if (interrupt_request & CPU_INTERRUPT_MCHK) {
+ idx = EXCP_MCHK;
+ }
+ }
+ if (idx >= 0) {
+ cs->exception_index = idx;
+ env->error_code = 0;
+ alpha_cpu_do_interrupt(cs);
+ return true;
+ }
+ return false;
+}
+
void alpha_cpu_dump_state(CPUState *cs, FILE *f, fprintf_function cpu_fprintf,
int flags)
{
--
1.9.3
- Re: [Qemu-devel] [PATCH 08/23] target-s390x: Use cpu_exec_interrupt qom hook, (continued)
- [Qemu-devel] [PATCH 10/23] target-cris: Use cpu_exec_interrupt qom hook, Richard Henderson, 2014/09/13
- [Qemu-devel] [PATCH 12/23] target-sh4: Use cpu_exec_interrupt qom hook, Richard Henderson, 2014/09/13
- [Qemu-devel] [PATCH 11/23] target-alpha: Use cpu_exec_interrupt qom hook,
Richard Henderson <=
- [Qemu-devel] [PATCH 13/23] target-unicore32: Use cpu_exec_interrupt qom hook, Richard Henderson, 2014/09/13
- [Qemu-devel] [PATCH 14/23] target-arm: Use cpu_exec_interrupt qom hook, Richard Henderson, 2014/09/13
- [Qemu-devel] [PATCH 15/23] target-sparc: Use cpu_exec_interrupt qom hook, Richard Henderson, 2014/09/13
- [Qemu-devel] [PATCH 17/23] target-tricore: Remove the dummy interrupt boilerplate, Richard Henderson, 2014/09/13
- [Qemu-devel] [PATCH 18/23] target-mips: Use cpu_exec_interrupt qom hook, Richard Henderson, 2014/09/13
- [Qemu-devel] [PATCH 16/23] target-openrisc: Use cpu_exec_interrupt qom hook, Richard Henderson, 2014/09/13
- [Qemu-devel] [PATCH 20/23] target-lm32: Use cpu_exec_interrupt qom hook, Richard Henderson, 2014/09/13