From: "Scott Parish" <srparish@us.ibm.com>
To: Jan Beulich <JBeulich@novell.com>
Cc: xen-devel@lists.xensource.com, Scott Parish <srparish@us.ibm.com>
Subject: Re: [patch] unwanted sign extending
Date: Wed, 22 Jun 2005 11:20:29 +0000 [thread overview]
Message-ID: <20050622112029.GC16276@us.ibm.com> (raw)
In-Reply-To: <42B92BFA020000780001D082@lyle.provo.novell.com>
[-- Attachment #1: Type: text/plain, Size: 588 bytes --]
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
[-- Attachment #2: no-sign-extend-2.diff --]
[-- Type: text/plain, Size: 1641 bytes --]
--- 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) &&
[-- Attachment #3: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
prev parent reply other threads:[~2005-06-22 11:20 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-06-21 20:10 [patch] unwanted sign extending Scott Parish
2005-06-22 7:14 ` Jan Beulich
2005-06-22 11:20 ` Scott Parish [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20050622112029.GC16276@us.ibm.com \
--to=srparish@us.ibm.com \
--cc=JBeulich@novell.com \
--cc=xen-devel@lists.xensource.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.