[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Nvidia + 2.4



There you are,
have a lot of fun 

Romain

Kristian Rink wrote:
> 
> Hello there...
> 
> ...can anyone give me a help by posting me the patch that makes NVIDIA's
> kernel module driver build with 2.4.0? By now I only found an url for this
> on linuxgames.com but it seems the site is down, at least I can't get
> there, right now... :((
> Thanks for your help, have a nice sunday. :)
> Bye,
> Kris
> 
> --
> "These outrageous events break through the peaceful silence.
>  Into a fragile community enters madness, insanity...
>  A season of darkness, no faith in the calm...
>  Nothing but the storm."
> (Benediction - dark is the season)
> 
> Kristian Rink
> paper: +49 180 5052 5560 8162
> phone: +49 174 5360871
> icq  : 48874445 (Krishna)
> irc  : #metal on IRCNet (Kawazu)
> 
> --
> To UNSUBSCRIBE, email to debian-user-request@lists.debian.org
> with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
diff -ruN NVIDIA_kernel-0.9-5/nv.c nvdriver/nv.c
--- NVIDIA_kernel-0.9-5/nv.c	Sat Aug 26 02:48:38 2000
+++ nvdriver/nv.c	Tue Jan  2 13:43:13 2001
@@ -49,6 +49,13 @@
 #include <linux/modversions.h>
 #endif
 
+#ifndef mem_map_dec_count
+  #define mem_map_dec_count(p) atomic_dec(&((p)->count));
+#endif
+#ifndef mem_map_inc_count
+  #define mem_map_inc_count(p) atomic_inc(&((p)->count));
+#endif
+
 #include <nv.h>			        // needs to precede other headers (SMP)
 
 #include <linux/stddef.h>
@@ -778,17 +785,6 @@
 }
 
 
-void nv_vma_release(struct vm_area_struct *vma)
-{
-    nv_state_t *nv;
-
-    nv = &nv_devices[NV_DEVICE_NUMBER(LINUX_VMA_DEV(vma))];
-    NV_DMSG(nv, "vma_release [0x%lx-0x%lx]", vma->vm_start, vma->vm_end);
-
-    MOD_DEC_USE_COUNT;
-}
-
-
 // assumes we are destroying entire map
 void nv_vma_unmap(
     struct vm_area_struct *vma,
@@ -833,6 +829,21 @@
     }
 }
 
+
+void nv_vma_release(struct vm_area_struct *vma)
+{
+    nv_state_t *nv;
+
+    nv = &nv_devices[NV_DEVICE_NUMBER(LINUX_VMA_DEV(vma))];
+    NV_DMSG(nv, "vma_release [0x%lx-0x%lx]", vma->vm_start, vma->vm_end);
+
+    /*  2.4.0 PR fix/hack  */
+    nv_vma_unmap(vma, vma->vm_start, vma->vm_end - vma->vm_start);
+
+    MOD_DEC_USE_COUNT;
+}
+
+
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 4, 0)
 struct vm_operations_struct nv_vm_ops = {
     nv_vma_open,
@@ -850,7 +861,8 @@
 struct vm_operations_struct nv_vm_ops = {
     open:     nv_vma_open,
     close:    nv_vma_release,
-    unmap:    nv_vma_unmap,  
+/*  2.4.0 PR hack/fix       */
+/*  unmap:    nv_vma_unmap, */
 };
 #endif
 
diff -ruN NVIDIA_kernel-0.9-5/nv.h nvdriver/nv.h
--- NVIDIA_kernel-0.9-5/nv.h	Sat Aug 26 02:48:38 2000
+++ nvdriver/nv.h	Tue Jan  2 13:43:41 2001
@@ -128,7 +128,7 @@
   #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 3, 0)
     #define KERNEL_2_2
   #else
-    #warning This driver is not officially supported on post-2.2 kernels
+/*  #warning This driver is not officially supported on post-2.2 kernels */
     #define KERNEL_2_3
   #endif  // < 2.3
 #endif  // < 2.2
diff -ruN NVIDIA_kernel-0.9-5/os-interface.c nvdriver/os-interface.c
--- NVIDIA_kernel-0.9-5/os-interface.c	Fri Sep  1 04:19:17 2000
+++ nvdriver/os-interface.c	Tue Jan  2 13:41:14 2001
@@ -1331,6 +1331,11 @@
     char *parmp;
     char ch;
 
+    spinlock_t unload_lock = SPIN_LOCK_UNLOCKED;
+    struct module *mp = THIS_MODULE;
+    struct module_symbol *sym;
+    int i;
+
     if ((strlen(regParmStr) + NV_SYM_PREFIX_LENGTH) > NV_MAX_SYM_NAME)
         goto done;
 
@@ -1351,11 +1356,18 @@
 
     *symp = '\0';
 
-    symbol_value = get_module_symbol(NV_MODULE_NAME, symbol_name);
-    
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4, 0)
-    put_module_symbol(symbol_value);
-#endif
+    spin_lock(&unload_lock);
+    if (MOD_CAN_QUERY(mp) && (mp->nsyms > 0)) {
+        for (i = mp->nsyms, sym = mp->syms;
+             i > 0; --i, ++sym) {
+
+            if (strcmp(sym->name, symbol_name) == 0) {
+                symbol_value = sym->value;
+                break;
+            }
+        }
+    }
+    spin_unlock(&unload_lock);
 
  done:
     return (void *) symbol_value;

Reply to: