# Calculate format=diff pkg(sys-kernel/calculate-sources)>=3.7&&pkg(sys-kernel/calculate-sources)<3.8&&merge(x11-drivers/nvidia-drivers)>=173&&merge(x11-drivers/nvidia-drivers)<174
diff --git a/usr/src/nv/conftest.sh b/usr/src/nv/conftest.sh
index 29012dd..4474130 100644
--- a/usr/src/nv/conftest.sh
+++ b/usr/src/nv/conftest.sh
@@ -20,6 +20,7 @@ ARCH=$3
 ISYSTEM=`$CC -print-file-name=include 2> /dev/null`
 SOURCES=$4
 HEADERS=$SOURCES/include
+HEADERSA=$SOURCES/include/uapi
 OUTPUT=$5
 XEN_PRESENT=1
 
@@ -118,7 +119,7 @@ build_cflags() {
         fi
     fi
 
-    CFLAGS="$CFLAGS $OUTPUT_CFLAGS -I$HEADERS $AUTOCONF_CFLAGS"
+    CFLAGS="$CFLAGS $OUTPUT_CFLAGS -I$HEADERS -I$HEADERSA $AUTOCONF_CFLAGS"
 
     test_xen
 
@@ -142,10 +143,10 @@ build_cflags() {
         fi
     fi
 
-    CFLAGS="$BASE_CFLAGS $MACH_CFLAGS $OUTPUT_CFLAGS -I$HEADERS $AUTOCONF_CFLAGS"
+    CFLAGS="$BASE_CFLAGS $MACH_CFLAGS $OUTPUT_CFLAGS -I$HEADERS -I$HEADERSA $AUTOCONF_CFLAGS"
 
     if [ "$ARCH" = "i386" -o "$ARCH" = "x86_64" ]; then
-        CFLAGS="$CFLAGS -I$SOURCES/arch/x86/include -I$OUTPUT/arch/x86/include/generated"
+        CFLAGS="$CFLAGS -I$SOURCES/arch/x86/include -I$SOURCES/arch/x86/include/uapi -I$OUTPUT/arch/x86/include/generated -I$OUTPUT/arch/x86/include/generated/uapi"
     fi
     if [ -n "$BUILD_PARAMS" ]; then
         CFLAGS="$CFLAGS -D$BUILD_PARAMS"
diff --git a/usr/src/nv/nv.c b/usr/src/nv/nv.c
index 538217e..73c7234 100644
--- a/usr/src/nv/nv.c
+++ b/usr/src/nv/nv.c
@@ -2609,7 +2609,7 @@ int nv_kern_mmap(
 
         /* prevent the swapper from swapping it out */
         /* mark the memory i/o so the buffers aren't dumped on core dumps */
-        vma->vm_flags |= (VM_IO | VM_LOCKED | VM_RESERVED);
+        vma->vm_flags |= (VM_IO | VM_LOCKED | (VM_DONTEXPAND | VM_DONTDUMP));
     }
 
     NV_VMA_FILE(vma) = file;
