aboutsummaryrefslogtreecommitdiff
path: root/emulators/virtualbox-ose/files/patch-src_VBox_Runtime_r0drv_freebsd_spinlock-r0drv-freebsd.c
blob: e76621407cea342b1afd89bf3dbe043cdcd7f688 (plain) (blame)
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
--- src/VBox/Runtime/r0drv/freebsd/spinlock-r0drv-freebsd.c.orig	2018-10-15 14:31:31 UTC
+++ src/VBox/Runtime/r0drv/freebsd/spinlock-r0drv-freebsd.c
@@ -82,7 +82,9 @@ RTDECL(int)  RTSpinlockCreate(PRTSPINLOCK pSpinlock, u
      * Allocate.
      */
     AssertCompile(sizeof(RTSPINLOCKINTERNAL) > sizeof(void *));
+    IPRT_FREEBSD_SAVE_EFL_AC();
     PRTSPINLOCKINTERNAL pThis = (PRTSPINLOCKINTERNAL)RTMemAllocZ(sizeof(*pThis));
+    IPRT_FREEBSD_RESTORE_EFL_AC();
     if (!pThis)
         return VERR_NO_MEMORY;
 
@@ -116,7 +118,9 @@ RTDECL(int)  RTSpinlockDestroy(RTSPINLOCK Spinlock)
      * Make the lock invalid and release the memory.
      */
     ASMAtomicIncU32(&pThis->u32Magic);
+    IPRT_FREEBSD_SAVE_EFL_AC();
     RTMemFree(pThis);
+    IPRT_FREEBSD_RESTORE_EFL_AC();
     return VINF_SUCCESS;
 }
 
@@ -142,6 +146,7 @@ RTDECL(void) RTSpinlockAcquire(RTSPINLOCK Spinlock)
                 {
                     RT_ASSERT_PREEMPT_CPUID_SPIN_ACQUIRED(pThis);
                     pThis->fIntSaved = fIntSaved;
+                    IPRT_FREEBSD_RESTORE_EFL_ONLY_AC_EX(fIntSaved);
                     return;
                 }
                 if (--c <= 0)