x86/HVM: use cached original value in RTC_REG_B writing code
authorJan Beulich <jbeulich@suse.com>
Wed, 23 Jan 2013 13:19:54 +0000 (14:19 +0100)
committerJan Beulich <jbeulich@suse.com>
Wed, 23 Jan 2013 13:19:54 +0000 (14:19 +0100)
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
xen/arch/x86/hvm/rtc.c

index e0c606fab892eb734f01e2f8e9de6f5c512283b2..f8d3bed6d9b03af985b3d5e75ab3c33f5cd03a68 100644 (file)
@@ -430,7 +430,7 @@ static int rtc_ioport_write(void *opaque, uint32_t addr, uint32_t data)
             /* set mode: reset UIP mode */
             s->hw.cmos_data[RTC_REG_A] &= ~RTC_UIP;
             /* adjust cmos before stopping */
-            if (!(s->hw.cmos_data[RTC_REG_B] & RTC_SET))
+            if (!(orig & RTC_SET))
             {
                 s->current_tm = gmtime(get_localtime(d));
                 rtc_copy_date(s);
@@ -439,12 +439,12 @@ static int rtc_ioport_write(void *opaque, uint32_t addr, uint32_t data)
         else
         {
             /* if disabling set mode, update the time */
-            if ( s->hw.cmos_data[RTC_REG_B] & RTC_SET )
+            if ( orig & RTC_SET )
                 rtc_set_time(s);
         }
         /* if the interrupt is already set when the interrupt become
          * enabled, raise an interrupt immediately*/
-        if ((data & RTC_UIE) && !(s->hw.cmos_data[RTC_REG_B] & RTC_UIE))
+        if ((data & RTC_UIE) && !(orig & RTC_UIE))
             if (s->hw.cmos_data[RTC_REG_C] & RTC_UF)
             {
                 rtc_toggle_irq(s);