Index: abi/include/abi/cap.h
===================================================================
--- abi/include/abi/cap.h	(revision f571ca49efe28da95a101816b820671161b895b2)
+++ abi/include/abi/cap.h	(revision f571ca49efe28da95a101816b820671161b895b2)
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2017 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @addtogroup generic
+ * @{
+ */
+/** @file
+ */
+
+#ifndef ABI_CAP_H_
+#define ABI_CAP_H_
+
+#define CAP_NIL		0
+
+#endif
+
+/** @}
+ */
Index: abi/include/abi/ipc/methods.h
===================================================================
--- abi/include/abi/ipc/methods.h	(revision 503ffceaab0f4c54907677d3399c3ed1363e507f)
+++ abi/include/abi/ipc/methods.h	(revision f571ca49efe28da95a101816b820671161b895b2)
@@ -36,6 +36,8 @@
 #define ABI_IPC_METHODS_H_
 
+#include <abi/cap.h>
+
 /* Well known phone descriptors */
-#define PHONE_NS  0
+#define PHONE_NS  (CAP_NIL + 1)
 
 /** Kernel IPC interfaces
Index: kernel/generic/src/cap/cap.c
===================================================================
--- kernel/generic/src/cap/cap.c	(revision 503ffceaab0f4c54907677d3399c3ed1363e507f)
+++ kernel/generic/src/cap/cap.c	(revision f571ca49efe28da95a101816b820671161b895b2)
@@ -73,4 +73,5 @@
 
 #include <cap/cap.h>
+#include <abi/cap.h>
 #include <proc/task.h>
 #include <synch/mutex.h>
@@ -81,5 +82,7 @@
 #include <stdint.h>
 
-#define MAX_CAPS	INT_MAX
+#define CAPS_START	(CAP_NIL + 1)
+#define CAPS_SIZE	(INT_MAX - CAPS_START)
+#define CAPS_LAST	(CAPS_SIZE - 1)
 
 static slab_cache_t *cap_slab;
@@ -129,5 +132,5 @@
 	if (!task->cap_info->handles)
 		goto error_handles;
-	if (!ra_span_add(task->cap_info->handles, 0, MAX_CAPS))
+	if (!ra_span_add(task->cap_info->handles, CAPS_START, CAPS_SIZE))
 		goto error_span;
 	if (!hash_table_create(&task->cap_info->caps, 0, 0, &caps_ops))
@@ -220,5 +223,5 @@
 	assert(mutex_locked(&task->cap_info->lock));
 
-	if ((handle < 0) || (handle >= MAX_CAPS))
+	if ((handle < CAPS_START) || (handle > CAPS_LAST))
 		return NULL;
 	ht_link_t *link = hash_table_find(&task->cap_info->caps, &handle);
@@ -357,6 +360,6 @@
 void cap_free(task_t *task, cap_handle_t handle)
 {
-	assert(handle >= 0);
-	assert(handle < MAX_CAPS);
+	assert(handle >= CAPS_START);
+	assert(handle <= CAPS_LAST);
 
 	mutex_lock(&task->cap_info->lock);
