diff -ru usr/src/nv/Makefile.kbuild usr/src/nv.1359015/Makefile.kbuild
--- usr/src/nv/Makefile.kbuild	2005-07-29 22:51:12.000000000 +0200
+++ usr/src/nv.1359015/Makefile.kbuild	2005-09-06 23:15:03.788036912 +0200
@@ -222,6 +222,10 @@
     EXTRA_CFLAGS += -DNV_VMAP_4_PRESENT
 endif
 
+ifeq ($(shell $(CONFTEST) supported_pte_mask), 1)
+  EXTRA_CFLAGS += -DNV_SUPPORTED_PTE_MASK_PRESENT
+endif
+
 #
 # Miscellaneous NVIDIA kernel module build support targets. They are needed
 # to satisfy KBUILD requirements and to support NVIDIA specifics.
diff -ru usr/src/nv/Makefile.nvidia usr/src/nv.1359015/Makefile.nvidia
--- usr/src/nv/Makefile.nvidia	2005-07-29 22:51:12.000000000 +0200
+++ usr/src/nv.1359015/Makefile.nvidia	2005-09-06 23:15:03.788036912 +0200
@@ -85,6 +85,10 @@
     DEFINES += -DNV_VMAP_4_PRESENT
 endif
 
+ifeq ($(shell $(CONFTEST) supported_pte_mask), 1)
+  EXTRA_CFLAGS += -DNV_SUPPORTED_PTE_MASK_PRESENT
+endif
+
 DEFINES+=$(EXTRA_DEFINES)
 
 # allow build parameters to be passed in through the environment
diff -ru usr/src/nv/conftest.sh usr/src/nv.1359015/conftest.sh
--- usr/src/nv/conftest.sh	2005-07-29 22:51:12.000000000 +0200
+++ usr/src/nv.1359015/conftest.sh	2005-09-06 23:15:03.789036760 +0200
@@ -537,7 +537,8 @@
 
     vmap_arg_count)
         #
-        # Determine, if vmap() is present, and how many arguments it takes
+        # Determine, if vmap() is present, and how many arguments
+        # it takes.
         #
 
         echo "#include <linux/vmalloc.h>
@@ -567,4 +568,30 @@
         else
             exit 1  # there ain't no vmap()
         fi
+    ;;
+
+    supported_pte_mask)
+        #
+        # Determine if the i386/x86_64 __supported_pte_mask symbol
+        # is available.
+        #
+
+        echo "#include <asm/pgtable.h>
+        #include <asm/page.h>
+        void nv___suported_pte_mask_test() {
+            pgprot_t prot = __pgprot(0);
+            pgprot_val(prot) &= __supported_pte_mask;
+        }" > conftest$$.c
+
+        $CC $CFLAGS -c conftest$$.c > /dev/null 2>&1
+        rm -f conftest$$.c
+
+        if [ -f conftest$$.o ]; then
+            rm -f conftest$$.o
+            echo 1
+        else
+            echo 0
+        fi
+    ;;
+
 esac
diff -ru usr/src/nv/nv-linux.h usr/src/nv.1359015/nv-linux.h
--- usr/src/nv/nv-linux.h	2005-07-29 22:51:12.000000000 +0200
+++ usr/src/nv.1359015/nv-linux.h	2005-09-06 23:16:43.998802560 +0200
@@ -980,7 +980,11 @@
         if (nv_use_cpa)
         {
             struct page *page = virt_to_page(__va(page_ptr->phys_addr));
-            change_page_attr(page, 1, PAGE_KERNEL_NOCACHE);
+            pgprot_t prot = PAGE_KERNEL_NOCACHE;
+#if defined(NV_SUPPORTED_PTE_MASK_PRESENT)
+            pgprot_val(prot) &= __supported_pte_mask;
+#endif
+            change_page_attr(page, 1, prot);
         }
     }
 static inline void NV_SET_PAGE_ATTRIB_CACHED(nv_pte_t *page_ptr)
@@ -988,7 +992,11 @@
         if (nv_use_cpa)
         {
             struct page *page = virt_to_page(__va(page_ptr->phys_addr));
-            change_page_attr(page, 1, PAGE_KERNEL);
+            pgprot_t prot = PAGE_KERNEL;
+#if defined(NV_SUPPORTED_PTE_MASK_PRESENT)
+            pgprot_val(prot) &= __supported_pte_mask;
+#endif
+            change_page_attr(page, 1, prot);
         }
     }
 #else
