Changeset 7331 in vbox for trunk/src/VBox/Runtime/r0drv
- Timestamp:
- Mar 6, 2008 4:09:57 PM (17 years ago)
- Location:
- trunk/src/VBox/Runtime/r0drv/solaris
- Files:
-
- 1 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r0drv/solaris/mp-r0drv-solaris.c
r7313 r7331 32 32 33 33 #include <iprt/mp.h> 34 #include <iprt/cpuset.h> 34 35 #include <iprt/err.h> 35 36 #include <iprt/asm.h> … … 39 40 RTDECL(RTCPUID) RTMpCpuId(void) 40 41 { 41 return ???; 42 } 43 44 45 /** 46 * Wrapper between the native solaris per-cpu callback and PFNRTWORKER 42 return cpuid_get_chipid(CPU); /* is there a better way? */ 43 } 44 45 46 RTDECL(bool) RTMpIsCpuOnline(RTCPUID idCpu) 47 { 48 cpu_t *pCpu = idCpu < NCPU ? cpu_get(idCpu) : NULL; 49 return pCpu 50 && cpu_is_online(pCpu); 51 } 52 53 54 RTDECL(bool) RTMpDoesCpuExist(RTCPUID idCpu) 55 { 56 cpu_t *pCpu = idCpu < NCPU ? cpu_get(idCpu) : NULL; 57 return pCpu != NULL; 58 } 59 60 61 RTDECL(int) RTMpCpuIdToSetIndex(RTCPUID idCpu) 62 { 63 return idCpu < NCPU ? idCpu : -1; 64 } 65 66 67 RTDECL(RTCPUID) RTMpCpuIdFromSetIndex(int iCpu) 68 { 69 return (unsigned)iCpu < NCPU ? iCpu : NIL_RTCPUID; 70 } 71 72 73 RTDECL(PRTCPUSET) RTMpGetSet(PRTCPUSET pSet) 74 { 75 RTCPUID idCpu; 76 77 RTCpuSetEmpty(pSet); 78 idCpu = RTMpGetMaxCpuId(); /* it's inclusive */ 79 do 80 { 81 if (RTMpDoesCpuExist(idCpu)) 82 RTCpuSetAdd(pSet, idCpu); 83 } while (idCpu-- > 0); 84 85 return pSet; 86 } 87 88 89 RTDECL(RTCPUID) RTMpGetCount(void) 90 { 91 return ncpus; 92 } 93 94 95 RTDECL(PRTCPUSET) RTMpGetOnlineSet(PRTCPUSET pSet) 96 { 97 RTCPUID idCpu; 98 99 RTCpuSetEmpty(pSet); 100 idCpu = RTMpGetMaxCpuId(); /* it's inclusive */ 101 do 102 { 103 if (RTMpIsCpuOnline(idCpu)) 104 RTCpuSetAdd(pSet, idCpu); 105 } while (idCpu-- > 0); 106 107 return pSet; 108 } 109 110 111 RTDECL(RTCPUID) RTMpGetOnlineCount(void) 112 { 113 return ncpus_online; 114 } 115 116 117 118 /** 119 * Wrapper between the native solaris per-cpu callback and PFNRTWORKER 47 120 * for the RTMpOnAll API. 48 * 49 * @param u64 Pointer to the RTMPARGS package. 50 * @param u64Ignored Ignored. 51 */ 52 static void rtmpOnAllSolarisWrapper(uint64_t u64, uint64_t u64Ignored) 53 { 54 PRTMPARGS pArgs = (PRTMPARGS)(uintptr_t)u64; 121 * 122 * @param uArgs Pointer to the RTMPARGS package. 123 * @param uIgnored1 Ignored. 124 * @param uIgnored2 Ignored. 125 */ 126 static int rtmpOnAllSolarisWrapper(xc_arg_t uArg, xc_arg_t uIgnored1, xc_arg_t uIgnored2) 127 { 128 PRTMPARGS pArgs = (PRTMPARGS)(uArg); 129 55 130 pArgs->pfnWorker(RTMpCpuId(), pArgs->pvUser1, pArgs->pvUser2); 56 NOREF(u64Ignored); 131 132 NOREF(uIgnored1); 133 NOREF(uIgnored2); 134 return 0; 57 135 } 58 136 … … 60 138 RTDECL(int) RTMpOnAll(PFNRTMPWORKER pfnWorker, void *pvUser1, void *pvUser2) 61 139 { 140 cpuset_t Set; 62 141 RTMPARGS Args; 142 63 143 Args.pfnWorker = pfnWorker; 64 144 Args.pvUser1 = pvUser1; … … 66 146 Args.idCpu = NIL_RTCPUID; 67 147 Args.cHits = 0; 68 xt_all(rtmpOnAllSolarisWrapper, (uintptr_t)&Args, 0); 148 149 CPUSET_ALL(Set); 150 xc_call((uintptr_t)&Args, 0, 0, X_CALL_HIPRI, Set, rtmpOnAllSolarisWrapper); 151 69 152 return VINF_SUCCESS; 70 153 } 71 154 72 155 73 /** 74 * Wrapper between the native solaris per-cpu callback and PFNRTWORKER 156 /** 157 * Wrapper between the native solaris per-cpu callback and PFNRTWORKER 75 158 * for the RTMpOnOthers API. 76 * 77 * @param u64 Pointer to the RTMPARGS package. 78 * @param u64Ignored Ignored. 79 */ 80 static void rtmpOnOthersSolarisWrapper(uint64_t u64, uint64_t u64Ignored) 81 { 82 PRTMPARGS pArgs = (PRTMPARGS)(uintptr_t)u64; 159 * 160 * @param uArgs Pointer to the RTMPARGS package. 161 * @param uIgnored1 Ignored. 162 * @param uIgnored2 Ignored. 163 */ 164 static int rtmpOnOthersSolarisWrapper(xc_arg_t uArg, xc_arg_t uIgnored1, xc_arg_t uIgnored2) 165 { 166 PRTMPARGS pArgs = (PRTMPARGS)(uArg); 83 167 RTCPUID idCpu = RTMpCpuId(); 84 if (idCpu != pArgs->idCpu) 85 pArgs->pfnWorker(RTMpCpuId(), pArgs->pvUser1, pArgs->pvUser2); 86 NOREF(u64Ignored); 168 169 Assert(idCpu != pArgs->idCpu); 170 pArgs->pfnWorker(idCpu, pArgs->pvUser1, pArgs->pvUser2); 171 172 NOREF(uIgnored1); 173 NOREF(uIgnored2); 174 return 0; 87 175 } 88 176 … … 91 179 { 92 180 int rc; 181 cpuset_t Set; 93 182 RTMPARGS Args; 183 94 184 Args.pfnWorker = pfnWorker; 95 185 Args.pvUser1 = pvUser1; 96 186 Args.pvUser2 = pvUser2; 97 Args.idCpu = NIL_RTCPUID;187 Args.idCpu = RTMpCpuId(); 98 188 Args.cHits = 0; 99 xt_all(rtmpOnOthersSolarisWrapper, (uintptr_t)&Args, 0); 189 190 CPUSET_ALL_BUT(Set, Args.idCpu); 191 xc_call((uintptr_t)&Args, 0, 0, X_CALL_HIPRI, Set, rtmpOnOthersSolarisWrapper); 192 100 193 return VINF_SUCCESS; 101 194 } 102 195 103 196 104 /** 105 * Wrapper between the native solaris per-cpu callback and PFNRTWORKER 197 /** 198 * Wrapper between the native solaris per-cpu callback and PFNRTWORKER 106 199 * for the RTMpOnSpecific API. 107 * 108 * @param pvArg Pointer to the RTMPARGS package. 109 */ 110 static void rtmpOnSpecificSolarisWrapper(void *pvArg) 111 { 112 PRTMPARGS pArgs = (PRTMPARGS)pvArg; 113 Assert(pArgs->idCpu == RTMpCpuId()); 200 * 201 * 202 * @param uArgs Pointer to the RTMPARGS package. 203 * @param uIgnored1 Ignored. 204 * @param uIgnored2 Ignored. 205 */ 206 static int rtmpOnSpecificSolarisWrapper(xc_arg_t uArg, xc_arg_t uIgnored1, xc_arg_t uIgnored2) 207 { 208 PRTMPARGS pArgs = (PRTMPARGS)(uArg); 209 RTCPUID idCpu = RTMpCpuId(); 210 211 Assert(idCpu != pArgs->idCpu); 114 212 pArgs->pfnWorker(idCpu, pArgs->pvUser1, pArgs->pvUser2); 115 213 ASMAtomicIncU32(&pArgs->cHits); 214 215 NOREF(uIgnored1); 216 NOREF(uIgnored2); 217 return 0; 116 218 } 117 219 … … 120 222 { 121 223 int rc; 224 cpuset_t Set; 122 225 RTMPARGS Args; 226 123 227 Args.pfnWorker = pfnWorker; 124 228 Args.pvUser1 = pvUser1; … … 126 230 Args.idCpu = idCpu; 127 231 Args.cHits = 0; 128 xt_one(idCpu, rtmpOnSpecificSolarisWrapper, (uintptr_t)&Args, 0); 129 return Args.cHits == 1 130 ? VINF_SUCCESS 232 233 CPUSET_ZERO(Set); 234 AssertReturn(idCpu < NCPU, VERR_INVALID_PARAMETER); 235 CPUSET_ADD(Set, idCpu); 236 237 xc_call((uintptr_t)&Args, 0, 0, X_CALL_HIPRI, Set, rtmpOnSpecificSolarisWrapper); 238 Assert(ASMAtomicUoReadU32(&Args.cHits) <= 1); 239 240 return ASMAtomicUoReadU32(&Args.cHits) == 1 241 ? VINF_SUCCESS 131 242 : VERR_CPU_NOT_FOUND; 132 243 } -
trunk/src/VBox/Runtime/r0drv/solaris/the-solaris-kernel.h
r6147 r7331 28 28 #define ___the_solaris_kernel_h 29 29 30 #define _MACHDEP /* needed for cpuset_t and sys/x_call.h */ 31 30 32 #include <sys/kmem.h> 31 33 #include <sys/types.h> … … 42 44 #include <sys/cyclic.h> 43 45 #include <sys/class.h> 46 #include <sys/cpuvar.h> 47 #include <sys/x_call.h> /* in platform dir */ 48 #include <sys/x86_archext.h> 44 49 #include <vm/hat.h> 45 50 #include <vm/seg_vn.h>
Note:
See TracChangeset
for help on using the changeset viewer.