/trunk/kernel/generic/include/syscall/syscall.h |
---|
48,7 → 48,7 |
SYS_AS_AREA_RESIZE, |
SYS_AS_AREA_DESTROY, |
SYS_IPC_CALL_SYNC_FAST, |
SYS_IPC_CALL_SYNC, |
SYS_IPC_CALL_SYNC_SLOW, |
SYS_IPC_CALL_ASYNC_FAST, |
SYS_IPC_CALL_ASYNC, |
SYS_IPC_ANSWER_FAST, |
/trunk/kernel/generic/include/ipc/sysipc.h |
---|
40,8 → 40,8 |
#include <arch/types.h> |
unative_t sys_ipc_call_sync_fast(unative_t phoneid, unative_t method, |
unative_t arg1, ipc_data_t *data); |
unative_t sys_ipc_call_sync(unative_t phoneid, ipc_data_t *question, |
unative_t arg1, unative_t arg2, unative_t arg3, ipc_data_t *data); |
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); |
/trunk/kernel/generic/src/syscall/syscall.c |
---|
133,7 → 133,7 |
/* IPC related syscalls. */ |
(syshandler_t) sys_ipc_call_sync_fast, |
(syshandler_t) sys_ipc_call_sync, |
(syshandler_t) sys_ipc_call_sync_slow, |
(syshandler_t) sys_ipc_call_async_fast, |
(syshandler_t) sys_ipc_call_async, |
(syshandler_t) sys_ipc_answer_fast, |
/trunk/kernel/generic/src/ipc/sysipc.c |
---|
348,12 → 348,14 |
/** Make a fast call over IPC, wait for reply and return to user. |
* |
* This function can handle only one argument of payload, but is faster than |
* the generic function (i.e. sys_ipc_call_sync()). |
* This function can handle only three arguments of payload, but is faster than |
* the generic function (i.e. sys_ipc_call_sync_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 data Address of userspace structure where the reply call will |
* be stored. |
* |
361,7 → 363,7 |
* Return ENOENT if there is no such phone handle. |
*/ |
unative_t sys_ipc_call_sync_fast(unative_t phoneid, unative_t method, |
unative_t arg1, ipc_data_t *data) |
unative_t arg1, unative_t arg2, unative_t arg3, ipc_data_t *data) |
{ |
call_t call; |
phone_t *phone; |
372,6 → 374,8 |
ipc_call_static_init(&call); |
IPC_SET_METHOD(call.data, method); |
IPC_SET_ARG1(call.data, arg1); |
IPC_SET_ARG2(call.data, arg2); |
IPC_SET_ARG3(call.data, arg3); |
if (!(res = request_preprocess(&call))) { |
ipc_call_sync(phone, &call); |
393,7 → 397,7 |
* |
* @return Zero on success or an error code. |
*/ |
unative_t sys_ipc_call_sync(unative_t phoneid, ipc_data_t *question, |
unative_t sys_ipc_call_sync_slow(unative_t phoneid, ipc_data_t *question, |
ipc_data_t *reply) |
{ |
call_t call; |
/trunk/uspace/app/tester/ipc/send_sync.c |
---|
29,6 → 29,7 |
#include <stdio.h> |
#include <unistd.h> |
#include "../tester.h" |
#include <ipc/ipc.h> |
char * test_send_sync(bool quiet) |
{ |
44,7 → 45,7 |
phoneid = c - '0'; |
printf("Sending msg..."); |
res = ipc_call_sync_2(phoneid, 2000, 0, 0, NULL, NULL); |
res = ipc_call_sync_0_0(phoneid, 2000); |
printf("done: %d\n", res); |
return NULL; |
/trunk/uspace/app/klog/klog.c |
---|
63,9 → 63,8 |
printf("Kernel console output.\n"); |
mapping = as_get_mappable_page(PAGE_SIZE); |
res = ipc_call_sync_3(PHONE_NS, IPC_M_AS_AREA_RECV, |
(sysarg_t) mapping, PAGE_SIZE, SERVICE_MEM_KLOG, |
NULL, NULL, NULL); |
res = ipc_call_sync_3_0(PHONE_NS, IPC_M_AS_AREA_RECV, |
(sysarg_t) mapping, PAGE_SIZE, SERVICE_MEM_KLOG); |
if (res) { |
printf("Failed to initialize klog memarea\n"); |
_exit(1); |
/trunk/uspace/lib/libc/include/ipc/ipc.h |
---|
51,16 → 51,139 |
typedef void (* ipc_async_callback_t)(void *private, int retval, |
ipc_call_t *data); |
#define ipc_call_sync_2(phoneid, method, arg1, arg2, res1, res2) \ |
ipc_call_sync_3((phoneid), (method), (arg1), (arg2), 0, (res1), \ |
(res2), 0) |
extern int ipc_call_sync_3(int phoneid, ipcarg_t method, ipcarg_t arg1, |
/* |
* User-friendly wrappers for ipc_call_sync_fast() and ipc_call_sync_slow(). |
* They are in the form ipc_call_sync_m_n(), where m denotes the number of |
* arguments of payload and n denotes number of return values. Whenever |
* possible, the fast version is used. |
*/ |
#define ipc_call_sync_0_0(phoneid, method) \ |
ipc_call_sync_fast((phoneid), (method), 0, 0, 0, 0, 0, 0, 0, 0) |
#define ipc_call_sync_0_1(phoneid, method, res1) \ |
ipc_call_sync_fast((phoneid), (method), 0, 0, 0, (res1), 0, 0, 0, 0) |
#define ipc_call_sync_0_2(phoneid, method, res1, res2) \ |
ipc_call_sync_fast((phoneid), (method), 0, 0, 0, (res1), (res2), 0, 0, 0) |
#define ipc_call_sync_0_3(phoneid, method, res1, res2, res3) \ |
ipc_call_sync_fast((phoneid), (method), 0, 0, 0, (res1), (res2), (res3), \ |
0, 0) |
#define ipc_call_sync_0_4(phoneid, method, res1, res2, res3, res4) \ |
ipc_call_sync_fast((phoneid), (method), 0, 0, 0, (res1), (res2), (res3), \ |
(res4), 0) |
#define ipc_call_sync_0_5(phoneid, method, res1, res2, res3, res4, res5) \ |
ipc_call_sync_fast((phoneid), (method), 0, 0, 0, (res1), (res2), (res3), \ |
(res4), (res5)) |
#define ipc_call_sync_1_0(phoneid, method, arg1) \ |
ipc_call_sync_fast((phoneid), (method), (arg1), 0, 0, 0, 0, 0, 0, 0) |
#define ipc_call_sync_1_1(phoneid, method, arg1, res1) \ |
ipc_call_sync_fast((phoneid), (method), (arg1), 0, 0, (res1), 0, 0, 0, 0) |
#define ipc_call_sync_1_2(phoneid, method, arg1, res1, res2) \ |
ipc_call_sync_fast((phoneid), (method), (arg1), 0, 0, (res1), (res2), 0, \ |
0, 0) |
#define ipc_call_sync_1_3(phoneid, method, arg1, res1, res2, res3) \ |
ipc_call_sync_fast((phoneid), (method), (arg1), 0, 0, (res1), (res2), \ |
(res3), 0, 0) |
#define ipc_call_sync_1_4(phoneid, method, arg1, res1, res2, res3, res4) \ |
ipc_call_sync_fast((phoneid), (method), (arg1), 0, 0, (res1), (res2), \ |
(res3), (res4), 0) |
#define ipc_call_sync_1_5(phoneid, method, arg1, res1, res2, res3, res4, \ |
res5) \ |
ipc_call_sync_fast((phoneid), (method), (arg1), 0, 0, (res1), (res2), \ |
(res3), (res4), (res5)) |
#define ipc_call_sync_2_0(phoneid, method, arg1, arg2) \ |
ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), 0, 0, 0, 0, \ |
0, 0) |
#define ipc_call_sync_2_1(phoneid, method, arg1, arg2, res1) \ |
ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), 0, (res1), 0, 0, \ |
0, 0) |
#define ipc_call_sync_2_2(phoneid, method, arg1, arg2, res1, res2) \ |
ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), 0, (res1), \ |
(res2), 0, 0, 0) |
#define ipc_call_sync_2_3(phoneid, method, arg1, arg2, res1, res2, res3) \ |
ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), 0, (res1), \ |
(res2), (res3), 0, 0) |
#define ipc_call_sync_2_4(phoneid, method, arg1, arg2, res1, res2, res3, \ |
res4) \ |
ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), 0, (res1), \ |
(res2), (res3), (res4), 0) |
#define ipc_call_sync_2_5(phoneid, method, arg1, arg2, res1, res2, res3, \ |
res4, res5)\ |
ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), 0, (res1), \ |
(res2), (res3), (res4), (res5)) |
#define ipc_call_sync_3_0(phoneid, method, arg1, arg2, arg3) \ |
ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), (arg3), 0, 0, 0, \ |
0, 0) |
#define ipc_call_sync_3_1(phoneid, method, arg1, arg2, arg3, res1) \ |
ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), (arg3), (res1), \ |
0, 0, 0, 0) |
#define ipc_call_sync_3_2(phoneid, method, arg1, arg2, arg3, res1, res2) \ |
ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), (arg3), (res1), \ |
(res2), 0, 0, 0) |
#define ipc_call_sync_3_3(phoneid, method, arg1, arg2, arg3, res1, res2, \ |
res3) \ |
ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), (arg3), \ |
(res1), (res2), (res3), 0, 0) |
#define ipc_call_sync_3_4(phoneid, method, arg1, arg2, arg3, res1, res2, \ |
res3, res4) \ |
ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), (arg3), \ |
(res1), (res2), (res3), (res4), 0) |
#define ipc_call_sync_3_5(phoneid, method, arg1, arg2, arg3, res1, res2, \ |
res3, res4, res5) \ |
ipc_call_sync_fast((phoneid), (method), (arg1), (arg2), (arg3), \ |
(res1), (res2), (res3), (res4), (res5)) |
#define ipc_call_sync_4_0(phoneid, method, arg1, arg2, arg3, arg4) \ |
ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), (arg4), \ |
0, 0, 0, 0, 0) |
#define ipc_call_sync_4_1(phoneid, method, arg1, arg2, arg3, arg4, res1) \ |
ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), (arg4), \ |
(res1), 0, 0, 0, 0) |
#define ipc_call_sync_4_2(phoneid, method, arg1, arg2, arg3, arg4, res1, res2) \ |
ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), (arg4), \ |
(res1), (res2), 0, 0, 0) |
#define ipc_call_sync_4_3(phoneid, method, arg1, arg2, arg3, arg4, res1, res2, \ |
res3) \ |
ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), \ |
(arg4), (res1), (res2), (res3), 0, 0) |
#define ipc_call_sync_4_4(phoneid, method, arg1, arg2, arg3, arg4, res1, res2, \ |
res3, res4) \ |
ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), \ |
(arg4), (res1), (res2), (res3), (res4), 0) |
#define ipc_call_sync_4_5(phoneid, method, arg1, arg2, arg3, arg4, res1, res2, \ |
res3, res4, res5) \ |
ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), \ |
(arg4), (res1), (res2), (res3), (res4), (res5)) |
#define ipc_call_sync_5_0(phoneid, method, arg1, arg2, arg3, arg4, arg5) \ |
ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), (arg4), \ |
(arg5), 0, 0, 0, 0, 0) |
#define ipc_call_sync_5_1(phoneid, method, arg1, arg2, arg3, arg4, arg5, res1) \ |
ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), (arg4), \ |
(arg5), (res1), 0, 0, 0, 0) |
#define ipc_call_sync_5_2(phoneid, method, arg1, arg2, arg3, arg4, arg5, res1, \ |
res2) \ |
ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), \ |
(arg4), (arg5), (res1), (res2), 0, 0, 0) |
#define ipc_call_sync_5_3(phoneid, method, arg1, arg2, arg3, arg4, arg5, res1, \ |
res2, res3) \ |
ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), \ |
(arg4), (arg5), (res1), (res2), (res3), 0, 0) |
#define ipc_call_sync_5_4(phoneid, method, arg1, arg2, arg3, arg4, arg5, res1, \ |
res2, res3, res4) \ |
ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), \ |
(arg4), (arg5), (res1), (res2), (res3), (res4), 0) |
#define ipc_call_sync_5_5(phoneid, method, arg1, arg2, arg3, arg4, arg5, res1, \ |
res2, res3, res4, res5) \ |
ipc_call_sync_slow((phoneid), (method), (arg1), (arg2), (arg3), \ |
(arg4), (arg5), (res1), (res2), (res3), (res4), (res5)) |
extern int ipc_call_sync_fast(int phoneid, ipcarg_t method, ipcarg_t arg1, |
ipcarg_t arg2, ipcarg_t arg3, ipcarg_t *result1, ipcarg_t *result2, |
ipcarg_t *result3); |
ipcarg_t *result3, ipcarg_t *result4, ipcarg_t *result5); |
extern int ipc_call_sync(int phoneid, ipcarg_t method, ipcarg_t arg1, |
ipcarg_t *result); |
extern int ipc_call_sync_slow(int phoneid, ipcarg_t method, ipcarg_t arg1, |
ipcarg_t arg2, ipcarg_t arg3, ipcarg_t arg4, ipcarg_t arg5, |
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) |
/trunk/uspace/lib/libc/generic/time.c |
---|
141,9 → 141,9 |
if (!ktime) { |
mapping = as_get_mappable_page(PAGE_SIZE); |
/* Get the mapping of kernel clock */ |
res = ipc_call_sync_3(PHONE_NS, IPC_M_AS_AREA_RECV, |
res = ipc_call_sync_3_2(PHONE_NS, IPC_M_AS_AREA_RECV, |
(sysarg_t) mapping, PAGE_SIZE, SERVICE_MEM_REALTIME, NULL, |
&rights, NULL); |
&rights); |
if (res) { |
printf("Failed to initialize timeofday memarea\n"); |
_exit(1); |
/trunk/uspace/lib/libc/generic/ipc.c |
---|
84,32 → 84,51 |
/** Make a fast synchronous call. |
* |
* Only one payload argument can be passed using this function. However, this |
* function is faster than the generic ipc_call_sync_3(). |
* Only three payload arguments can be passed using this function. However, this |
* function is faster than the generic ipc_call_sync_slow() because the payload |
* is passed directly in registers. |
* |
* @param phoneid Phone handle for the call. |
* @param method Requested method. |
* @param arg1 Service-defined payload argument. |
* @param result If non-NULL, the return ARG1 will be stored there. |
* @param arg2 Service-defined payload argument. |
* @param arg3 Service-defined payload argument. |
* @param result1 If non-NULL, the return ARG1 will be stored there. |
* @param result2 If non-NULL, the return ARG2 will be stored there. |
* @param result3 If non-NULL, the return ARG3 will be stored there. |
* @param result4 If non-NULL, the return ARG4 will be stored there. |
* @param result5 If non-NULL, the return ARG5 will be stored there. |
* |
* @return Negative values represent errors returned by IPC. |
* Otherwise the RETVAL of the answer is returned. |
*/ |
int ipc_call_sync(int phoneid, ipcarg_t method, ipcarg_t arg1, ipcarg_t *result) |
int |
ipc_call_sync_fast(int phoneid, ipcarg_t method, ipcarg_t arg1, ipcarg_t arg2, |
ipcarg_t arg3, ipcarg_t *result1, ipcarg_t *result2, ipcarg_t *result3, |
ipcarg_t *result4, ipcarg_t *result5) |
{ |
ipc_call_t resdata; |
int callres; |
callres = __SYSCALL4(SYS_IPC_CALL_SYNC_FAST, phoneid, method, arg1, |
(sysarg_t) &resdata); |
callres = __SYSCALL6(SYS_IPC_CALL_SYNC_FAST, phoneid, method, arg1, |
arg2, arg3, (sysarg_t) &resdata); |
if (callres) |
return callres; |
if (result) |
*result = IPC_GET_ARG1(resdata); |
if (result1) |
*result1 = IPC_GET_ARG1(resdata); |
if (result2) |
*result2 = IPC_GET_ARG2(resdata); |
if (result3) |
*result3 = IPC_GET_ARG3(resdata); |
if (result4) |
*result4 = IPC_GET_ARG4(resdata); |
if (result5) |
*result5 = IPC_GET_ARG5(resdata); |
return IPC_GET_RETVAL(resdata); |
} |
/** Make a synchronous call transmitting 3 arguments of payload. |
/** Make a synchronous call transmitting 5 arguments of payload. |
* |
* @param phoneid Phone handle for the call. |
* @param method Requested method. |
116,15 → 135,21 |
* @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 result1 If non-NULL, storage for the first return argument. |
* @param result2 If non-NULL, storage for the second return argument. |
* @param result3 If non-NULL, storage for the third return argument. |
* @param result4 If non-NULL, storage for the fourth return argument. |
* @param result5 If non-NULL, storage for the fifth return argument. |
* |
* @return Negative value means IPC error. |
* Otherwise the RETVAL of the answer. |
*/ |
int ipc_call_sync_3(int phoneid, ipcarg_t method, ipcarg_t arg1, ipcarg_t arg2, |
ipcarg_t arg3, ipcarg_t *result1, ipcarg_t *result2, ipcarg_t *result3) |
int |
ipc_call_sync_slow(int phoneid, ipcarg_t method, ipcarg_t arg1, ipcarg_t arg2, |
ipcarg_t arg3, ipcarg_t arg4, ipcarg_t arg5, ipcarg_t *result1, |
ipcarg_t *result2, ipcarg_t *result3, ipcarg_t *result4, ipcarg_t *result5) |
{ |
ipc_call_t data; |
int callres; |
133,8 → 158,10 |
IPC_SET_ARG1(data, arg1); |
IPC_SET_ARG2(data, arg2); |
IPC_SET_ARG3(data, arg3); |
IPC_SET_ARG4(data, arg4); |
IPC_SET_ARG5(data, arg5); |
callres = __SYSCALL3(SYS_IPC_CALL_SYNC, phoneid, (sysarg_t) &data, |
callres = __SYSCALL3(SYS_IPC_CALL_SYNC_SLOW, phoneid, (sysarg_t) &data, |
(sysarg_t) &data); |
if (callres) |
return callres; |
145,6 → 172,11 |
*result2 = IPC_GET_ARG2(data); |
if (result3) |
*result3 = IPC_GET_ARG3(data); |
if (result4) |
*result4 = IPC_GET_ARG4(data); |
if (result5) |
*result5 = IPC_GET_ARG5(data); |
return IPC_GET_RETVAL(data); |
} |
515,8 → 547,8 |
*/ |
int ipc_connect_to_me(int phoneid, int arg1, int arg2, ipcarg_t *phonehash) |
{ |
return ipc_call_sync_3(phoneid, IPC_M_CONNECT_TO_ME, arg1, arg2, 0, 0, |
0, phonehash); |
return ipc_call_sync_2_3(phoneid, IPC_M_CONNECT_TO_ME, arg1, arg2, |
NULL, NULL, phonehash); |
} |
/** Ask through phone for a new connection to some service. |
532,8 → 564,8 |
ipcarg_t newphid; |
int res; |
res = ipc_call_sync_3(phoneid, IPC_M_CONNECT_ME_TO, arg1, arg2, 0, 0, 0, |
&newphid); |
res = ipc_call_sync_2_3(phoneid, IPC_M_CONNECT_ME_TO, arg1, arg2, NULL, |
NULL, &newphid); |
if (res) |
return res; |
return newphid; |
605,8 → 637,8 |
*/ |
int ipc_data_send(int phoneid, void *src, size_t size) |
{ |
return ipc_call_sync_3(phoneid, IPC_M_DATA_SEND, 0, (ipcarg_t) src, |
(ipcarg_t) size, NULL, NULL, NULL); |
return ipc_call_sync_3_0(phoneid, IPC_M_DATA_SEND, 0, (ipcarg_t) src, |
(ipcarg_t) size); |
} |
/** Wrapper for receiving the IPC_M_DATA_SEND calls. |
/trunk/uspace/srv/fs/fat/fat.c |
---|
157,8 → 157,8 |
/* |
* Request sharing the Path Lookup Buffer with VFS. |
*/ |
rc = ipc_call_sync_3(vfs_phone, IPC_M_AS_AREA_RECV, (ipcarg_t) plb_ro, |
PLB_SIZE, 0, NULL, NULL, NULL); |
rc = ipc_call_sync_2_0(vfs_phone, IPC_M_AS_AREA_RECV, (ipcarg_t) plb_ro, |
PLB_SIZE); |
if (rc) { |
async_wait_for(req, NULL); |
return rc; |