Changeset 21452 in vbox for trunk/src/VBox/Runtime
- Timestamp:
- Jul 9, 2009 5:43:31 PM (16 years ago)
- svn:sync-xref-src-repo-rev:
- 49866
- Location:
- trunk/src/VBox/Runtime/r0drv/solaris/vbi
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r0drv/solaris/vbi/i86pc/os/vbi.c
r20471 r21452 56 56 #include <sys/modctl.h> 57 57 #include <sys/machparam.h> 58 #include <sys/utsname.h> 58 59 59 60 #include "vbi.h" … … 111 112 */ 112 113 static struct modlmisc vbi_modlmisc = { 113 &mod_miscops, "VirtualBox Interfaces V 5"114 &mod_miscops, "VirtualBox Interfaces V6" 114 115 }; 115 116 … … 124 125 125 126 #define VBI_VERBOSE(msg) {if (vbi_verbose) cmn_err(CE_WARN, msg);} 127 128 /* Introduced in v6 */ 129 static int vbi_is_nevada = 0; 130 131 #ifdef _LP64 132 /* 64-bit Solaris 10 offsets */ 133 /* CPU */ 134 static int off_s10_cpu_runrun = 232; 135 static int off_s10_cpu_kprunrun = 233; 136 /* kthread_t */ 137 static int off_s10_t_preempt = 42; 138 139 /* 64-bit Solaris 11 (Nevada/OpenSolaris) offsets */ 140 /* CPU */ 141 static int off_s11_cpu_runrun = 216; 142 static int off_s11_cpu_kprunrun = 217; 143 /* kthread_t */ 144 static int off_s11_t_preempt = 42; 145 #else 146 /* 32-bit Solaris 10 offsets */ 147 /* CPU */ 148 static int off_s10_cpu_runrun = 124; 149 static int off_s10_cpu_kprunrun = 125; 150 /* kthread_t */ 151 static int off_s10_t_preempt = 26; 152 153 /* 32-bit Solaris 11 (Nevada/OpenSolaris) offsets */ 154 /* CPU */ 155 static int off_s11_cpu_runrun = 112; 156 static int off_s11_cpu_kprunrun = 113; 157 /* kthread_t */ 158 static int off_s11_t_preempt = 26; 159 #endif 160 161 162 /* Which offsets will be used */ 163 static int off_cpu_runrun = -1; 164 static int off_cpu_kprunrun = -1; 165 static int off_t_preempt = -1; 166 167 #define VBI_T_PREEMPT (*((char *)curthread + off_t_preempt)) 168 #define VBI_CPU_KPRUNRUN (*((char *)CPU + off_cpu_kprunrun)) 169 #define VBI_CPU_RUNRUN (*((char *)CPU + off_cpu_runrun)) 170 171 #undef kpreempt_disable 172 #undef kpreempt_enable 173 174 #define VBI_PREEMPT_DISABLE() \ 175 { \ 176 VBI_T_PREEMPT++; \ 177 ASSERT(VBI_T_PREEMPT >= 1); \ 178 } 179 #define VBI_PREEMPT_ENABLE() \ 180 { \ 181 ASSERT(VBI_T_PREEMPT >= 1); \ 182 if (--VBI_T_PREEMPT == 0 && \ 183 VBI_CPU_RUNRUN) \ 184 kpreempt(KPREEMPT_SYNC); \ 185 } 186 187 /* End of v6 intro */ 188 126 189 127 190 int … … 161 224 } 162 225 226 /* 227 * Check if this is S10 or Nevada 228 */ 229 if (!strncmp(utsname.release, "5.11", sizeof("5.11") - 1)) 230 { 231 /* Nevada detected... */ 232 vbi_is_nevada = 1; 233 234 off_cpu_runrun = off_s11_cpu_runrun; 235 off_cpu_kprunrun = off_s11_cpu_kprunrun; 236 off_t_preempt = off_s11_t_preempt; 237 } 238 else 239 { 240 /* Solaris 10 detected... */ 241 vbi_is_nevada = 0; 242 243 off_cpu_runrun = off_s10_cpu_runrun; 244 off_cpu_kprunrun = off_s10_cpu_kprunrun; 245 off_t_preempt = off_s10_t_preempt; 246 } 247 248 /* 249 * Sanity checking... 250 */ 251 /* CPU */ 252 char crr = VBI_CPU_RUNRUN; 253 char krr = VBI_CPU_KPRUNRUN; 254 if ( (crr < 0 || crr > 1) 255 || (krr < 0 || krr > 1)) 256 { 257 cmn_err(CE_NOTE, ":CPU structure sanity check failed! OS version mismatch.\n"); 258 return EINVAL; 259 } 260 261 /* Thread */ 262 char t_preempt = VBI_T_PREEMPT; 263 if (t_preempt < 0 || t_preempt > 32) 264 { 265 cmn_err(CE_NOTE, ":Thread structure sanity check failed! OS version mismatch.\n"); 266 return EINVAL; 267 } 268 163 269 err = mod_install(&vbi_modlinkage); 164 270 if (err != 0) … … 287 393 int rv = 0; 288 394 289 kpreempt_disable(); 290 if (curthread->t_preempt == 1 && CPU->cpu_kprunrun) 395 vbi_preempt_disable(); 396 397 char tpr = VBI_T_PREEMPT; 398 char kpr = VBI_CPU_KPRUNRUN; 399 if (tpr == 1 && kpr) 291 400 rv = 1; 292 kpreempt_enable(); 401 402 vbi_preempt_enable(); 293 403 return (rv); 294 404 } … … 474 584 vbi_preempt_disable(void) 475 585 { 476 kpreempt_disable();586 VBI_PREEMPT_DISABLE(); 477 587 } 478 588 … … 480 590 vbi_preempt_enable(void) 481 591 { 482 kpreempt_enable();592 VBI_PREEMPT_ENABLE(); 483 593 } 484 594 … … 1069 1179 vbi_is_preempt_enabled(void) 1070 1180 { 1071 return (curthread->t_preempt == 0); 1181 char tpr = VBI_T_PREEMPT; 1182 return (tpr == 0); 1072 1183 } 1073 1184 … … 1084 1195 * increased. Also change vbi_modlmisc at the top of the file. 1085 1196 */ 1086 uint_t vbi_revision_level = 5;1197 uint_t vbi_revision_level = 6; 1087 1198 1088 1199 void * … … 1097 1208 p_contig_free(va, size); 1098 1209 } 1210 1211 /* 1212 * This is revision 6 of the interface. 1213 */ 1214 1215 int 1216 vbi_is_preempt_pending(void) 1217 { 1218 char crr = VBI_CPU_RUNRUN; 1219 char krr = VBI_CPU_KPRUNRUN; 1220 return crr != 0 || krr != 0; 1221 } 1222 -
trunk/src/VBox/Runtime/r0drv/solaris/vbi/i86pc/sys/vbi.h
r20480 r21452 331 331 /* end of interfaces defined for version 5 */ 332 332 333 /* begin interfaces defined for version 6 */ 334 extern int vbi_is_preempt_pending(void); 335 336 /* end of interfaces defined for version 6 */ 337 333 338 #ifdef __cplusplus 334 339 } -
trunk/src/VBox/Runtime/r0drv/solaris/vbi/thread-r0drv-solaris.c
r20124 r21452 108 108 Assert(hThread == NIL_RTTHREAD); 109 109 /** @todo Review this! */ 110 return CPU->cpu_runrun != 0 111 || CPU->cpu_kprunrun != 0; 110 return !!vbi_is_preempt_pending(); 112 111 } 113 112
Note:
See TracChangeset
for help on using the changeset viewer.