Commit 6d0c293dc336807e4a2ab9c3a74483da747601ce

Authored by blueswir1
1 parent fdce4963

Halt the CPU using a qemu_irq

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5601 c046a42c-6fe2-441c-8c8c-71466251a162
hw/slavio_misc.c
... ... @@ -50,7 +50,7 @@ typedef struct MiscState {
50 50 uint8_t diag, mctrl;
51 51 uint32_t sysctrl;
52 52 uint16_t leds;
53   - CPUState *env;
  53 + qemu_irq cpu_halt;
54 54 qemu_irq fdc_tc;
55 55 } MiscState;
56 56  
... ... @@ -256,7 +256,7 @@ static void apc_mem_writeb(void *opaque, target_phys_addr_t addr, uint32_t val)
256 256 MiscState *s = opaque;
257 257  
258 258 MISC_DPRINTF("Write power management %2.2x\n", val & 0xff);
259   - cpu_interrupt(s->env, CPU_INTERRUPT_HALT);
  259 + qemu_irq_raise(s->cpu_halt);
260 260 }
261 261  
262 262 static uint32_t apc_mem_readb(void *opaque, target_phys_addr_t addr)
... ... @@ -417,7 +417,7 @@ static int slavio_misc_load(QEMUFile *f, void *opaque, int version_id)
417 417 void *slavio_misc_init(target_phys_addr_t base, target_phys_addr_t power_base,
418 418 target_phys_addr_t aux1_base,
419 419 target_phys_addr_t aux2_base, qemu_irq irq,
420   - CPUState *env, qemu_irq **fdc_tc)
  420 + qemu_irq cpu_halt, qemu_irq **fdc_tc)
421 421 {
422 422 int io;
423 423 MiscState *s;
... ... @@ -471,7 +471,7 @@ void *slavio_misc_init(target_phys_addr_t base, target_phys_addr_t power_base,
471 471 }
472 472  
473 473 s->irq = irq;
474   - s->env = env;
  474 + s->cpu_halt = cpu_halt;
475 475 *fdc_tc = &s->fdc_tc;
476 476  
477 477 register_savevm("slavio_misc", base, 1, slavio_misc_save, slavio_misc_load,
... ...
hw/sun4m.c
... ... @@ -360,6 +360,12 @@ static void secondary_cpu_reset(void *opaque)
360 360 env->halted = 1;
361 361 }
362 362  
  363 +static void cpu_halt_signal(void *opaque, int irq, int level)
  364 +{
  365 + if (level && cpu_single_env)
  366 + cpu_interrupt(cpu_single_env, CPU_INTERRUPT_HALT);
  367 +}
  368 +
363 369 static unsigned long sun4m_load_kernel(const char *kernel_filename,
364 370 const char *initrd_filename,
365 371 ram_addr_t RAM_size)
... ... @@ -426,6 +432,7 @@ static void sun4m_hw_init(const struct sun4m_hwdef *hwdef, ram_addr_t RAM_size,
426 432 *espdma_irq, *ledma_irq;
427 433 qemu_irq *esp_reset, *le_reset;
428 434 qemu_irq *fdc_tc;
  435 + qemu_irq *cpu_halt;
429 436 unsigned long prom_offset, kernel_size;
430 437 int ret;
431 438 char buf[1024];
... ... @@ -547,9 +554,10 @@ static void sun4m_hw_init(const struct sun4m_hwdef *hwdef, ram_addr_t RAM_size,
547 554 slavio_serial_init(hwdef->serial_base, slavio_irq[hwdef->ser_irq],
548 555 serial_hds[1], serial_hds[0]);
549 556  
  557 + cpu_halt = qemu_allocate_irqs(cpu_halt_signal, NULL, 1);
550 558 slavio_misc = slavio_misc_init(hwdef->slavio_base, hwdef->apc_base,
551 559 hwdef->aux1_base, hwdef->aux2_base,
552   - slavio_irq[hwdef->me_irq], envs[0],
  560 + slavio_irq[hwdef->me_irq], cpu_halt[0],
553 561 &fdc_tc);
554 562  
555 563 if (hwdef->fd_base != (target_phys_addr_t)-1) {
... ... @@ -1575,7 +1583,7 @@ static void sun4c_hw_init(const struct sun4c_hwdef *hwdef, ram_addr_t RAM_size,
1575 1583 serial_hds[1], serial_hds[0]);
1576 1584  
1577 1585 slavio_misc = slavio_misc_init(0, -1, hwdef->aux1_base, -1,
1578   - slavio_irq[hwdef->me_irq], env, &fdc_tc);
  1586 + slavio_irq[hwdef->me_irq], NULL, &fdc_tc);
1579 1587  
1580 1588 if (hwdef->fd_base != (target_phys_addr_t)-1) {
1581 1589 /* there is zero or one floppy drive */
... ...
hw/sun4m.h
... ... @@ -58,7 +58,7 @@ void slavio_serial_ms_kbd_init(target_phys_addr_t base, qemu_irq irq,
58 58 void *slavio_misc_init(target_phys_addr_t base, target_phys_addr_t power_base,
59 59 target_phys_addr_t aux1_base,
60 60 target_phys_addr_t aux2_base, qemu_irq irq,
61   - CPUState *env, qemu_irq **fdc_tc);
  61 + qemu_irq cpu_halt, qemu_irq **fdc_tc);
62 62 void slavio_set_power_fail(void *opaque, int power_failing);
63 63  
64 64 /* cs4231.c */
... ...