Changeset 9309 in vbox
- Timestamp:
- Jun 2, 2008 3:11:59 PM (16 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
-
include/iprt/cpuset.h (modified) (7 diffs)
-
include/iprt/mp.h (modified) (1 diff)
-
src/VBox/Runtime/Makefile.kmk (modified) (8 diffs)
-
src/VBox/Runtime/r0drv/linux/the-linux-kernel.h (modified) (1 diff)
-
src/VBox/Runtime/r0drv/mp-r0drv.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/iprt/cpuset.h
r8245 r9309 33 33 #include <iprt/types.h> 34 34 #include <iprt/mp.h> /* RTMpCpuIdToSetIndex */ 35 #include <iprt/asm.h> 35 36 36 37 … … 81 82 * @param pSet Pointer to the set. 82 83 * @param idCpu The identifier of the CPU to add. 84 * @remarks The modification is atomic. 83 85 */ 84 86 DECLINLINE(int) RTCpuSetAdd(PRTCPUSET pSet, RTCPUID idCpu) … … 87 89 if (RT_UNLIKELY(iCpu < 0)) 88 90 return -1; 89 *pSet |= RT_BIT_64(iCpu);91 ASMAtomicBitSet(pSet, iCpu); 90 92 return 0; 91 93 } … … 98 100 * @param pSet Pointer to the set. 99 101 * @param idCpu The identifier of the CPU to delete. 102 * @remarks The modification is atomic. 100 103 */ 101 104 DECLINLINE(int) RTCpuSetDel(PRTCPUSET pSet, RTCPUID idCpu) … … 104 107 if (RT_UNLIKELY(iCpu < 0)) 105 108 return -1; 106 *pSet &= ~RT_BIT_64(iCpu);109 ASMAtomicBitClear(pSet, iCpu); 107 110 return 0; 108 111 } … … 115 118 * @param pSet Pointer to the set. 116 119 * @param idCpu The identifier of the CPU to look for. 120 * @remarks The test is atomic. 117 121 */ 118 122 DECLINLINE(bool) RTCpuSetIsMember(PCRTCPUSET pSet, RTCPUID idCpu) … … 121 125 if (RT_UNLIKELY(iCpu < 0)) 122 126 return false; 123 return !!(*pSet & RT_BIT_64(iCpu));127 return ASMBitTest((volatile void *)pSet, iCpu); 124 128 } 125 129 -
trunk/include/iprt/mp.h
r8245 r9309 196 196 RTDECL(int) RTMpOnSpecific(RTCPUID idCpu, PFNRTMPWORKER pfnWorker, void *pvUser1, void *pvUser2); 197 197 198 199 /** 200 * MP event, see FNRTMPNOTIFICATION. 201 */ 202 typedef enum RTMPEVENT 203 { 204 /** The CPU goes online. */ 205 RTMPEVENT_ONLINE = 1, 206 /** The CPU goes offline. */ 207 RTMPEVENT_OFFLINE 208 } RTMPEVENT; 209 210 /** 211 * Notification callback. 212 * 213 * The context this is called in differs a bit from platform to 214 * platform, so be careful while in here. 215 * 216 * @param idCpu The CPU this applies to. 217 * @param enmEvent The event. 218 * @param pvUser The user argument. 219 */ 220 typedef DECLCALLBACK(void) FNRTMPNOTIFICATION(RTMPEVENT enmEvent, RTCPUID idCpu, void *pvUser); 221 /** Pointer to a FNRTMPNOTIFICATION(). */ 222 typedef FNRTMPNOTIFICATION *PFNRTMPNOTIFICATION; 223 224 /** 225 * Registers a notification callback for cpu events. 226 * 227 * On platforms which doesn't do cpu offline/online events this API 228 * will just be a no-op that pretends to work. 229 * 230 * @returns IPRT status code. 231 * @retval VINF_SUCCESS on success. 232 * @retval VERR_NO_MEMORY if a registration record cannot be allocated. 233 * @retval VERR_ALREADY_EXISTS if the pfnCallback and pvUser already exist 234 * in the callback list. 235 * 236 * @param pfnCallback The callback. 237 * @param pvUser The user argument to the callback function. 238 */ 239 RTDECL(int) RTMpNotificationRegister(PFNRTMPNOTIFICATION pfnCallback, void *pvUser); 240 241 /** 242 * This deregisters a notification callback registered via RTMpNotificationRegister(). 243 * 244 * The pfnCallback and pvUser arguments must be identical to the registration call 245 * of we won't find the right entry. 246 * 247 * @returns IPRT status code. 248 * @retval VINF_SUCCESS on success. 249 * @retval VERR_NOT_FOUND if no matching entry was found. 250 * 251 * @param pfnCallback The callback. 252 * @param pvUser The user argument to the callback function. 253 */ 254 RTDECL(int) RTMpNotificationDeregister(PFNRTMPNOTIFICATION pfnCallback, void *pvUser); 255 256 /** 257 * Initializes the multiprocessor event notifcations. 258 * 259 * This must be called before calling RTMpNotificationRegister(). This is an 260 * inconvenice caused Visual C++ not implmenting weak externals. 261 * 262 * @returns IPRT status code. 263 * @param pvOS Reserved, pass NULL. 264 */ 265 RTR0DECL(int) RTR0MpNotificationInit(void *pvOS); 266 267 268 /** 269 * Terminates the multiprocessor event notifcations. 270 * 271 * The number of RTR0MpNotificationInit calls must match the calls to this 272 * function exactly. 273 * 274 * @returns IPRT status code. 275 * @param pvOS Reserved, pass NULL. 276 */ 277 RTR0DECL(void) RTR0MpNotificationTerm(void *pvOS); 278 198 279 #endif /* IN_RING0 */ 199 280 -
trunk/src/VBox/Runtime/Makefile.kmk
r9236 r9309 923 923 r0drv/linux/memobj-r0drv-linux.c \ 924 924 r0drv/linux/mp-r0drv-linux.c \ 925 r0drv/linux/mpnotification-r0drv-linux.c \ 925 926 r0drv/linux/process-r0drv-linux.c \ 926 927 r0drv/linux/RTLogWriteDebugger-r0drv-linux.c \ … … 931 932 r0drv/linux/thread-r0drv-linux.c \ 932 933 r0drv/linux/time-r0drv-linux.c \ 933 r0drv/memobj-r0drv.cpp 934 r0drv/memobj-r0drv.cpp \ 935 r0drv/mpnotification-r0drv.c 934 936 ## @todo thread2-r0drv-linux.c, timer-r0drv-linux.c and assert-r0drv-linux.c 937 # r0drv/linux/timer-r0drv-linux.c \ 935 938 936 939 RuntimeR0Drv_SOURCES.win = \ … … 940 943 common/string/strpbrk.cpp \ 941 944 generic/RTAssertDoBreakpoint-generic.cpp \ 942 r0drv/nt/mp-r0drv-nt.cpp \943 945 nt/RTErrConvertFromNtStatus.cpp \ 944 946 r0drv/memobj-r0drv.cpp \ 947 r0drv/mpnotification-r0drv.c \ 945 948 r0drv/nt/alloc-r0drv-nt.cpp \ 946 949 r0drv/nt/initterm-r0drv-nt.cpp \ 947 950 r0drv/nt/memobj-r0drv-nt.cpp \ 951 r0drv/nt/mp-r0drv-nt.cpp \ 952 r0drv/nt/mpnotification-r0drv-nt.cpp \ 948 953 r0drv/nt/process-r0drv-nt.cpp \ 949 954 r0drv/nt/RTLogWriteDebugger-r0drv-nt.cpp \ … … 983 988 generic/timer-generic.cpp \ 984 989 r0drv/generic/RTMpOn-r0drv-generic.cpp \ 990 r0drv/generic/mpnotification-r0drv-generic.cpp \ 985 991 r0drv/darwin/alloc-r0drv-darwin.cpp \ 986 992 r0drv/darwin/assert-r0drv-darwin.cpp \ … … 1028 1034 r0drv/memobj-r0drv.cpp \ 1029 1035 r0drv/generic/RTMpOn-r0drv-generic.cpp \ 1036 r0drv/generic/mpnotification-r0drv-generic.cpp \ 1030 1037 r0drv/os2/alloc-r0drv-os2.cpp \ 1031 1038 r0drv/os2/assert-r0drv-os2.cpp \ … … 1071 1078 generic/RTTimerCreate-generic.cpp \ 1072 1079 r0drv/generic/RTMpOn-r0drv-generic.cpp \ 1080 r0drv/generic/mpnotification-r0drv-generic.cpp \ 1073 1081 r0drv/freebsd/alloc-r0drv-freebsd.c \ 1074 1082 r0drv/freebsd/assert-r0drv-freebsd.c \ … … 1092 1100 generic/RTAssertDoBreakpoint-generic.cpp \ 1093 1101 generic/RTTimerCreate-generic.cpp \ 1094 r0drv/memobj-r0drv.cpp 1102 r0drv/memobj-r0drv.cpp \ 1103 r0drv/mpnotification-r0drv.cpp \ 1104 r0drv/solaris/mpnotification-r0drv-solaris.cpp 1095 1105 1096 1106 ifdef VBOX_WITH_SOLARIS_VBI … … 1193 1203 generic/RTMpIsCpuOnline-generic.cpp \ 1194 1204 r0drv/generic/RTMpOn-r0drv-generic.cpp \ 1205 r0drv/generic/mpnotification-r0drv-generic.cpp \ 1195 1206 r0drv/solaris/alloc-r0drv-solaris.c \ 1196 1207 r0drv/solaris/assert-r0drv-solaris.c \ -
trunk/src/VBox/Runtime/r0drv/linux/the-linux-kernel.h
r9238 r9309 86 86 #endif 87 87 #include <linux/wait.h> 88 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5, 71) 89 # include <linux/cpu.h> 90 #endif 88 91 /* For the basic additions module */ 89 92 #include <linux/pci.h> -
trunk/src/VBox/Runtime/r0drv/mp-r0drv.h
r8245 r9309 46 46 47 47 /** 48 * RTMpOn* argument packet used by the host specific callback 48 * RTMpOn* argument packet used by the host specific callback 49 49 * wrapper functions. 50 50 */ … … 60 60 typedef RTMPARGS *PRTMPARGS; 61 61 62 int rtR0MpNotificationNativeInit(void *pvOS); 63 void rtR0MpNotificationNativeTerm(void *pvOS); 64 void rtMpNotificationDoCallbacks(RTMPEVENT enmEvent, RTCPUID idCpu); 65 62 66 #endif
Note:
See TracChangeset
for help on using the changeset viewer.

