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

Re: [Xen-devel] [patch] double incrementing l2tab

To: Scott Parish <srparish@xxxxxxxxxx>
Subject: Re: [Xen-devel] [patch] double incrementing l2tab
From: Keir Fraser <Keir.Fraser@xxxxxxxxxxxx>
Date: Fri, 13 May 2005 09:08:02 +0100
Cc: xen-devel@xxxxxxxxxxxxxxxxxxx
Delivery-date: Fri, 13 May 2005 08:10:20 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <20050512210603.GB27910@xxxxxxxxxx>
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>
References: <20050512210603.GB27910@xxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx

On 12 May 2005, at 22:06, Scott Parish wrote:

For PAE, l2e_get_phys() will look something like this:

#define l2e_get_phys(_x) ((((u64)(_x).l2_hi & 0x0f) << 32) |\
                                      ((u64)(_x).l2_lo & PAGE_MASK))

Thus l2e_get_phys(++foo) is not safe, as the increment will be evaluated
multiple times and at undefined times.

This leaves the macro to bite you in future. Either make l2e_get_phys() a static inline function, or do something like:

#define l2e_get_phys(_x) ({ \
    u64 __x = (_x); \
    <your macro here but _x -> __x>; \
})

 -- Keir


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

<Prev in Thread] Current Thread [Next in Thread>