summaryrefslogtreecommitdiff
path: root/arch/sh/include/asm/pgtable.h
diff options
context:
space:
mode:
authorPaul Mundt <lethal@linux-sh.org>2009-08-04 17:14:39 +0900
committerPaul Mundt <lethal@linux-sh.org>2009-08-04 17:14:39 +0900
commitc7914834ef3b8a396b7e82ea34ac07cdcfe6f868 (patch)
tree59f6f76dfca96cd7ad330ae3c281cfa57e98f44e /arch/sh/include/asm/pgtable.h
parentc0fe478dbb14fd32e71d1383dbe302b54ce94134 (diff)
sh: Tidy up NEFF-based sign extension for SH-5.
This consolidates all of the NEFF-based sign extension for SH-5. In the future the other SH code will need to make use of this as well, so make it generic in preparation for more 32/64 consolidation. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/sh/include/asm/pgtable.h')
-rw-r--r--arch/sh/include/asm/pgtable.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/arch/sh/include/asm/pgtable.h b/arch/sh/include/asm/pgtable.h
index 43ef3e99fdd1..3cd7127af957 100644
--- a/arch/sh/include/asm/pgtable.h
+++ b/arch/sh/include/asm/pgtable.h
@@ -36,6 +36,12 @@ extern unsigned long empty_zero_page[PAGE_SIZE / sizeof(unsigned long)];
#define NEFF_SIGN (1LL << (NEFF - 1))
#define NEFF_MASK (-1LL << NEFF)
+static inline unsigned long long neff_sign_extend(unsigned long val)
+{
+ unsigned long long extended = val;
+ return (extended & NEFF_SIGN) ? (extended | NEFF_MASK) : extended;
+}
+
#ifdef CONFIG_29BIT
#define NPHYS 29
#else