summaryrefslogtreecommitdiff
path: root/sysutils/aperture/patches/patch-ab
blob: 5e8b20e7a5372161fe0e38434cfce5268197fb5c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
$NetBSD: patch-ab,v 1.7 2003/11/11 13:00:24 wennmach Exp $

o add support for cpu_info (for recent kernel versions)
o do not define cpu_id, cpu_feature, cpu_vendor directly; leave that
  to machine/cpu.h

--- module/xf86_mod.c.orig	Fri Nov  7 16:29:19 2003
+++ module/xf86_mod.c	Fri Nov  7 16:36:27 2003
@@ -10,6 +10,7 @@
 #include <sys/lkm.h>
 #include <sys/malloc.h>
 
+#include <machine/cpu.h>
 #include <machine/specialreg.h>
 
 #include "xf86_reg.h"
@@ -17,9 +18,11 @@
 #include "memrange.h"
 
 /* Pull in the cpuid values from locore.s */
-extern int cpu_id;
-extern int cpu_feature;
-extern char cpu_vendor[];
+#if __NetBSD_Version__ >= 106080000
+extern struct cpu_info cpu_info_primary;
+#define cpu_vendor ((char *)cpu_info_primary.ci_vendor)
+#define cpu_id cpu_info_primary.ci_signature
+#endif
 
 extern struct mem_range_ops i686_mrops, k6_mrops;
 
@@ -31,7 +34,11 @@
 	0,
 	seltrue, xf86mmap, 0};
 
+#if __NetBSD_Version__ >= 106080000
+MOD_DEV("xf86", "xf86ap", NULL, -1, &newdev, -1)
+#else
 MOD_DEV("xf86", LM_DT_CHAR, -1, &newdev)
+#endif
 
 char *xf86_major_version = "2";
 char *xf86_minor_version = "0";
@@ -76,7 +83,10 @@
 		
 	case LKM_E_UNLOAD:
 		/* Free allocated memory */
+		if (mem_range_softc.mr_desc != NULL) {
 		free(mem_range_softc.mr_desc, M_MEMDESC);
+			mem_range_softc.mr_desc = NULL;
+		}
 		break;
 		
 	case LKM_E_STAT: