diff options
author | Ot ten Thije <ottenthije@google.com> | 2010-09-06 15:03:52 +0100 |
---|---|---|
committer | Ot ten Thije <ottenthije@google.com> | 2010-09-06 15:47:45 +0100 |
commit | a7f114bcbd85d71f59f716df5a38340bdfe30637 (patch) | |
tree | 0697b0290c7e710fa74797b820bcd8a184edc74a /vl-android.c | |
parent | cefa7443eb3d3e4bb134595f756145426d5613e3 (diff) | |
download | external_qemu-a7f114bcbd85d71f59f716df5a38340bdfe30637.zip external_qemu-a7f114bcbd85d71f59f716df5a38340bdfe30637.tar.gz external_qemu-a7f114bcbd85d71f59f716df5a38340bdfe30637.tar.bz2 |
Fix suspending and resuming timers.
This brings the code for saving and restoring the vm clock up to
date with the current codebase. It also includes a workaround for an
issue that occurred when the state of a goldfish timer was restored.
For unexplained reasons, the compiler generated code to copy the
least significant 32 bits only when reading a 64 bit number,
dropping the remaining 32 bits.
In order to facilitate debugging, the variables in the goldfish
timer code have been suffixed with their units ("ns" for nanoseconds
or "tks" for ticks).
Diffstat (limited to 'vl-android.c')
-rw-r--r-- | vl-android.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/vl-android.c b/vl-android.c index 07ef4e2..0cd6b52 100644 --- a/vl-android.c +++ b/vl-android.c @@ -1351,30 +1351,30 @@ void qemu_get_timer(QEMUFile *f, QEMUTimer *ts) static void timer_save(QEMUFile *f, void *opaque) { -#if 0 - if (cpu_ticks_enabled) { + TimersState *s = opaque; + + if (s->cpu_ticks_enabled) { hw_error("cannot save state if virtual timers are running"); } - qemu_put_be64(f, cpu_ticks_offset); + qemu_put_be64(f, s->cpu_ticks_offset); qemu_put_be64(f, ticks_per_sec); - qemu_put_be64(f, cpu_clock_offset); -#endif + qemu_put_be64(f, s->cpu_clock_offset); } static int timer_load(QEMUFile *f, void *opaque, int version_id) { -#if 0 + TimersState *s = opaque; + if (version_id != 1 && version_id != 2) return -EINVAL; - if (cpu_ticks_enabled) { + if (s->cpu_ticks_enabled) { return -EINVAL; } - cpu_ticks_offset=qemu_get_be64(f); - ticks_per_sec=qemu_get_be64(f); + s->cpu_ticks_offset = qemu_get_be64(f); + ticks_per_sec = qemu_get_be64(f); if (version_id == 2) { - cpu_clock_offset=qemu_get_be64(f); + s->cpu_clock_offset = qemu_get_be64(f); } -#endif return 0; } @@ -6414,7 +6414,7 @@ int main(int argc, char **argv, char **envp) if (drive_init(&drives_opt[i], snapshot, machine) == -1) exit(1); - register_savevm("timer", 0, 2, timer_save, timer_load, NULL); + register_savevm("timer", 0, 2, timer_save, timer_load, &timers_state); register_savevm_live("ram", 0, 3, ram_save_live, NULL, ram_load, NULL); #ifndef _WIN32 |