summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Huddleston <eradicator@gentoo.org>2005-10-28 07:13:00 +0000
committerJeremy Huddleston <eradicator@gentoo.org>2005-10-28 07:13:00 +0000
commit0b7ffa8687b0ef5eecd289d98c337d2b07e8a6bf (patch)
tree0943380badc7e5e285715ffb970fee73e8148c51 /media-video/nvidia-kernel
parentNew version (diff)
downloadhistorical-0b7ffa8687b0ef5eecd289d98c337d2b07e8a6bf.tar.gz
historical-0b7ffa8687b0ef5eecd289d98c337d2b07e8a6bf.tar.bz2
historical-0b7ffa8687b0ef5eecd289d98c337d2b07e8a6bf.zip
Patches for some amd64 issues from upstream.
Package-Manager: portage-2.0.53_rc6
Diffstat (limited to 'media-video/nvidia-kernel')
-rw-r--r--media-video/nvidia-kernel/ChangeLog13
-rw-r--r--media-video/nvidia-kernel/Manifest71
-rw-r--r--media-video/nvidia-kernel/files/1.0.7676/NVIDIA_kernel-1.0-7676-1321905.diff24
-rw-r--r--media-video/nvidia-kernel/files/1.0.7676/NVIDIA_kernel-1.0-7676-1359015.diff101
-rw-r--r--media-video/nvidia-kernel/files/1.0.7676/NVIDIA_kernel-1.0-7676-1361053.diff98
-rw-r--r--media-video/nvidia-kernel/files/1.0.7676/NVIDIA_kernel-1.0-7676-1386866.diff72
-rw-r--r--media-video/nvidia-kernel/files/1.0.7676/NVIDIA_kernel-1.0-7676-1392404.diff58
-rw-r--r--media-video/nvidia-kernel/files/digest-nvidia-kernel-1.0.7676-r12
-rw-r--r--media-video/nvidia-kernel/nvidia-kernel-1.0.7676-r1.ebuild145
9 files changed, 556 insertions, 28 deletions
diff --git a/media-video/nvidia-kernel/ChangeLog b/media-video/nvidia-kernel/ChangeLog
index be1098c1cc5b..4bb1aa1673db 100644
--- a/media-video/nvidia-kernel/ChangeLog
+++ b/media-video/nvidia-kernel/ChangeLog
@@ -1,6 +1,17 @@
# ChangeLog for media-video/nvidia-kernel
# Copyright 2002-2005 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/media-video/nvidia-kernel/ChangeLog,v 1.121 2005/08/15 03:50:09 augustus Exp $
+# $Header: /var/cvsroot/gentoo-x86/media-video/nvidia-kernel/ChangeLog,v 1.122 2005/10/28 07:13:00 eradicator Exp $
+
+*nvidia-kernel-1.0.7676-r1 (28 Oct 2005)
+
+ 28 Oct 2005; Jeremy Huddleston <eradicator@gentoo.org>
+ +files/1.0.7676/NVIDIA_kernel-1.0-7676-1321905.diff,
+ +files/1.0.7676/NVIDIA_kernel-1.0-7676-1359015.diff,
+ +files/1.0.7676/NVIDIA_kernel-1.0-7676-1361053.diff,
+ +files/1.0.7676/NVIDIA_kernel-1.0-7676-1386866.diff,
+ +files/1.0.7676/NVIDIA_kernel-1.0-7676-1392404.diff,
+ +nvidia-kernel-1.0.7676-r1.ebuild:
+ Patches for some amd64 issues from upstream.
*nvidia-kernel-1.0.7676 (15 Aug 2005)
diff --git a/media-video/nvidia-kernel/Manifest b/media-video/nvidia-kernel/Manifest
index 6b8c61758cc6..0801703344da 100644
--- a/media-video/nvidia-kernel/Manifest
+++ b/media-video/nvidia-kernel/Manifest
@@ -1,42 +1,31 @@
-MD5 e728e6c122edde2faae03bed1404bb8f ChangeLog 31079
-MD5 075fe48a4f1fc90d2c3814e7bcd1d1ab metadata.xml 313
-MD5 bb1452c4b0662d0852e6a817b1058819 nvidia-kernel-1.0.7676.ebuild 4520
-MD5 cde8131d8df1e65490d7de0923721b8a nvidia-kernel-1.0.6629-r4.ebuild 4571
-MD5 31dc5b8d10b1e9dc8bff64fd56fd642a nvidia-kernel-1.0.6111-r3.ebuild 4494
-MD5 e4bd52644954f799ac186b4ad070d4dc nvidia-kernel-1.0.7167-r1.ebuild 3953
-MD5 4005c9a8094dcdfcba1fdec1fc2dfd9d nvidia-kernel-1.0.7174.ebuild 3991
-MD5 6aba502097ccdfa8ae9697ecfbb42383 nvidia-kernel-1.0.7667.ebuild 4507
-MD5 d8fcf2021aa68584d4a4d9e96b671da0 files/nvidia 501
-MD5 4ea42a34abde5c81fe828b09afab7651 files/digest-nvidia-kernel-1.0.7676 163
-MD5 8a4687b0fc3e7cc0b36c247697d94701 files/digest-nvidia-kernel-1.0.6629-r4 163
-MD5 ed1e098d85579c75542ef0a49ee4dd5c files/digest-nvidia-kernel-1.0.6111-r3 163
-MD5 97b3ec5488fb7f7f6cdde31ee42e45af files/digest-nvidia-kernel-1.0.7167-r1 163
-MD5 61c3ebdd8604c971bf969ea03040d170 files/digest-nvidia-kernel-1.0.7174 163
-MD5 ef2c4ecedb45b67d79b43ffe58c660cf files/digest-nvidia-kernel-1.0.7667 163
-MD5 29eafcaf7ab5d59dd90d3d3243bf57c3 files/1.0.6111/nv_enable_pci.patch 3640
-MD5 14924b09123b075f910c73316baff848 files/1.0.6111/power-suspend-2.6.9-changes.patch 856
+-----BEGIN PGP SIGNED MESSAGE-----
+Hash: SHA1
+
+MD5 feb6391ece9afa87e4d19534b1ccb996 ChangeLog 31540
+MD5 b5b7f947ffb9e6c19f7457ff7c14d0db files/1.0.6111/conftest_koutput_includes.patch 1082
MD5 762e6f6e16aa6dd5b2469e99fe8decd3 files/1.0.6111/nv-pci_find_class.patch 2903
MD5 c2b155f40d7b904f07550e8e326969c2 files/1.0.6111/nv-remap-range.patch 5715
+MD5 29eafcaf7ab5d59dd90d3d3243bf57c3 files/1.0.6111/nv_enable_pci.patch 3640
+MD5 14924b09123b075f910c73316baff848 files/1.0.6111/power-suspend-2.6.9-changes.patch 856
MD5 5177339888e44bb5f4b6124fa5830e7f files/1.0.6111/vmalloc-reserve.patch 542
-MD5 b5b7f947ffb9e6c19f7457ff7c14d0db files/1.0.6111/conftest_koutput_includes.patch 1082
-MD5 dbf80a2cbaf69a10521429e1b2a7e10c files/1.0.6629/conftest_koutput_includes.patch 1082
-MD5 5aef5c6a394896bbb8392816f6795147 files/1.0.6629/nv-amd64-shutup-warnings.patch 902
-MD5 c039797780f78262baa02ff488e822ff files/1.0.6629/nv-disable-preempt-on-smp_processor_id.patch 435
-MD5 e70739410861defb6bf3d40f2706d554 files/1.0.6629/nv-pgd_offset.patch 3139
-MD5 0009ccc8f3896f22bad06fd549639072 files/1.0.6629/nv-pgprot-speedup.patch 1518
-MD5 64d76075a90dedc83f1dc971389c910e files/1.0.6629/nv-shutup-warnings.patch 712
-MD5 7c9db721d244f6ca709e2b8003ce4e0d files/1.0.6629/nv-vm_flags-no-VM_LOCKED.patch 677
-MD5 ddeae194df6bb2112d7de723df8d84c2 files/1.0.6629/nv-fix-memory-limit.patch 18398
MD5 0009ccc8f3896f22bad06fd549639072 files/1.0.6629/NVIDIA_kernel-1.0-6629-1155389.patch 1518
MD5 ddeae194df6bb2112d7de723df8d84c2 files/1.0.6629/NVIDIA_kernel-1.0-6629-1161283.patch 18398
MD5 5a17c3fa427b4d0ff8e38f82e57cd817 files/1.0.6629/NVIDIA_kernel-1.0-6629-1162524.patch 9417
MD5 ada7d22def202e56c01c1e72c8000d45 files/1.0.6629/NVIDIA_kernel-1.0-6629-1165235.patch 581
MD5 f1a5a01593ef996b38fe70bc93fa7440 files/1.0.6629/NVIDIA_kernel-1.0-6629-1171869.patch 2160
MD5 59c5fa8340585303cd18362bbeb0086f files/1.0.6629/NVIDIA_kernel-1.0-6629-1175225.patch 1877
-MD5 e210d99cae87c3f60120ea474b97fca7 files/1.0.6629/NVIDIA_kernel-1.0-6629-1189413.patch 8072
MD5 d4e8ffdb0cc67c56884e6055d2045e51 files/1.0.6629/NVIDIA_kernel-1.0-6629-1182399.patch 2608
+MD5 e210d99cae87c3f60120ea474b97fca7 files/1.0.6629/NVIDIA_kernel-1.0-6629-1189413.patch 8072
MD5 da7644fcc801d40c26fb22b570a88835 files/1.0.6629/NVIDIA_kernel-1.0-6629-1201042.diff 9445
MD5 bca6ad85efa6071a949bdcb24fce1733 files/1.0.6629/NVIDIA_kernel-1.0-6629-agp_bridge_data.patch 7860
+MD5 dbf80a2cbaf69a10521429e1b2a7e10c files/1.0.6629/conftest_koutput_includes.patch 1082
+MD5 5aef5c6a394896bbb8392816f6795147 files/1.0.6629/nv-amd64-shutup-warnings.patch 902
+MD5 c039797780f78262baa02ff488e822ff files/1.0.6629/nv-disable-preempt-on-smp_processor_id.patch 435
+MD5 ddeae194df6bb2112d7de723df8d84c2 files/1.0.6629/nv-fix-memory-limit.patch 18398
+MD5 e70739410861defb6bf3d40f2706d554 files/1.0.6629/nv-pgd_offset.patch 3139
+MD5 0009ccc8f3896f22bad06fd549639072 files/1.0.6629/nv-pgprot-speedup.patch 1518
+MD5 64d76075a90dedc83f1dc971389c910e files/1.0.6629/nv-shutup-warnings.patch 712
+MD5 7c9db721d244f6ca709e2b8003ce4e0d files/1.0.6629/nv-vm_flags-no-VM_LOCKED.patch 677
MD5 70bb10b2da2423a6be2a4c2bce38d807 files/1.0.7167/NVIDIA_kernel-1.0-7167-1233959.patch 490
MD5 e2625e9e0a6679c38783b5d8985fdaf6 files/1.0.7167/NVIDIA_kernel-1.0-7167-1237815.patch 1100
MD5 82d99e72fddbc1b0447708afd84dc8c5 files/1.0.7167/NVIDIA_kernel-1.0-7167-amd64-shutup-warnings.patch 770
@@ -44,3 +33,31 @@ MD5 7ae487fba8a81fb91d53f35b9066512f files/1.0.7167/NVIDIA_kernel-1.0-7167-conft
MD5 9df3fbed7af6fcb4ad13b1b5c3851381 files/1.0.7167/NVIDIA_kernel-1.0-7167-disable-preempt-on-smp_processor_id.patch 419
MD5 6c6bd7d2e4589cf3f4725082bb413a43 files/1.0.7167/NVIDIA_kernel-1.0-7167-x86-shutup-warnings.patch 742
MD5 e1718c0414288a04c27b70a124947613 files/1.0.7667/NVIDIA_kernel-1.0-7667-KERNEL_VERSION-moved.patch 1764
+MD5 99b630e5a1d4b732e930781f25187194 files/1.0.7676/NVIDIA_kernel-1.0-7676-1321905.diff 1047
+MD5 c0495ec827a938afcb807dd618e03945 files/1.0.7676/NVIDIA_kernel-1.0-7676-1359015.diff 3294
+MD5 5125c6d55ae72122144771ef1697db53 files/1.0.7676/NVIDIA_kernel-1.0-7676-1361053.diff 2989
+MD5 196649a84a2396a6588f27457a39d1fa files/1.0.7676/NVIDIA_kernel-1.0-7676-1386866.diff 2491
+MD5 5eaf8c4597d2f0b2670caa1303b2a4bc files/1.0.7676/NVIDIA_kernel-1.0-7676-1392404.diff 2359
+MD5 ed1e098d85579c75542ef0a49ee4dd5c files/digest-nvidia-kernel-1.0.6111-r3 163
+MD5 8a4687b0fc3e7cc0b36c247697d94701 files/digest-nvidia-kernel-1.0.6629-r4 163
+MD5 97b3ec5488fb7f7f6cdde31ee42e45af files/digest-nvidia-kernel-1.0.7167-r1 163
+MD5 61c3ebdd8604c971bf969ea03040d170 files/digest-nvidia-kernel-1.0.7174 163
+MD5 ef2c4ecedb45b67d79b43ffe58c660cf files/digest-nvidia-kernel-1.0.7667 163
+MD5 4ea42a34abde5c81fe828b09afab7651 files/digest-nvidia-kernel-1.0.7676 163
+MD5 4ea42a34abde5c81fe828b09afab7651 files/digest-nvidia-kernel-1.0.7676-r1 163
+MD5 d8fcf2021aa68584d4a4d9e96b671da0 files/nvidia 501
+MD5 075fe48a4f1fc90d2c3814e7bcd1d1ab metadata.xml 313
+MD5 31dc5b8d10b1e9dc8bff64fd56fd642a nvidia-kernel-1.0.6111-r3.ebuild 4494
+MD5 cde8131d8df1e65490d7de0923721b8a nvidia-kernel-1.0.6629-r4.ebuild 4571
+MD5 e4bd52644954f799ac186b4ad070d4dc nvidia-kernel-1.0.7167-r1.ebuild 3953
+MD5 4005c9a8094dcdfcba1fdec1fc2dfd9d nvidia-kernel-1.0.7174.ebuild 3991
+MD5 6aba502097ccdfa8ae9697ecfbb42383 nvidia-kernel-1.0.7667.ebuild 4507
+MD5 731d9029e10a2cc3667dcb12b80be70c nvidia-kernel-1.0.7676-r1.ebuild 4642
+MD5 bb1452c4b0662d0852e6a817b1058819 nvidia-kernel-1.0.7676.ebuild 4520
+-----BEGIN PGP SIGNATURE-----
+Version: GnuPG v1.4.2 (GNU/Linux)
+
+iD8DBQFDYc+HOpjtAl+gMRURAiEXAJ0WkUx0YJk+7OMxId8FuSVq+mpBjwCfSO9p
+Xu3W3JFcw6JvdShTk+ZVBmM=
+=VVYh
+-----END PGP SIGNATURE-----
diff --git a/media-video/nvidia-kernel/files/1.0.7676/NVIDIA_kernel-1.0-7676-1321905.diff b/media-video/nvidia-kernel/files/1.0.7676/NVIDIA_kernel-1.0-7676-1321905.diff
new file mode 100644
index 000000000000..4e592a950f1f
--- /dev/null
+++ b/media-video/nvidia-kernel/files/1.0.7676/NVIDIA_kernel-1.0-7676-1321905.diff
@@ -0,0 +1,24 @@
+diff -ru usr/src/nv/nv-vm.c usr/src/nv.1321905/nv-vm.c
+--- usr/src/nv/nv-vm.c 2005-07-29 22:30:43.000000000 +0200
++++ usr/src/nv.1321905/nv-vm.c 2005-09-29 20:08:12.186906704 +0200
+@@ -248,6 +248,20 @@
+ /* lock the page for dma purposes */
+ SetPageReserved(NV_GET_PAGE_STRUCT(phys_addr));
+
++#if defined(_PAGE_NX)
++ if ((_PAGE_NX & pgprot_val(PAGE_KERNEL)) != 0 && phys_addr < 0x400000) {
++ // Until a bug in change_page_attr() is fixed
++ // we avoid pages with physaddr < 0x400000,
++ // since splitting "jumbo" mappings results
++ // in kernel pages being mapped as PAGE_KERNEL, which
++ // may include _PAGE_NX, effectively making much of the
++ // kernel code non-executable.
++ nv_printf(NV_DBG_MEMINFO, "NVRM: nv_vm_malloc discarding page @%08x\n", phys_addr);
++ --i;
++ continue;
++ }
++#endif
++
+ page_ptr = at->page_table[i];
+ page_ptr->phys_addr = phys_addr;
+ page_ptr->virt_addr = virt_addr;
diff --git a/media-video/nvidia-kernel/files/1.0.7676/NVIDIA_kernel-1.0-7676-1359015.diff b/media-video/nvidia-kernel/files/1.0.7676/NVIDIA_kernel-1.0-7676-1359015.diff
new file mode 100644
index 000000000000..61e0c9a1a250
--- /dev/null
+++ b/media-video/nvidia-kernel/files/1.0.7676/NVIDIA_kernel-1.0-7676-1359015.diff
@@ -0,0 +1,101 @@
+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
diff --git a/media-video/nvidia-kernel/files/1.0.7676/NVIDIA_kernel-1.0-7676-1361053.diff b/media-video/nvidia-kernel/files/1.0.7676/NVIDIA_kernel-1.0-7676-1361053.diff
new file mode 100644
index 000000000000..bcb3d85b1809
--- /dev/null
+++ b/media-video/nvidia-kernel/files/1.0.7676/NVIDIA_kernel-1.0-7676-1361053.diff
@@ -0,0 +1,98 @@
+diff -ru usr/src/nv/nv-linux.h usr/src/nv.1361053/nv-linux.h
+--- usr/src/nv/nv-linux.h 2005-07-29 22:51:12.000000000 +0200
++++ usr/src/nv.1361053/nv-linux.h 2005-10-11 18:57:16.781700696 +0200
+@@ -973,6 +973,36 @@
+ #define NV_CHANGE_PAGE_ATTR_BUG_PRESENT 1
+ #endif
+
++#if defined(NVCPU_X86) || defined(NVCPU_X86_64)
++/*
++ * On Linux/x86-64 (and recent Linux/x86) kernels, the PAGE_KERNEL
++ * and PAGE_KERNEL_NOCACHE protection bit masks include _PAGE_NX
++ * to indicate that the no-execute protection page feature is used
++ * for the page in question.
++ *
++ * We need to be careful to mask out _PAGE_NX when the host system
++ * doesn't support this feature or when it's disabled: the kernel
++ * may not do this in its implementation of the change_page_attr()
++ * interface.
++ */
++#ifndef X86_FEATURE_NX
++#define X86_FEATURE_NX (1*32+20)
++#endif
++#ifndef boot_cpu_has
++#define boot_cpu_has(x) test_bit(x, boot_cpu_data.x86_capability)
++#endif
++#ifndef MSR_EFER
++#define MSR_EFER 0xc0000080
++#endif
++#ifndef EFER_NX
++#define EFER_NX (1 << 11)
++#endif
++#ifndef _PAGE_NX
++#define _PAGE_NX ((NvU64)1 << 63)
++#endif
++extern NvU64 __nv_supported_pte_mask;
++#endif
++
+ #if defined(NV_CHANGE_PAGE_ATTR_PRESENT)
+ extern int nv_use_cpa;
+ static inline void NV_SET_PAGE_ATTRIB_UNCACHED(nv_pte_t *page_ptr)
+@@ -980,15 +1010,23 @@
+ 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(NVCPU_X86) || defined(NVCPU_X86_64)
++ pgprot_val(prot) &= __nv_supported_pte_mask;
++#endif
++ change_page_attr(page, 1, prot);
+ }
+ }
+ static inline void NV_SET_PAGE_ATTRIB_CACHED(nv_pte_t *page_ptr)
+ {
+ if (nv_use_cpa)
+ {
+- struct page *page = virt_to_page(__va(page_ptr->phys_addr));
+- change_page_attr(page, 1, PAGE_KERNEL);
++ struct page *page = virt_to_page(__va(page_ptr->phys_addr));
++ pgprot_t prot = PAGE_KERNEL;
++#if defined(NVCPU_X86) || defined(NVCPU_X86_64)
++ pgprot_val(prot) &= __nv_supported_pte_mask;
++#endif
++ change_page_attr(page, 1, prot);
+ }
+ }
+ #else
+diff -ru usr/src/nv/nv.c usr/src/nv.1361053/nv.c
+--- usr/src/nv/nv.c 2005-07-29 22:51:11.000000000 +0200
++++ usr/src/nv.1361053/nv.c 2005-10-11 18:58:08.578826336 +0200
+@@ -38,6 +38,10 @@
+ static int nv_disable_pat = 0;
+ NV_MODULE_PARAMETER(nv_disable_pat);
+
++#if defined(NVCPU_X86) || defined(NVCPU_X86_64)
++NvU64 __nv_supported_pte_mask = ~_PAGE_NX;
++#endif
++
+ /*
+ * And one for the control device
+ */
+@@ -1158,6 +1162,16 @@
+ __nv_enable_pat_support();
+ }
+ #endif
++
++#if defined(NVCPU_X86_64) || (defined(NVCPU_X86) && defined(CONFIG_X86_PAE))
++ if (boot_cpu_has(X86_FEATURE_NX))
++ {
++ U032 __eax, __edx;
++ rdmsr(MSR_EFER, __eax, __edx);
++ if ((__eax & EFER_NX) != 0)
++ __nv_supported_pte_mask |= _PAGE_NX;
++ }
++#endif
+
+ return 0;
+
diff --git a/media-video/nvidia-kernel/files/1.0.7676/NVIDIA_kernel-1.0-7676-1386866.diff b/media-video/nvidia-kernel/files/1.0.7676/NVIDIA_kernel-1.0-7676-1386866.diff
new file mode 100644
index 000000000000..7161b1b388a2
--- /dev/null
+++ b/media-video/nvidia-kernel/files/1.0.7676/NVIDIA_kernel-1.0-7676-1386866.diff
@@ -0,0 +1,72 @@
+diff -ru usr/src/nv/nv-vm.c usr/src/nv.1386866/nv-vm.c
+--- usr/src/nv/nv-vm.c 2005-07-29 22:51:11.000000000 +0200
++++ usr/src/nv.1386866/nv-vm.c 2005-10-11 19:34:36.222253984 +0200
+@@ -58,26 +58,57 @@
+ * conflicts. we try to rely on the kernel's provided interfaces when possible,
+ * but need additional flushing on earlier kernels.
+ */
+-#if defined(KERNEL_2_4)
+-/* wrap CACHE_FLUSH so we can pass it to smp_call_function */
+-static void cache_flush(void *p)
+-{
+- CACHE_FLUSH();
+-}
+-#endif
+-
+ /*
+ * 2.4 kernels handle flushing in the change_page_attr() call, but kernels
+ * earlier than 2.4.27 don't flush on cpus that support Self Snoop, so we
+ * manually flush on these kernels (actually, we go ahead and flush on all
+ * 2.4 kernels, as it's possible some others may be missing this fix and
+ * we'd prefer to be a little slower flushing caches than hanging the
+- * system. 2.6 kernels split the flushing out to a seperate call,
+- * global_flush_tlb(), so we rely on that.
++ * system.
++ * 2.6 kernels split the flushing out to a seperate call,
++ * global_flush_tlb(), so we rely on that. however, there are some 2.6
++ * x86_64 kernels that do not properly flush. for now, we'll flush on all
++ * potential kernels, as it's slightly slower, but safer.
+ */
++#if defined(KERNEL_2_4) || (defined(KERNEL_2_6) && defined(NVCPU_X86_64))
++#define NV_CPA_NEEDS_FLUSHING 1
++#endif
++
++#if defined(NV_CPA_NEEDS_FLUSHING)
++static void cache_flush(void *p)
++{
++ unsigned long reg0, reg1;
++
++ CACHE_FLUSH();
++
++ // flush global TLBs
++#if defined (NVCPU_X86)
++ asm volatile("movl %%cr4, %0; \n"
++ "andl $~0x80, %0; \n"
++ "movl %0, %%cr4; \n"
++ "movl %%cr3, %1; \n"
++ "movl %1, %%cr3; \n"
++ "orl $0x80, %0; \n"
++ "movl %0, %%cr4; \n"
++ : "=&r" (reg0), "=&r" (reg1)
++ : : "memory");
++#else
++ asm volatile("movq %%cr4, %0; \n"
++ "andq $~0x80, %0; \n"
++ "movq %0, %%cr4; \n"
++ "movq %%cr3, %1; \n"
++ "movq %1, %%cr3; \n"
++ "orq $0x80, %0; \n"
++ "movq %0, %%cr4; \n"
++ : "=&r" (reg0), "=&r" (reg1)
++ : : "memory");
++#endif
++}
++#endif
++
+ static void nv_flush_caches(void)
+ {
+-#if defined(KERNEL_2_4)
++#if defined(NV_CPA_NEEDS_FLUSHING)
+ #ifdef CONFIG_SMP
+ smp_call_function(cache_flush, NULL, 1, 1);
+ #endif
diff --git a/media-video/nvidia-kernel/files/1.0.7676/NVIDIA_kernel-1.0-7676-1392404.diff b/media-video/nvidia-kernel/files/1.0.7676/NVIDIA_kernel-1.0-7676-1392404.diff
new file mode 100644
index 000000000000..54d653d0afa3
--- /dev/null
+++ b/media-video/nvidia-kernel/files/1.0.7676/NVIDIA_kernel-1.0-7676-1392404.diff
@@ -0,0 +1,58 @@
+diff -ru usr/src/nv/nv-vm.c usr/src/nv.1392404/nv-vm.c
+--- usr/src/nv/nv-vm.c 2005-07-29 22:51:11.000000000 +0200
++++ usr/src/nv.1392404/nv-vm.c 2005-10-18 23:25:09.868215136 +0200
+@@ -261,10 +261,14 @@
+ {
+ nv_printf(NV_DBG_ERRORS,
+ "NVRM: VM: nv_vm_malloc_pages: failed to sg map pages\n");
++ NV_UNLOCK_PAGE(page_ptr);
++ if (!NV_ALLOC_MAPPING_VMALLOC(at->flags))
++ NV_FREE_PAGES(virt_addr, 0);
++ i--;
+ goto failed;
+ }
+ }
+- nv_sg_load(&at->page_table[i]->sg_list, page_ptr);
++ nv_sg_load(&page_ptr->sg_list, page_ptr);
+
+ if (NV_ALLOC_MAPPING_VMAP(at->flags))
+ pages[i] = NV_GET_PAGE_STRUCT(page_ptr->phys_addr);
+@@ -303,9 +307,9 @@
+
+ failed:
+
+- for (j = 0; j <= i; j++)
++ for (j = 1; j <= (i+1); j++)
+ {
+- page_ptr = at->page_table[j];
++ page_ptr = at->page_table[j-1];
+
+ // if we failed when allocating this page, skip over it
+ // but if we failed pci_map_sg, make sure to free this page
+@@ -316,7 +320,7 @@
+ NV_SET_PAGE_ATTRIB_CACHED(page_ptr);
+ #if defined(NV_SG_MAP_BUFFERS)
+ if (!NV_ALLOC_MAPPING_CONTIG(at->flags))
+- nv_sg_unmap_buffer(dev, &at->page_table[j]->sg_list, page_ptr);
++ nv_sg_unmap_buffer(dev, &page_ptr->sg_list, page_ptr);
+ #endif
+ if (!NV_ALLOC_MAPPING_CONTIG(at->flags) && !NV_ALLOC_MAPPING_VMALLOC(at->flags))
+ NV_FREE_PAGES(page_ptr->virt_addr, 0);
+@@ -340,7 +344,7 @@
+
+ #if defined(NV_SG_MAP_BUFFERS)
+ if (NV_ALLOC_MAPPING_VMAP(at->flags) && pages != 0)
+- NV_VFREE((void *)pages, sizeof(struct page *) * at->num_pages);
++ NV_KFREE((void *)pages, sizeof(struct page *) * at->num_pages);
+ #endif
+
+ return -1;
+@@ -408,7 +412,7 @@
+ if (NV_ALLOC_MAPPING_VMAP(at->flags))
+ page_ptr->virt_addr = (unsigned long) __va(page_ptr->phys_addr);
+ if (!NV_ALLOC_MAPPING_CONTIG(at->flags))
+- nv_sg_unmap_buffer(dev, &at->page_table[i]->sg_list, page_ptr);
++ nv_sg_unmap_buffer(dev, &page_ptr->sg_list, page_ptr);
+ #endif
+ if (!NV_ALLOC_MAPPING_CONTIG(at->flags) && !NV_ALLOC_MAPPING_VMALLOC(at->flags))
+ NV_FREE_PAGES(page_ptr->virt_addr, 0);
diff --git a/media-video/nvidia-kernel/files/digest-nvidia-kernel-1.0.7676-r1 b/media-video/nvidia-kernel/files/digest-nvidia-kernel-1.0.7676-r1
new file mode 100644
index 000000000000..14f9d0f6c87b
--- /dev/null
+++ b/media-video/nvidia-kernel/files/digest-nvidia-kernel-1.0.7676-r1
@@ -0,0 +1,2 @@
+MD5 2474c5513006668b0fba401e042dc009 NVIDIA-Linux-x86-1.0-7676-pkg0.run 5631274
+MD5 df2081504b609aaa95ccc8e95aebfb97 NVIDIA-Linux-x86_64-1.0-7676-pkg2.run 8824402
diff --git a/media-video/nvidia-kernel/nvidia-kernel-1.0.7676-r1.ebuild b/media-video/nvidia-kernel/nvidia-kernel-1.0.7676-r1.ebuild
new file mode 100644
index 000000000000..c7b500f6d1b3
--- /dev/null
+++ b/media-video/nvidia-kernel/nvidia-kernel-1.0.7676-r1.ebuild
@@ -0,0 +1,145 @@
+# Copyright 1999-2005 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/media-video/nvidia-kernel/nvidia-kernel-1.0.7676-r1.ebuild,v 1.1 2005/10/28 07:13:00 eradicator Exp $
+
+inherit eutils linux-mod
+
+X86_PKG_V="pkg0"
+AMD64_PKG_V="pkg2"
+NV_V="${PV/1.0./1.0-}"
+X86_NV_PACKAGE="NVIDIA-Linux-x86-${NV_V}"
+AMD64_NV_PACKAGE="NVIDIA-Linux-x86_64-${NV_V}"
+
+DESCRIPTION="Linux kernel module for the NVIDIA X11 driver"
+HOMEPAGE="http://www.nvidia.com/"
+SRC_URI="x86? ( ftp://download.nvidia.com/XFree86/Linux-x86/${NV_V}/${X86_NV_PACKAGE}-${X86_PKG_V}.run )
+ amd64? ( http://download.nvidia.com/XFree86/Linux-x86_64/${NV_V}/${AMD64_NV_PACKAGE}-${AMD64_PKG_V}.run )"
+
+if use x86; then
+ PKG_V="${X86_PKG_V}"
+ NV_PACKAGE="${X86_NV_PACKAGE}"
+elif use amd64; then
+ PKG_V="${AMD64_PKG_V}"
+ NV_PACKAGE="${AMD64_NV_PACKAGE}"
+fi
+
+S="${WORKDIR}/${NV_PACKAGE}-${PKG_V}/usr/src/nv"
+
+LICENSE="NVIDIA"
+SLOT="0"
+KEYWORDS="-* ~x86 ~amd64"
+RESTRICT="nostrip"
+IUSE=""
+
+DEPEND="virtual/linux-sources"
+export _POSIX2_VERSION="199209"
+
+mtrr_check() {
+ ebegin "Checking for MTRR support"
+ linux_chkconfig_present MTRR
+ eend $?
+
+ if [[ $? -ne 0 ]] ; then
+ eerror "This version needs MTRR support for most chipsets!"
+ eerror "Please enable MTRR support in your kernel config, found at:"
+ eerror
+ eerror " Processor type and features"
+ eerror " [*] MTRR (Memory Type Range Register) support"
+ eerror
+ eerror "and recompile your kernel ..."
+ die "MTRR support not detected!"
+ fi
+}
+
+pkg_setup() {
+ linux-mod_pkg_setup
+ MODULE_NAMES="nvidia(video:${S})"
+ BUILD_PARAMS="IGNORE_CC_MISMATCH=yes V=1 SYSSRC=${KV_DIR} SYSOUT=${KV_OUT_DIR}"
+ mtrr_check
+}
+
+src_unpack() {
+ local NV_PATCH_PREFIX="${FILESDIR}/${PV}/NVIDIA_kernel-1.0-${PV##*.}"
+
+ if [[ ${KV_MINOR} -eq 6 && ${KV_PATCH} -lt 7 ]] ; then
+ echo
+ ewarn "Your kernel version is ${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}"
+ ewarn "This is not officially supported for ${P}. It is likely you"
+ ewarn "will not be able to compile or use the kernel module."
+ ewarn "It is recommended that you upgrade your kernel to a version >= 2.6.7"
+ echo
+ ewarn "DO NOT file bug reports for kernel versions less than 2.6.7 as they will be ignored."
+ fi
+
+ cd ${WORKDIR}
+ bash ${DISTDIR}/${NV_PACKAGE}-${PKG_V}.run --extract-only
+
+ # Add patches below, with a breif description.
+ cd ${S}
+ # Any general patches should go here
+ # Shutup pointer arith warnings
+ # use x86 && epatch ${NV_PATCH_PREFIX//7174/7167}-x86-shutup-warnings.patch
+ # use amd64 && epatch ${NV_PATCH_PREFIX//7174/7167}-amd64-shutup-warnings.patch
+
+ # Patches from Zander goes here
+ # (http://www.nvnews.net/vbulletin/forumdisplay.php?f=14, or possibly
+ # archived here: http://www.minion.de/files/1.0-7167/)
+ epatch ${NV_PATCH_PREFIX}-1321905.diff
+ #epatch ${NV_PATCH_PREFIX}-1359015.diff
+ epatch ${NV_PATCH_PREFIX}-1361053.diff
+ epatch ${NV_PATCH_PREFIX}-1386866.diff
+ epatch ${NV_PATCH_PREFIX}-1392404.diff
+
+ # Now any patches specific to the 2.6 kernel should go here
+ if kernel_is 2 6 ; then
+ einfo "Applying 2.6 kernel patches"
+ # Fix the /usr/src/linux/include/asm not existing on koutput issue #58294
+ # epatch ${NV_PATCH_PREFIX//7174/7167}-conftest-koutput-includes.patch
+ # Fix calling of smp_processor_id() when preempt is enabled
+ epatch ${NV_PATCH_PREFIX//7676/7167}-disable-preempt-on-smp_processor_id.patch
+ epatch ${NV_PATCH_PREFIX//7676/7667}-KERNEL_VERSION-moved.patch
+ fi
+
+ # Quiet down warnings the user do not need to see
+ sed -i \
+ -e 's:-Wpointer-arith::g' \
+ -e 's:-Wsign-compare::g' \
+ ${S}/Makefile.kbuild
+
+ # If you set this then it's your own fault when stuff breaks :)
+ [[ -n ${USE_CRAZY_OPTS} ]] && sed -i "s:-O:${CFLAGS}:" Makefile.*
+
+ # If greater than 2.6.5 use M= instead of SUBDIR=
+ cd ${S}; convert_to_m Makefile.kbuild
+}
+
+src_install() {
+ linux-mod_src_install
+
+ # Add the aliases
+ sed -e 's:\${PACKAGE}:'${PF}':g' ${FILESDIR}/nvidia > ${WORKDIR}/nvidia
+ insinto /etc/modules.d
+ newins ${WORKDIR}/nvidia nvidia
+
+ # Docs
+ # Bug #97768: Install README correctly and install Changelog.
+ newdoc ${S}/../../share/doc/README.txt README
+ dodoc ${S}/../../share/doc/NVIDIA_Changelog
+
+ # The device creation script
+ # This script appears to be gone. Maybe NVIDIA is no longer supporting
+ # a static /dev.
+ #into /
+ #newsbin ${S}/makedevices.sh NVmakedevices.sh
+}
+
+pkg_postinst() {
+ # This script appears to be gone. Maybe NVIDIA is no longer supporting
+ # a static /dev.
+ #if [[ "${ROOT}" = "/" && ! -e /dev/.devfsd && \
+ # ! -e /dev/.udev && -x /sbin/NVmakedevices.sh ]] ; then
+ # /sbin/NVmakedevices.sh >/dev/null 2>&1
+ #fi
+
+ linux-mod_pkg_postinst
+}