Rev 2618 | Rev 2620 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2618 | Rev 2619 | ||
---|---|---|---|
Line 373... | Line 373... | ||
373 | } |
373 | } |
374 | 374 | ||
375 | 375 | ||
376 | /** Answer a received call - fast version. |
376 | /** Answer a received call - fast version. |
377 | * |
377 | * |
378 | * The fast answer makes use of passing retval and first two arguments in |
378 | * The fast answer makes use of passing retval and first four arguments in |
379 | * registers. If you need to return more, use the ipc_answer() instead. |
379 | * registers. If you need to return more, use the ipc_answer_slow() instead. |
380 | * |
380 | * |
381 | * @param callid Hash of the call being answered. |
381 | * @param callid Hash of the call being answered. |
382 | * @param retval Return value. |
382 | * @param retval Return value. |
383 | * @param arg1 First return argument. |
383 | * @param arg1 First return argument. |
384 | * @param arg2 Second return argument. |
384 | * @param arg2 Second return argument. |
- | 385 | * @param arg3 Third return argument. |
|
- | 386 | * @param arg4 Fourth return argument. |
|
385 | * |
387 | * |
386 | * @return Zero on success or a value from @ref errno.h on failure. |
388 | * @return Zero on success or a value from @ref errno.h on failure. |
387 | */ |
389 | */ |
388 | ipcarg_t ipc_answer_fast(ipc_callid_t callid, ipcarg_t retval, ipcarg_t arg1, |
390 | ipcarg_t ipc_answer_fast(ipc_callid_t callid, ipcarg_t retval, ipcarg_t arg1, |
389 | ipcarg_t arg2) |
391 | ipcarg_t arg2, ipcarg_t arg3, ipcarg_t arg4) |
390 | { |
392 | { |
391 | return __SYSCALL4(SYS_IPC_ANSWER_FAST, callid, retval, arg1, arg2); |
393 | return __SYSCALL6(SYS_IPC_ANSWER_FAST, callid, retval, arg1, arg2, arg3, |
- | 394 | arg4); |
|
392 | } |
395 | } |
393 | 396 | ||
394 | /** Answer a received call - full version. |
397 | /** Answer a received call - slow full version. |
395 | * |
398 | * |
396 | * @param callid Hash of the call being answered. |
399 | * @param callid Hash of the call being answered. |
- | 400 | * @param retval Return value. |
|
397 | * @param call Call structure with the answer. |
401 | * @param arg1 First return argument. |
- | 402 | * @param arg2 Second return argument. |
|
- | 403 | * @param arg3 Third return argument. |
|
- | 404 | * @param arg4 Fourth return argument. |
|
398 | * Must be already initialized by the responder. |
405 | * @param arg5 Fifth return argument. |
399 | * |
406 | * |
400 | * @return Zero on success or a value from @ref errno.h on failure. |
407 | * @return Zero on success or a value from @ref errno.h on failure. |
401 | */ |
408 | */ |
402 | ipcarg_t ipc_answer(ipc_callid_t callid, ipc_call_t *call) |
409 | ipcarg_t ipc_answer_slow(ipc_callid_t callid, ipcarg_t retval, ipcarg_t arg1, |
- | 410 | ipcarg_t arg2, ipcarg_t arg3, ipcarg_t arg4, ipcarg_t arg5) |
|
403 | { |
411 | { |
- | 412 | ipc_call_t data; |
|
- | 413 | ||
- | 414 | IPC_SET_RETVAL(data, retval); |
|
- | 415 | IPC_SET_ARG1(data, arg1); |
|
- | 416 | IPC_SET_ARG2(data, arg2); |
|
- | 417 | IPC_SET_ARG3(data, arg3); |
|
- | 418 | IPC_SET_ARG4(data, arg4); |
|
- | 419 | IPC_SET_ARG5(data, arg5); |
|
- | 420 | ||
404 | return __SYSCALL2(SYS_IPC_ANSWER, callid, (sysarg_t) call); |
421 | return __SYSCALL2(SYS_IPC_ANSWER_SLOW, callid, (sysarg_t) &data); |
405 | } |
422 | } |
406 | 423 | ||
407 | 424 | ||
408 | /** Try to dispatch queued calls from the async queue. */ |
425 | /** Try to dispatch queued calls from the async queue. */ |
409 | static void try_dispatch_queued_calls(void) |
426 | static void try_dispatch_queued_calls(void) |
Line 656... | Line 673... | ||
656 | * |
673 | * |
657 | * So far, this wrapper is to be used from within a connection fibril. |
674 | * So far, this wrapper is to be used from within a connection fibril. |
658 | * |
675 | * |
659 | * @param callid Storage where the hash of the IPC_M_DATA_SEND call will |
676 | * @param callid Storage where the hash of the IPC_M_DATA_SEND call will |
660 | * be stored. |
677 | * be stored. |
661 | * @param call Storage where the incoming call will be stored. |
- | |
662 | * @param dst Storage where the suggested destination address will |
678 | * @param dst Storage where the suggested destination address will |
663 | * be stored. May be NULL. |
679 | * be stored. May be NULL. |
664 | * @param size Storage where the suggested size will be stored. May be |
680 | * @param size Storage where the suggested size will be stored. May be |
665 | * NULL |
681 | * NULL |
666 | * |
682 | * |
667 | * @return Non-zero on success, zero on failure. |
683 | * @return Non-zero on success, zero on failure. |
668 | */ |
684 | */ |
669 | int ipc_data_receive(ipc_callid_t *callid, ipc_call_t *call, void **dst, |
685 | int ipc_data_receive(ipc_callid_t *callid, void **dst, size_t *size) |
670 | size_t *size) |
- | |
671 | { |
686 | { |
- | 687 | ipc_call_t data; |
|
- | 688 | ||
672 | assert(callid); |
689 | assert(callid); |
673 | assert(call); |
- | |
674 | 690 | ||
675 | *callid = async_get_call(call); |
691 | *callid = async_get_call(&data); |
676 | if (IPC_GET_METHOD(*call) != IPC_M_DATA_SEND) |
692 | if (IPC_GET_METHOD(data) != IPC_M_DATA_SEND) |
677 | return 0; |
693 | return 0; |
678 | if (dst) |
694 | if (dst) |
679 | *dst = (void *) IPC_GET_ARG1(*call); |
695 | *dst = (void *) IPC_GET_ARG1(data); |
680 | if (size) |
696 | if (size) |
681 | *size = (size_t) IPC_GET_ARG3(*call); |
697 | *size = (size_t) IPC_GET_ARG3(data); |
682 | return 1; |
698 | return 1; |
683 | } |
699 | } |
684 | 700 | ||
685 | /** Wrapper for answering the IPC_M_DATA_SEND calls. |
701 | /** Wrapper for answering the IPC_M_DATA_SEND calls. |
686 | * |
702 | * |
687 | * This wrapper only makes it more comfortable to answer IPC_M_DATA_SEND calls |
703 | * This wrapper only makes it more comfortable to answer IPC_M_DATA_SEND calls |
688 | * so that the user doesn't have to remember the meaning of each IPC argument. |
704 | * so that the user doesn't have to remember the meaning of each IPC argument. |
689 | * |
705 | * |
690 | * @param callid Hash of the IPC_M_DATA_SEND call to answer. |
706 | * @param callid Hash of the IPC_M_DATA_SEND call to answer. |
691 | * @param call Call structure with the request. |
- | |
692 | * @param dst Final destination address for the IPC_M_DATA_SEND call. |
707 | * @param dst Final destination address for the IPC_M_DATA_SEND call. |
693 | * @param size Final size for the IPC_M_DATA_SEND call. |
708 | * @param size Final size for the IPC_M_DATA_SEND call. |
694 | * |
709 | * |
695 | * @return Zero on success or a value from @ref errno.h on failure. |
710 | * @return Zero on success or a value from @ref errno.h on failure. |
696 | */ |
711 | */ |
697 | ipcarg_t ipc_data_deliver(ipc_callid_t callid, ipc_call_t *call, void *dst, |
712 | ipcarg_t ipc_data_deliver(ipc_callid_t callid, void *dst, size_t size) |
698 | size_t size) |
- | |
699 | { |
713 | { |
700 | IPC_SET_RETVAL(*call, EOK); |
- | |
701 | IPC_SET_ARG1(*call, (ipcarg_t) dst); |
- | |
702 | IPC_SET_ARG3(*call, (ipcarg_t) size); |
- | |
703 | return ipc_answer(callid, call); |
714 | return ipc_answer_3(callid, EOK, (ipcarg_t) dst, 0, (ipcarg_t) size); |
704 | } |
715 | } |
705 | 716 | ||
706 | /** @} |
717 | /** @} |
707 | */ |
718 | */ |