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-devel

[Xen-devel] [PATCH] x86: replace some intpte_t * casts

To: <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH] x86: replace some intpte_t * casts
From: "Jan Beulich" <jbeulich@xxxxxxxxxx>
Date: Mon, 14 May 2007 17:16:44 +0200
Delivery-date: Mon, 14 May 2007 08:14:16 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Don't cast values when other (type safe) mechanisms are available to achieve
the same effect.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx>

Index: 2007-05-14/xen/arch/x86/mm.c
===================================================================
--- 2007-05-14.orig/xen/arch/x86/mm.c   2007-05-14 08:40:14.000000000 +0200
+++ 2007-05-14/xen/arch/x86/mm.c        2007-05-14 08:40:20.000000000 +0200
@@ -1017,7 +1017,7 @@ static void pae_flush_pgd(
             l3tab_ptr = &cache->table[cache->inuse_idx][idx];
             _ol3e = l3e_get_intpte(*l3tab_ptr);
             _nl3e = l3e_get_intpte(nl3e);
-            _pl3e = cmpxchg((intpte_t *)l3tab_ptr, _ol3e, _nl3e);
+            _pl3e = cmpxchg(&l3e_get_intpte(*l3tab_ptr), _ol3e, _nl3e);
             BUG_ON(_pl3e != _ol3e);
         }
 
@@ -1316,7 +1316,7 @@ static inline int update_intpte(intpte_t
 /* Macro that wraps the appropriate type-changes around update_intpte().
  * Arguments are: type, ptr, old, new, mfn, vcpu */
 #define UPDATE_ENTRY(_t,_p,_o,_n,_m,_v)                             \
-    update_intpte((intpte_t *)(_p),                                 \
+    update_intpte(&_t ## e_get_intpte(*(_p)),                       \
                   _t ## e_get_intpte(_o), _t ## e_get_intpte(_n),   \
                   (_m), (_v))
 
@@ -2498,7 +2498,7 @@ static int create_grant_pte_mapping(
     }
 
     ol1e = *(l1_pgentry_t *)va;
-    if ( !UPDATE_ENTRY(l1, va, ol1e, nl1e, mfn, v) )
+    if ( !UPDATE_ENTRY(l1, (l1_pgentry_t *)va, ol1e, nl1e, mfn, v) )
     {
         put_page_type(page);
         rc = GNTST_general_error;
@@ -3278,7 +3278,7 @@ static int ptwr_emulated_update(
         intpte_t t = old;
         ol1e = l1e_from_intpte(old);
 
-        okay = paging_cmpxchg_guest_entry(v, (intpte_t *) pl1e, 
+        okay = paging_cmpxchg_guest_entry(v, &l1e_get_intpte(*pl1e),
                                           &t, val, _mfn(mfn));
         okay = (okay && t == old);
 




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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH] x86: replace some intpte_t * casts, Jan Beulich <=