Changeset 92460 in vbox for trunk/src/VBox/Runtime/r0drv
- Timestamp:
- Nov 16, 2021 2:04:29 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r0drv/linux/thread-r0drv-linux.c
r90416 r92460 43 43 44 44 /********************************************************************************************************************************* 45 * Defined Constants And Macros * 46 *********************************************************************************************************************************/ 47 #if defined(CONFIG_PREEMPT_COUNT) /* since 3.1 */ \ 48 || defined(CONFIG_PREEMPTION) /* since 5.3 */ \ 49 || defined(CONFIG_PREEMPT) /* since 2.6.13 - preemption model choice; before that arch specific choice back to 2.5.45. */ 50 # define IPRT_LNX_HAVE_PREEMPTION 51 #endif 52 53 54 /********************************************************************************************************************************* 45 55 * Global Variables * 46 56 *********************************************************************************************************************************/ 47 #ifndef CONFIG_PREEMPT57 #ifndef IPRT_LNX_HAVE_PREEMPTION 48 58 /** Per-cpu preemption counters. */ 49 59 static int32_t volatile g_acPreemptDisabled[NR_CPUS]; … … 104 114 RTDECL(bool) RTThreadPreemptIsEnabled(RTTHREAD hThread) 105 115 { 106 #ifdef CONFIG_PREEMPT116 #ifdef IPRT_LNX_HAVE_PREEMPTION 107 117 Assert(hThread == NIL_RTTHREAD); RT_NOREF_PV(hThread); 108 118 # ifdef preemptible … … 165 175 RTDECL(bool) RTThreadPreemptIsPossible(void) 166 176 { 167 #ifdef CONFIG_PREEMPT177 #ifdef IPRT_LNX_HAVE_PREEMPTION 168 178 return true; /* Yes, kernel preemption is possible. */ 169 179 #else 170 return false; /* No kernel preemption (or CONFIG_PREEMPT_VOLUNTARY). */180 return false; /* No kernel preemption (or just CONFIG_PREEMPT_VOLUNTARY). */ 171 181 #endif 172 182 } … … 176 186 RTDECL(void) RTThreadPreemptDisable(PRTTHREADPREEMPTSTATE pState) 177 187 { 178 #ifdef CONFIG_PREEMPT188 #ifdef IPRT_LNX_HAVE_PREEMPTION 179 189 AssertPtr(pState); 180 190 Assert(pState->u32Reserved == 0); 181 191 pState->u32Reserved = 42; 182 /* This ASSUMES that CONFIG_PREEMPT_COUNT is always defined with CONFIG_PREEMPT. */183 192 preempt_disable(); 184 193 RT_ASSERT_PREEMPT_CPUID_DISABLE(pState); 185 194 186 #else /* ! CONFIG_PREEMPT*/195 #else /* !IPRT_LNX_HAVE_PREEMPTION */ 187 196 int32_t c; 188 197 AssertPtr(pState); … … 201 210 RTDECL(void) RTThreadPreemptRestore(PRTTHREADPREEMPTSTATE pState) 202 211 { 203 #ifdef CONFIG_PREEMPT212 #ifdef IPRT_LNX_HAVE_PREEMPTION 204 213 IPRT_LINUX_SAVE_EFL_AC(); /* paranoia */ 205 214 AssertPtr(pState);
Note:
See TracChangeset
for help on using the changeset viewer.