Changeset 63345 in vbox for trunk/src/VBox/Runtime/r0drv/netbsd/thread-r0drv-netbsd.c
- Timestamp:
- Aug 11, 2016 6:25:33 PM (8 years ago)
- File:
-
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r0drv/netbsd/thread-r0drv-netbsd.c
r63342 r63345 1 1 /* $Id$ */ 2 2 /** @file 3 * IPRT - Threads (Part 1), Ring-0 Driver, FreeBSD.3 * IPRT - Threads (Part 1), Ring-0 Driver, NetBSD. 4 4 */ 5 5 6 6 /* 7 * Copyright (C) 2007-201 6Oracle Corporation7 * Copyright (C) 2007-2011 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 25 25 */ 26 26 27 28 27 /********************************************************************************************************************************* 29 28 * Header Files * 30 29 *********************************************************************************************************************************/ 31 #include "the- freebsd-kernel.h"30 #include "the-netbsd-kernel.h" 32 31 #include "internal/iprt.h" 33 32 #include <iprt/thread.h> … … 43 42 RTDECL(RTNATIVETHREAD) RTThreadNativeSelf(void) 44 43 { 45 return (RTNATIVETHREAD)cur thread;44 return (RTNATIVETHREAD)curlwp; 46 45 } 47 46 48 47 49 static int rtR0Thread FbsdSleepCommon(RTMSINTERVAL cMillies)48 static int rtR0ThreadNbsdSleepCommon(RTMSINTERVAL cMillies) 50 49 { 51 50 int rc; … … 103 102 RTDECL(int) RTThreadSleep(RTMSINTERVAL cMillies) 104 103 { 105 return rtR0Thread FbsdSleepCommon(cMillies);104 return rtR0ThreadNbsdSleepCommon(cMillies); 106 105 } 107 106 … … 109 108 RTDECL(int) RTThreadSleepNoLog(RTMSINTERVAL cMillies) 110 109 { 111 return rtR0Thread FbsdSleepCommon(cMillies);110 return rtR0ThreadNbsdSleepCommon(cMillies); 112 111 } 113 112 … … 115 114 RTDECL(bool) RTThreadYield(void) 116 115 { 117 #if __FreeBSD_version >= 900032 118 kern_yield(curthread->td_user_pri); 119 #else 120 uio_yield(); 121 #endif 122 return false; /** @todo figure this one ... */ 116 yield(); 117 return true; 123 118 } 124 119 … … 128 123 Assert(hThread == NIL_RTTHREAD); 129 124 130 return cur thread->td_critnest == 0131 && ASMIntAreEnabled(); /** @todo is there a native freebsd function/macro for this? */125 return curlwp->l_dopreempt == 0 126 && ASMIntAreEnabled(); /** @todo is there a native netbsd function/macro for this? */ 132 127 } 133 128 … … 137 132 Assert(hThread == NIL_RTTHREAD); 138 133 139 return cur thread->td_owepreempt == 1;134 return curlwp->l_dopreempt; 140 135 } 141 136 … … 154 149 } 155 150 156 157 151 RTDECL(void) RTThreadPreemptDisable(PRTTHREADPREEMPTSTATE pState) 158 152 { 159 153 AssertPtr(pState); 160 Assert(pState->u32Reserved == 0);161 pState->u32Reserved = 42;162 154 163 c ritical_enter();164 RT_ASSERT_PREEMPT_CPUID_DISABLE(pState);155 curlwp->l_nopreempt++; 156 __insn_barrier(); 165 157 } 166 158 … … 168 160 RTDECL(void) RTThreadPreemptRestore(PRTTHREADPREEMPTSTATE pState) 169 161 { 162 170 163 AssertPtr(pState); 171 Assert(pState->u32Reserved == 42); 172 pState->u32Reserved = 0; 173 174 RT_ASSERT_PREEMPT_CPUID_RESTORE(pState); 175 critical_exit(); 164 __insn_barrier(); 165 if (--curlwp->l_nopreempt != 0) 166 return; 167 __insn_barrier(); 168 if (__predict_false(curlwp->l_dopreempt)) 169 kpreempt(0); 170 __insn_barrier(); 176 171 } 177 178 172 179 173 RTDECL(bool) RTThreadIsInInterrupt(RTTHREAD hThread) 180 174 { 181 175 Assert(hThread == NIL_RTTHREAD); NOREF(hThread); 182 /** @todo FreeBSD: Implement RTThreadIsInInterrupt. Required for guest176 /** @todo NetBSD: Implement RTThreadIsInInterrupt. Required for guest 183 177 * additions! */ 184 178 return !ASMIntAreEnabled(); 185 179 } 186
Note:
See TracChangeset
for help on using the changeset viewer.