>From 7aec2ffc14516de513538bead07c41e5f9f7d73e Mon Sep 17 00:00:00 2001
From: HATAYAMA Daisuke <d.hatayama@jp.fujitsu.com>
Date: Thu, 28 Apr 2011 07:46:44 +0900
Subject: [PATCH 2/5] x86_64: Add _PAGE_PROTNONE check

_PAGE_PROTNONE collides with _PAGE_PSE on earlier than 2.6.28 but this is no
problem because hugepages on those kernels are never swapped out.
---
 x86_64.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/x86_64.c b/x86_64.c
index ba73cf9..1a442a8 100755
--- a/x86_64.c
+++ b/x86_64.c
@@ -1288,7 +1288,7 @@ x86_64_uvtop_level4(struct task_context *tc, ulong uvaddr, physaddr_t *paddr, in
 	pmd_pte = ULONG(machdep->pmd + PAGEOFFSET(pmd));
         if (verbose) 
                 fprintf(fp, "   PMD: %lx => %lx\n", (ulong)pmd, pmd_pte);
-	if (!(pmd_pte & _PAGE_PRESENT))
+	if (!(pmd_pte & (_PAGE_PRESENT | _PAGE_PROTNONE)))
 		goto no_upage;
         if (pmd_pte & _PAGE_PSE) {
                 if (verbose) {
@@ -2083,7 +2083,7 @@ x86_64_translate_pte(ulong pte, void *physaddr, ulonglong unused)
 	int page_present;
 
         paddr = pte & PHYSICAL_PAGE_MASK;
-        page_present = pte & _PAGE_PRESENT;
+        page_present = pte & (_PAGE_PRESENT | _PAGE_PROTNONE);
 
         if (physaddr) {
 		*((ulong *)physaddr) = paddr;
-- 
1.7.4.4

