From: Scott Parish Subject: [patch] double incrementing l2tab Date: Thu, 12 May 2005 21:06:03 +0000 Message-ID: <20050512210603.GB27910@us.ibm.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="kXdP64Ggrk/fb43R" Return-path: Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org --kXdP64Ggrk/fb43R Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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. sRp -- Scott Parish Signed-off-by: srparish@us.ibm.com --kXdP64Ggrk/fb43R Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="double-inc.diff" --- old-xen-unstable/xen/arch/x86/domain_build.c 2005-05-12 17:15:33.000000000 +0000 +++ new-xen-unstable/xen/arch/x86/domain_build.c 2005-05-12 20:47:02.000000000 +0000 @@ -330,7 +330,10 @@ int construct_dom0(struct domain *d, get_page(page, d); /* an extra ref because of readable mapping */ } if ( !((unsigned long)++l1tab & (PAGE_SIZE - 1)) ) - l1start = l1tab = (l1_pgentry_t *)l2e_get_phys(*++l2tab); + { + l2tab++; + l1start = l1tab = (l1_pgentry_t *)l2e_get_phys(*l2tab); + } } #elif defined(__x86_64__) --kXdP64Ggrk/fb43R Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --kXdP64Ggrk/fb43R--