tcg-i386: Remove abort from GETPC_LDST
[qemu/ar7.git] / hw / mips / mips_int.c
blob7dbd24d3d6e5d00ff63901d29a3bb1e3f450460c
1 /*
2 * QEMU MIPS interrupt support
4 * Permission is hereby granted, free of charge, to any person obtaining a copy
5 * of this software and associated documentation files (the "Software"), to deal
6 * in the Software without restriction, including without limitation the rights
7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 * copies of the Software, and to permit persons to whom the Software is
9 * furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 * THE SOFTWARE.
23 #include "hw/hw.h"
24 #include "hw/mips/cpudevs.h"
25 #include "cpu.h"
27 static void cpu_mips_irq_request(void *opaque, int irq, int level)
29 MIPSCPU *cpu = opaque;
30 CPUMIPSState *env = &cpu->env;
31 CPUState *cs = CPU(cpu);
33 if (irq < 0 || irq > 7)
34 return;
36 if (level) {
37 env->CP0_Cause |= 1 << (irq + CP0Ca_IP);
38 } else {
39 env->CP0_Cause &= ~(1 << (irq + CP0Ca_IP));
42 if (env->CP0_Cause & CP0Ca_IP_mask) {
43 cpu_interrupt(cs, CPU_INTERRUPT_HARD);
44 } else {
45 cpu_reset_interrupt(cs, CPU_INTERRUPT_HARD);
49 void cpu_mips_irq_init_cpu(CPUMIPSState *env)
51 qemu_irq *qi;
52 int i;
54 qi = qemu_allocate_irqs(cpu_mips_irq_request, mips_env_get_cpu(env), 8);
55 for (i = 0; i < 8; i++) {
56 env->irq[i] = qi[i];
60 void cpu_mips_soft_irq(CPUMIPSState *env, int irq, int level)
62 if (irq < 0 || irq > 2) {
63 return;
66 qemu_set_irq(env->irq[irq], level);