WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] [HVM] i8254: Fix bogus use of current

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] [HVM] i8254: Fix bogus use of current
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Wed, 17 Jan 2007 10:40:15 -0800
Delivery-date: Wed, 17 Jan 2007 10:40:18 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User kfraser@xxxxxxxxxxxxxxxxxxxxx
# Date 1169046207 0
# Node ID 120d882a4d8efe5a82365ff54b91d6cfbf636dde
# Parent  9fa13c7ebf8a650d515a2ddbafb49cf0932d736b
[HVM] i8254: Fix bogus use of current

The function pit_load_count incorrectly references current for
determining whether the channel number is zero.  This breaks
when starting a new guest because current points to dom0.

The fix is to explicitly pass the address for verification.

Signed-off-by: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
---
 xen/arch/x86/hvm/i8254.c |   14 ++++++--------
 1 files changed, 6 insertions(+), 8 deletions(-)

diff -r 9fa13c7ebf8a -r 120d882a4d8e xen/arch/x86/hvm/i8254.c
--- a/xen/arch/x86/hvm/i8254.c  Wed Jan 17 14:58:53 2007 +0000
+++ b/xen/arch/x86/hvm/i8254.c  Wed Jan 17 15:03:27 2007 +0000
@@ -182,11 +182,9 @@ void pit_time_fired(struct vcpu *v, void
     s->count_load_time = hvm_get_guest_time(v);
 }
 
-static inline void pit_load_count(PITChannelState *s, int val)
+static inline void pit_load_count(PITChannelState *s, int channel, int val)
 {
     u32 period;
-    PITChannelState *ch0 =
-        &current->domain->arch.hvm_domain.pl_time.vpit.channels[0];
 
     if (val == 0)
         val = 0x10000;
@@ -194,7 +192,7 @@ static inline void pit_load_count(PITCha
     s->count = val;
     period = DIV_ROUND((val * 1000000000ULL), PIT_FREQ);
 
-    if (s != ch0)
+    if (channel != 0)
         return;
 
 #ifdef DEBUG_PIT
@@ -282,17 +280,17 @@ static void pit_ioport_write(void *opaqu
         switch(s->write_state) {
         default:
         case RW_STATE_LSB:
-            pit_load_count(s, val);
+            pit_load_count(s, addr, val);
             break;
         case RW_STATE_MSB:
-            pit_load_count(s, val << 8);
+            pit_load_count(s, addr, val << 8);
             break;
         case RW_STATE_WORD0:
             s->write_latch = val;
             s->write_state = RW_STATE_WORD1;
             break;
         case RW_STATE_WORD1:
-            pit_load_count(s, s->write_latch | (val << 8));
+            pit_load_count(s, addr, s->write_latch | (val << 8));
             s->write_state = RW_STATE_WORD0;
             break;
         }
@@ -369,7 +367,7 @@ static void pit_reset(void *opaque)
         destroy_periodic_time(&s->pt);
         s->mode = 0xff; /* the init mode */
         s->gate = (i != 2);
-        pit_load_count(s, 0);
+        pit_load_count(s, i, 0);
     }
 }
 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] [HVM] i8254: Fix bogus use of current, Xen patchbot-unstable <=