summaryrefslogtreecommitdiff
path: root/emulators/virtualbox-ose-kmod-legacy/files/patch-src-VBox-Runtime-r0drv-freebsd-mp-r0drv-freebsd.c
blob: c298f52fd501f72e03a6f915f899fb450345114f (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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
--- src/VBox/Runtime/r0drv/freebsd/mp-r0drv-freebsd.c.orig	2011-05-16 12:33:52.000000000 -0400
+++ src/VBox/Runtime/r0drv/freebsd/mp-r0drv-freebsd.c	2011-06-24 13:57:31.000000000 -0400
@@ -163,17 +163,26 @@ RTDECL(int) RTMpOnOthers(PFNRTMPWORKER p
     /* Will panic if no rendezvousing cpus, so check up front. */
     if (RTMpGetOnlineCount() > 1)
     {
-#if  __FreeBSD_version >= 700000
-        cpumask_t   Mask = ~(cpumask_t)curcpu;
+#if __FreeBSD_version >= 900000
+        cpuset_t    Mask;
+#elif __FreeBSD_version >= 700000
+        cpumask_t   Mask;
 #endif
+        RTCPUID     idCpu = curcpu;
         RTMPARGS    Args;
 
         Args.pfnWorker = pfnWorker;
         Args.pvUser1 = pvUser1;
         Args.pvUser2 = pvUser2;
-        Args.idCpu = RTMpCpuId();
+        Args.idCpu = idCpu;
         Args.cHits = 0;
 #if __FreeBSD_version >= 700000
+        Mask = all_cpus;
+#if __FreeBSD_version >= 900000
+        CPU_CLR(idCpu, &Mask);
+#else
+        Mask &= ~((cpumask_t)1 << idCpu);
+#endif
         smp_rendezvous_cpus(Mask, NULL, rtmpOnOthersFreeBSDWrapper, smp_no_rendevous_barrier, &Args);
 #else
         smp_rendezvous(NULL, rtmpOnOthersFreeBSDWrapper, NULL, &Args);
@@ -203,8 +212,10 @@ static void rtmpOnSpecificFreeBSDWrapper
 
 RTDECL(int) RTMpOnSpecific(RTCPUID idCpu, PFNRTMPWORKER pfnWorker, void *pvUser1, void *pvUser2)
 {
-#if  __FreeBSD_version >= 700000
-    cpumask_t   Mask = 1 << idCpu;
+#if __FreeBSD_version >= 900000
+    cpuset_t    Mask;
+#elif __FreeBSD_version >= 700000
+    cpumask_t   Mask;
 #endif
     RTMPARGS    Args;
 
@@ -218,7 +229,11 @@ RTDECL(int) RTMpOnSpecific(RTCPUID idCpu
     Args.idCpu = idCpu;
     Args.cHits = 0;
 #if __FreeBSD_version >= 700000
+#if __FreeBSD_version >= 900000
+    CPU_SETOF(idCpu, &Mask);
+#else
     Mask = (cpumask_t)1 << idCpu;
+#endif
     smp_rendezvous_cpus(Mask, NULL, rtmpOnSpecificFreeBSDWrapper, smp_no_rendevous_barrier, &Args);
 #else
     smp_rendezvous(NULL, rtmpOnSpecificFreeBSDWrapper, NULL, &Args);
@@ -242,13 +257,21 @@ static void rtmpFreeBSDPokeCallback(void
 
 RTDECL(int) RTMpPokeCpu(RTCPUID idCpu)
 {
+#if __FreeBSD_version >= 900000
+    cpuset_t    Mask;
+#else
     cpumask_t   Mask;
+#endif
 
     /* Will panic if no rendezvousing cpus, so make sure the cpu is online. */
     if (!RTMpIsCpuOnline(idCpu))
         return VERR_CPU_NOT_FOUND;
 
+#if __FreeBSD_version >= 900000
+    CPU_SETOF(idCpu, &Mask);
+#else
     Mask = (cpumask_t)1 << idCpu;
+#endif
     smp_rendezvous_cpus(Mask, NULL, rtmpFreeBSDPokeCallback, smp_no_rendevous_barrier, NULL);
 
     return VINF_SUCCESS;