- Timestamp:
- Jul 22, 2013 2:18:41 PM (11 years ago)
- Location:
- trunk/src/VBox/Runtime
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r0drv/solaris/initterm-r0drv-solaris.c
r44528 r47302 67 67 /** The xc_call callout table structure. */ 68 68 RTR0FNSOLXCCALL g_rtSolXcCall; 69 /** Whether to use the old-style installctx()/removectx() routines. */ 70 bool g_frtSolOldThreadCtx = false; 71 /** The thread-context hooks callout table structure. */ 72 RTR0FNSOLTHREADCTX g_rtSolThreadCtx; 69 73 /** Thread preemption offset. */ 70 74 size_t g_offrtSolThreadPreempt; … … 127 131 goto errorbail; 128 132 } 129 cmn_err(CE_CONT, "!cpu_t::cpu_runrun @ 0x%lx \n",g_offrtSolCpuPreempt);130 cmn_err(CE_CONT, "!cpu_t::cpu_kprunrun @ 0x%lx \n",g_offrtSolCpuForceKernelPreempt);131 cmn_err(CE_CONT, "!kthread_t::t_preempt @ 0x%lx \n", g_offrtSolThreadPreempt);133 cmn_err(CE_CONT, "!cpu_t::cpu_runrun @ 0x%lx (%ld)\n", g_offrtSolCpuPreempt, g_offrtSolCpuPreempt); 134 cmn_err(CE_CONT, "!cpu_t::cpu_kprunrun @ 0x%lx (%ld)\n", g_offrtSolCpuForceKernelPreempt, g_offrtSolCpuForceKernelPreempt); 135 cmn_err(CE_CONT, "!kthread_t::t_preempt @ 0x%lx (%ld)\n", g_offrtSolThreadPreempt, g_offrtSolThreadPreempt); 132 136 133 137 /* … … 161 165 goto errorbail; 162 166 } 167 } 168 169 /* 170 * Mandatory: Thread-context hooks. 171 */ 172 rc = RTR0DbgKrnlInfoQuerySymbol(g_hKrnlDbgInfo, NULL /* pszModule */, "exitctx", NULL /* ppvSymbol */); 173 if (RT_SUCCESS(rc)) 174 { 175 g_rtSolThreadCtx.Install.pfnSol_installctx = (void *)installctx; 176 g_rtSolThreadCtx.Remove.pfnSol_removectx = (void *)removectx; 177 } 178 else 179 { 180 g_frtSolOldThreadCtx = true; 181 g_rtSolThreadCtx.Install.pfnSol_installctx_old = (void *)installctx; 182 g_rtSolThreadCtx.Remove.pfnSol_removectx_old = (void *)removectx; 163 183 } 164 184 -
trunk/src/VBox/Runtime/r0drv/solaris/the-solaris-kernel.h
r47206 r47302 148 148 extern bool g_frtSolOldIPIUlong; 149 149 150 /* 151 * Thread-context hooks. 152 * Workarounds for older Solaris versions that did not have the exitctx() callback. 153 */ 154 typedef struct RTR0FNSOLTHREADCTX 155 { 156 union 157 { 158 void *(*pfnSol_installctx) (kthread_t *pThread, void *pvArg, 159 void (*pfnSave)(void *pvArg), 160 void (*pfnRestore)(void *pvArg), 161 void (*pfnFork)(void *pvThread, void *pvThreadFork), 162 void (*pfnLwpCreate)(void *pvThread, void *pvThreadCreate), 163 void (*pfnExit)(void *pvThread), 164 void (*pfnFree)(void *pvArg, int fIsExec)); 165 166 void *(*pfnSol_installctx_old) (kthread_t *pThread, void *pvArg, 167 void (*pfnSave)(void *pvArg), 168 void (*pfnRestore)(void *pvArg), 169 void (*pfnFork)(void *pvThread, void *pvThreadFork), 170 void (*pfnLwpCreate)(void *pvThread, void *pvThreadCreate), 171 void (*pfnFree)(void *pvArg, int fIsExec)); 172 } Install; 173 174 union 175 { 176 int (*pfnSol_removectx) (kthread_t *pThread, void *pvArg, 177 void (*pfnSave)(void *pvArg), 178 void (*pfnRestore)(void *pvArg), 179 void (*pfnFork)(void *pvThread, void *pvThreadFork), 180 void (*pfnLwpCreate)(void *pvThread, void *pvThreadCreate), 181 void (*pfnExit)(void *pvThread), 182 void (*pfnFree)(void *pvArg, int fIsExec)); 183 184 int (*pfnSol_removectx_old) (kthread_t *pThread, void *pvArg, 185 void (*pfnSave)(void *pvArg), 186 void (*pfnRestore)(void *pvArg), 187 void (*pfnFork)(void *pvThread, void *pvThreadFork), 188 void (*pfnLwpCreate)(void *pvThread, void *pvThreadCreate), 189 void (*pfnFree)(void *pvArg, int fIsExec)); 190 } Remove; 191 } RTR0FNSOLTHREADCTX; 192 typedef RTR0FNSOLTHREADCTX *PRTR0FNSOLTHREADCTX; 193 194 extern RTR0FNSOLTHREADCTX g_rtSolThreadCtx; 195 extern bool g_frtSolOldThreadCtx; 150 196 151 197 /* Solaris globals. */ -
trunk/src/VBox/Runtime/r0drv/solaris/threadctxhooks-r0drv-solaris.c
r47206 r47302 121 121 * invoke the consumer's hook or not. 122 122 */ 123 installctx(curthread, 124 pThis, 125 rtThreadCtxHooksSolPreempting, 126 rtThreadCtxHooksSolResumed, 127 NULL, /* fork */ 128 NULL, /* lwp_create */ 129 NULL, /* exit */ 130 NULL); /* free */ 123 if (g_frtSolOldThreadCtx) 124 { 125 g_rtSolThreadCtx.Install.pfnSol_installctx_old(curthread, 126 pThis, 127 rtThreadCtxHooksSolPreempting, 128 rtThreadCtxHooksSolResumed, 129 NULL, /* fork */ 130 NULL, /* lwp_create */ 131 NULL); /* free */ 132 } 133 else 134 { 135 g_rtSolThreadCtx.Install.pfnSol_installctx(curthread, 136 pThis, 137 rtThreadCtxHooksSolPreempting, 138 rtThreadCtxHooksSolResumed, 139 NULL, /* fork */ 140 NULL, /* lwp_create */ 141 NULL, /* exit */ 142 NULL); /* free */ 143 } 131 144 132 145 *phThreadCtx = pThis; … … 151 164 * Deregister the hook. 152 165 */ 153 int rc = removectx(curthread, 154 pThis, 155 rtThreadCtxHooksSolPreempting, 156 rtThreadCtxHooksSolResumed, 157 NULL, /* fork */ 158 NULL, /* lwp_create */ 159 NULL, /* exit */ 160 NULL); /* free */ 166 int rc; 167 if (g_frtSolOldThreadCtx) 168 { 169 rc = g_rtSolThreadCtx.Remove.pfnSol_removectx_old(curthread, 170 pThis, 171 rtThreadCtxHooksSolPreempting, 172 rtThreadCtxHooksSolResumed, 173 NULL, /* fork */ 174 NULL, /* lwp_create */ 175 NULL); /* free */ 176 } 177 else 178 { 179 rc = g_rtSolThreadCtx.Remove.pfnSol_removectx(curthread, 180 pThis, 181 rtThreadCtxHooksSolPreempting, 182 rtThreadCtxHooksSolResumed, 183 NULL, /* fork */ 184 NULL, /* lwp_create */ 185 NULL, /* exit */ 186 NULL); /* free */ 187 } 161 188 AssertMsg(rc, ("removectx failed. rc=%d\n", rc)); 162 189 NOREF(rc); -
trunk/src/VBox/Runtime/testcase/tstR0ThreadPreemption.cpp
r47206 r47302 293 293 } 294 294 295 PTSTRTR0THREADCTXDATA pCtxData = (PTSTRTR0THREADCTXDATA)RTMemAlloc (sizeof(*pCtxData));295 PTSTRTR0THREADCTXDATA pCtxData = (PTSTRTR0THREADCTXDATA)RTMemAllocZ(sizeof(*pCtxData)); 296 296 AssertReturn(pCtxData, VERR_NO_MEMORY); 297 297 pCtxData->u32Magic = TSTRTR0THREADCTXDATA_MAGIC;
Note:
See TracChangeset
for help on using the changeset viewer.