Hi!

 Attached are three patches:

1. patch-src-VBox-Runtime-r0drv-freebsd.semevent-r0drv-freebsd.c
 and
2. patch-src-VBox-Runtime-r0drv-freebsd-semeventmulti-r0drv-freebsd.c
account for changed sleeq*() args in FreeBSD 8 vs 7 (relevant commitlog
is here:
        http://lists.freebsd.org/pipermail/cvs-src/2008-March/088483.html
and here:
        http://lists.freebsd.org/pipermail/cvs-src/2008-March/088484.html
), and

3. patch-src-VBox-Runtime-r0drv-freebsd-spinlock-r0drv-freebsd.c
avoids an assert crash when running a debug build.  (happened on
FreeBSD 8/amd64 in this case.)

 Enjoy,
        Juergen
Index: src/VBox/Runtime/r0drv/freebsd/semevent-r0drv-freebsd.c
@@ -205,15 +205,23 @@ static int rtSemEventWait(RTSEMEVENT Eve
 
                 RTSpinlockRelease(pEventInt->hSpinLock, &Tmp);
 
+#if __FreeBSD_version >=800026
                 if (fInterruptible)
                     rc = sleepq_timedwait_sig(pEventInt, 0);
                 else
                     rc = sleepq_timedwait(pEventInt, 0);
+#else
+                if (fInterruptible)
+                    rc = sleepq_timedwait_sig(pEventInt);
+                else
+                    rc = sleepq_timedwait(pEventInt);
+#endif
             }
             else
             {
                 RTSpinlockRelease(pEventInt->hSpinLock, &Tmp);
 
+#if __FreeBSD_version >=800026
                 if (fInterruptible)
                     rc = sleepq_wait_sig(pEventInt, 0);
                 else
@@ -221,6 +229,15 @@ static int rtSemEventWait(RTSEMEVENT Eve
                     rc = 0;
                     sleepq_wait(pEventInt, 0);
                 }
+#else
+                if (fInterruptible)
+                    rc = sleepq_wait_sig(pEventInt);
+                else
+                {
+                    rc = 0;
+                    sleepq_wait(pEventInt);
+                }
+#endif
             }
 
             RTSpinlockAcquire(pEventInt->hSpinLock, &Tmp);
Index: src/VBox/Runtime/r0drv/freebsd/semeventmulti-r0drv-freebsd.c
@@ -215,15 +215,23 @@ static int rtSemEventMultiWait(RTSEMEVEN
 
                 RTSpinlockRelease(pEventMultiInt->hSpinLock, &Tmp);
 
+#if __FreeBSD_version >=800026
                 if (fInterruptible)
                     rc = sleepq_timedwait_sig(pEventMultiInt, 0);
                 else
                     rc = sleepq_timedwait(pEventMultiInt, 0);
+#else
+                if (fInterruptible)
+                    rc = sleepq_timedwait_sig(pEventMultiInt);
+                else
+                    rc = sleepq_timedwait(pEventMultiInt);
+#endif
             }
             else
             {
                 RTSpinlockRelease(pEventMultiInt->hSpinLock, &Tmp);
 
+#if __FreeBSD_version >=800026
                 if (fInterruptible)
                     rc = sleepq_wait_sig(pEventMultiInt, 0);
                 else
@@ -231,6 +239,15 @@ static int rtSemEventMultiWait(RTSEMEVEN
                     rc = 0;
                     sleepq_wait(pEventMultiInt, 0);
                 }
+#else
+                if (fInterruptible)
+                    rc = sleepq_wait_sig(pEventMultiInt);
+                else
+                {
+                    rc = 0;
+                    sleepq_wait(pEventMultiInt);
+                }
+#endif
             }
 
             RTSpinlockAcquire(pEventMultiInt->hSpinLock, &Tmp);
Index: src/VBox/Runtime/r0drv/freebsd/spinlock-r0drv-freebsd.c
@@ -171,7 +171,12 @@ RTDECL(void) RTSpinlockAcquire(RTSPINLOC
     AssertPtr(pThis);
     Assert(pThis->u32Magic == RTSPINLOCK_MAGIC);
 #ifdef RT_STRICT
+#if 0
+    /* This can't work because at least RTPowerNotificationRegister calls
+     * RTSpinlockAcquire with *pTmp allocated on the stack.
+     */
     Assert(pTmp->uFlags == 0);
+#endif
     pTmp->uFlags = 42;
 #endif
 
_______________________________________________
vbox-dev mailing list
[email protected]
http://vbox.innotek.de/mailman/listinfo/vbox-dev

Reply via email to