Index: uspace/lib/c/generic/ipc.c
===================================================================
--- uspace/lib/c/generic/ipc.c	(revision 228e490270cec3d6a6de666f61839f0d9ed5f193)
+++ uspace/lib/c/generic/ipc.c	(revision 63f89665fc0283c1661274dc636d5a66e03d48b4)
@@ -38,5 +38,5 @@
  */
 /** @file
- */
+ */ 
 
 #include <ipc/ipc.h>
@@ -104,7 +104,7 @@
  */
 int
-ipc_call_sync_fast(int phoneid, sysarg_t method, sysarg_t arg1, sysarg_t arg2,
-    sysarg_t arg3, sysarg_t *result1, sysarg_t *result2, sysarg_t *result3,
-    sysarg_t *result4, sysarg_t *result5)
+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;
@@ -131,29 +131,29 @@
 /** Make a synchronous call transmitting 5 arguments of payload.
  *
- * @param phoneid Phone handle for the call.
- * @param imethod Requested interface and 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.
- *
+ * @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_slow(int phoneid, sysarg_t imethod, sysarg_t arg1, sysarg_t arg2,
-    sysarg_t arg3, sysarg_t arg4, sysarg_t arg5, sysarg_t *result1,
-    sysarg_t *result2, sysarg_t *result3, sysarg_t *result4, sysarg_t *result5)
+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;
-	
-	IPC_SET_IMETHOD(data, imethod);
+	int callres;
+
+	IPC_SET_METHOD(data, method);
 	IPC_SET_ARG1(data, arg1);
 	IPC_SET_ARG2(data, arg2);
@@ -161,10 +161,10 @@
 	IPC_SET_ARG4(data, arg4);
 	IPC_SET_ARG5(data, arg5);
-	
-	int callres = __SYSCALL3(SYS_IPC_CALL_SYNC_SLOW, phoneid,
-	    (sysarg_t) &data, (sysarg_t) &data);
+
+	callres = __SYSCALL3(SYS_IPC_CALL_SYNC_SLOW, phoneid, (sysarg_t) &data,
+	    (sysarg_t) &data);
 	if (callres)
 		return callres;
-	
+
 	if (result1)
 		*result1 = IPC_GET_ARG1(data);
@@ -177,5 +177,5 @@
 	if (result5)
 		*result5 = IPC_GET_ARG5(data);
-	
+
 	return IPC_GET_RETVAL(data);
 }
@@ -183,9 +183,8 @@
 /** Syscall to send asynchronous message.
  *
- * @param phoneid Phone handle for the call.
- * @param data    Call data with the request.
- *
- * @return Hash of the call or an error code.
- *
+ * @param phoneid	Phone handle for the call.
+ * @param data		Call data with the request.
+ *
+ * @return		Hash of the call or an error code.
  */
 static ipc_callid_t _ipc_call_async(int phoneid, ipc_call_t *data)
@@ -278,23 +277,23 @@
  * If the call cannot be temporarily made, queue it.
  *
- * @param phoneid     Phone handle for the call.
- * @param imethod     Requested interface and 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
- *                    case the kernel temporarily refuses to accept more
- *                    asynchronous calls.
- *
- */
-void ipc_call_async_fast(int phoneid, sysarg_t imethod, sysarg_t arg1,
-    sysarg_t arg2, sysarg_t arg3, sysarg_t arg4, void *private,
+ * @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 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
+ *			case the kernel temporarily refuses to accept more
+ *			asynchronous calls.
+ */
+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;
+
 	if (callback) {
 		call = ipc_prepare_async(private, callback);
@@ -302,5 +301,5 @@
 			return;
 	}
-	
+
 	/*
 	 * We need to make sure that we get callid before another thread
@@ -308,7 +307,7 @@
 	 */
 	futex_down(&ipc_futex);
-	ipc_callid_t callid = __SYSCALL6(SYS_IPC_CALL_ASYNC_FAST, phoneid,
-	    imethod, arg1, arg2, arg3, arg4);
-	
+	callid = __SYSCALL6(SYS_IPC_CALL_ASYNC_FAST, phoneid, method, arg1,
+	    arg2, arg3, arg4);
+
 	if (callid == (ipc_callid_t) IPC_CALLRET_TEMPORARY) {
 		if (!call) {
@@ -317,5 +316,5 @@
 				return;
 		}
-		IPC_SET_IMETHOD(call->u.msg.data, imethod);
+		IPC_SET_METHOD(call->u.msg.data, method);
 		IPC_SET_ARG1(call->u.msg.data, arg1);
 		IPC_SET_ARG2(call->u.msg.data, arg2);
@@ -338,20 +337,20 @@
  * If the call cannot be temporarily made, queue it.
  *
- * @param phoneid     Phone handle for the call.
- * @param imethod     Requested interface and 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 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
- *                    case the kernel temporarily refuses to accept more
- *                    asynchronous calls.
- *
- */
-void ipc_call_async_slow(int phoneid, sysarg_t imethod, sysarg_t arg1,
-    sysarg_t arg2, sysarg_t arg3, sysarg_t arg4, sysarg_t arg5, void *private,
+ * @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 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
+ *			case the kernel temporarily refuses to accept more
+ *			asynchronous calls.
+ *
+ */
+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)
 {
@@ -363,5 +362,5 @@
 		return;
 
-	IPC_SET_IMETHOD(call->u.msg.data, imethod);
+	IPC_SET_METHOD(call->u.msg.data, method);
 	IPC_SET_ARG1(call->u.msg.data, arg1);
 	IPC_SET_ARG2(call->u.msg.data, arg2);
@@ -394,6 +393,6 @@
  * @return		Zero on success or a value from @ref errno.h on failure.
  */
-sysarg_t ipc_answer_fast(ipc_callid_t callid, sysarg_t retval, sysarg_t arg1,
-    sysarg_t arg2, sysarg_t arg3, sysarg_t arg4)
+ipcarg_t ipc_answer_fast(ipc_callid_t callid, ipcarg_t retval, ipcarg_t arg1,
+    ipcarg_t arg2, ipcarg_t arg3, ipcarg_t arg4)
 {
 	return __SYSCALL6(SYS_IPC_ANSWER_FAST, callid, retval, arg1, arg2, arg3,
@@ -413,6 +412,6 @@
  * @return		Zero on success or a value from @ref errno.h on failure.
  */
-sysarg_t ipc_answer_slow(ipc_callid_t callid, sysarg_t retval, sysarg_t arg1,
-    sysarg_t arg2, sysarg_t arg3, sysarg_t arg4, sysarg_t arg5)
+ipcarg_t ipc_answer_slow(ipc_callid_t callid, ipcarg_t retval, ipcarg_t arg1,
+    ipcarg_t arg2, ipcarg_t arg3, ipcarg_t arg4, ipcarg_t arg5)
 {
 	ipc_call_t data;
@@ -586,5 +585,5 @@
  */
 int ipc_connect_to_me(int phoneid, int arg1, int arg2, int arg3, 
-    sysarg_t *phonehash)
+    ipcarg_t *phonehash)
 {
 	return ipc_call_sync_3_5(phoneid, IPC_M_CONNECT_TO_ME, arg1, arg2,
@@ -603,5 +602,5 @@
 int ipc_connect_me_to(int phoneid, int arg1, int arg2, int arg3)
 {
-	sysarg_t newphid;
+	ipcarg_t newphid;
 	int res;
 
@@ -627,5 +626,5 @@
 int ipc_connect_me_to_blocking(int phoneid, int arg1, int arg2, int arg3)
 {
-	sysarg_t newphid;
+	ipcarg_t newphid;
 	int res;
 
@@ -677,12 +676,12 @@
 /** Forward a received call to another destination.
  *
- * @param callid  Hash of the call to forward.
- * @param phoneid Phone handle to use for forwarding.
- * @param imethod New interface and method for the forwarded call.
- * @param arg1    New value of the first argument for the forwarded call.
- * @param arg2    New value of the second argument for the forwarded call.
- * @param mode    Flags specifying mode of the forward operation.
- *
- * @return Zero on success or an error code.
+ * @param callid	Hash of the call to forward.
+ * @param phoneid	Phone handle to use for forwarding.
+ * @param method	New method for the forwarded call.
+ * @param arg1		New value of the first argument for the forwarded call.
+ * @param arg2		New value of the second argument for the forwarded call.
+ * @param mode		Flags specifying mode of the forward operation.
+ *
+ * @return		Zero on success or an error code.
  *
  * For non-system methods, the old method, arg1 and arg2 are rewritten by the
@@ -691,19 +690,19 @@
  * methods are forwarded verbatim.
  */
-int ipc_forward_fast(ipc_callid_t callid, int phoneid, int imethod,
-    sysarg_t arg1, sysarg_t arg2, int mode)
-{
-	return __SYSCALL6(SYS_IPC_FORWARD_FAST, callid, phoneid, imethod, arg1,
+int ipc_forward_fast(ipc_callid_t callid, int phoneid, int method,
+    ipcarg_t arg1, ipcarg_t arg2, int mode)
+{
+	return __SYSCALL6(SYS_IPC_FORWARD_FAST, callid, phoneid, method, arg1, 
 	    arg2, mode);
 }
 
 
-int ipc_forward_slow(ipc_callid_t callid, int phoneid, int imethod,
-    sysarg_t arg1, sysarg_t arg2, sysarg_t arg3, sysarg_t arg4, sysarg_t arg5,
+int ipc_forward_slow(ipc_callid_t callid, int phoneid, int method,
+    ipcarg_t arg1, ipcarg_t arg2, ipcarg_t arg3, ipcarg_t arg4, ipcarg_t arg5,
     int mode)
 {
 	ipc_call_t data;
-	
-	IPC_SET_IMETHOD(data, imethod);
+
+	IPC_SET_METHOD(data, method);
 	IPC_SET_ARG1(data, arg1);
 	IPC_SET_ARG2(data, arg2);
@@ -711,5 +710,5 @@
 	IPC_SET_ARG4(data, arg4);
 	IPC_SET_ARG5(data, arg5);
-	
+
 	return __SYSCALL4(SYS_IPC_FORWARD_SLOW, callid, phoneid, (sysarg_t) &data, mode);
 }
@@ -726,10 +725,10 @@
  * @return		Zero on success or a negative error code from errno.h.
  */
-int ipc_share_in_start(int phoneid, void *dst, size_t size, sysarg_t arg,
+int ipc_share_in_start(int phoneid, void *dst, size_t size, ipcarg_t arg,
     int *flags)
 {
 	sysarg_t tmp_flags = 0;
-	int res = ipc_call_sync_3_2(phoneid, IPC_M_SHARE_IN, (sysarg_t) dst,
-	    (sysarg_t) size, arg, NULL, &tmp_flags);
+	int res = ipc_call_sync_3_2(phoneid, IPC_M_SHARE_IN, (ipcarg_t) dst,
+	    (ipcarg_t) size, arg, NULL, &tmp_flags);
 	
 	if (flags)
@@ -752,5 +751,5 @@
 int ipc_share_in_finalize(ipc_callid_t callid, void *src, int flags)
 {
-	return ipc_answer_2(callid, EOK, (sysarg_t) src, (sysarg_t) flags);
+	return ipc_answer_2(callid, EOK, (ipcarg_t) src, (ipcarg_t) flags);
 }
 
@@ -765,6 +764,6 @@
 int ipc_share_out_start(int phoneid, void *src, int flags)
 {
-	return ipc_call_sync_3_0(phoneid, IPC_M_SHARE_OUT, (sysarg_t) src, 0,
-	    (sysarg_t) flags);
+	return ipc_call_sync_3_0(phoneid, IPC_M_SHARE_OUT, (ipcarg_t) src, 0,
+	    (ipcarg_t) flags);
 }
 
@@ -781,5 +780,5 @@
 int ipc_share_out_finalize(ipc_callid_t callid, void *dst)
 {
-	return ipc_answer_1(callid, EOK, (sysarg_t) dst);
+	return ipc_answer_1(callid, EOK, (ipcarg_t) dst);
 }
 
@@ -795,6 +794,6 @@
 int ipc_data_read_start(int phoneid, void *dst, size_t size)
 {
-	return ipc_call_sync_2_0(phoneid, IPC_M_DATA_READ, (sysarg_t) dst,
-	    (sysarg_t) size);
+	return ipc_call_sync_2_0(phoneid, IPC_M_DATA_READ, (ipcarg_t) dst,
+	    (ipcarg_t) size);
 }
 
@@ -813,5 +812,5 @@
 int ipc_data_read_finalize(ipc_callid_t callid, const void *src, size_t size)
 {
-	return ipc_answer_2(callid, EOK, (sysarg_t) src, (sysarg_t) size);
+	return ipc_answer_2(callid, EOK, (ipcarg_t) src, (ipcarg_t) size);
 }
 
@@ -826,6 +825,6 @@
 int ipc_data_write_start(int phoneid, const void *src, size_t size)
 {
-	return ipc_call_sync_2_0(phoneid, IPC_M_DATA_WRITE, (sysarg_t) src,
-	    (sysarg_t) size);
+	return ipc_call_sync_2_0(phoneid, IPC_M_DATA_WRITE, (ipcarg_t) src,
+	    (ipcarg_t) size);
 }
 
@@ -843,22 +842,19 @@
 int ipc_data_write_finalize(ipc_callid_t callid, void *dst, size_t size)
 {
-	return ipc_answer_2(callid, EOK, (sysarg_t) dst, (sysarg_t) size);
-}
-
+	return ipc_answer_2(callid, EOK, (ipcarg_t) dst, (ipcarg_t) size);
+}
+
+#include <kernel/syscall/sysarg64.h>
 /** Connect to a task specified by id.
- *
  */
 int ipc_connect_kbox(task_id_t id)
 {
-#ifdef __32_BITS__
-	sysarg64_t arg = (sysarg64_t) id;
+	sysarg64_t arg;
+
+	arg.value = (unsigned long long) id;
+
 	return __SYSCALL1(SYS_IPC_CONNECT_KBOX, (sysarg_t) &arg);
-#endif
-	
-#ifdef __64_BITS__
-	return __SYSCALL1(SYS_IPC_CONNECT_KBOX, (sysarg_t) id);
-#endif
-}
-
+}
+ 
 /** @}
  */
