From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Scott Parish" Subject: Re: [patch] unwanted sign extending Date: Wed, 22 Jun 2005 11:20:29 +0000 Message-ID: <20050622112029.GC16276@us.ibm.com> References: <20050621201030.GB16276@us.ibm.com> <42B92BFA020000780001D082@lyle.provo.novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="aM3YZ0Iwxop3KEKx" Return-path: Content-Disposition: inline In-Reply-To: <42B92BFA020000780001D082@lyle.provo.novell.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: Jan Beulich Cc: xen-devel@lists.xensource.com, Scott Parish List-Id: xen-devel@lists.xenproject.org --aM3YZ0Iwxop3KEKx Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Wed, Jun 22, 2005 at 01:14:34AM -0600, Jan Beulich wrote: > I'd think that for correctness this should also be done to > alloc_l2_table. And I also think that this is still wrong for 64 bits: > Shifting left an unsigned yields an unsigned, and since 'i' can range > from 0 to 511 and the shift count is 30, the result is going to be > truncated. That is, the code should be > > vaddr = (unsigned long)i << L3_PAGETABLE_SHIFT; > > (and again, for consistency it should also be done so in > alloc_l2_table). Good point sRp -- Scott Parish Signed-off-by: srparish@us.ibm.com --aM3YZ0Iwxop3KEKx Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="no-sign-extend-2.diff" --- old-xen-build/xen/arch/x86/mm.c 2005-06-14 15:55:34.000000000 +0000 +++ new-xen-build/xen/arch/x86/mm.c 2005-06-22 12:06:46.000000000 +0000 @@ -658,7 +658,7 @@ static int alloc_l1_table(struct pfn_inf struct domain *d = page_get_owner(page); unsigned long pfn = page_to_pfn(page); l1_pgentry_t *pl1e; - int i; + unsigned long i; ASSERT(!shadow_mode_refcounts(d)); @@ -687,7 +687,7 @@ static int create_pae_xen_mappings(l3_pg struct pfn_info *page; l2_pgentry_t *pl2e; l3_pgentry_t l3e3; - int i; + unsigned long i; pl3e = (l3_pgentry_t *)((unsigned long)pl3e & PAGE_MASK); @@ -762,7 +762,7 @@ static int alloc_l2_table(struct pfn_inf unsigned long pfn = page_to_pfn(page); unsigned long vaddr; l2_pgentry_t *pl2e; - int i; + unsigned long i; /* See the code in shadow_promote() to understand why this is here. */ if ( (PGT_base_page_table == PGT_l2_page_table) && @@ -814,7 +814,7 @@ static int alloc_l3_table(struct pfn_inf unsigned long pfn = page_to_pfn(page); unsigned long vaddr; l3_pgentry_t *pl3e; - int i; + unsigned long i; ASSERT(!shadow_mode_refcounts(d)); @@ -851,7 +851,7 @@ static int alloc_l4_table(struct pfn_inf struct domain *d = page_get_owner(page); unsigned long pfn = page_to_pfn(page); l4_pgentry_t *pl4e = page_to_virt(page); - int i; + unsigned long i; /* See the code in shadow_promote() to understand why this is here. */ if ( (PGT_base_page_table == PGT_l4_page_table) && --aM3YZ0Iwxop3KEKx 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 --aM3YZ0Iwxop3KEKx--