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] Shadow: Make gfn_t always an unsigned lon

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] Shadow: Make gfn_t always an unsigned long. GFNs are passed around
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Wed, 19 Dec 2007 12:40:08 -0800
Delivery-date: Wed, 19 Dec 2007 12:40:26 -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 Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1198059037 0
# Node ID 0335b9fe2f1003c0c10f081748cb567164ea9361
# Parent  7c98b9177b15990b8ac267d70960da1a9b2dff4e
Shadow: Make gfn_t always an unsigned long.  GFNs are passed around
outside the shadow code, and although a 32-bit gfn_t is guaranteed to
hold all GFNs that can be found in a 32-bit pagetable, comparisons
with INVALID_GFN aren't safe when (-1UL) != (u32)(-1).
Signed-off-by: Tim Deegan <Tim.Deegan@xxxxxxxxxx>
---
 xen/arch/x86/mm/shadow/types.h |   53 +++++++++++++++++------------------------
 1 files changed, 23 insertions(+), 30 deletions(-)

diff -r 7c98b9177b15 -r 0335b9fe2f10 xen/arch/x86/mm/shadow/types.h
--- a/xen/arch/x86/mm/shadow/types.h    Wed Dec 19 09:51:35 2007 +0000
+++ b/xen/arch/x86/mm/shadow/types.h    Wed Dec 19 10:10:37 2007 +0000
@@ -233,6 +233,29 @@ static inline shadow_l4e_t shadow_l4e_fr
 })
 #endif
 
+
+/* Type of the guest's frame numbers */
+TYPE_SAFE(unsigned long,gfn)
+#define SH_PRI_gfn "05lx"
+
+#define VALID_GFN(m) (m != INVALID_GFN)
+
+static inline int
+valid_gfn(gfn_t m)
+{
+    return VALID_GFN(gfn_x(m));
+}
+
+static inline paddr_t
+gfn_to_paddr(gfn_t gfn)
+{
+    return ((paddr_t)gfn_x(gfn)) << PAGE_SHIFT;
+}
+
+/* Override gfn_to_mfn to work with gfn_t */
+#undef gfn_to_mfn
+#define gfn_to_mfn(d, g, t) _gfn_to_mfn((d), gfn_x(g), (t))
+
 #if GUEST_PAGING_LEVELS == 2
 
 #include "../page-guest32.h"
@@ -241,12 +264,6 @@ static inline shadow_l4e_t shadow_l4e_fr
 #define GUEST_L2_PAGETABLE_ENTRIES     1024
 #define GUEST_L1_PAGETABLE_SHIFT         12
 #define GUEST_L2_PAGETABLE_SHIFT         22
-
-/* Type of the guest's frame numbers */
-TYPE_SAFE(u32,gfn)
-#undef INVALID_GFN
-#define INVALID_GFN ((u32)(-1u))
-#define SH_PRI_gfn "05x"
 
 /* Types of the guest's page tables */
 typedef l1_pgentry_32_t guest_l1e_t;
@@ -307,12 +324,6 @@ static inline guest_l2e_t guest_l2e_from
 #define GUEST_L4_PAGETABLE_SHIFT         39
 #endif
 
-/* Type of the guest's frame numbers */
-TYPE_SAFE(unsigned long,gfn)
-#undef INVALID_GFN
-#define INVALID_GFN ((unsigned long)(-1ul))
-#define SH_PRI_gfn "05lx"
-
 /* Types of the guest's page tables */
 typedef l1_pgentry_t guest_l1e_t;
 typedef l2_pgentry_t guest_l2e_t;
@@ -399,24 +410,6 @@ static inline guest_l4e_t guest_l4e_from
 #endif
 
 #endif /* GUEST_PAGING_LEVELS != 2 */
-
-#define VALID_GFN(m) (m != INVALID_GFN)
-
-static inline int
-valid_gfn(gfn_t m)
-{
-    return VALID_GFN(gfn_x(m));
-}
-
-static inline paddr_t
-gfn_to_paddr(gfn_t gfn)
-{
-    return ((paddr_t)gfn_x(gfn)) << PAGE_SHIFT;
-}
-
-/* Override gfn_to_mfn to work with gfn_t */
-#undef gfn_to_mfn
-#define gfn_to_mfn(d, g, t) _gfn_to_mfn((d), gfn_x(g), (t))
 
 
 /* Type used for recording a walk through guest pagetables.  It is

_______________________________________________
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] Shadow: Make gfn_t always an unsigned long. GFNs are passed around, Xen patchbot-unstable <=