Commit 4721c4575004f9436e3c167f4daa66e2a2d6a3ff
1 parent
a6e022ad
UIP update fix
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@699 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
1 changed file
with
7 additions
and
1 deletions
hw/mc146818rtc.c
| @@ -206,6 +206,7 @@ static void rtc_set_time(RTCState *s) | @@ -206,6 +206,7 @@ static void rtc_set_time(RTCState *s) | ||
| 206 | static void rtc_update_second(void *opaque) | 206 | static void rtc_update_second(void *opaque) |
| 207 | { | 207 | { |
| 208 | RTCState *s = opaque; | 208 | RTCState *s = opaque; |
| 209 | + int64_t delay; | ||
| 209 | 210 | ||
| 210 | /* if the oscillator is not in normal operation, we do not update */ | 211 | /* if the oscillator is not in normal operation, we do not update */ |
| 211 | if ((s->cmos_data[RTC_REG_A] & 0x70) != 0x20) { | 212 | if ((s->cmos_data[RTC_REG_A] & 0x70) != 0x20) { |
| @@ -218,8 +219,13 @@ static void rtc_update_second(void *opaque) | @@ -218,8 +219,13 @@ static void rtc_update_second(void *opaque) | ||
| 218 | /* update in progress bit */ | 219 | /* update in progress bit */ |
| 219 | s->cmos_data[RTC_REG_A] |= REG_A_UIP; | 220 | s->cmos_data[RTC_REG_A] |= REG_A_UIP; |
| 220 | } | 221 | } |
| 222 | + /* should be 244 us = 8 / 32768 seconds, but currently the | ||
| 223 | + timers do not have the necessary resolution. */ | ||
| 224 | + delay = (ticks_per_sec * 1) / 100; | ||
| 225 | + if (delay < 1) | ||
| 226 | + delay = 1; | ||
| 221 | qemu_mod_timer(s->second_timer2, | 227 | qemu_mod_timer(s->second_timer2, |
| 222 | - s->next_second_time + (ticks_per_sec * 99) / 100); | 228 | + s->next_second_time + delay); |
| 223 | } | 229 | } |
| 224 | } | 230 | } |
| 225 | 231 |