[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20080116154710.GA28946@elte.hu>
Date: Wed, 16 Jan 2008 16:47:10 +0100
From: Ingo Molnar <mingo@...e.hu>
To: Jan Beulich <jbeulich@...ell.com>
Cc: Andi Kleen <ak@...e.de>,
Glauber de Oliveira Costa <glommer@...il.com>,
Jeremy Fitzhardinge <jeremy@...p.org>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 0 of 4] x86: some more patches
* Jan Beulich <jbeulich@...ell.com> wrote:
> > Yes, but if you cast to long the result will be 32bit again. Or do
> > you rely on it being always used in 64bit signed context with sign
> > extension? While that might work it would seem rather fragile to me,
> > just asking for similar future bugs.
>
> Even if conversion is to 64-bit unsigned, the value (being signed)
> will be sign-extended first (to preserve its value modulo 2**<target
> type width>).
yes. It would be nice if Andi could test my fix instead of arguing why
he thinks it's unlikely to work ;-)
(i've got the cleanup patch below as well ontop of today's x86.git which
includes the first fix, but it's an RFC as it has wider impact and might
break stuff.)
Ingo
--------------->
Subject: x86: PAGE_MASK cleanup
From: Ingo Molnar <mingo@...e.hu>
Signed-off-by: Ingo Molnar <mingo@...e.hu>
---
include/asm-x86/page.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
Index: linux-x86.q/include/asm-x86/page.h
===================================================================
--- linux-x86.q.orig/include/asm-x86/page.h
+++ linux-x86.q/include/asm-x86/page.h
@@ -6,12 +6,12 @@
/* PAGE_SHIFT determines the page size */
#define PAGE_SHIFT 12
#define PAGE_SIZE (_AC(1,UL) << PAGE_SHIFT)
-#define PAGE_MASK (~(PAGE_SIZE-1))
+#define PAGE_MASK (_AT(phys_addr_t, ~(PAGE_SIZE-1)))
#ifdef __KERNEL__
#define PHYSICAL_PAGE_MASK (PAGE_MASK & __PHYSICAL_MASK)
-#define PTE_MASK (_AT(long, PHYSICAL_PAGE_MASK))
+#define PTE_MASK PHYSICAL_PAGE_MASK
#define LARGE_PAGE_SIZE (_AC(1,UL) << PMD_SHIFT)
#define LARGE_PAGE_MASK (~(LARGE_PAGE_SIZE-1))
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists