Index: uspace/lib/libc/generic/ipc.c
===================================================================
--- uspace/lib/libc/generic/ipc.c	(revision 6c383b0276be208b47b6cf306a8fcdbe62d15436)
+++ uspace/lib/libc/generic/ipc.c	(revision 2e51969e2c8c3905ceef1d73437f34d14c927dff)
@@ -85,30 +85,7 @@
 /** 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().
- *
- * @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.
- *
- * @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)
-{
-	ipc_call_t resdata;
-	int callres;
-	
-	callres = __SYSCALL4(SYS_IPC_CALL_SYNC_FAST, phoneid, method, arg1,
-	    (sysarg_t) &resdata);
-	if (callres)
-		return callres;
-	if (result)
-		*result = IPC_GET_ARG1(resdata);
-	return IPC_GET_RETVAL(resdata);
-}
-
-/** Make a synchronous call transmitting 3 arguments of payload.
+ * 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.
@@ -117,13 +94,61 @@
  * @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_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 = __SYSCALL6(SYS_IPC_CALL_SYNC_FAST, phoneid, method, arg1,
+	    arg2, arg3, (sysarg_t) &resdata);
+	if (callres)
+		return callres;
+	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 5 arguments of payload.
+ *
+ * @param phoneid	Phone handle for the call.
+ * @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 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;
@@ -134,6 +159,8 @@
 	IPC_SET_ARG2(data, arg2);
 	IPC_SET_ARG3(data, arg3);
-
-	callres = __SYSCALL3(SYS_IPC_CALL_SYNC, phoneid, (sysarg_t) &data,
+	IPC_SET_ARG4(data, arg4);
+	IPC_SET_ARG5(data, arg5);
+
+	callres = __SYSCALL3(SYS_IPC_CALL_SYNC_SLOW, phoneid, (sysarg_t) &data,
 	    (sysarg_t) &data);
 	if (callres)
@@ -146,4 +173,9 @@
 	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);
 }
@@ -516,6 +548,6 @@
 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);
 }
 
@@ -533,6 +565,6 @@
 	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;
@@ -606,6 +638,6 @@
 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);
 }
 
Index: uspace/lib/libc/generic/time.c
===================================================================
--- uspace/lib/libc/generic/time.c	(revision 6c383b0276be208b47b6cf306a8fcdbe62d15436)
+++ uspace/lib/libc/generic/time.c	(revision 2e51969e2c8c3905ceef1d73437f34d14c927dff)
@@ -142,7 +142,7 @@
 		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");
Index: uspace/lib/libc/include/ipc/ipc.h
===================================================================
--- uspace/lib/libc/include/ipc/ipc.h	(revision 6c383b0276be208b47b6cf306a8fcdbe62d15436)
+++ uspace/lib/libc/include/ipc/ipc.h	(revision 2e51969e2c8c3905ceef1d73437f34d14c927dff)
@@ -52,13 +52,136 @@
     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);
-
-extern int ipc_call_sync(int phoneid, ipcarg_t method, ipcarg_t arg1,
-    ipcarg_t *result);
+    ipcarg_t *result3, ipcarg_t *result4, ipcarg_t *result5);
+
+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);
