Revision 17604dac
b/hw/mc146818rtc.c | ||
---|---|---|
99 | 99 |
QEMUTimer *coalesced_timer; |
100 | 100 |
QEMUTimer *second_timer; |
101 | 101 |
QEMUTimer *second_timer2; |
102 |
Notifier clock_reset_notifier; |
|
102 | 103 |
} RTCState; |
103 | 104 |
|
104 | 105 |
static void rtc_set_time(RTCState *s); |
... | ... | |
572 | 573 |
} |
573 | 574 |
}; |
574 | 575 |
|
576 |
static void rtc_notify_clock_reset(Notifier *notifier, void *data) |
|
577 |
{ |
|
578 |
RTCState *s = container_of(notifier, RTCState, clock_reset_notifier); |
|
579 |
int64_t now = *(int64_t *)data; |
|
580 |
|
|
581 |
rtc_set_date_from_host(&s->dev); |
|
582 |
s->next_second_time = now + (get_ticks_per_sec() * 99) / 100; |
|
583 |
qemu_mod_timer(s->second_timer2, s->next_second_time); |
|
584 |
rtc_timer_update(s, now); |
|
585 |
#ifdef TARGET_I386 |
|
586 |
if (rtc_td_hack) { |
|
587 |
rtc_coalesced_timer_update(s); |
|
588 |
} |
|
589 |
#endif |
|
590 |
} |
|
591 |
|
|
575 | 592 |
static void rtc_reset(void *opaque) |
576 | 593 |
{ |
577 | 594 |
RTCState *s = opaque; |
... | ... | |
608 | 625 |
s->second_timer = qemu_new_timer_ns(rtc_clock, rtc_update_second, s); |
609 | 626 |
s->second_timer2 = qemu_new_timer_ns(rtc_clock, rtc_update_second2, s); |
610 | 627 |
|
628 |
s->clock_reset_notifier.notify = rtc_notify_clock_reset; |
|
629 |
qemu_register_clock_reset_notifier(rtc_clock, &s->clock_reset_notifier); |
|
630 |
|
|
611 | 631 |
s->next_second_time = |
612 | 632 |
qemu_get_clock_ns(rtc_clock) + (get_ticks_per_sec() * 99) / 100; |
613 | 633 |
qemu_mod_timer(s->second_timer2, s->next_second_time); |
Also available in: Unified diff