aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorblueswir1 <blueswir1@c046a42c-6fe2-441c-8c8c-71466251a162>2008-11-02 10:51:05 +0000
committerblueswir1 <blueswir1@c046a42c-6fe2-441c-8c8c-71466251a162>2008-11-02 10:51:05 +0000
commit6d0c293dc336807e4a2ab9c3a74483da747601ce (patch)
tree7a84f9a9a102f9cb2e6500097d0b57b4cd49abf7 /hw
parentfdce4963ea58ec2405e87b2edf96f8c93275d919 (diff)
Halt the CPU using a qemu_irq
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5601 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'hw')
-rw-r--r--hw/slavio_misc.c8
-rw-r--r--hw/sun4m.c12
-rw-r--r--hw/sun4m.h2
3 files changed, 15 insertions, 7 deletions
diff --git a/hw/slavio_misc.c b/hw/slavio_misc.c
index 6a30f0ca39..2890cfda02 100644
--- a/hw/slavio_misc.c
+++ b/hw/slavio_misc.c
@@ -50,7 +50,7 @@ typedef struct MiscState {
uint8_t diag, mctrl;
uint32_t sysctrl;
uint16_t leds;
- CPUState *env;
+ qemu_irq cpu_halt;
qemu_irq fdc_tc;
} MiscState;
@@ -256,7 +256,7 @@ static void apc_mem_writeb(void *opaque, target_phys_addr_t addr, uint32_t val)
MiscState *s = opaque;
MISC_DPRINTF("Write power management %2.2x\n", val & 0xff);
- cpu_interrupt(s->env, CPU_INTERRUPT_HALT);
+ qemu_irq_raise(s->cpu_halt);
}
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)
void *slavio_misc_init(target_phys_addr_t base, target_phys_addr_t power_base,
target_phys_addr_t aux1_base,
target_phys_addr_t aux2_base, qemu_irq irq,
- CPUState *env, qemu_irq **fdc_tc)
+ qemu_irq cpu_halt, qemu_irq **fdc_tc)
{
int io;
MiscState *s;
@@ -471,7 +471,7 @@ void *slavio_misc_init(target_phys_addr_t base, target_phys_addr_t power_base,
}
s->irq = irq;
- s->env = env;
+ s->cpu_halt = cpu_halt;
*fdc_tc = &s->fdc_tc;
register_savevm("slavio_misc", base, 1, slavio_misc_save, slavio_misc_load,
diff --git a/hw/sun4m.c b/hw/sun4m.c
index f3c6501fb1..7756e5e0b0 100644
--- a/hw/sun4m.c
+++ b/hw/sun4m.c
@@ -360,6 +360,12 @@ static void secondary_cpu_reset(void *opaque)
env->halted = 1;
}
+static void cpu_halt_signal(void *opaque, int irq, int level)
+{
+ if (level && cpu_single_env)
+ cpu_interrupt(cpu_single_env, CPU_INTERRUPT_HALT);
+}
+
static unsigned long sun4m_load_kernel(const char *kernel_filename,
const char *initrd_filename,
ram_addr_t RAM_size)
@@ -426,6 +432,7 @@ static void sun4m_hw_init(const struct sun4m_hwdef *hwdef, ram_addr_t RAM_size,
*espdma_irq, *ledma_irq;
qemu_irq *esp_reset, *le_reset;
qemu_irq *fdc_tc;
+ qemu_irq *cpu_halt;
unsigned long prom_offset, kernel_size;
int ret;
char buf[1024];
@@ -547,9 +554,10 @@ static void sun4m_hw_init(const struct sun4m_hwdef *hwdef, ram_addr_t RAM_size,
slavio_serial_init(hwdef->serial_base, slavio_irq[hwdef->ser_irq],
serial_hds[1], serial_hds[0]);
+ cpu_halt = qemu_allocate_irqs(cpu_halt_signal, NULL, 1);
slavio_misc = slavio_misc_init(hwdef->slavio_base, hwdef->apc_base,
hwdef->aux1_base, hwdef->aux2_base,
- slavio_irq[hwdef->me_irq], envs[0],
+ slavio_irq[hwdef->me_irq], cpu_halt[0],
&fdc_tc);
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,
serial_hds[1], serial_hds[0]);
slavio_misc = slavio_misc_init(0, -1, hwdef->aux1_base, -1,
- slavio_irq[hwdef->me_irq], env, &fdc_tc);
+ slavio_irq[hwdef->me_irq], NULL, &fdc_tc);
if (hwdef->fd_base != (target_phys_addr_t)-1) {
/* there is zero or one floppy drive */
diff --git a/hw/sun4m.h b/hw/sun4m.h
index a208420f9f..f6d822ee39 100644
--- a/hw/sun4m.h
+++ b/hw/sun4m.h
@@ -58,7 +58,7 @@ void slavio_serial_ms_kbd_init(target_phys_addr_t base, qemu_irq irq,
void *slavio_misc_init(target_phys_addr_t base, target_phys_addr_t power_base,
target_phys_addr_t aux1_base,
target_phys_addr_t aux2_base, qemu_irq irq,
- CPUState *env, qemu_irq **fdc_tc);
+ qemu_irq cpu_halt, qemu_irq **fdc_tc);
void slavio_set_power_fail(void *opaque, int power_failing);
/* cs4231.c */