Ignore:
File:
1 edited

Legend:

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

    r20c7c40 r057d21a  
    6161{ \
    6262        if (phoneid > IPC_MAX_PHONES) { \
    63                 err \
     63                err; \
    6464        } \
    6565        phone = &TASK->phones[phoneid]; \
     
    122122        case IPC_M_DATA_READ:
    123123                return 1;
     124                break;
    124125        default:
    125126                return 0;
     
    375376                phone_t *cloned_phone;
    376377                GET_CHECK_PHONE(cloned_phone, IPC_GET_ARG1(call->data),
    377                     return ENOENT;);
     378                    return ENOENT);
    378379                phones_lock(cloned_phone, phone);
    379380                if ((cloned_phone->state != IPC_PHONE_CONNECTED) ||
     
    530531    unative_t arg1, unative_t arg2, unative_t arg3, ipc_data_t *data)
    531532{
    532         call_t *call;
     533        call_t call;
    533534        phone_t *phone;
    534535        int res;
    535536        int rc;
    536537       
    537         GET_CHECK_PHONE(phone, phoneid, return ENOENT;);
    538 
    539         call = ipc_call_alloc(0);
    540         IPC_SET_METHOD(call->data, method);
    541         IPC_SET_ARG1(call->data, arg1);
    542         IPC_SET_ARG2(call->data, arg2);
    543         IPC_SET_ARG3(call->data, arg3);
     538        GET_CHECK_PHONE(phone, phoneid, return ENOENT);
     539
     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);
    544545        /*
    545546         * To achieve deterministic behavior, zero out arguments that are beyond
    546547         * the limits of the fast version.
    547548         */
    548         IPC_SET_ARG4(call->data, 0);
    549         IPC_SET_ARG5(call->data, 0);
    550 
    551         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))) {
    552553#ifdef CONFIG_UDEBUG
    553554                udebug_stoppable_begin();
    554555#endif
    555                 rc = ipc_call_sync(phone, call);
     556                rc = ipc_call_sync(phone, &call);
    556557#ifdef CONFIG_UDEBUG
    557558                udebug_stoppable_end();
    558559#endif
    559                 if (rc != EOK) {
    560                         /* The call will be freed by ipc_cleanup(). */
     560                if (rc != EOK)
    561561                        return rc;
    562                 }
    563                 process_answer(call);
     562                process_answer(&call);
    564563
    565564        } else {
    566                 IPC_SET_RETVAL(call->data, res);
    567         }
    568         rc = STRUCT_TO_USPACE(&data->args, &call->data.args);
    569         ipc_call_free(call);
     565                IPC_SET_RETVAL(call.data, res);
     566        }
     567        rc = STRUCT_TO_USPACE(&data->args, &call.data.args);
    570568        if (rc != 0)
    571569                return rc;
     
    586584    ipc_data_t *reply)
    587585{
    588         call_t *call;
     586        call_t call;
    589587        phone_t *phone;
    590588        int res;
    591589        int rc;
    592590
    593         GET_CHECK_PHONE(phone, phoneid, return ENOENT;);
    594 
    595         call = ipc_call_alloc(0);
    596         rc = copy_from_uspace(&call->data.args, &question->args,
    597             sizeof(call->data.args));
    598         if (rc != 0) {
    599                 ipc_call_free(call);
     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)
    600595                return (unative_t) rc;
    601         }
    602 
    603 
    604         if (!(res = request_preprocess(call, phone))) {
     596
     597        GET_CHECK_PHONE(phone, phoneid, return ENOENT);
     598
     599        if (!(res = request_preprocess(&call, phone))) {
    605600#ifdef CONFIG_UDEBUG
    606601                udebug_stoppable_begin();
    607602#endif
    608                 rc = ipc_call_sync(phone, call);
     603                rc = ipc_call_sync(phone, &call);
    609604#ifdef CONFIG_UDEBUG
    610605                udebug_stoppable_end();
    611606#endif
    612                 if (rc != EOK) {
    613                         /* The call will be freed by ipc_cleanup(). */
     607                if (rc != EOK)
    614608                        return rc;
    615                 }
    616                 process_answer(call);
     609                process_answer(&call);
    617610        } else
    618                 IPC_SET_RETVAL(call->data, res);
    619 
    620         rc = STRUCT_TO_USPACE(&reply->args, &call->data.args);
    621         ipc_call_free(call);
     611                IPC_SET_RETVAL(call.data, res);
     612
     613        rc = STRUCT_TO_USPACE(&reply->args, &call.data.args);
    622614        if (rc != 0)
    623615                return rc;
     
    666658                return IPC_CALLRET_TEMPORARY;
    667659
    668         GET_CHECK_PHONE(phone, phoneid, return IPC_CALLRET_FATAL;);
     660        GET_CHECK_PHONE(phone, phoneid, return IPC_CALLRET_FATAL);
    669661
    670662        call = ipc_call_alloc(0);
     
    705697                return IPC_CALLRET_TEMPORARY;
    706698
    707         GET_CHECK_PHONE(phone, phoneid, return IPC_CALLRET_FATAL;);
     699        GET_CHECK_PHONE(phone, phoneid, return IPC_CALLRET_FATAL);
    708700
    709701        call = ipc_call_alloc(0);
     
    755747        call->flags |= IPC_CALL_FORWARDED;
    756748
    757         GET_CHECK_PHONE(phone, phoneid, {
     749        GET_CHECK_PHONE(phone, phoneid, { 
    758750                IPC_SET_RETVAL(call->data, EFORWARD);
    759751                ipc_answer(&TASK->answerbox, call);
     
    960952        phone_t *phone;
    961953
    962         GET_CHECK_PHONE(phone, phoneid, return ENOENT;);
     954        GET_CHECK_PHONE(phone, phoneid, return ENOENT);
    963955
    964956        if (ipc_phone_hangup(phone))
     
    999991
    1000992        if (call->flags & IPC_CALL_NOTIF) {
     993                ASSERT(! (call->flags & IPC_CALL_STATIC_ALLOC));
     994
    1001995                /* Set in_phone_hash to the interrupt counter */
    1002996                call->data.phone = (void *) call->priv;
     
    10111005        if (call->flags & IPC_CALL_ANSWERED) {
    10121006                process_answer(call);
     1007
     1008                ASSERT(! (call->flags & IPC_CALL_STATIC_ALLOC));
    10131009
    10141010                if (call->flags & IPC_CALL_DISCARD_ANSWER) {
Note: See TracChangeset for help on using the changeset viewer.