/trunk/kernel/generic/include/syscall/syscall.h |
---|
50,7 → 50,7 |
SYS_IPC_CALL_SYNC_FAST, |
SYS_IPC_CALL_SYNC_SLOW, |
SYS_IPC_CALL_ASYNC_FAST, |
SYS_IPC_CALL_ASYNC, |
SYS_IPC_CALL_ASYNC_SLOW, |
SYS_IPC_ANSWER_FAST, |
SYS_IPC_ANSWER, |
SYS_IPC_FORWARD_FAST, |
/trunk/kernel/generic/include/ipc/sysipc.h |
---|
44,8 → 44,8 |
unative_t sys_ipc_call_sync_slow(unative_t phoneid, ipc_data_t *question, |
ipc_data_t *reply); |
unative_t sys_ipc_call_async_fast(unative_t phoneid, unative_t method, |
unative_t arg1, unative_t arg2); |
unative_t sys_ipc_call_async(unative_t phoneid, ipc_data_t *data); |
unative_t arg1, unative_t arg2, unative_t arg3, unative_t arg4); |
unative_t sys_ipc_call_async_slow(unative_t phoneid, ipc_data_t *data); |
unative_t sys_ipc_answer_fast(unative_t callid, unative_t retval, |
unative_t arg1, unative_t arg2); |
unative_t sys_ipc_answer(unative_t callid, ipc_data_t *data); |
/trunk/kernel/generic/src/syscall/syscall.c |
---|
135,7 → 135,7 |
(syshandler_t) sys_ipc_call_sync_fast, |
(syshandler_t) sys_ipc_call_sync_slow, |
(syshandler_t) sys_ipc_call_async_fast, |
(syshandler_t) sys_ipc_call_async, |
(syshandler_t) sys_ipc_call_async_slow, |
(syshandler_t) sys_ipc_answer_fast, |
(syshandler_t) sys_ipc_answer, |
(syshandler_t) sys_ipc_forward_fast, |
/trunk/kernel/generic/src/ipc/sysipc.c |
---|
444,13 → 444,15 |
/** Make a fast asynchronous call over IPC. |
* |
* This function can only handle two arguments of payload, but is faster than |
* the generic function sys_ipc_call_async(). |
* This function can only handle four arguments of payload, but is faster than |
* the generic function sys_ipc_call_async_slow(). |
* |
* @param phoneid Phone handle for the call. |
* @param method Method of the call. |
* @param arg1 Service-defined payload argument. |
* @param arg2 Service-defined payload argument. |
* @param arg3 Service-defined payload argument. |
* @param arg4 Service-defined payload argument. |
* |
* @return Return call hash on success. |
* Return IPC_CALLRET_FATAL in case of a fatal error and |
458,7 → 460,7 |
* asynchronous requests; answers should be handled first. |
*/ |
unative_t sys_ipc_call_async_fast(unative_t phoneid, unative_t method, |
unative_t arg1, unative_t arg2) |
unative_t arg1, unative_t arg2, unative_t arg3, unative_t arg4) |
{ |
call_t *call; |
phone_t *phone; |
473,7 → 475,8 |
IPC_SET_METHOD(call->data, method); |
IPC_SET_ARG1(call->data, arg1); |
IPC_SET_ARG2(call->data, arg2); |
IPC_SET_ARG3(call->data, 0); |
IPC_SET_ARG3(call->data, arg3); |
IPC_SET_ARG4(call->data, arg4); |
if (!(res = request_preprocess(call))) |
ipc_call(phone, call); |
490,7 → 493,7 |
* |
* @return See sys_ipc_call_async_fast(). |
*/ |
unative_t sys_ipc_call_async(unative_t phoneid, ipc_data_t *data) |
unative_t sys_ipc_call_async_slow(unative_t phoneid, ipc_data_t *data) |
{ |
call_t *call; |
phone_t *phone; |
/trunk/uspace/app/tester/ipc/send_async.c |
---|
48,7 → 48,7 |
} while (c < '2' || c > '9'); |
phoneid = c - '0'; |
ipc_call_async(phoneid, 2000, 0, (void *) msgid, callback, 1); |
ipc_call_async_0(phoneid, 2000, (void *) msgid, callback, 1); |
printf("Async sent - msg %d\n", msgid); |
msgid++; |
/trunk/uspace/lib/libc/include/ipc/ipc.h |
---|
37,7 → 37,6 |
#include <kernel/ipc/ipc.h> |
#include <kernel/ddi/irq.h> |
#include <libc.h> |
#include <sys/types.h> |
#include <kernel/synch/synch.h> |
183,7 → 182,6 |
ipcarg_t *result1, ipcarg_t *result2, ipcarg_t *result3, ipcarg_t *result4, |
ipcarg_t *result5); |
extern ipc_callid_t ipc_wait_cycle(ipc_call_t *call, uint32_t usec, int flags); |
extern ipc_callid_t ipc_wait_for_call_timeout(ipc_call_t *data, uint32_t usec); |
static inline ipc_callid_t ipc_wait_for_call(ipc_call_t *data) |
193,22 → 191,51 |
extern ipc_callid_t ipc_trywait_for_call(ipc_call_t *data); |
#define ipc_answer_fast_0(callid, retval) \ |
ipc_answer_fast((callid), (retval), 0, 0) |
ipc_answer_fast((callid), (retval), 0, 0) |
#define ipc_answer_fast_1(callid, retval, arg1) \ |
ipc_answer_fast((callid), (retval), (arg1), 0) |
ipc_answer_fast((callid), (retval), (arg1), 0) |
extern ipcarg_t ipc_answer_fast(ipc_callid_t callid, ipcarg_t retval, |
ipcarg_t arg1, ipcarg_t arg2); |
extern ipcarg_t ipc_answer(ipc_callid_t callid, ipc_call_t *call); |
#define ipc_call_async(phoneid, method, arg1, private, callback, can_preempt) \ |
(ipc_call_async_2(phoneid, method, arg1, 0, private, callback, can_preempt)) |
extern void ipc_call_async_2(int phoneid, ipcarg_t method, ipcarg_t arg1, |
ipcarg_t arg2, void *private, ipc_async_callback_t callback, |
int can_preempt); |
extern void ipc_call_async_3(int phoneid, ipcarg_t method, ipcarg_t arg1, |
ipcarg_t arg2, ipcarg_t arg3, void *private, ipc_async_callback_t callback, |
int can_preempt); |
/* |
* User-friendly wrappers for ipc_call_async_fast() and ipc_call_async_slow(). |
* They are in the form of ipc_call_async_m(), where m is the number of payload |
* arguments. The macros decide between the fast and the slow version according |
* to m. |
*/ |
#define ipc_call_async_0(phoneid, method, private, callback, \ |
can_preempt) \ |
ipc_call_async_fast((phoneid), (method), 0, 0, 0, 0, (private), \ |
(callback), (can_preempt)) |
#define ipc_call_async_1(phoneid, method, arg1, private, callback, \ |
can_preempt) \ |
ipc_call_async_fast((phoneid), (method), (arg1), 0, 0, 0, (private), \ |
(callback), (can_preempt)) |
#define ipc_call_async_2(phoneid, method, arg1, arg2, private, callback, \ |
can_preempt) \ |
ipc_call_async_fast((phoneid), (method), (arg1), (arg2), 0, 0, \ |
(private), (callback), (can_preempt)) |
#define ipc_call_async_3(phoneid, method, arg1, arg2, arg3, private, callback, \ |
can_preempt) \ |
ipc_call_async_fast((phoneid), (method), (arg1), (arg2), (arg3), 0, \ |
(private), (callback), (can_preempt)) |
#define ipc_call_async_4(phoneid, method, arg1, arg2, arg3, arg4, private, \ |
callback, can_preempt) \ |
ipc_call_async_fast((phoneid), (method), (arg1), (arg2), (arg3), \ |
(arg4), (private), (callback), (can_preempt)) |
#define ipc_call_async_5(phoneid, method, arg1, arg2, arg3, arg4, arg5, \ |
private, callback, can_preempt) \ |
ipc_call_async_slow((phoneid), (method), (arg1), (arg2), (arg3), \ |
(arg4), (arg5), (private), (callback), (can_preempt)) |
extern void ipc_call_async_fast(int phoneid, ipcarg_t method, ipcarg_t arg1, |
ipcarg_t arg2, ipcarg_t arg3, ipcarg_t arg4, void *private, |
ipc_async_callback_t callback, int can_preempt); |
extern void ipc_call_async_slow(int phoneid, ipcarg_t method, ipcarg_t arg1, |
ipcarg_t arg2, ipcarg_t arg3, ipcarg_t arg4, ipcarg_t arg5, void *private, |
ipc_async_callback_t callback, int can_preempt); |
extern int ipc_connect_to_me(int phoneid, int arg1, int arg2, ipcarg_t *phone); |
extern int ipc_connect_me_to(int phoneid, int arg1, int arg2); |
extern int ipc_hangup(int phoneid); |
/trunk/uspace/lib/libc/generic/ipc.c |
---|
189,7 → 189,7 |
*/ |
static ipc_callid_t _ipc_call_async(int phoneid, ipc_call_t *data) |
{ |
return __SYSCALL2(SYS_IPC_CALL_ASYNC, phoneid, (sysarg_t) data); |
return __SYSCALL2(SYS_IPC_CALL_ASYNC_SLOW, phoneid, (sysarg_t) data); |
} |
/** Prolog to ipc_call_async_*() functions. |
268,8 → 268,8 |
/** Make a fast asynchronous call. |
* |
* This function can only handle two arguments of payload. It is, however, |
* faster than the more generic ipc_call_async_3(). |
* This function can only handle four arguments of payload. It is, however, |
* faster than the more generic ipc_call_async_slow(). |
* |
* Note that this function is a void function. |
* During normal opertation, answering this call will trigger the callback. |
280,6 → 280,8 |
* @param method Requested method. |
* @param arg1 Service-defined payload argument. |
* @param arg2 Service-defined payload argument. |
* @param arg3 Service-defined payload argument. |
* @param arg4 Service-defined payload argument. |
* @param private Argument to be passed to the answer/error callback. |
* @param callback Answer or error callback. |
* @param can_preempt If non-zero, the current fibril will be preempted in |
286,9 → 288,9 |
* case the kernel temporarily refuses to accept more |
* asynchronous calls. |
*/ |
void ipc_call_async_2(int phoneid, ipcarg_t method, ipcarg_t arg1, |
ipcarg_t arg2, void *private, ipc_async_callback_t callback, |
int can_preempt) |
void ipc_call_async_fast(int phoneid, ipcarg_t method, ipcarg_t arg1, |
ipcarg_t arg2, ipcarg_t arg3, ipcarg_t arg4, void *private, |
ipc_async_callback_t callback, int can_preempt) |
{ |
async_call_t *call = NULL; |
ipc_callid_t callid; |
304,8 → 306,8 |
* accesses the queue again. |
*/ |
futex_down(&ipc_futex); |
callid = __SYSCALL4(SYS_IPC_CALL_ASYNC_FAST, phoneid, method, arg1, |
arg2); |
callid = __SYSCALL6(SYS_IPC_CALL_ASYNC_FAST, phoneid, method, arg1, |
arg2, arg3, arg4); |
if (callid == IPC_CALLRET_TEMPORARY) { |
if (!call) { |
316,6 → 318,8 |
IPC_SET_METHOD(call->u.msg.data, method); |
IPC_SET_ARG1(call->u.msg.data, arg1); |
IPC_SET_ARG2(call->u.msg.data, arg2); |
IPC_SET_ARG3(call->u.msg.data, arg3); |
IPC_SET_ARG4(call->u.msg.data, arg4); |
} |
ipc_finish_async(callid, phoneid, call, can_preempt); |
} |
332,6 → 336,8 |
* @param arg1 Service-defined payload argument. |
* @param arg2 Service-defined payload argument. |
* @param arg3 Service-defined payload argument. |
* @param arg4 Service-defined payload argument. |
* @param arg5 Service-defined payload argument. |
* @param private Argument to be passed to the answer/error callback. |
* @param callback Answer or error callback. |
* @param can_preempt If non-zero, the current fibril will be preempted in |
339,9 → 345,9 |
* asynchronous calls. |
* |
*/ |
void ipc_call_async_3(int phoneid, ipcarg_t method, ipcarg_t arg1, |
ipcarg_t arg2, ipcarg_t arg3, void *private, ipc_async_callback_t callback, |
int can_preempt) |
void ipc_call_async_slow(int phoneid, ipcarg_t method, ipcarg_t arg1, |
ipcarg_t arg2, ipcarg_t arg3, ipcarg_t arg4, ipcarg_t arg5, void *private, |
ipc_async_callback_t callback, int can_preempt) |
{ |
async_call_t *call; |
ipc_callid_t callid; |
354,9 → 360,11 |
IPC_SET_ARG1(call->u.msg.data, arg1); |
IPC_SET_ARG2(call->u.msg.data, arg2); |
IPC_SET_ARG3(call->u.msg.data, arg3); |
IPC_SET_ARG4(call->u.msg.data, arg4); |
IPC_SET_ARG5(call->u.msg.data, arg5); |
/* |
* We need to make sure that we get callid before another thread accesses |
* the queue again. |
* We need to make sure that we get callid before another thread |
* accesses the queue again. |
*/ |
futex_down(&ipc_futex); |
callid = _ipc_call_async(phoneid, &call->u.msg.data); |
/trunk/uspace/srv/console/console.c |
---|
32,9 → 32,7 |
/** @file |
*/ |
/* TODO: remove */ |
#include <stdio.h> |
#include <libc.h> |
#include <fb.h> |
#include <ipc/ipc.h> |
#include <keys.h> |