sparc64: reimplement tick timers v4

sparc64 timer has tick counter which can be set and read,
and tick compare value used as deadline to fire timer interrupt.
The timer is not used as periodic timer, instead deadline
is set each time new timer interrupt is needed.

v3 -> v4:
- coding style

v2 -> v3:
- added missing timer debug output macro
- CPUTimer struct and typedef moved to cpu.h
- change CPU_SAVE_VERSION to 6, older save formats not supported

v1 -> v2:
- new conversion helpers cpu_to_timer_ticks and timer_to_cpu_ticks
- save offset from clock source to implement cpu_tick_set_count
- renamed struct sun4u_timer to CPUTimer
- load and save cpu timers

v0 -> v1:
- coding style

Signed-off-by: Igor V. Kovalenko <igor.v.kovalenko@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
This commit is contained in:
Igor V. Kovalenko 2010-01-28 00:00:53 +03:00 committed by Blue Swirl
parent 4f690853bb
commit 8f4efc5588
3 changed files with 202 additions and 46 deletions

View file

@ -84,8 +84,8 @@ void cpu_save(QEMUFile *f, void *opaque)
qemu_put_be64s(f, &env->fprs);
qemu_put_be64s(f, &env->tick_cmpr);
qemu_put_be64s(f, &env->stick_cmpr);
qemu_put_ptimer(f, env->tick);
qemu_put_ptimer(f, env->stick);
cpu_put_timer(f, env->tick);
cpu_put_timer(f, env->stick);
qemu_put_be64s(f, &env->gsr);
qemu_put_be32s(f, &env->gl);
qemu_put_be64s(f, &env->hpstate);
@ -96,7 +96,7 @@ void cpu_save(QEMUFile *f, void *opaque)
qemu_put_be64s(f, &env->hver);
qemu_put_be64s(f, &env->hstick_cmpr);
qemu_put_be64s(f, &env->ssr);
qemu_put_ptimer(f, env->hstick);
cpu_put_timer(f, env->hstick);
#endif
}
@ -106,7 +106,7 @@ int cpu_load(QEMUFile *f, void *opaque, int version_id)
int i;
uint32_t tmp;
if (version_id != 5)
if (version_id < 6)
return -EINVAL;
for(i = 0; i < 8; i++)
qemu_get_betls(f, &env->gregs[i]);
@ -180,8 +180,8 @@ int cpu_load(QEMUFile *f, void *opaque, int version_id)
qemu_get_be64s(f, &env->fprs);
qemu_get_be64s(f, &env->tick_cmpr);
qemu_get_be64s(f, &env->stick_cmpr);
qemu_get_ptimer(f, env->tick);
qemu_get_ptimer(f, env->stick);
cpu_get_timer(f, env->tick);
cpu_get_timer(f, env->stick);
qemu_get_be64s(f, &env->gsr);
qemu_get_be32s(f, &env->gl);
qemu_get_be64s(f, &env->hpstate);
@ -192,7 +192,7 @@ int cpu_load(QEMUFile *f, void *opaque, int version_id)
qemu_get_be64s(f, &env->hver);
qemu_get_be64s(f, &env->hstick_cmpr);
qemu_get_be64s(f, &env->ssr);
qemu_get_ptimer(f, env->hstick);
cpu_get_timer(f, env->hstick);
#endif
tlb_flush(env, 1);
return 0;