From: Keir Fraser Subject: Re: [patch] double incrementing l2tab Date: Fri, 13 May 2005 09:08:02 +0100 Message-ID: <76efd3d3dc1966c89a41ec2632ace561@cl.cam.ac.uk> References: <20050512210603.GB27910@us.ibm.com> Mime-Version: 1.0 (Apple Message framework v622) Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20050512210603.GB27910@us.ibm.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Scott Parish Cc: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org 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); \ __x>; \ }) -- Keir