Index: kernel/generic/src/ipc/sysipc.c
===================================================================
--- kernel/generic/src/ipc/sysipc.c	(revision c25a39e2128c1d1c14d7a9f13ab8a2fb58439aae)
+++ kernel/generic/src/ipc/sysipc.c	(revision eadaeae8dacc68cf558028f23cc96b90a08b7361)
@@ -271,5 +271,6 @@
  *
  */
-errno_t ipc_req_internal(cap_handle_t handle, ipc_data_t *data, sysarg_t priv)
+errno_t
+ipc_req_internal(cap_phone_handle_t handle, ipc_data_t *data, sysarg_t priv)
 {
 	kobject_t *kobj = kobject_get(TASK, handle, KOBJECT_TYPE_PHONE);
@@ -362,5 +363,5 @@
  *
  */
-sys_errno_t sys_ipc_call_async_fast(sysarg_t handle, sysarg_t imethod,
+sys_errno_t sys_ipc_call_async_fast(cap_phone_handle_t handle, sysarg_t imethod,
     sysarg_t arg1, sysarg_t arg2, sysarg_t arg3, sysarg_t label)
 {
@@ -409,5 +410,5 @@
  *
  */
-sys_errno_t sys_ipc_call_async_slow(sysarg_t handle, ipc_data_t *data,
+sys_errno_t sys_ipc_call_async_slow(cap_phone_handle_t handle, ipc_data_t *data,
     sysarg_t label)
 {
@@ -466,7 +467,7 @@
  *
  */
-static sys_errno_t sys_ipc_forward_common(sysarg_t chandle, sysarg_t phandle,
-    sysarg_t imethod, sysarg_t arg1, sysarg_t arg2, sysarg_t arg3,
-    sysarg_t arg4, sysarg_t arg5, unsigned int mode, bool slow)
+static sys_errno_t sys_ipc_forward_common(cap_call_handle_t chandle,
+    cap_phone_handle_t phandle, sysarg_t imethod, sysarg_t arg1, sysarg_t arg2,
+    sysarg_t arg3, sysarg_t arg4, sysarg_t arg5, unsigned int mode, bool slow)
 {
 	kobject_t *ckobj = cap_unpublish(TASK, chandle, KOBJECT_TYPE_CALL);
@@ -506,5 +507,6 @@
 		if (method_is_system(IPC_GET_IMETHOD(call->data))) {
 			if (IPC_GET_IMETHOD(call->data) == IPC_M_CONNECT_TO_ME)
-				phone_dealloc(IPC_GET_ARG5(call->data));
+				phone_dealloc((cap_phone_handle_t)
+				    IPC_GET_ARG5(call->data));
 
 			IPC_SET_ARG1(call->data, imethod);
@@ -577,6 +579,7 @@
  *
  */
-sys_errno_t sys_ipc_forward_fast(sysarg_t chandle, sysarg_t phandle,
-    sysarg_t imethod, sysarg_t arg1, sysarg_t arg2, unsigned int mode)
+sys_errno_t sys_ipc_forward_fast(cap_call_handle_t chandle,
+    cap_phone_handle_t phandle, sysarg_t imethod, sysarg_t arg1, sysarg_t arg2,
+    unsigned int mode)
 {
 	return sys_ipc_forward_common(chandle, phandle, imethod, arg1, arg2, 0,
@@ -601,6 +604,6 @@
  *
  */
-sys_errno_t sys_ipc_forward_slow(sysarg_t chandle, sysarg_t phandle,
-    ipc_data_t *data, unsigned int mode)
+sys_errno_t sys_ipc_forward_slow(cap_call_handle_t chandle,
+    cap_phone_handle_t phandle, ipc_data_t *data, unsigned int mode)
 {
 	ipc_data_t newdata;
@@ -631,6 +634,6 @@
  *
  */
-sys_errno_t sys_ipc_answer_fast(sysarg_t chandle, sysarg_t retval, sysarg_t arg1,
-    sysarg_t arg2, sysarg_t arg3, sysarg_t arg4)
+sys_errno_t sys_ipc_answer_fast(cap_call_handle_t chandle, sysarg_t retval,
+    sysarg_t arg1, sysarg_t arg2, sysarg_t arg3, sysarg_t arg4)
 {
 	kobject_t *kobj = cap_unpublish(TASK, chandle, KOBJECT_TYPE_CALL);
@@ -678,5 +681,5 @@
  *
  */
-sys_errno_t sys_ipc_answer_slow(sysarg_t chandle, ipc_data_t *data)
+sys_errno_t sys_ipc_answer_slow(cap_call_handle_t chandle, ipc_data_t *data)
 {
 	kobject_t *kobj = cap_unpublish(TASK, chandle, KOBJECT_TYPE_CALL);
@@ -722,5 +725,5 @@
  *
  */
-sys_errno_t sys_ipc_hangup(sysarg_t handle)
+sys_errno_t sys_ipc_hangup(cap_phone_handle_t handle)
 {
 	kobject_t *kobj = cap_unpublish(TASK, handle, KOBJECT_TYPE_PHONE);
@@ -800,5 +803,5 @@
 		goto restart;
 
-	cap_handle_t handle;
+	cap_handle_t handle = CAP_NIL;
 	errno_t rc = cap_alloc(TASK, &handle);
 	if (rc != EOK) {
@@ -821,5 +824,5 @@
 
 error:
-	if (handle >= 0)
+	if (CAP_HANDLE_VALID(handle))
 		cap_free(TASK, handle);
 
@@ -861,5 +864,5 @@
  * @param ucode   Uspace pointer to the top-half pseudocode.
  *
- * @param[out] uspace_handle  Uspace pointer to IRQ kernel object capability
+ * @param[out] uspace_handle  Uspace pointer to IRQ capability handle
  *
  * @return EPERM
@@ -867,6 +870,6 @@
  *
  */
-sys_errno_t sys_ipc_irq_subscribe(inr_t inr, sysarg_t imethod, irq_code_t *ucode,
-	cap_handle_t *uspace_handle)
+sys_errno_t sys_ipc_irq_subscribe(inr_t inr, sysarg_t imethod,
+    irq_code_t *ucode, cap_irq_handle_t *uspace_handle)
 {
 	if (!(perm_get(TASK) & PERM_IRQ_REG))
@@ -878,16 +881,15 @@
 /** Disconnect an IRQ handler from a task.
  *
- * @param inr   IRQ number.
- * @param devno Device number.
+ * @param handle  IRQ capability handle.
  *
  * @return Zero on success or EPERM on error.
  *
  */
-sys_errno_t sys_ipc_irq_unsubscribe(sysarg_t cap)
+sys_errno_t sys_ipc_irq_unsubscribe(cap_irq_handle_t handle)
 {
 	if (!(perm_get(TASK) & PERM_IRQ_REG))
 		return EPERM;
 
-	ipc_irq_unsubscribe(&TASK->answerbox, cap);
+	ipc_irq_unsubscribe(&TASK->answerbox, handle);
 
 	return 0;
@@ -899,9 +901,10 @@
  *
  */
-sys_errno_t sys_ipc_connect_kbox(task_id_t *uspace_taskid, cap_handle_t *uspace_phone)
+sys_errno_t sys_ipc_connect_kbox(task_id_t *uspace_taskid,
+    cap_phone_handle_t *uspace_phone)
 {
 #ifdef CONFIG_UDEBUG
 	task_id_t taskid;
-	cap_handle_t phone;
+	cap_phone_handle_t phone;
 
 	errno_t rc = copy_from_uspace(&taskid, uspace_taskid, sizeof(task_id_t));
