mirror of https://github.com/xqemu/xqemu.git
exec: Pass CPUState to cpu_reset_interrupt()
Move it to qom/cpu.c to avoid build failures depending on include order of cpu-qom.h and exec/cpu-all.h. Change opaques of various ..._irq_handler() functions to the appropriate CPU type to facilitate using cpu_reset_interrupt(). Fix Coding Style issues while at it (missing braces, indentation). Signed-off-by: Andreas Färber <afaerber@suse.de>
This commit is contained in:
parent
259186a7d2
commit
d8ed887bdc
7
exec.c
7
exec.c
|
@ -492,13 +492,6 @@ void cpu_single_step(CPUArchState *env, int enabled)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void cpu_reset_interrupt(CPUArchState *env, int mask)
|
|
||||||
{
|
|
||||||
CPUState *cpu = ENV_GET_CPU(env);
|
|
||||||
|
|
||||||
cpu->interrupt_request &= ~mask;
|
|
||||||
}
|
|
||||||
|
|
||||||
void cpu_exit(CPUArchState *env)
|
void cpu_exit(CPUArchState *env)
|
||||||
{
|
{
|
||||||
CPUState *cpu = ENV_GET_CPU(env);
|
CPUState *cpu = ENV_GET_CPU(env);
|
||||||
|
|
|
@ -63,10 +63,11 @@ static void cpu_irq_change(AlphaCPU *cpu, uint64_t req)
|
||||||
/* If there are any non-masked interrupts, tell the cpu. */
|
/* If there are any non-masked interrupts, tell the cpu. */
|
||||||
if (cpu != NULL) {
|
if (cpu != NULL) {
|
||||||
CPUAlphaState *env = &cpu->env;
|
CPUAlphaState *env = &cpu->env;
|
||||||
|
CPUState *cs = CPU(cpu);
|
||||||
if (req) {
|
if (req) {
|
||||||
cpu_interrupt(env, CPU_INTERRUPT_HARD);
|
cpu_interrupt(env, CPU_INTERRUPT_HARD);
|
||||||
} else {
|
} else {
|
||||||
cpu_reset_interrupt(env, CPU_INTERRUPT_HARD);
|
cpu_reset_interrupt(cs, CPU_INTERRUPT_HARD);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -359,16 +360,17 @@ static void cchip_write(void *opaque, hwaddr addr,
|
||||||
AlphaCPU *cpu = s->cchip.cpu[i];
|
AlphaCPU *cpu = s->cchip.cpu[i];
|
||||||
if (cpu != NULL) {
|
if (cpu != NULL) {
|
||||||
CPUAlphaState *env = &cpu->env;
|
CPUAlphaState *env = &cpu->env;
|
||||||
|
CPUState *cs = CPU(cpu);
|
||||||
/* IPI can be either cleared or set by the write. */
|
/* IPI can be either cleared or set by the write. */
|
||||||
if (newval & (1 << (i + 8))) {
|
if (newval & (1 << (i + 8))) {
|
||||||
cpu_interrupt(env, CPU_INTERRUPT_SMP);
|
cpu_interrupt(env, CPU_INTERRUPT_SMP);
|
||||||
} else {
|
} else {
|
||||||
cpu_reset_interrupt(env, CPU_INTERRUPT_SMP);
|
cpu_reset_interrupt(cs, CPU_INTERRUPT_SMP);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ITI can only be cleared by the write. */
|
/* ITI can only be cleared by the write. */
|
||||||
if ((newval & (1 << (i + 4))) == 0) {
|
if ((newval & (1 << (i + 4))) == 0) {
|
||||||
cpu_reset_interrupt(env, CPU_INTERRUPT_TIMER);
|
cpu_reset_interrupt(cs, CPU_INTERRUPT_TIMER);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -187,7 +187,7 @@ void apic_deliver_pic_intr(DeviceState *d, int level)
|
||||||
reset_bit(s->irr, lvt & 0xff);
|
reset_bit(s->irr, lvt & 0xff);
|
||||||
/* fall through */
|
/* fall through */
|
||||||
case APIC_DM_EXTINT:
|
case APIC_DM_EXTINT:
|
||||||
cpu_reset_interrupt(&s->cpu->env, CPU_INTERRUPT_HARD);
|
cpu_reset_interrupt(CPU(s->cpu), CPU_INTERRUPT_HARD);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -485,7 +485,7 @@ void apic_sipi(DeviceState *d)
|
||||||
{
|
{
|
||||||
APICCommonState *s = DO_UPCAST(APICCommonState, busdev.qdev, d);
|
APICCommonState *s = DO_UPCAST(APICCommonState, busdev.qdev, d);
|
||||||
|
|
||||||
cpu_reset_interrupt(&s->cpu->env, CPU_INTERRUPT_SIPI);
|
cpu_reset_interrupt(CPU(s->cpu), CPU_INTERRUPT_SIPI);
|
||||||
|
|
||||||
if (!s->wait_for_sipi)
|
if (!s->wait_for_sipi)
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -16,19 +16,22 @@ static void arm_pic_cpu_handler(void *opaque, int irq, int level)
|
||||||
{
|
{
|
||||||
ARMCPU *cpu = opaque;
|
ARMCPU *cpu = opaque;
|
||||||
CPUARMState *env = &cpu->env;
|
CPUARMState *env = &cpu->env;
|
||||||
|
CPUState *cs = CPU(cpu);
|
||||||
|
|
||||||
switch (irq) {
|
switch (irq) {
|
||||||
case ARM_PIC_CPU_IRQ:
|
case ARM_PIC_CPU_IRQ:
|
||||||
if (level)
|
if (level) {
|
||||||
cpu_interrupt(env, CPU_INTERRUPT_HARD);
|
cpu_interrupt(env, CPU_INTERRUPT_HARD);
|
||||||
else
|
} else {
|
||||||
cpu_reset_interrupt(env, CPU_INTERRUPT_HARD);
|
cpu_reset_interrupt(cs, CPU_INTERRUPT_HARD);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case ARM_PIC_CPU_FIQ:
|
case ARM_PIC_CPU_FIQ:
|
||||||
if (level)
|
if (level) {
|
||||||
cpu_interrupt(env, CPU_INTERRUPT_FIQ);
|
cpu_interrupt(env, CPU_INTERRUPT_FIQ);
|
||||||
else
|
} else {
|
||||||
cpu_reset_interrupt(env, CPU_INTERRUPT_FIQ);
|
cpu_reset_interrupt(cs, CPU_INTERRUPT_FIQ);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
hw_error("arm_pic_cpu_handler: Bad interrupt line %d\n", irq);
|
hw_error("arm_pic_cpu_handler: Bad interrupt line %d\n", irq);
|
||||||
|
|
|
@ -62,13 +62,13 @@ static void pxa2xx_pic_update(void *opaque)
|
||||||
if ((mask[0] & s->is_fiq[0]) || (mask[1] & s->is_fiq[1])) {
|
if ((mask[0] & s->is_fiq[0]) || (mask[1] & s->is_fiq[1])) {
|
||||||
cpu_interrupt(&s->cpu->env, CPU_INTERRUPT_FIQ);
|
cpu_interrupt(&s->cpu->env, CPU_INTERRUPT_FIQ);
|
||||||
} else {
|
} else {
|
||||||
cpu_reset_interrupt(&s->cpu->env, CPU_INTERRUPT_FIQ);
|
cpu_reset_interrupt(cpu, CPU_INTERRUPT_FIQ);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((mask[0] & ~s->is_fiq[0]) || (mask[1] & ~s->is_fiq[1])) {
|
if ((mask[0] & ~s->is_fiq[0]) || (mask[1] & ~s->is_fiq[1])) {
|
||||||
cpu_interrupt(&s->cpu->env, CPU_INTERRUPT_HARD);
|
cpu_interrupt(&s->cpu->env, CPU_INTERRUPT_HARD);
|
||||||
} else {
|
} else {
|
||||||
cpu_reset_interrupt(&s->cpu->env, CPU_INTERRUPT_HARD);
|
cpu_reset_interrupt(cpu, CPU_INTERRUPT_HARD);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,16 +30,19 @@
|
||||||
|
|
||||||
static void cris_pic_cpu_handler(void *opaque, int irq, int level)
|
static void cris_pic_cpu_handler(void *opaque, int irq, int level)
|
||||||
{
|
{
|
||||||
CPUCRISState *env = (CPUCRISState *)opaque;
|
CRISCPU *cpu = opaque;
|
||||||
|
CPUCRISState *env = &cpu->env;
|
||||||
|
CPUState *cs = CPU(cpu);
|
||||||
int type = irq ? CPU_INTERRUPT_NMI : CPU_INTERRUPT_HARD;
|
int type = irq ? CPU_INTERRUPT_NMI : CPU_INTERRUPT_HARD;
|
||||||
|
|
||||||
if (level)
|
if (level) {
|
||||||
cpu_interrupt(env, type);
|
cpu_interrupt(env, type);
|
||||||
else
|
} else {
|
||||||
cpu_reset_interrupt(env, type);
|
cpu_reset_interrupt(cs, type);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
qemu_irq *cris_pic_init_cpu(CPUCRISState *env)
|
qemu_irq *cris_pic_init_cpu(CPUCRISState *env)
|
||||||
{
|
{
|
||||||
return qemu_allocate_irqs(cris_pic_cpu_handler, env, 2);
|
return qemu_allocate_irqs(cris_pic_cpu_handler, cris_env_get_cpu(env), 2);
|
||||||
}
|
}
|
||||||
|
|
|
@ -190,10 +190,12 @@ static void pic_irq_request(void *opaque, int irq, int level)
|
||||||
env = env->next_cpu;
|
env = env->next_cpu;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (level)
|
CPUState *cs = CPU(x86_env_get_cpu(env));
|
||||||
|
if (level) {
|
||||||
cpu_interrupt(env, CPU_INTERRUPT_HARD);
|
cpu_interrupt(env, CPU_INTERRUPT_HARD);
|
||||||
else
|
} else {
|
||||||
cpu_reset_interrupt(env, CPU_INTERRUPT_HARD);
|
cpu_reset_interrupt(cs, CPU_INTERRUPT_HARD);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,12 +41,14 @@ typedef struct {
|
||||||
|
|
||||||
static void cpu_irq_handler(void *opaque, int irq, int level)
|
static void cpu_irq_handler(void *opaque, int irq, int level)
|
||||||
{
|
{
|
||||||
CPULM32State *env = opaque;
|
LM32CPU *cpu = opaque;
|
||||||
|
CPULM32State *env = &cpu->env;
|
||||||
|
CPUState *cs = CPU(cpu);
|
||||||
|
|
||||||
if (level) {
|
if (level) {
|
||||||
cpu_interrupt(env, CPU_INTERRUPT_HARD);
|
cpu_interrupt(env, CPU_INTERRUPT_HARD);
|
||||||
} else {
|
} else {
|
||||||
cpu_reset_interrupt(env, CPU_INTERRUPT_HARD);
|
cpu_reset_interrupt(cs, CPU_INTERRUPT_HARD);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -117,7 +119,7 @@ static void lm32_evr_init(QEMUMachineInitArgs *args)
|
||||||
0x01, 0x7e, 0x43, 0x00, 0x555, 0x2aa, 1);
|
0x01, 0x7e, 0x43, 0x00, 0x555, 0x2aa, 1);
|
||||||
|
|
||||||
/* create irq lines */
|
/* create irq lines */
|
||||||
cpu_irq = qemu_allocate_irqs(cpu_irq_handler, env, 1);
|
cpu_irq = qemu_allocate_irqs(cpu_irq_handler, cpu, 1);
|
||||||
env->pic_state = lm32_pic_init(*cpu_irq);
|
env->pic_state = lm32_pic_init(*cpu_irq);
|
||||||
for (i = 0; i < 32; i++) {
|
for (i = 0; i < 32; i++) {
|
||||||
irq[i] = qdev_get_gpio_in(env->pic_state, i);
|
irq[i] = qdev_get_gpio_in(env->pic_state, i);
|
||||||
|
|
|
@ -46,12 +46,14 @@ typedef struct {
|
||||||
|
|
||||||
static void cpu_irq_handler(void *opaque, int irq, int level)
|
static void cpu_irq_handler(void *opaque, int irq, int level)
|
||||||
{
|
{
|
||||||
CPULM32State *env = opaque;
|
LM32CPU *cpu = opaque;
|
||||||
|
CPULM32State *env = &cpu->env;
|
||||||
|
CPUState *cs = CPU(cpu);
|
||||||
|
|
||||||
if (level) {
|
if (level) {
|
||||||
cpu_interrupt(env, CPU_INTERRUPT_HARD);
|
cpu_interrupt(env, CPU_INTERRUPT_HARD);
|
||||||
} else {
|
} else {
|
||||||
cpu_reset_interrupt(env, CPU_INTERRUPT_HARD);
|
cpu_reset_interrupt(cs, CPU_INTERRUPT_HARD);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -123,7 +125,7 @@ milkymist_init(QEMUMachineInitArgs *args)
|
||||||
0x00, 0x89, 0x00, 0x1d, 1);
|
0x00, 0x89, 0x00, 0x1d, 1);
|
||||||
|
|
||||||
/* create irq lines */
|
/* create irq lines */
|
||||||
cpu_irq = qemu_allocate_irqs(cpu_irq_handler, env, 1);
|
cpu_irq = qemu_allocate_irqs(cpu_irq_handler, cpu, 1);
|
||||||
env->pic_state = lm32_pic_init(*cpu_irq);
|
env->pic_state = lm32_pic_init(*cpu_irq);
|
||||||
for (i = 0; i < 32; i++) {
|
for (i = 0; i < 32; i++) {
|
||||||
irq[i] = qdev_get_gpio_in(env->pic_state, i);
|
irq[i] = qdev_get_gpio_in(env->pic_state, i);
|
||||||
|
|
|
@ -29,16 +29,20 @@
|
||||||
|
|
||||||
static void microblaze_pic_cpu_handler(void *opaque, int irq, int level)
|
static void microblaze_pic_cpu_handler(void *opaque, int irq, int level)
|
||||||
{
|
{
|
||||||
CPUMBState *env = (CPUMBState *)opaque;
|
MicroBlazeCPU *cpu = opaque;
|
||||||
|
CPUMBState *env = &cpu->env;
|
||||||
|
CPUState *cs = CPU(cpu);
|
||||||
int type = irq ? CPU_INTERRUPT_NMI : CPU_INTERRUPT_HARD;
|
int type = irq ? CPU_INTERRUPT_NMI : CPU_INTERRUPT_HARD;
|
||||||
|
|
||||||
if (level)
|
if (level) {
|
||||||
cpu_interrupt(env, type);
|
cpu_interrupt(env, type);
|
||||||
else
|
} else {
|
||||||
cpu_reset_interrupt(env, type);
|
cpu_reset_interrupt(cs, type);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
qemu_irq *microblaze_pic_init_cpu(CPUMBState *env)
|
qemu_irq *microblaze_pic_init_cpu(CPUMBState *env)
|
||||||
{
|
{
|
||||||
return qemu_allocate_irqs(microblaze_pic_cpu_handler, env, 2);
|
return qemu_allocate_irqs(microblaze_pic_cpu_handler, mb_env_get_cpu(env),
|
||||||
|
2);
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,9 @@
|
||||||
|
|
||||||
static void cpu_mips_irq_request(void *opaque, int irq, int level)
|
static void cpu_mips_irq_request(void *opaque, int irq, int level)
|
||||||
{
|
{
|
||||||
CPUMIPSState *env = (CPUMIPSState *)opaque;
|
MIPSCPU *cpu = opaque;
|
||||||
|
CPUMIPSState *env = &cpu->env;
|
||||||
|
CPUState *cs = CPU(cpu);
|
||||||
|
|
||||||
if (irq < 0 || irq > 7)
|
if (irq < 0 || irq > 7)
|
||||||
return;
|
return;
|
||||||
|
@ -40,7 +42,7 @@ static void cpu_mips_irq_request(void *opaque, int irq, int level)
|
||||||
if (env->CP0_Cause & CP0Ca_IP_mask) {
|
if (env->CP0_Cause & CP0Ca_IP_mask) {
|
||||||
cpu_interrupt(env, CPU_INTERRUPT_HARD);
|
cpu_interrupt(env, CPU_INTERRUPT_HARD);
|
||||||
} else {
|
} else {
|
||||||
cpu_reset_interrupt(env, CPU_INTERRUPT_HARD);
|
cpu_reset_interrupt(cs, CPU_INTERRUPT_HARD);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,7 +51,7 @@ void cpu_mips_irq_init_cpu(CPUMIPSState *env)
|
||||||
qemu_irq *qi;
|
qemu_irq *qi;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
qi = qemu_allocate_irqs(cpu_mips_irq_request, env, 8);
|
qi = qemu_allocate_irqs(cpu_mips_irq_request, mips_env_get_cpu(env), 8);
|
||||||
for (i = 0; i < 8; i++) {
|
for (i = 0; i < 8; i++) {
|
||||||
env->irq[i] = qi[i];
|
env->irq[i] = qi[i];
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
static void openrisc_pic_cpu_handler(void *opaque, int irq, int level)
|
static void openrisc_pic_cpu_handler(void *opaque, int irq, int level)
|
||||||
{
|
{
|
||||||
OpenRISCCPU *cpu = (OpenRISCCPU *)opaque;
|
OpenRISCCPU *cpu = (OpenRISCCPU *)opaque;
|
||||||
|
CPUState *cs = CPU(cpu);
|
||||||
int i;
|
int i;
|
||||||
uint32_t irq_bit = 1 << irq;
|
uint32_t irq_bit = 1 << irq;
|
||||||
|
|
||||||
|
@ -42,7 +43,7 @@ static void openrisc_pic_cpu_handler(void *opaque, int irq, int level)
|
||||||
if ((cpu->env.picsr && (1 << i)) && (cpu->env.picmr && (1 << i))) {
|
if ((cpu->env.picsr && (1 << i)) && (cpu->env.picmr && (1 << i))) {
|
||||||
cpu_interrupt(&cpu->env, CPU_INTERRUPT_HARD);
|
cpu_interrupt(&cpu->env, CPU_INTERRUPT_HARD);
|
||||||
} else {
|
} else {
|
||||||
cpu_reset_interrupt(&cpu->env, CPU_INTERRUPT_HARD);
|
cpu_reset_interrupt(cs, CPU_INTERRUPT_HARD);
|
||||||
cpu->env.picsr &= ~(1 << i);
|
cpu->env.picsr &= ~(1 << i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,6 +52,7 @@ static void cpu_ppc_tb_start (CPUPPCState *env);
|
||||||
|
|
||||||
void ppc_set_irq(PowerPCCPU *cpu, int n_IRQ, int level)
|
void ppc_set_irq(PowerPCCPU *cpu, int n_IRQ, int level)
|
||||||
{
|
{
|
||||||
|
CPUState *cs = CPU(cpu);
|
||||||
CPUPPCState *env = &cpu->env;
|
CPUPPCState *env = &cpu->env;
|
||||||
unsigned int old_pending = env->pending_interrupts;
|
unsigned int old_pending = env->pending_interrupts;
|
||||||
|
|
||||||
|
@ -60,8 +61,9 @@ void ppc_set_irq(PowerPCCPU *cpu, int n_IRQ, int level)
|
||||||
cpu_interrupt(env, CPU_INTERRUPT_HARD);
|
cpu_interrupt(env, CPU_INTERRUPT_HARD);
|
||||||
} else {
|
} else {
|
||||||
env->pending_interrupts &= ~(1 << n_IRQ);
|
env->pending_interrupts &= ~(1 << n_IRQ);
|
||||||
if (env->pending_interrupts == 0)
|
if (env->pending_interrupts == 0) {
|
||||||
cpu_reset_interrupt(env, CPU_INTERRUPT_HARD);
|
cpu_reset_interrupt(cs, CPU_INTERRUPT_HARD);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (old_pending != env->pending_interrupts) {
|
if (old_pending != env->pending_interrupts) {
|
||||||
|
|
|
@ -42,15 +42,16 @@ void sh_intc_toggle_source(struct intc_source *source,
|
||||||
pending_changed = 1;
|
pending_changed = 1;
|
||||||
|
|
||||||
if (pending_changed) {
|
if (pending_changed) {
|
||||||
|
CPUState *cpu = CPU(sh_env_get_cpu(first_cpu));
|
||||||
if (source->pending) {
|
if (source->pending) {
|
||||||
source->parent->pending++;
|
source->parent->pending++;
|
||||||
if (source->parent->pending == 1)
|
if (source->parent->pending == 1)
|
||||||
cpu_interrupt(first_cpu, CPU_INTERRUPT_HARD);
|
cpu_interrupt(first_cpu, CPU_INTERRUPT_HARD);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
source->parent->pending--;
|
source->parent->pending--;
|
||||||
if (source->parent->pending == 0)
|
if (source->parent->pending == 0) {
|
||||||
cpu_reset_interrupt(first_cpu, CPU_INTERRUPT_HARD);
|
cpu_reset_interrupt(cpu, CPU_INTERRUPT_HARD);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -67,6 +67,7 @@ void leon3_irq_ack(void *irq_manager, int intno)
|
||||||
static void leon3_set_pil_in(void *opaque, uint32_t pil_in)
|
static void leon3_set_pil_in(void *opaque, uint32_t pil_in)
|
||||||
{
|
{
|
||||||
CPUSPARCState *env = (CPUSPARCState *)opaque;
|
CPUSPARCState *env = (CPUSPARCState *)opaque;
|
||||||
|
CPUState *cs;
|
||||||
|
|
||||||
assert(env != NULL);
|
assert(env != NULL);
|
||||||
|
|
||||||
|
@ -89,9 +90,10 @@ static void leon3_set_pil_in(void *opaque, uint32_t pil_in)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (!env->pil_in && (env->interrupt_index & ~15) == TT_EXTINT) {
|
} else if (!env->pil_in && (env->interrupt_index & ~15) == TT_EXTINT) {
|
||||||
|
cs = CPU(sparc_env_get_cpu(env));
|
||||||
trace_leon3_reset_irq(env->interrupt_index & 15);
|
trace_leon3_reset_irq(env->interrupt_index & 15);
|
||||||
env->interrupt_index = 0;
|
env->interrupt_index = 0;
|
||||||
cpu_reset_interrupt(env, CPU_INTERRUPT_HARD);
|
cpu_reset_interrupt(cs, CPU_INTERRUPT_HARD);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -230,6 +230,8 @@ void sun4m_irq_info(Monitor *mon, const QDict *qdict)
|
||||||
|
|
||||||
void cpu_check_irqs(CPUSPARCState *env)
|
void cpu_check_irqs(CPUSPARCState *env)
|
||||||
{
|
{
|
||||||
|
CPUState *cs;
|
||||||
|
|
||||||
if (env->pil_in && (env->interrupt_index == 0 ||
|
if (env->pil_in && (env->interrupt_index == 0 ||
|
||||||
(env->interrupt_index & ~15) == TT_EXTINT)) {
|
(env->interrupt_index & ~15) == TT_EXTINT)) {
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
@ -247,9 +249,10 @@ void cpu_check_irqs(CPUSPARCState *env)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (!env->pil_in && (env->interrupt_index & ~15) == TT_EXTINT) {
|
} else if (!env->pil_in && (env->interrupt_index & ~15) == TT_EXTINT) {
|
||||||
|
cs = CPU(sparc_env_get_cpu(env));
|
||||||
trace_sun4m_cpu_reset_interrupt(env->interrupt_index & 15);
|
trace_sun4m_cpu_reset_interrupt(env->interrupt_index & 15);
|
||||||
env->interrupt_index = 0;
|
env->interrupt_index = 0;
|
||||||
cpu_reset_interrupt(env, CPU_INTERRUPT_HARD);
|
cpu_reset_interrupt(cs, CPU_INTERRUPT_HARD);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -276,7 +276,7 @@ void cpu_check_irqs(CPUSPARCState *env)
|
||||||
CPUIRQ_DPRINTF("Reset CPU IRQ (current interrupt %x)\n",
|
CPUIRQ_DPRINTF("Reset CPU IRQ (current interrupt %x)\n",
|
||||||
env->interrupt_index);
|
env->interrupt_index);
|
||||||
env->interrupt_index = 0;
|
env->interrupt_index = 0;
|
||||||
cpu_reset_interrupt(env, CPU_INTERRUPT_HARD);
|
cpu_reset_interrupt(cs, CPU_INTERRUPT_HARD);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -309,7 +309,7 @@ void cpu_check_irqs(CPUSPARCState *env)
|
||||||
"current interrupt %x\n",
|
"current interrupt %x\n",
|
||||||
pil, env->pil_in, env->softint, env->interrupt_index);
|
pil, env->pil_in, env->softint, env->interrupt_index);
|
||||||
env->interrupt_index = 0;
|
env->interrupt_index = 0;
|
||||||
cpu_reset_interrupt(env, CPU_INTERRUPT_HARD);
|
cpu_reset_interrupt(cs, CPU_INTERRUPT_HARD);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -344,8 +344,9 @@ static void cpu_set_ivec_irq(void *opaque, int irq, int level)
|
||||||
} else {
|
} else {
|
||||||
if (env->ivec_status & 0x20) {
|
if (env->ivec_status & 0x20) {
|
||||||
CPUIRQ_DPRINTF("Lower IVEC IRQ %d\n", irq);
|
CPUIRQ_DPRINTF("Lower IVEC IRQ %d\n", irq);
|
||||||
|
cs = CPU(cpu);
|
||||||
env->ivec_status &= ~0x20;
|
env->ivec_status &= ~0x20;
|
||||||
cpu_reset_interrupt(env, CPU_INTERRUPT_HARD);
|
cpu_reset_interrupt(cs, CPU_INTERRUPT_HARD);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,13 +26,15 @@
|
||||||
|
|
||||||
static void puv3_intc_cpu_handler(void *opaque, int irq, int level)
|
static void puv3_intc_cpu_handler(void *opaque, int irq, int level)
|
||||||
{
|
{
|
||||||
CPUUniCore32State *env = opaque;
|
UniCore32CPU *cpu = opaque;
|
||||||
|
CPUUniCore32State *env = &cpu->env;
|
||||||
|
CPUState *cs = CPU(cpu);
|
||||||
|
|
||||||
assert(irq == 0);
|
assert(irq == 0);
|
||||||
if (level) {
|
if (level) {
|
||||||
cpu_interrupt(env, CPU_INTERRUPT_HARD);
|
cpu_interrupt(env, CPU_INTERRUPT_HARD);
|
||||||
} else {
|
} else {
|
||||||
cpu_reset_interrupt(env, CPU_INTERRUPT_HARD);
|
cpu_reset_interrupt(cs, CPU_INTERRUPT_HARD);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,7 +46,8 @@ static void puv3_soc_init(CPUUniCore32State *env)
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
/* Initialize interrupt controller */
|
/* Initialize interrupt controller */
|
||||||
cpu_intc = qemu_allocate_irqs(puv3_intc_cpu_handler, env, 1);
|
cpu_intc = qemu_allocate_irqs(puv3_intc_cpu_handler,
|
||||||
|
uc32_env_get_cpu(env), 1);
|
||||||
dev = sysbus_create_simple("puv3_intc", PUV3_INTC_BASE, *cpu_intc);
|
dev = sysbus_create_simple("puv3_intc", PUV3_INTC_BASE, *cpu_intc);
|
||||||
for (i = 0; i < PUV3_IRQS_NR; i++) {
|
for (i = 0; i < PUV3_IRQS_NR; i++) {
|
||||||
irqs[i] = qdev_get_gpio_in(dev, i);
|
irqs[i] = qdev_get_gpio_in(dev, i);
|
||||||
|
|
|
@ -80,7 +80,7 @@ void check_interrupts(CPUXtensaState *env)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
env->pending_irq_level = 0;
|
env->pending_irq_level = 0;
|
||||||
cpu_reset_interrupt(env, CPU_INTERRUPT_HARD);
|
cpu_reset_interrupt(cs, CPU_INTERRUPT_HARD);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void xtensa_set_irq(void *opaque, int irq, int active)
|
static void xtensa_set_irq(void *opaque, int irq, int active)
|
||||||
|
|
|
@ -434,8 +434,6 @@ static inline void cpu_interrupt(CPUArchState *s, int mask)
|
||||||
void cpu_interrupt(CPUArchState *env, int mask);
|
void cpu_interrupt(CPUArchState *env, int mask);
|
||||||
#endif /* USER_ONLY */
|
#endif /* USER_ONLY */
|
||||||
|
|
||||||
void cpu_reset_interrupt(CPUArchState *env, int mask);
|
|
||||||
|
|
||||||
void cpu_exit(CPUArchState *s);
|
void cpu_exit(CPUArchState *s);
|
||||||
|
|
||||||
/* Breakpoint/watchpoint flags */
|
/* Breakpoint/watchpoint flags */
|
||||||
|
|
|
@ -221,5 +221,14 @@ void run_on_cpu(CPUState *cpu, void (*func)(void *data), void *data);
|
||||||
*/
|
*/
|
||||||
CPUState *qemu_get_cpu(int index);
|
CPUState *qemu_get_cpu(int index);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* cpu_reset_interrupt:
|
||||||
|
* @cpu: The CPU to clear the interrupt on.
|
||||||
|
* @mask: The interrupt mask to clear.
|
||||||
|
*
|
||||||
|
* Resets interrupts on the vCPU @cpu.
|
||||||
|
*/
|
||||||
|
void cpu_reset_interrupt(CPUState *cpu, int mask);
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -21,6 +21,11 @@
|
||||||
#include "qom/cpu.h"
|
#include "qom/cpu.h"
|
||||||
#include "qemu-common.h"
|
#include "qemu-common.h"
|
||||||
|
|
||||||
|
void cpu_reset_interrupt(CPUState *cpu, int mask)
|
||||||
|
{
|
||||||
|
cpu->interrupt_request &= ~mask;
|
||||||
|
}
|
||||||
|
|
||||||
void cpu_reset(CPUState *cpu)
|
void cpu_reset(CPUState *cpu)
|
||||||
{
|
{
|
||||||
CPUClass *klass = CPU_GET_CLASS(cpu);
|
CPUClass *klass = CPU_GET_CLASS(cpu);
|
||||||
|
|
|
@ -312,14 +312,16 @@ int cpu_m68k_handle_mmu_fault (CPUM68KState *env, target_ulong address, int rw,
|
||||||
simplicitly we calculate it when the interrupt is signalled. */
|
simplicitly we calculate it when the interrupt is signalled. */
|
||||||
void m68k_set_irq_level(M68kCPU *cpu, int level, uint8_t vector)
|
void m68k_set_irq_level(M68kCPU *cpu, int level, uint8_t vector)
|
||||||
{
|
{
|
||||||
|
CPUState *cs = CPU(cpu);
|
||||||
CPUM68KState *env = &cpu->env;
|
CPUM68KState *env = &cpu->env;
|
||||||
|
|
||||||
env->pending_level = level;
|
env->pending_level = level;
|
||||||
env->pending_vector = vector;
|
env->pending_vector = vector;
|
||||||
if (level)
|
if (level) {
|
||||||
cpu_interrupt(env, CPU_INTERRUPT_HARD);
|
cpu_interrupt(env, CPU_INTERRUPT_HARD);
|
||||||
else
|
} else {
|
||||||
cpu_reset_interrupt(env, CPU_INTERRUPT_HARD);
|
cpu_reset_interrupt(cs, CPU_INTERRUPT_HARD);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -534,12 +534,11 @@ static inline void mips_vpe_wake(CPUMIPSState *c)
|
||||||
static inline void mips_vpe_sleep(MIPSCPU *cpu)
|
static inline void mips_vpe_sleep(MIPSCPU *cpu)
|
||||||
{
|
{
|
||||||
CPUState *cs = CPU(cpu);
|
CPUState *cs = CPU(cpu);
|
||||||
CPUMIPSState *c = &cpu->env;
|
|
||||||
|
|
||||||
/* The VPE was shut off, really go to bed.
|
/* The VPE was shut off, really go to bed.
|
||||||
Reset any old _WAKE requests. */
|
Reset any old _WAKE requests. */
|
||||||
cs->halted = 1;
|
cs->halted = 1;
|
||||||
cpu_reset_interrupt(c, CPU_INTERRUPT_WAKE);
|
cpu_reset_interrupt(cs, CPU_INTERRUPT_WAKE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void mips_tc_wake(MIPSCPU *cpu, int tc)
|
static inline void mips_tc_wake(MIPSCPU *cpu, int tc)
|
||||||
|
@ -2104,7 +2103,7 @@ void helper_wait(CPUMIPSState *env)
|
||||||
CPUState *cs = CPU(mips_env_get_cpu(env));
|
CPUState *cs = CPU(mips_env_get_cpu(env));
|
||||||
|
|
||||||
cs->halted = 1;
|
cs->halted = 1;
|
||||||
cpu_reset_interrupt(env, CPU_INTERRUPT_WAKE);
|
cpu_reset_interrupt(cs, CPU_INTERRUPT_WAKE);
|
||||||
helper_raise_exception(env, EXCP_HLT);
|
helper_raise_exception(env, EXCP_HLT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue