Subversion Repositories HelenOS-historic

Rev

Rev 999 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 999 Rev 1006
Line 80... Line 80...
80
    IPC_SET_METHOD(data, method);
80
    IPC_SET_METHOD(data, method);
81
    IPC_SET_ARG1(data, arg1);
81
    IPC_SET_ARG1(data, arg1);
82
    IPC_SET_ARG2(data, arg2);
82
    IPC_SET_ARG2(data, arg2);
83
    IPC_SET_ARG3(data, arg3);
83
    IPC_SET_ARG3(data, arg3);
84
 
84
 
85
    callres = __SYSCALL2(SYS_IPC_CALL_SYNC, phoneid, (sysarg_t)&data);
85
    callres = __SYSCALL3(SYS_IPC_CALL_SYNC, phoneid, (sysarg_t)&data,
-
 
86
                 (sysarg_t)&data);
86
    if (callres)
87
    if (callres)
87
        return callres;
88
        return callres;
88
 
89
 
89
    if (result1)
90
    if (result1)
90
        *result1 = IPC_GET_ARG1(data);
91
        *result1 = IPC_GET_ARG1(data);
Line 119... Line 120...
119
    }
120
    }
120
       
121
       
121
    callid = __SYSCALL4(SYS_IPC_CALL_ASYNC_FAST, phoneid, method, arg1, arg2);
122
    callid = __SYSCALL4(SYS_IPC_CALL_ASYNC_FAST, phoneid, method, arg1, arg2);
122
    if (callid == IPC_CALLRET_FATAL) {
123
    if (callid == IPC_CALLRET_FATAL) {
123
        /* Call asynchronous handler with error code */
124
        /* Call asynchronous handler with error code */
124
        IPC_SET_RETVAL(call->u.msg.data, ENOENT);
-
 
125
        callback(private, ENOENT, NULL);
125
        callback(private, ENOENT, NULL);
126
        free(call);
126
        free(call);
127
        return;
127
        return;
128
    }
128
    }
129
 
129
 
Line 148... Line 148...
148
 
148
 
149
/** Send answer to a received call */
149
/** Send answer to a received call */
150
void ipc_answer(ipc_callid_t callid, ipcarg_t retval, ipcarg_t arg1,
150
void ipc_answer(ipc_callid_t callid, ipcarg_t retval, ipcarg_t arg1,
151
        ipcarg_t arg2)
151
        ipcarg_t arg2)
152
{
152
{
153
    __SYSCALL4(SYS_IPC_ANSWER, callid, retval, arg1, arg2);
153
    __SYSCALL4(SYS_IPC_ANSWER_FAST, callid, retval, arg1, arg2);
154
}
154
}
155
 
155
 
156
 
156
 
157
/** Call syscall function sys_ipc_wait_for_call */
157
/** Call syscall function sys_ipc_wait_for_call */
158
static inline ipc_callid_t _ipc_wait_for_call(ipc_data_t *data, int flags)
158
static inline ipc_callid_t _ipc_wait_for_call(ipc_call_t *call, int flags)
159
{
159
{
160
    return __SYSCALL2(SYS_IPC_WAIT, (sysarg_t)data, flags);
160
    return __SYSCALL3(SYS_IPC_WAIT, (sysarg_t)&call->data,
-
 
161
              (sysarg_t)&call->taskid, flags);
161
}
162
}
162
 
163
 
163
/** Try to dispatch queed calls from async queue */
164
/** Try to dispatch queed calls from async queue */
164
static void try_dispatch_queued_calls(void)
165
static void try_dispatch_queued_calls(void)
165
{
166
{
Line 218... Line 219...
218
 * - dispatch ASYNC reoutines in the background
219
 * - dispatch ASYNC reoutines in the background
219
 * @param data Space where the message is stored
220
 * @param data Space where the message is stored
220
 * @return Callid or 0 if nothing available and started with
221
 * @return Callid or 0 if nothing available and started with
221
 *         IPC_WAIT_NONBLOCKING
222
 *         IPC_WAIT_NONBLOCKING
222
 */
223
 */
223
int ipc_wait_for_call(ipc_data_t *data, int flags)
224
int ipc_wait_for_call(ipc_call_t *call, int flags)
224
{
225
{
225
    ipc_callid_t callid;
226
    ipc_callid_t callid;
226
 
227
 
227
    do {
228
    do {
228
        try_dispatch_queued_calls();
229
        try_dispatch_queued_calls();
229
 
230
 
230
        callid = _ipc_wait_for_call(data, flags);
231
        callid = _ipc_wait_for_call(call, flags);
231
        /* Handle received answers */
232
        /* Handle received answers */
232
        if (callid & IPC_CALLID_ANSWERED)
233
        if (callid & IPC_CALLID_ANSWERED)
233
            handle_answer(callid, data);
234
            handle_answer(callid, &call->data);
234
    } while (callid & IPC_CALLID_ANSWERED);
235
    } while (callid & IPC_CALLID_ANSWERED);
235
 
236
 
236
    return callid;
237
    return callid;
237
}
238
}