Changeset 35bb2e7 in mainline for kernel/generic/src/ipc/sysipc.c


Ignore:
Timestamp:
2009-11-19T21:02:52Z (14 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
4ca28512
Parents:
4e739652
Message:

Allocate the call structure for synchronous calls dynamically.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/ipc/sysipc.c

    r4e739652 r35bb2e7  
    531531    unative_t arg1, unative_t arg2, unative_t arg3, ipc_data_t *data)
    532532{
    533         call_t call;
     533        call_t *call;
    534534        phone_t *phone;
    535535        int res;
     
    538538        GET_CHECK_PHONE(phone, phoneid, return ENOENT);
    539539
    540         ipc_call_static_init(&call);
    541         IPC_SET_METHOD(call.data, method);
    542         IPC_SET_ARG1(call.data, arg1);
    543         IPC_SET_ARG2(call.data, arg2);
    544         IPC_SET_ARG3(call.data, arg3);
     540        call = ipc_call_alloc(0);
     541        IPC_SET_METHOD(call->data, method);
     542        IPC_SET_ARG1(call->data, arg1);
     543        IPC_SET_ARG2(call->data, arg2);
     544        IPC_SET_ARG3(call->data, arg3);
    545545        /*
    546546         * To achieve deterministic behavior, zero out arguments that are beyond
    547547         * the limits of the fast version.
    548548         */
    549         IPC_SET_ARG4(call.data, 0);
    550         IPC_SET_ARG5(call.data, 0);
    551 
    552         if (!(res = request_preprocess(&call, phone))) {
     549        IPC_SET_ARG4(call->data, 0);
     550        IPC_SET_ARG5(call->data, 0);
     551
     552        if (!(res = request_preprocess(call, phone))) {
    553553#ifdef CONFIG_UDEBUG
    554554                udebug_stoppable_begin();
    555555#endif
    556                 rc = ipc_call_sync(phone, &call);
     556                rc = ipc_call_sync(phone, call);
    557557#ifdef CONFIG_UDEBUG
    558558                udebug_stoppable_end();
    559559#endif
    560                 if (rc != EOK)
     560                if (rc != EOK) {
     561                        /* The call will be freed by someone else. */
    561562                        return rc;
    562                 process_answer(&call);
     563                }
     564                process_answer(call);
    563565
    564566        } else {
    565                 IPC_SET_RETVAL(call.data, res);
    566         }
    567         rc = STRUCT_TO_USPACE(&data->args, &call.data.args);
     567                IPC_SET_RETVAL(call->data, res);
     568        }
     569        rc = STRUCT_TO_USPACE(&data->args, &call->data.args);
     570        ipc_call_free(call);
    568571        if (rc != 0)
    569572                return rc;
     
    584587    ipc_data_t *reply)
    585588{
    586         call_t call;
     589        call_t *call;
    587590        phone_t *phone;
    588591        int res;
    589592        int rc;
    590593
    591         ipc_call_static_init(&call);
    592         rc = copy_from_uspace(&call.data.args, &question->args,
    593             sizeof(call.data.args));
    594         if (rc != 0)
     594        GET_CHECK_PHONE(phone, phoneid, return ENOENT);
     595
     596        call = ipc_call_alloc(0);
     597        rc = copy_from_uspace(&call->data.args, &question->args,
     598            sizeof(call->data.args));
     599        if (rc != 0) {
     600                ipc_call_free(call);
    595601                return (unative_t) rc;
    596 
    597         GET_CHECK_PHONE(phone, phoneid, return ENOENT);
    598 
    599         if (!(res = request_preprocess(&call, phone))) {
     602        }
     603
     604
     605        if (!(res = request_preprocess(call, phone))) {
    600606#ifdef CONFIG_UDEBUG
    601607                udebug_stoppable_begin();
    602608#endif
    603                 rc = ipc_call_sync(phone, &call);
     609                rc = ipc_call_sync(phone, call);
    604610#ifdef CONFIG_UDEBUG
    605611                udebug_stoppable_end();
    606612#endif
    607                 if (rc != EOK)
     613                if (rc != EOK) {
     614                        /* The call will be freed by someone else. */
    608615                        return rc;
    609                 process_answer(&call);
     616                }
     617                process_answer(call);
    610618        } else
    611                 IPC_SET_RETVAL(call.data, res);
    612 
    613         rc = STRUCT_TO_USPACE(&reply->args, &call.data.args);
     619                IPC_SET_RETVAL(call->data, res);
     620
     621        rc = STRUCT_TO_USPACE(&reply->args, &call->data.args);
     622        ipc_call_free(call);
    614623        if (rc != 0)
    615624                return rc;
Note: See TracChangeset for help on using the changeset viewer.