From 23e39294034e13d29a0707483542bab850d601b4 Mon Sep 17 00:00:00 2001 From: pbrook Date: Wed, 2 Jul 2008 16:48:32 +0000 Subject: Save/restore for stellaris boards. git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4824 c046a42c-6fe2-441c-8c8c-71466251a162 --- hw/armv7m_nvic.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'hw/armv7m_nvic.c') diff --git a/hw/armv7m_nvic.c b/hw/armv7m_nvic.c index 37596d0ccb..26e4c2f2fd 100644 --- a/hw/armv7m_nvic.c +++ b/hw/armv7m_nvic.c @@ -368,6 +368,31 @@ static void nvic_writel(void *opaque, uint32_t offset, uint32_t value) } } +static void nvic_save(QEMUFile *f, void *opaque) +{ + nvic_state *s = (nvic_state *)opaque; + + qemu_put_be32(f, s->systick.control); + qemu_put_be32(f, s->systick.reload); + qemu_put_be64(f, s->systick.tick); + qemu_put_timer(f, s->systick.timer); +} + +static int nvic_load(QEMUFile *f, void *opaque, int version_id) +{ + nvic_state *s = (nvic_state *)opaque; + + if (version_id != 1) + return -EINVAL; + + s->systick.control = qemu_get_be32(f); + s->systick.reload = qemu_get_be32(f); + s->systick.tick = qemu_get_be64(f); + qemu_get_timer(f, s->systick.timer); + + return 0; +} + qemu_irq *armv7m_nvic_init(CPUState *env) { nvic_state *s; @@ -381,5 +406,6 @@ qemu_irq *armv7m_nvic_init(CPUState *env) if (env->v7m.nvic) cpu_abort(env, "CPU can only have one NVIC\n"); env->v7m.nvic = s; + register_savevm("armv7m_nvic", -1, 1, nvic_save, nvic_load, s); return s->gic->in; } -- cgit v1.2.3