- Timestamp:
- Sep 14, 2009 3:55:46 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMReq.cpp
r20880 r23010 190 190 int rc = VMR3ReqCallVU(pVM->pUVM, idDstCpu, ppReq, cMillies, fFlags, pfnFunction, cArgs, va); 191 191 va_end(va); 192 return rc; 193 } 194 195 196 /** 197 * Convenience wrapper for VMR3ReqCallU. 198 * 199 * This assumes (1) you're calling a function that returns an VBox status code, 200 * (2) that you want it's return code on success, and (3) that you wish to wait 201 * for ever for it to return. 202 * 203 * @returns VBox status code. In the unlikely event that VMR3ReqCallVU fails, 204 * its status code is return. Otherwise, the status of pfnFunction is 205 * returned. 206 * 207 * @param pVM Pointer to the shared VM structure. 208 * @param idDstCpu The destination CPU(s). Either a specific CPU ID or 209 * one of the following special values: 210 * VMCPUID_ANY, VMCPUID_ANY_QUEUE, VMCPUID_ALL or VMCPUID_ALL_REVERSE. 211 * @param pfnFunction Pointer to the function to call. 212 * @param cArgs Number of arguments following in the ellipsis. 213 * Not possible to pass 64-bit arguments! 214 * @param ... Function arguments. 215 * 216 * @remarks Use VMR3ReqCallWaitU where possible. 217 */ 218 VMMR3DECL(int) VMR3ReqCallWait(PVM pVM, VMCPUID idDstCpu, PFNRT pfnFunction, unsigned cArgs, ...) 219 { 220 PVMREQ pReq; 221 va_list va; 222 va_start(va, cArgs); 223 int rc = VMR3ReqCallVU(pVM->pUVM, idDstCpu, &pReq, RT_INDEFINITE_WAIT, VMREQFLAGS_VBOX_STATUS, 224 pfnFunction, cArgs, va); 225 va_end(va); 226 if (RT_SUCCESS(rc)) 227 rc = pReq->iStatus; 228 VMR3ReqFree(pReq); 229 return rc; 230 } 231 232 233 /** 234 * Convenience wrapper for VMR3ReqCallU. 235 * 236 * This assumes (1) you're calling a function that returns an VBox status code, 237 * (2) that you want it's return code on success, and (3) that you wish to wait 238 * for ever for it to return. 239 * 240 * @returns VBox status code. In the unlikely event that VMR3ReqCallVU fails, 241 * its status code is return. Otherwise, the status of pfnFunction is 242 * returned. 243 * 244 * @param pUVM Pointer to the user mode VM structure. 245 * @param idDstCpu The destination CPU(s). Either a specific CPU ID or 246 * one of the following special values: 247 * VMCPUID_ANY, VMCPUID_ANY_QUEUE, VMCPUID_ALL or VMCPUID_ALL_REVERSE. 248 * @param pfnFunction Pointer to the function to call. 249 * @param cArgs Number of arguments following in the ellipsis. 250 * Not possible to pass 64-bit arguments! 251 * @param ... Function arguments. 252 */ 253 VMMR3DECL(int) VMR3ReqCallWaitU(PUVM pUVM, VMCPUID idDstCpu, PFNRT pfnFunction, unsigned cArgs, ...) 254 { 255 PVMREQ pReq; 256 va_list va; 257 va_start(va, cArgs); 258 int rc = VMR3ReqCallVU(pUVM, idDstCpu, &pReq, RT_INDEFINITE_WAIT, VMREQFLAGS_VBOX_STATUS, 259 pfnFunction, cArgs, va); 260 va_end(va); 261 if (RT_SUCCESS(rc)) 262 rc = pReq->iStatus; 263 VMR3ReqFree(pReq); 264 return rc; 265 } 266 267 268 /** 269 * Convenience wrapper for VMR3ReqCallU. 270 * 271 * This assumes (1) you're calling a function that returns an VBox status code 272 * and that you do not wish to wait for it to complete. 273 * 274 * @returns VBox status code returned by VMR3ReqCallVU. 275 * 276 * @param pVM Pointer to the shared VM structure. 277 * @param idDstCpu The destination CPU(s). Either a specific CPU ID or 278 * one of the following special values: 279 * VMCPUID_ANY, VMCPUID_ANY_QUEUE, VMCPUID_ALL or VMCPUID_ALL_REVERSE. 280 * @param pfnFunction Pointer to the function to call. 281 * @param cArgs Number of arguments following in the ellipsis. 282 * Not possible to pass 64-bit arguments! 283 * @param ... Function arguments. 284 * 285 * @remarks Use VMR3ReqCallNoWaitU where possible. 286 */ 287 VMMR3DECL(int) VMR3ReqCallNoWait(PVM pVM, VMCPUID idDstCpu, PFNRT pfnFunction, unsigned cArgs, ...) 288 { 289 va_list va; 290 va_start(va, cArgs); 291 int rc = VMR3ReqCallVU(pVM->pUVM, idDstCpu, NULL, 0, VMREQFLAGS_VBOX_STATUS | VMREQFLAGS_NO_WAIT, 292 pfnFunction, cArgs, va); 293 va_end(va); 294 return rc; 295 } 296 297 298 /** 299 * Convenience wrapper for VMR3ReqCallU. 300 * 301 * This assumes (1) you're calling a function that returns an VBox status code 302 * and that you do not wish to wait for it to complete. 303 * 304 * @returns VBox status code returned by VMR3ReqCallVU. 305 * 306 * @param pUVM Pointer to the user mode VM structure. 307 * @param idDstCpu The destination CPU(s). Either a specific CPU ID or 308 * one of the following special values: 309 * VMCPUID_ANY, VMCPUID_ANY_QUEUE, VMCPUID_ALL or VMCPUID_ALL_REVERSE. 310 * @param pfnFunction Pointer to the function to call. 311 * @param cArgs Number of arguments following in the ellipsis. 312 * Not possible to pass 64-bit arguments! 313 * @param ... Function arguments. 314 */ 315 VMMR3DECL(int) VMR3ReqCallNoWaitU(PUVM pUVM, VMCPUID idDstCpu, PFNRT pfnFunction, unsigned cArgs, ...) 316 { 317 va_list va; 318 va_start(va, cArgs); 319 int rc = VMR3ReqCallVU(pUVM, idDstCpu, NULL, 0, VMREQFLAGS_VBOX_STATUS | VMREQFLAGS_NO_WAIT, 320 pfnFunction, cArgs, va); 321 va_end(va); 322 return rc; 323 } 324 325 326 /** 327 * Convenience wrapper for VMR3ReqCallU. 328 * 329 * This assumes (1) you're calling a function that returns void, and (2) that 330 * you wish to wait for ever for it to return. 331 * 332 * @returns VBox status code of VMR3ReqCallVU. 333 * 334 * @param pVM Pointer to the shared VM structure. 335 * @param idDstCpu The destination CPU(s). Either a specific CPU ID or 336 * one of the following special values: 337 * VMCPUID_ANY, VMCPUID_ANY_QUEUE, VMCPUID_ALL or VMCPUID_ALL_REVERSE. 338 * @param pfnFunction Pointer to the function to call. 339 * @param cArgs Number of arguments following in the ellipsis. 340 * Not possible to pass 64-bit arguments! 341 * @param ... Function arguments. 342 * 343 * @remarks Use VMR3ReqCallVoidWaitU where possible. 344 */ 345 VMMR3DECL(int) VMR3ReqCallVoidWait(PVM pVM, VMCPUID idDstCpu, PFNRT pfnFunction, unsigned cArgs, ...) 346 { 347 PVMREQ pReq; 348 va_list va; 349 va_start(va, cArgs); 350 int rc = VMR3ReqCallVU(pVM->pUVM, idDstCpu, &pReq, RT_INDEFINITE_WAIT, VMREQFLAGS_VOID, 351 pfnFunction, cArgs, va); 352 va_end(va); 353 VMR3ReqFree(pReq); 354 return rc; 355 } 356 357 358 /** 359 * Convenience wrapper for VMR3ReqCallU. 360 * 361 * This assumes (1) you're calling a function that returns void, and (2) that 362 * you wish to wait for ever for it to return. 363 * 364 * @returns VBox status code of VMR3ReqCallVU. 365 * 366 * @param pUVM Pointer to the user mode VM structure. 367 * @param idDstCpu The destination CPU(s). Either a specific CPU ID or 368 * one of the following special values: 369 * VMCPUID_ANY, VMCPUID_ANY_QUEUE, VMCPUID_ALL or VMCPUID_ALL_REVERSE. 370 * @param pfnFunction Pointer to the function to call. 371 * @param cArgs Number of arguments following in the ellipsis. 372 * Not possible to pass 64-bit arguments! 373 * @param ... Function arguments. 374 */ 375 VMMR3DECL(int) VMR3ReqCallVoidWaitU(PUVM pUVM, VMCPUID idDstCpu, PFNRT pfnFunction, unsigned cArgs, ...) 376 { 377 PVMREQ pReq; 378 va_list va; 379 va_start(va, cArgs); 380 int rc = VMR3ReqCallVU(pUVM, idDstCpu, &pReq, RT_INDEFINITE_WAIT, VMREQFLAGS_VOID, 381 pfnFunction, cArgs, va); 382 va_end(va); 383 VMR3ReqFree(pReq); 384 return rc; 385 } 386 387 388 /** 389 * Convenience wrapper for VMR3ReqCallU. 390 * 391 * This assumes (1) you're calling a function that returns void, and (2) that 392 * you do not wish to wait for it to complete. 393 * 394 * @returns VBox status code of VMR3ReqCallVU. 395 * 396 * @param pVM Pointer to the shared VM structure. 397 * @param idDstCpu The destination CPU(s). Either a specific CPU ID or 398 * one of the following special values: 399 * VMCPUID_ANY, VMCPUID_ANY_QUEUE, VMCPUID_ALL or VMCPUID_ALL_REVERSE. 400 * @param pfnFunction Pointer to the function to call. 401 * @param cArgs Number of arguments following in the ellipsis. 402 * Not possible to pass 64-bit arguments! 403 * @param ... Function arguments. 404 */ 405 VMMR3DECL(int) VMR3ReqCallVoidNoWait(PVM pVM, VMCPUID idDstCpu, PFNRT pfnFunction, unsigned cArgs, ...) 406 { 407 PVMREQ pReq; 408 va_list va; 409 va_start(va, cArgs); 410 int rc = VMR3ReqCallVU(pVM->pUVM, idDstCpu, &pReq, RT_INDEFINITE_WAIT, VMREQFLAGS_VOID | VMREQFLAGS_NO_WAIT, 411 pfnFunction, cArgs, va); 412 va_end(va); 413 VMR3ReqFree(pReq); 414 return rc; 415 } 416 417 418 /** 419 * Convenience wrapper for VMR3ReqCallU. 420 * 421 * This assumes (1) you're calling a function that returns void, and (2) that 422 * you do not wish to wait for it to complete. 423 * 424 * @returns VBox status code of VMR3ReqCallVU. 425 * 426 * @param pUVM Pointer to the user mode VM structure. 427 * @param idDstCpu The destination CPU(s). Either a specific CPU ID or 428 * one of the following special values: 429 * VMCPUID_ANY, VMCPUID_ANY_QUEUE, VMCPUID_ALL or VMCPUID_ALL_REVERSE. 430 * @param pfnFunction Pointer to the function to call. 431 * @param cArgs Number of arguments following in the ellipsis. 432 * Not possible to pass 64-bit arguments! 433 * @param ... Function arguments. 434 */ 435 VMMR3DECL(int) VMR3ReqCallVoidNoWaitU(PUVM pUVM, VMCPUID idDstCpu, PFNRT pfnFunction, unsigned cArgs, ...) 436 { 437 PVMREQ pReq; 438 va_list va; 439 va_start(va, cArgs); 440 int rc = VMR3ReqCallVU(pUVM, idDstCpu, &pReq, RT_INDEFINITE_WAIT, VMREQFLAGS_VOID | VMREQFLAGS_NO_WAIT, 441 pfnFunction, cArgs, va); 442 va_end(va); 443 VMR3ReqFree(pReq); 192 444 return rc; 193 445 } … … 676 928 } 677 929 else if ( pReq->idDstCpu != VMCPUID_ANY /* for a specific VMCPU? */ 678 && pReq->idDstCpu != VMCPUID_ANY_QUEUE 930 && pReq->idDstCpu != VMCPUID_ANY_QUEUE 679 931 && ( !pUVCpu /* and it's not the current thread. */ 680 932 || pUVCpu->idCpu != pReq->idDstCpu))
Note:
See TracChangeset
for help on using the changeset viewer.