Merge remote-tracking branch 'jliu/or32' into staging

# By Jia Liu
# Via Jia Liu
* jliu/or32:
  hw/openrisc: Avoid undefined shift in openrisc_pic_cpu_handler()
  hw/openrisc: Fix masking in openrisc_pic_cpu_handler()
  hw/openrisc: Avoid using uninitialised variable 'entry'

Message-id: 1377050811-11116-1-git-send-email-proljc@gmail.com
Signed-off-by: Anthony Liguori <anthony@codemonkey.ws>
This commit is contained in:
Anthony Liguori 2013-08-22 09:29:13 -05:00
commit 9fe480695a
2 changed files with 9 additions and 11 deletions

View File

@ -86,9 +86,8 @@ static void cpu_openrisc_load_kernel(ram_addr_t ram_size,
kernel_filename); kernel_filename);
exit(1); exit(1);
} }
cpu->env.pc = entry;
} }
cpu->env.pc = entry;
} }
static void openrisc_sim_init(QEMUMachineInitArgs *args) static void openrisc_sim_init(QEMUMachineInitArgs *args)

View File

@ -26,26 +26,25 @@ static void openrisc_pic_cpu_handler(void *opaque, int irq, int level)
{ {
OpenRISCCPU *cpu = (OpenRISCCPU *)opaque; OpenRISCCPU *cpu = (OpenRISCCPU *)opaque;
CPUState *cs = CPU(cpu); CPUState *cs = CPU(cpu);
int i; uint32_t irq_bit;
uint32_t irq_bit = 1 << irq;
if (irq > 31 || irq < 0) { if (irq > 31 || irq < 0) {
return; return;
} }
irq_bit = 1U << irq;
if (level) { if (level) {
cpu->env.picsr |= irq_bit; cpu->env.picsr |= irq_bit;
} else { } else {
cpu->env.picsr &= ~irq_bit; cpu->env.picsr &= ~irq_bit;
} }
for (i = 0; i < 32; i++) { if (cpu->env.picsr & cpu->env.picmr) {
if ((cpu->env.picsr && (1 << i)) && (cpu->env.picmr && (1 << i))) { cpu_interrupt(cs, CPU_INTERRUPT_HARD);
cpu_interrupt(cs, CPU_INTERRUPT_HARD); } else {
} else { cpu_reset_interrupt(cs, CPU_INTERRUPT_HARD);
cpu_reset_interrupt(cs, CPU_INTERRUPT_HARD); cpu->env.picsr = 0;
cpu->env.picsr &= ~(1 << i);
}
} }
} }