Changeset 3209923 in mainline


Ignore:
Timestamp:
2007-11-20T09:12:49Z (17 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
b74959bd
Parents:
bc50fc42
Message:

Modify asynchronous IPC to make use of all six syscall arguments. The preferred
means of asynchronous communication is now via the set of ipc_call_async_m()
macros, where m is the number of payload arguments passed to the kernel. These
macros will automatically decide between the fast and the universal slow version
of ipc_call_async.

Files:
8 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/include/ipc/sysipc.h

    rbc50fc42 r3209923  
    4545    ipc_data_t *reply);
    4646unative_t sys_ipc_call_async_fast(unative_t phoneid, unative_t method,
    47     unative_t arg1, unative_t arg2);
    48 unative_t sys_ipc_call_async(unative_t phoneid, ipc_data_t *data);
     47    unative_t arg1, unative_t arg2, unative_t arg3, unative_t arg4);
     48unative_t sys_ipc_call_async_slow(unative_t phoneid, ipc_data_t *data);
    4949unative_t sys_ipc_answer_fast(unative_t callid, unative_t retval,
    5050    unative_t arg1, unative_t arg2);
  • kernel/generic/include/syscall/syscall.h

    rbc50fc42 r3209923  
    5151        SYS_IPC_CALL_SYNC_SLOW,
    5252        SYS_IPC_CALL_ASYNC_FAST,
    53         SYS_IPC_CALL_ASYNC,
     53        SYS_IPC_CALL_ASYNC_SLOW,
    5454        SYS_IPC_ANSWER_FAST,
    5555        SYS_IPC_ANSWER,
  • kernel/generic/src/ipc/sysipc.c

    rbc50fc42 r3209923  
    445445/** Make a fast asynchronous call over IPC.
    446446 *
    447  * This function can only handle two arguments of payload, but is faster than
    448  * the generic function sys_ipc_call_async().
     447 * This function can only handle four arguments of payload, but is faster than
     448 * the generic function sys_ipc_call_async_slow().
    449449 *
    450450 * @param phoneid       Phone handle for the call.
     
    452452 * @param arg1          Service-defined payload argument.
    453453 * @param arg2          Service-defined payload argument.
     454 * @param arg3          Service-defined payload argument.
     455 * @param arg4          Service-defined payload argument.
    454456 *
    455457 * @return              Return call hash on success.
     
    459461 */
    460462unative_t sys_ipc_call_async_fast(unative_t phoneid, unative_t method,
    461     unative_t arg1, unative_t arg2)
     463    unative_t arg1, unative_t arg2, unative_t arg3, unative_t arg4)
    462464{
    463465        call_t *call;
     
    474476        IPC_SET_ARG1(call->data, arg1);
    475477        IPC_SET_ARG2(call->data, arg2);
    476         IPC_SET_ARG3(call->data, 0);
     478        IPC_SET_ARG3(call->data, arg3);
     479        IPC_SET_ARG4(call->data, arg4);
    477480
    478481        if (!(res = request_preprocess(call)))
     
    491494 * @return              See sys_ipc_call_async_fast().
    492495 */
    493 unative_t sys_ipc_call_async(unative_t phoneid, ipc_data_t *data)
     496unative_t sys_ipc_call_async_slow(unative_t phoneid, ipc_data_t *data)
    494497{
    495498        call_t *call;
  • kernel/generic/src/syscall/syscall.c

    rbc50fc42 r3209923  
    136136        (syshandler_t) sys_ipc_call_sync_slow,
    137137        (syshandler_t) sys_ipc_call_async_fast,
    138         (syshandler_t) sys_ipc_call_async,
     138        (syshandler_t) sys_ipc_call_async_slow,
    139139        (syshandler_t) sys_ipc_answer_fast,
    140140        (syshandler_t) sys_ipc_answer,
  • uspace/app/tester/ipc/send_async.c

    rbc50fc42 r3209923  
    4949        phoneid = c - '0';
    5050
    51         ipc_call_async(phoneid, 2000, 0, (void *) msgid, callback, 1);
     51        ipc_call_async_0(phoneid, 2000, (void *) msgid, callback, 1);
    5252        printf("Async sent - msg %d\n", msgid);
    5353        msgid++;
  • uspace/lib/libc/generic/ipc.c

    rbc50fc42 r3209923  
    190190static ipc_callid_t _ipc_call_async(int phoneid, ipc_call_t *data)
    191191{
    192         return __SYSCALL2(SYS_IPC_CALL_ASYNC, phoneid, (sysarg_t) data);
     192        return __SYSCALL2(SYS_IPC_CALL_ASYNC_SLOW, phoneid, (sysarg_t) data);
    193193}
    194194
     
    269269/** Make a fast asynchronous call.
    270270 *
    271  * This function can only handle two arguments of payload. It is, however,
    272  * faster than the more generic ipc_call_async_3().
     271 * This function can only handle four arguments of payload. It is, however,
     272 * faster than the more generic ipc_call_async_slow().
    273273 *
    274274 * Note that this function is a void function.
     
    281281 * @param arg1          Service-defined payload argument.
    282282 * @param arg2          Service-defined payload argument.
     283 * @param arg3          Service-defined payload argument.
     284 * @param arg4          Service-defined payload argument.
    283285 * @param private       Argument to be passed to the answer/error callback.
    284286 * @param callback      Answer or error callback.
     
    287289 *                      asynchronous calls.
    288290 */
    289 void ipc_call_async_2(int phoneid, ipcarg_t method, ipcarg_t arg1,
    290     ipcarg_t arg2, void *private, ipc_async_callback_t callback,
    291     int can_preempt)
     291void ipc_call_async_fast(int phoneid, ipcarg_t method, ipcarg_t arg1,
     292    ipcarg_t arg2, ipcarg_t arg3, ipcarg_t arg4, void *private,
     293    ipc_async_callback_t callback, int can_preempt)
    292294{
    293295        async_call_t *call = NULL;
     
    305307         */
    306308        futex_down(&ipc_futex);
    307         callid = __SYSCALL4(SYS_IPC_CALL_ASYNC_FAST, phoneid, method, arg1,
    308             arg2);
     309        callid = __SYSCALL6(SYS_IPC_CALL_ASYNC_FAST, phoneid, method, arg1,
     310            arg2, arg3, arg4);
    309311
    310312        if (callid == IPC_CALLRET_TEMPORARY) {
     
    317319                IPC_SET_ARG1(call->u.msg.data, arg1);
    318320                IPC_SET_ARG2(call->u.msg.data, arg2);
     321                IPC_SET_ARG3(call->u.msg.data, arg3);
     322                IPC_SET_ARG4(call->u.msg.data, arg4);
    319323        }
    320324        ipc_finish_async(callid, phoneid, call, can_preempt);
     
    333337 * @param arg2          Service-defined payload argument.
    334338 * @param arg3          Service-defined payload argument.
     339 * @param arg4          Service-defined payload argument.
     340 * @param arg5          Service-defined payload argument.
    335341 * @param private       Argument to be passed to the answer/error callback.
    336342 * @param callback      Answer or error callback.
     
    340346 *
    341347 */
    342 void ipc_call_async_3(int phoneid, ipcarg_t method, ipcarg_t arg1,
    343     ipcarg_t arg2, ipcarg_t arg3, void *private, ipc_async_callback_t callback,
    344     int can_preempt)
     348void ipc_call_async_slow(int phoneid, ipcarg_t method, ipcarg_t arg1,
     349    ipcarg_t arg2, ipcarg_t arg3, ipcarg_t arg4, ipcarg_t arg5, void *private,
     350    ipc_async_callback_t callback, int can_preempt)
    345351{
    346352        async_call_t *call;
     
    355361        IPC_SET_ARG2(call->u.msg.data, arg2);
    356362        IPC_SET_ARG3(call->u.msg.data, arg3);
     363        IPC_SET_ARG4(call->u.msg.data, arg4);
     364        IPC_SET_ARG5(call->u.msg.data, arg5);
    357365        /*
    358          * We need to make sure that we get callid before another thread accesses
    359          * the queue again.
     366         * We need to make sure that we get callid before another thread
     367         * accesses the queue again.
    360368         */
    361369        futex_down(&ipc_futex);
  • uspace/lib/libc/include/ipc/ipc.h

    rbc50fc42 r3209923  
    3838#include <kernel/ipc/ipc.h>
    3939#include <kernel/ddi/irq.h>
    40 #include <libc.h>
    4140#include <sys/types.h>
    4241#include <kernel/synch/synch.h>
     
    184183    ipcarg_t *result5);
    185184
    186 
    187185extern ipc_callid_t ipc_wait_cycle(ipc_call_t *call, uint32_t usec, int flags);
    188186extern ipc_callid_t ipc_wait_for_call_timeout(ipc_call_t *data, uint32_t usec);
     
    194192
    195193#define ipc_answer_fast_0(callid, retval) \
    196         ipc_answer_fast((callid), (retval), 0, 0)
     194    ipc_answer_fast((callid), (retval), 0, 0)
    197195#define ipc_answer_fast_1(callid, retval, arg1) \
    198         ipc_answer_fast((callid), (retval), (arg1), 0)
     196    ipc_answer_fast((callid), (retval), (arg1), 0)
    199197extern ipcarg_t ipc_answer_fast(ipc_callid_t callid, ipcarg_t retval,
    200198    ipcarg_t arg1, ipcarg_t arg2);
    201199extern ipcarg_t ipc_answer(ipc_callid_t callid, ipc_call_t *call);
    202200
    203 #define ipc_call_async(phoneid, method, arg1, private, callback, can_preempt) \
    204     (ipc_call_async_2(phoneid, method, arg1, 0, private, callback, can_preempt))
    205 extern void ipc_call_async_2(int phoneid, ipcarg_t method, ipcarg_t arg1,
    206     ipcarg_t arg2, void *private, ipc_async_callback_t callback,
    207     int can_preempt);
    208 extern void ipc_call_async_3(int phoneid, ipcarg_t method, ipcarg_t arg1,
    209     ipcarg_t arg2, ipcarg_t arg3, void *private, ipc_async_callback_t callback,
    210     int can_preempt);
     201/*
     202 * User-friendly wrappers for ipc_call_async_fast() and ipc_call_async_slow().
     203 * They are in the form of ipc_call_async_m(), where m is the number of payload
     204 * arguments. The macros decide between the fast and the slow version according
     205 * to m.
     206 */
     207#define ipc_call_async_0(phoneid, method, private, callback, \
     208    can_preempt) \
     209        ipc_call_async_fast((phoneid), (method), 0, 0, 0, 0, (private), \
     210            (callback), (can_preempt))
     211#define ipc_call_async_1(phoneid, method, arg1, private, callback, \
     212    can_preempt) \
     213        ipc_call_async_fast((phoneid), (method), (arg1), 0, 0, 0, (private), \
     214            (callback), (can_preempt))
     215#define ipc_call_async_2(phoneid, method, arg1, arg2, private, callback, \
     216    can_preempt) \
     217        ipc_call_async_fast((phoneid), (method), (arg1), (arg2), 0, 0, \
     218            (private), (callback), (can_preempt))
     219#define ipc_call_async_3(phoneid, method, arg1, arg2, arg3, private, callback, \
     220    can_preempt) \
     221        ipc_call_async_fast((phoneid), (method), (arg1), (arg2), (arg3), 0, \
     222            (private), (callback), (can_preempt))
     223#define ipc_call_async_4(phoneid, method, arg1, arg2, arg3, arg4, private, \
     224    callback, can_preempt) \
     225        ipc_call_async_fast((phoneid), (method), (arg1), (arg2), (arg3), \
     226            (arg4), (private), (callback), (can_preempt))
     227#define ipc_call_async_5(phoneid, method, arg1, arg2, arg3, arg4, arg5, \
     228    private, callback, can_preempt) \
     229        ipc_call_async_slow((phoneid), (method), (arg1), (arg2), (arg3), \
     230            (arg4), (arg5), (private), (callback), (can_preempt))
     231
     232extern void ipc_call_async_fast(int phoneid, ipcarg_t method, ipcarg_t arg1,
     233    ipcarg_t arg2, ipcarg_t arg3, ipcarg_t arg4, void *private,
     234    ipc_async_callback_t callback, int can_preempt);
     235extern void ipc_call_async_slow(int phoneid, ipcarg_t method, ipcarg_t arg1,
     236    ipcarg_t arg2, ipcarg_t arg3, ipcarg_t arg4, ipcarg_t arg5, void *private,
     237    ipc_async_callback_t callback, int can_preempt);
    211238
    212239extern int ipc_connect_to_me(int phoneid, int arg1, int arg2, ipcarg_t *phone);
  • uspace/srv/console/console.c

    rbc50fc42 r3209923  
    3333 */
    3434
    35 /* TODO: remove */
    36 #include <stdio.h>
    37 
     35#include <libc.h>
    3836#include <fb.h>
    3937#include <ipc/ipc.h>
Note: See TracChangeset for help on using the changeset viewer.