Skip to content

Commit 3a366f7

Browse files
kirylIngo Molnar
authored andcommitted
x86/mm/dump_pagetables: Generalize address normalization
Modify normalize_addr to handle different sizes of virtual address space. It's preparation for enabling 5-level paging. Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Andy Lutomirski <luto@amacapital.net> Cc: Dave Hansen <dave.hansen@intel.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: linux-arch@vger.kernel.org Cc: linux-mm@kvack.org Link: http://lkml.kernel.org/r/20170716225954.74185-2-kirill.shutemov@linux.intel.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
1 parent 693bf0a commit 3a366f7

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

arch/x86/mm/dump_pagetables.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -188,11 +188,12 @@ static void printk_prot(struct seq_file *m, pgprot_t prot, int level, bool dmsg)
188188
*/
189189
static unsigned long normalize_addr(unsigned long u)
190190
{
191-
#ifdef CONFIG_X86_64
192-
return (signed long)(u << 16) >> 16;
193-
#else
194-
return u;
195-
#endif
191+
int shift;
192+
if (!IS_ENABLED(CONFIG_X86_64))
193+
return u;
194+
195+
shift = 64 - (__VIRTUAL_MASK_SHIFT + 1);
196+
return (signed long)(u << shift) >> shift;
196197
}
197198

198199
/*

0 commit comments

Comments
 (0)