Index: kernel/generic/src/adt/bitmap.c
===================================================================
--- kernel/generic/src/adt/bitmap.c	(revision bf1fb9f49ca7a033e969484ce601cf42dfbecd12)
+++ kernel/generic/src/adt/bitmap.c	(revision cc27c8c5e6462ab97fd46b844e8591be59e37ac6)
@@ -55,5 +55,5 @@
  * @param bits Number of bits stored in bitmap.
  */
-void bitmap_initialize(bitmap_t *bitmap, uint8_t *map, count_t bits)
+void bitmap_initialize(bitmap_t *bitmap, uint8_t *map, size_t bits)
 {
 	bitmap->map = map;
@@ -67,11 +67,11 @@
  * @param bits Number of bits to set.
  */
-void bitmap_set_range(bitmap_t *bitmap, index_t start, count_t bits)
+void bitmap_set_range(bitmap_t *bitmap, size_t start, size_t bits)
 {
-	index_t i=0;
-	index_t aligned_start;
-	count_t lub;		/* leading unaligned bits */
-	count_t amb;		/* aligned middle bits */
-	count_t tab;		/* trailing aligned bits */
+	size_t i = 0;
+	size_t aligned_start;
+	size_t lub;		/* leading unaligned bits */
+	size_t amb;		/* aligned middle bits */
+	size_t tab;		/* trailing aligned bits */
 	
 	ASSERT(start + bits <= bitmap->bits);
@@ -117,11 +117,11 @@
  * @param bits Number of bits to clear.
  */
-void bitmap_clear_range(bitmap_t *bitmap, index_t start, count_t bits)
+void bitmap_clear_range(bitmap_t *bitmap, size_t start, size_t bits)
 {
-	index_t i=0;
-	index_t aligned_start;
-	count_t lub;		/* leading unaligned bits */
-	count_t amb;		/* aligned middle bits */
-	count_t tab;		/* trailing aligned bits */
+	size_t i = 0;
+	size_t aligned_start;
+	size_t lub;		/* leading unaligned bits */
+	size_t amb;		/* aligned middle bits */
+	size_t tab;		/* trailing aligned bits */
 	
 	ASSERT(start + bits <= bitmap->bits);
@@ -169,7 +169,7 @@
  * @param bits Number of bits to copy.
  */
-void bitmap_copy(bitmap_t *dst, bitmap_t *src, count_t bits)
+void bitmap_copy(bitmap_t *dst, bitmap_t *src, size_t bits)
 {
-	index_t i;
+	size_t i;
 	
 	ASSERT(bits <= dst->bits);
Index: kernel/generic/src/adt/btree.c
===================================================================
--- kernel/generic/src/adt/btree.c	(revision bf1fb9f49ca7a033e969484ce601cf42dfbecd12)
+++ kernel/generic/src/adt/btree.c	(revision cc27c8c5e6462ab97fd46b844e8591be59e37ac6)
@@ -64,7 +64,7 @@
 static btree_node_t *node_split(btree_node_t *node, btree_key_t key, void *value, btree_node_t *rsubtree, btree_key_t *median);
 static btree_node_t *node_combine(btree_node_t *node);
-static index_t find_key_by_subtree(btree_node_t *node, btree_node_t *subtree, bool right);
-static void rotate_from_right(btree_node_t *lnode, btree_node_t *rnode, index_t idx);
-static void rotate_from_left(btree_node_t *lnode, btree_node_t *rnode, index_t idx);
+static size_t find_key_by_subtree(btree_node_t *node, btree_node_t *subtree, bool right);
+static void rotate_from_right(btree_node_t *lnode, btree_node_t *rnode, size_t idx);
+static void rotate_from_left(btree_node_t *lnode, btree_node_t *rnode, size_t idx);
 static bool try_insert_by_rotation_to_left(btree_node_t *node, btree_key_t key, void *value, btree_node_t *rsubtree);
 static bool try_insert_by_rotation_to_right(btree_node_t *node, btree_key_t key, void *value, btree_node_t *rsubtree);
@@ -138,5 +138,5 @@
 void btree_destroy_subtree(btree_node_t *root)
 {
-	count_t i;
+	size_t i;
 
 	if (root->keys) {
@@ -270,5 +270,5 @@
 	
 	if (node->keys > FILL_FACTOR) {
-		count_t i;
+		size_t i;
 
 		/*
@@ -286,5 +286,5 @@
 		
 	} else {
-		index_t idx;
+		size_t idx;
 		btree_node_t *rnode, *parent;
 
@@ -336,5 +336,5 @@
 		} else {
 			void *val;
-			count_t i;
+			size_t i;
 		
 			/*
@@ -443,9 +443,9 @@
 void node_insert_key_and_lsubtree(btree_node_t *node, btree_key_t key, void *value, btree_node_t *lsubtree)
 {
-	count_t i;
+	size_t i;
 
 	for (i = 0; i < node->keys; i++) {
 		if (key < node->key[i]) {
-			count_t j;
+			size_t j;
 		
 			for (j = node->keys; j > i; j--) {
@@ -479,9 +479,9 @@
 void node_insert_key_and_rsubtree(btree_node_t *node, btree_key_t key, void *value, btree_node_t *rsubtree)
 {
-	count_t i;
+	size_t i;
 
 	for (i = 0; i < node->keys; i++) {
 		if (key < node->key[i]) {
-			count_t j;
+			size_t j;
 		
 			for (j = node->keys; j > i; j--) {
@@ -511,5 +511,5 @@
 void node_remove_key_and_lsubtree(btree_node_t *node, btree_key_t key)
 {
-	count_t i, j;
+	size_t i, j;
 	
 	for (i = 0; i < node->keys; i++) {
@@ -539,5 +539,5 @@
 void node_remove_key_and_rsubtree(btree_node_t *node, btree_key_t key)
 {
-	count_t i, j;
+	size_t i, j;
 	
 	for (i = 0; i < node->keys; i++) {
@@ -577,5 +577,5 @@
 {
 	btree_node_t *rnode;
-	count_t i, j;
+	size_t i, j;
 
 	ASSERT(median);
@@ -604,5 +604,5 @@
 	 * If this is an index node, do not copy the median.
 	 */
-	i = (count_t) INDEX_NODE(node);
+	i = (size_t) INDEX_NODE(node);
 	for (i += MEDIAN_HIGH_INDEX(node), j = 0; i < node->keys; i++, j++) {
 		rnode->key[j] = node->key[i];
@@ -637,7 +637,7 @@
 btree_node_t *node_combine(btree_node_t *node)
 {
-	index_t idx;
+	size_t idx;
 	btree_node_t *rnode;
-	count_t i;
+	size_t i;
 
 	ASSERT(!ROOT_NODE(node));
@@ -686,7 +686,7 @@
  * @return Index of the key associated with the subtree.
  */ 
-index_t find_key_by_subtree(btree_node_t *node, btree_node_t *subtree, bool right)
-{
-	count_t i;
+size_t find_key_by_subtree(btree_node_t *node, btree_node_t *subtree, bool right)
+{
+	size_t i;
 	
 	for (i = 0; i < node->keys + 1; i++) {
@@ -707,5 +707,5 @@
  * @param idx Index of the parent node key that is taking part in the rotation.
  */
-void rotate_from_left(btree_node_t *lnode, btree_node_t *rnode, index_t idx)
+void rotate_from_left(btree_node_t *lnode, btree_node_t *rnode, size_t idx)
 {
 	btree_key_t key;
@@ -744,5 +744,5 @@
  * @param idx Index of the parent node key that is taking part in the rotation.
  */
-void rotate_from_right(btree_node_t *lnode, btree_node_t *rnode, index_t idx)
+void rotate_from_right(btree_node_t *lnode, btree_node_t *rnode, size_t idx)
 {
 	btree_key_t key;
@@ -787,5 +787,5 @@
 bool try_insert_by_rotation_to_left(btree_node_t *node, btree_key_t inskey, void *insvalue, btree_node_t *rsubtree)
 {
-	index_t idx;
+	size_t idx;
 	btree_node_t *lnode;
 
@@ -834,5 +834,5 @@
 bool try_insert_by_rotation_to_right(btree_node_t *node, btree_key_t inskey, void *insvalue, btree_node_t *rsubtree)
 {
-	index_t idx;
+	size_t idx;
 	btree_node_t *rnode;
 
@@ -873,5 +873,5 @@
 bool try_rotation_from_left(btree_node_t *rnode)
 {
-	index_t idx;
+	size_t idx;
 	btree_node_t *lnode;
 
@@ -908,5 +908,5 @@
 bool try_rotation_from_right(btree_node_t *lnode)
 {
-	index_t idx;
+	size_t idx;
 	btree_node_t *rnode;
 
@@ -941,5 +941,5 @@
 void btree_print(btree_t *t)
 {
-	count_t i;
+	size_t i;
 	int depth = t->root->depth;
 	link_t head, *cur;
Index: kernel/generic/src/adt/hash_table.c
===================================================================
--- kernel/generic/src/adt/hash_table.c	(revision bf1fb9f49ca7a033e969484ce601cf42dfbecd12)
+++ kernel/generic/src/adt/hash_table.c	(revision cc27c8c5e6462ab97fd46b844e8591be59e37ac6)
@@ -52,7 +52,7 @@
  * @param op Hash table operations structure.
  */
-void hash_table_create(hash_table_t *h, count_t m, count_t max_keys, hash_table_operations_t *op)
+void hash_table_create(hash_table_t *h, size_t m, size_t max_keys, hash_table_operations_t *op)
 {
-	index_t i;
+	size_t i;
 
 	ASSERT(h);
@@ -84,5 +84,5 @@
 void hash_table_insert(hash_table_t *h, unative_t key[], link_t *item)
 {
-	index_t chain;
+	size_t chain;
 	
 	ASSERT(item);
@@ -108,5 +108,5 @@
 {
 	link_t *cur;
-	index_t chain;
+	size_t chain;
 	
 	ASSERT(h);
@@ -138,7 +138,7 @@
  * @param keys Number of keys in the key array.
  */
-void hash_table_remove(hash_table_t *h, unative_t key[], count_t keys)
+void hash_table_remove(hash_table_t *h, unative_t key[], size_t keys)
 {
-	index_t chain;
+	size_t chain;
 	link_t *cur;
 	
Index: kernel/generic/src/console/cmd.c
===================================================================
--- kernel/generic/src/console/cmd.c	(revision bf1fb9f49ca7a033e969484ce601cf42dfbecd12)
+++ kernel/generic/src/console/cmd.c	(revision cc27c8c5e6462ab97fd46b844e8591be59e37ac6)
@@ -514,5 +514,5 @@
 	
 	link_t *cur;
-	count_t len = 0;
+	size_t len = 0;
 	for (cur = cmd_head.next; cur != &cmd_head; cur = cur->next) {
 		cmd_info_t *hlp;
@@ -652,5 +652,5 @@
 	 */
 	
-	count_t i;
+	size_t i;
 	for (i = 0; i < config.cpu_count; i++) {
 		if (!cpus[i].active)
@@ -971,5 +971,5 @@
 int cmd_tests(cmd_arg_t *argv)
 {
-	count_t len = 0;
+	size_t len = 0;
 	test_t *test;
 	for (test = tests; test->name != NULL; test++) {
Index: kernel/generic/src/console/console.c
===================================================================
--- kernel/generic/src/console/console.c	(revision bf1fb9f49ca7a033e969484ce601cf42dfbecd12)
+++ kernel/generic/src/console/console.c	(revision cc27c8c5e6462ab97fd46b844e8591be59e37ac6)
@@ -62,5 +62,5 @@
 static bool klog_inited = false;
 /** First kernel log characters */
-static index_t klog_start = 0;
+static size_t klog_start = 0;
 /** Number of valid kernel log characters */
 static size_t klog_len = 0;
@@ -171,8 +171,8 @@
  *
  */
-count_t gets(indev_t *indev, char *buf, size_t buflen)
+size_t gets(indev_t *indev, char *buf, size_t buflen)
 {
 	size_t offset = 0;
-	count_t count = 0;
+	size_t count = 0;
 	buf[offset] = 0;
 	
@@ -227,5 +227,5 @@
 	if ((klog_stored > 0) && (stdout) && (stdout->op->write)) {
 		/* Print charaters stored in kernel log */
-		index_t i;
+		size_t i;
 		for (i = klog_len - klog_stored; i < klog_len; i++)
 			stdout->op->write(stdout, klog[(klog_start + i) % KLOG_LENGTH], silent);
Index: kernel/generic/src/console/kconsole.c
===================================================================
--- kernel/generic/src/console/kconsole.c	(revision bf1fb9f49ca7a033e969484ce601cf42dfbecd12)
+++ kernel/generic/src/console/kconsole.c	(revision cc27c8c5e6462ab97fd46b844e8591be59e37ac6)
@@ -87,5 +87,5 @@
 
 static wchar_t history[KCONSOLE_HISTORY][MAX_CMDLINE] = {};
-static count_t history_pos = 0;
+static size_t history_pos = 0;
 
 /** Initialize kconsole data structures
@@ -160,7 +160,7 @@
 
 /** Print count times a character */
-static void print_cc(wchar_t ch, count_t count)
-{
-	count_t i;
+static void print_cc(wchar_t ch, size_t count)
+{
+	size_t i;
 	for (i = 0; i < count; i++)
 		putchar(ch);
@@ -170,5 +170,5 @@
 static const char *cmdtab_search_one(const char *name, link_t **startpos)
 {
-	count_t namelen = str_length(name);
+	size_t namelen = str_length(name);
 	
 	spinlock_lock(&cmd_lock);
@@ -206,5 +206,5 @@
 	const char *name = input;
 	
-	count_t found = 0;
+	size_t found = 0;
 	link_t *pos = NULL;
 	const char *hint;
@@ -241,5 +241,5 @@
 	printf("%s> ", prompt);
 	
-	count_t position = 0;
+	size_t position = 0;
 	wchar_t *current = history[history_pos];
 	current[0] = 0;
@@ -281,5 +281,5 @@
 			/* Find the beginning of the word
 			   and copy it to tmp */
-			count_t beg;
+			size_t beg;
 			for (beg = position - 1; (beg > 0) && (!isspace(current[beg]));
 			    beg--);
@@ -314,5 +314,5 @@
 			
 			size_t off = 0;
-			count_t i = 0;
+			size_t i = 0;
 			while ((ch = str_decode(tmp, &off, STR_NO_LIMIT)) != 0) {
 				if (!wstr_linsert(current, ch, position + i, MAX_CMDLINE))
@@ -543,5 +543,5 @@
 		if (str_lcmp(hlp->name, cmdline + start,
 		    max(str_length(hlp->name),
-		    str_nlength(cmdline + start, (count_t) (end - start) - 1))) == 0) {
+		    str_nlength(cmdline + start, (size_t) (end - start) - 1))) == 0) {
 			cmd = hlp;
 			break;
@@ -569,5 +569,5 @@
 	
 	bool error = false;
-	count_t i;
+	size_t i;
 	for (i = 0; i < cmd->argc; i++) {
 		start = end;
@@ -660,5 +660,5 @@
 	while (true) {
 		wchar_t *tmp = clever_readline((char *) prompt, stdin);
-		count_t len = wstr_length(tmp);
+		size_t len = wstr_length(tmp);
 		if (!len)
 			continue;
Index: kernel/generic/src/ddi/ddi.c
===================================================================
--- kernel/generic/src/ddi/ddi.c	(revision bf1fb9f49ca7a033e969484ce601cf42dfbecd12)
+++ kernel/generic/src/ddi/ddi.c	(revision cc27c8c5e6462ab97fd46b844e8591be59e37ac6)
@@ -98,5 +98,5 @@
  *
  */
-static int ddi_physmem_map(uintptr_t pf, uintptr_t vp, count_t pages, int flags)
+static int ddi_physmem_map(uintptr_t pf, uintptr_t vp, size_t pages, int flags)
 {
 	ASSERT(TASK);
@@ -119,7 +119,7 @@
 	/* Find the zone of the physical memory */
 	spinlock_lock(&zones.lock);
-	count_t znum = find_zone(ADDR2PFN(pf), pages, 0);
-	
-	if (znum == (count_t) -1) {
+	size_t znum = find_zone(ADDR2PFN(pf), pages, 0);
+	
+	if (znum == (size_t) -1) {
 		/* Frames not found in any zones
 		 * -> assume it is hardware device and allow mapping
@@ -243,5 +243,5 @@
 	return (unative_t) ddi_physmem_map(ALIGN_DOWN((uintptr_t) phys_base,
 	    FRAME_SIZE), ALIGN_DOWN((uintptr_t) virt_base, PAGE_SIZE),
-	    (count_t) pages, (int) flags);
+	    (size_t) pages, (int) flags);
 }
 
Index: kernel/generic/src/ddi/irq.c
===================================================================
--- kernel/generic/src/ddi/irq.c	(revision bf1fb9f49ca7a033e969484ce601cf42dfbecd12)
+++ kernel/generic/src/ddi/irq.c	(revision cc27c8c5e6462ab97fd46b844e8591be59e37ac6)
@@ -100,6 +100,6 @@
  * there will be collisions between different keys.
  */
-static index_t irq_ht_hash(unative_t *key);
-static bool irq_ht_compare(unative_t *key, count_t keys, link_t *item);
+static size_t irq_ht_hash(unative_t *key);
+static bool irq_ht_compare(unative_t *key, size_t keys, link_t *item);
 static void irq_ht_remove(link_t *item);
 
@@ -116,6 +116,6 @@
  * elements with single key (sharing of one IRQ).
  */
-static index_t irq_lin_hash(unative_t *key);
-static bool irq_lin_compare(unative_t *key, count_t keys, link_t *item);
+static size_t irq_lin_hash(unative_t *key);
+static bool irq_lin_compare(unative_t *key, size_t keys, link_t *item);
 static void irq_lin_remove(link_t *item);
 
@@ -127,5 +127,5 @@
 
 /** Number of buckets in either of the hash tables. */
-static count_t buckets;
+static size_t buckets;
 
 /** Initialize IRQ subsystem.
@@ -134,5 +134,5 @@
  * @param chains Number of chains in the hash table.
  */
-void irq_init(count_t inrs, count_t chains)
+void irq_init(size_t inrs, size_t chains)
 {
 	buckets = chains;
@@ -299,5 +299,5 @@
  * @return Index into the hash table.
  */
-index_t irq_ht_hash(unative_t key[])
+size_t irq_ht_hash(unative_t key[])
 {
 	inr_t inr = (inr_t) key[KEY_INR];
@@ -325,5 +325,5 @@
  * @return True on match or false otherwise.
  */
-bool irq_ht_compare(unative_t key[], count_t keys, link_t *item)
+bool irq_ht_compare(unative_t key[], size_t keys, link_t *item)
 {
 	irq_t *irq = hash_table_get_instance(item, irq_t, link);
@@ -372,5 +372,5 @@
  * @return Index into the hash table.
  */
-index_t irq_lin_hash(unative_t key[])
+size_t irq_lin_hash(unative_t key[])
 {
 	inr_t inr = (inr_t) key[KEY_INR];
@@ -398,5 +398,5 @@
  * @return True on match or false otherwise.
  */
-bool irq_lin_compare(unative_t key[], count_t keys, link_t *item)
+bool irq_lin_compare(unative_t key[], size_t keys, link_t *item)
 {
 	irq_t *irq = list_get_instance(item, irq_t, link);
Index: kernel/generic/src/debug/symtab.c
===================================================================
--- kernel/generic/src/debug/symtab.c	(revision bf1fb9f49ca7a033e969484ce601cf42dfbecd12)
+++ kernel/generic/src/debug/symtab.c	(revision cc27c8c5e6462ab97fd46b844e8591be59e37ac6)
@@ -56,5 +56,5 @@
 {
 #ifdef CONFIG_SYMTAB
-	count_t i;
+	size_t i;
 	
 	for (i = 1; symbol_table[i].address_le; i++) {
@@ -113,9 +113,9 @@
  *
  */
-static const char *symtab_search_one(const char *name, count_t *startpos)
-{
-	count_t namelen = str_length(name);
-	
-	count_t pos;
+static const char *symtab_search_one(const char *name, size_t *startpos)
+{
+	size_t namelen = str_length(name);
+	
+	size_t pos;
 	for (pos = *startpos; symbol_table[pos].address_le; pos++) {
 		const char *curname = symbol_table[pos].symbol_name;
@@ -154,6 +154,6 @@
 {
 #ifdef CONFIG_SYMTAB
-	count_t found = 0;
-	count_t pos = 0;
+	size_t found = 0;
+	size_t pos = 0;
 	const char *hint;
 	
@@ -183,5 +183,5 @@
 {
 #ifdef CONFIG_SYMTAB
-	count_t pos = 0;
+	size_t pos = 0;
 	while (symtab_search_one(name, &pos)) {
 		uintptr_t addr = uint64_t_le2host(symbol_table[pos].address_le);
@@ -204,5 +204,5 @@
  *
  */
-int symtab_compl(char *input, count_t size)
+int symtab_compl(char *input, size_t size)
 {
 #ifdef CONFIG_SYMTAB
@@ -217,6 +217,6 @@
 		return 0;
 	
-	count_t found = 0;
-	count_t pos = 0;
+	size_t found = 0;
+	size_t pos = 0;
 	const char *hint;
 	char output[MAX_SYMBOL_NAME];
Index: kernel/generic/src/ipc/event.c
===================================================================
--- kernel/generic/src/ipc/event.c	(revision bf1fb9f49ca7a033e969484ce601cf42dfbecd12)
+++ kernel/generic/src/ipc/event.c	(revision cc27c8c5e6462ab97fd46b844e8591be59e37ac6)
@@ -65,6 +65,6 @@
 }
 
-static int
-event_subscribe(event_type_t evno, unative_t method, answerbox_t *answerbox)
+static int event_subscribe(event_type_t evno, unative_t method,
+    answerbox_t *answerbox)
 {
 	if (evno >= EVENT_END)
@@ -123,6 +123,5 @@
 }
 
-void
-event_notify(event_type_t evno, unative_t a1, unative_t a2, unative_t a3,
+void event_notify(event_type_t evno, unative_t a1, unative_t a2, unative_t a3,
     unative_t a4, unative_t a5)
 {
Index: kernel/generic/src/lib/sort.c
===================================================================
--- kernel/generic/src/lib/sort.c	(revision bf1fb9f49ca7a033e969484ce601cf42dfbecd12)
+++ kernel/generic/src/lib/sort.c	(revision cc27c8c5e6462ab97fd46b844e8591be59e37ac6)
@@ -46,6 +46,6 @@
 #define EBUFSIZE	32
 
-void _qsort(void * data, count_t n, size_t e_size, int (* cmp) (void * a, void * b), void *tmp, void *pivot);
-void _bubblesort(void * data, count_t n, size_t e_size, int (* cmp) (void * a, void * b), void *slot);
+void _qsort(void * data, size_t n, size_t e_size, int (* cmp) (void * a, void * b), void *tmp, void *pivot);
+void _bubblesort(void * data, size_t n, size_t e_size, int (* cmp) (void * a, void * b), void *slot);
 
 /** Quicksort wrapper
@@ -62,5 +62,5 @@
  * 
  */
-void qsort(void * data, count_t n, size_t e_size, int (* cmp) (void * a, void * b))
+void qsort(void * data, size_t n, size_t e_size, int (* cmp) (void * a, void * b))
 {
 	uint8_t buf_tmp[EBUFSIZE];
@@ -94,5 +94,5 @@
  * 
  */
-void _qsort(void * data, count_t n, size_t e_size, int (* cmp) (void * a, void * b), void *tmp, void *pivot)
+void _qsort(void * data, size_t n, size_t e_size, int (* cmp) (void * a, void * b), void *tmp, void *pivot)
 {
 	if (n > 4) {
@@ -134,5 +134,5 @@
  * 
  */
-void bubblesort(void * data, count_t n, size_t e_size, int (* cmp) (void * a, void * b))
+void bubblesort(void * data, size_t n, size_t e_size, int (* cmp) (void * a, void * b))
 {
 	uint8_t buf_slot[EBUFSIZE];
@@ -161,5 +161,5 @@
  * 
  */
-void _bubblesort(void * data, count_t n, size_t e_size, int (* cmp) (void * a, void * b), void *slot)
+void _bubblesort(void * data, size_t n, size_t e_size, int (* cmp) (void * a, void * b), void *slot)
 {
 	bool done = false;
Index: kernel/generic/src/lib/string.c
===================================================================
--- kernel/generic/src/lib/string.c	(revision bf1fb9f49ca7a033e969484ce601cf42dfbecd12)
+++ kernel/generic/src/lib/string.c	(revision cc27c8c5e6462ab97fd46b844e8591be59e37ac6)
@@ -63,8 +63,8 @@
  *
  *  [wide] string length  number of CHARACTERS in a [wide] string (excluding
- *                        the NULL-terminator), count_t
+ *                        the NULL-terminator), size_t
  *
  *  [wide] string width   number of display cells on a monospace display taken
- *                        by a [wide] string, count_t
+ *                        by a [wide] string, size_t
  *
  *
@@ -76,8 +76,8 @@
  *                            NULL-terminator)
  *
- *  length  l        count_t  number of CHARACTERS in a string (excluding the
+ *  length  l        size_t   number of CHARACTERS in a string (excluding the
  *                            null terminator)
  *
- *  width  w         count_t  number of display cells on a monospace display
+ *  width  w         size_t   number of display cells on a monospace display
  *                            taken by a string
  *
@@ -98,5 +98,5 @@
  *  pointer (char *, wchar_t *)
  *  byte offset (size_t)
- *  character index (count_t)
+ *  character index (size_t)
  *
  */
@@ -310,7 +310,7 @@
  *
  */
-size_t str_lsize(const char *str, count_t max_len)
-{
-	count_t len = 0;
+size_t str_lsize(const char *str, size_t max_len)
+{
+	size_t len = 0;
 	size_t offset = 0;
 	
@@ -338,5 +338,5 @@
  *
  */
-size_t wstr_lsize(const wchar_t *str, count_t max_len)
+size_t wstr_lsize(const wchar_t *str, size_t max_len)
 {
 	return (wstr_nlength(str, max_len * sizeof(wchar_t)) * sizeof(wchar_t));
@@ -350,7 +350,7 @@
  *
  */
-count_t str_length(const char *str)
-{
-	count_t len = 0;
+size_t str_length(const char *str)
+{
+	size_t len = 0;
 	size_t offset = 0;
 	
@@ -368,7 +368,7 @@
  *
  */
-count_t wstr_length(const wchar_t *wstr)
-{
-	count_t len = 0;
+size_t wstr_length(const wchar_t *wstr)
+{
+	size_t len = 0;
 	
 	while (*wstr++ != 0)
@@ -386,7 +386,7 @@
  *
  */
-count_t str_nlength(const char *str, size_t size)
-{
-	count_t len = 0;
+size_t str_nlength(const char *str, size_t size)
+{
+	size_t len = 0;
 	size_t offset = 0;
 	
@@ -405,9 +405,9 @@
  *
  */
-count_t wstr_nlength(const wchar_t *str, size_t size)
-{
-	count_t len = 0;
-	count_t limit = ALIGN_DOWN(size, sizeof(wchar_t));
-	count_t offset = 0;
+size_t wstr_nlength(const wchar_t *str, size_t size)
+{
+	size_t len = 0;
+	size_t limit = ALIGN_DOWN(size, sizeof(wchar_t));
+	size_t offset = 0;
 	
 	while ((offset < limit) && (*str++ != 0)) {
@@ -497,5 +497,5 @@
  *
  */
-int str_lcmp(const char *s1, const char *s2, count_t max_len)
+int str_lcmp(const char *s1, const char *s2, size_t max_len)
 {
 	wchar_t c1 = 0;
@@ -505,5 +505,5 @@
 	size_t off2 = 0;
 	
-	count_t len = 0;
+	size_t len = 0;
 
 	while (true) {
@@ -616,5 +616,5 @@
 	
 	wchar_t ch;
-	count_t src_idx = 0;
+	size_t src_idx = 0;
 	size_t dst_off = 0;
 	
@@ -667,12 +667,12 @@
  *
  */
-bool wstr_linsert(wchar_t *str, wchar_t ch, count_t pos, count_t max_pos)
-{
-	count_t len = wstr_length(str);
+bool wstr_linsert(wchar_t *str, wchar_t ch, size_t pos, size_t max_pos)
+{
+	size_t len = wstr_length(str);
 	
 	if ((pos > len) || (pos + 1 > max_pos))
 		return false;
 	
-	count_t i;
+	size_t i;
 	for (i = len; i + 1 > pos; i--)
 		str[i + 1] = str[i];
@@ -695,12 +695,12 @@
  *
  */
-bool wstr_remove(wchar_t *str, count_t pos)
-{
-	count_t len = wstr_length(str);
+bool wstr_remove(wchar_t *str, size_t pos)
+{
+	size_t len = wstr_length(str);
 	
 	if (pos >= len)
 		return false;
 	
-	count_t i;
+	size_t i;
 	for (i = pos + 1; i <= len; i++)
 		str[i - 1] = str[i];
Index: kernel/generic/src/main/kinit.c
===================================================================
--- kernel/generic/src/main/kinit.c	(revision bf1fb9f49ca7a033e969484ce601cf42dfbecd12)
+++ kernel/generic/src/main/kinit.c	(revision cc27c8c5e6462ab97fd46b844e8591be59e37ac6)
@@ -128,5 +128,5 @@
 	
 	if (config.cpu_count > 1) {
-		count_t i;
+		size_t i;
 		
 		/*
@@ -141,5 +141,5 @@
 				thread_ready(thread);
 			} else
-				printf("Unable to create kcpulb thread for cpu" PRIc "\n", i);
+				printf("Unable to create kcpulb thread for cpu" PRIs "\n", i);
 		}
 	}
@@ -169,10 +169,10 @@
 	 * Create user tasks, load RAM disk images.
 	 */
-	count_t i;
+	size_t i;
 	program_t programs[CONFIG_INIT_TASKS];
 	
 	for (i = 0; i < init.cnt; i++) {
 		if (init.tasks[i].addr % FRAME_SIZE) {
-			printf("init[%" PRIc "].addr is not frame aligned\n", i);
+			printf("init[%" PRIs "].addr is not frame aligned\n", i);
 			continue;
 		}
@@ -214,5 +214,5 @@
 			
 			if (rd != RE_OK)
-				printf("Init binary %" PRIc " not used (error %d)\n", i, rd);
+				printf("Init binary %" PRIs " not used (error %d)\n", i, rd);
 		}
 	}
Index: kernel/generic/src/main/main.c
===================================================================
--- kernel/generic/src/main/main.c	(revision bf1fb9f49ca7a033e969484ce601cf42dfbecd12)
+++ kernel/generic/src/main/main.c	(revision cc27c8c5e6462ab97fd46b844e8591be59e37ac6)
@@ -154,5 +154,5 @@
 	
 	/* Avoid placing stack on top of init */
-	count_t i;
+	size_t i;
 	for (i = 0; i < init.cnt; i++) {
 		if (PA_overlaps(config.stack_base, config.stack_size,
@@ -234,5 +234,5 @@
 	LOG_EXEC(slab_enable_cpucache());
 	
-	printf("Detected %" PRIc " CPU(s), %" PRIu64" MiB free memory\n",
+	printf("Detected %" PRIs " CPU(s), %" PRIu64" MiB free memory\n",
 	    config.cpu_count, SIZE2MB(zone_total_size()));
 	
@@ -248,7 +248,7 @@
 	
 	if (init.cnt > 0) {
-		count_t i;
+		size_t i;
 		for (i = 0; i < init.cnt; i++)
-			LOG("init[%" PRIc "].addr=%#" PRIp ", init[%" PRIc
+			LOG("init[%" PRIs "].addr=%#" PRIp ", init[%" PRIs
 			    "].size=%#" PRIs, i, init.tasks[i].addr, i,
 			    init.tasks[i].size);
Index: kernel/generic/src/mm/as.c
===================================================================
--- kernel/generic/src/mm/as.c	(revision bf1fb9f49ca7a033e969484ce601cf42dfbecd12)
+++ kernel/generic/src/mm/as.c	(revision cc27c8c5e6462ab97fd46b844e8591be59e37ac6)
@@ -419,6 +419,6 @@
 			if ((cond = (bool) node->keys)) {
 				uintptr_t b = node->key[node->keys - 1];
-				count_t c =
-				    (count_t) node->value[node->keys - 1];
+				size_t c =
+				    (size_t) node->value[node->keys - 1];
 				unsigned int i = 0;
 			
@@ -556,8 +556,8 @@
 		for (i = 0; i < node->keys; i++) {
 			uintptr_t b = node->key[i];
-			count_t j;
+			size_t j;
 			pte_t *pte;
 			
-			for (j = 0; j < (count_t) node->value[i]; j++) {
+			for (j = 0; j < (size_t) node->value[i]; j++) {
 				page_table_lock(as, false);
 				pte = page_mapping_find(as, b + j * PAGE_SIZE);
@@ -789,6 +789,6 @@
 	int page_flags;
 	uintptr_t *old_frame;
-	index_t frame_idx;
-	count_t used_pages;
+	size_t frame_idx;
+	size_t used_pages;
 	
 	/* Flags for the new memory mapping */
@@ -828,5 +828,5 @@
 		node = list_get_instance(cur, btree_node_t, leaf_link);
 		for (i = 0; i < node->keys; i++) {
-			used_pages += (count_t) node->value[i];
+			used_pages += (size_t) node->value[i];
 		}
 	}
@@ -854,8 +854,8 @@
 		for (i = 0; i < node->keys; i++) {
 			uintptr_t b = node->key[i];
-			count_t j;
+			size_t j;
 			pte_t *pte;
 			
-			for (j = 0; j < (count_t) node->value[i]; j++) {
+			for (j = 0; j < (size_t) node->value[i]; j++) {
 				page_table_lock(as, false);
 				pte = page_mapping_find(as, b + j * PAGE_SIZE);
@@ -904,7 +904,7 @@
 		for (i = 0; i < node->keys; i++) {
 			uintptr_t b = node->key[i];
-			count_t j;
+			size_t j;
 			
-			for (j = 0; j < (count_t) node->value[i]; j++) {
+			for (j = 0; j < (size_t) node->value[i]; j++) {
 				page_table_lock(as, false);
 
@@ -1398,8 +1398,8 @@
  * @return		Zero on failure and non-zero on success.
  */
-int used_space_insert(as_area_t *a, uintptr_t page, count_t count)
+int used_space_insert(as_area_t *a, uintptr_t page, size_t count)
 {
 	btree_node_t *leaf, *node;
-	count_t pages;
+	size_t pages;
 	unsigned int i;
 
@@ -1407,5 +1407,5 @@
 	ASSERT(count);
 
-	pages = (count_t) btree_search(&a->used_space, page, &leaf);
+	pages = (size_t) btree_search(&a->used_space, page, &leaf);
 	if (pages) {
 		/*
@@ -1424,6 +1424,6 @@
 		uintptr_t left_pg = node->key[node->keys - 1];
 		uintptr_t right_pg = leaf->key[0];
-		count_t left_cnt = (count_t) node->value[node->keys - 1];
-		count_t right_cnt = (count_t) leaf->value[0];
+		size_t left_cnt = (size_t) node->value[node->keys - 1];
+		size_t right_cnt = (size_t) leaf->value[0];
 		
 		/*
@@ -1479,5 +1479,5 @@
 	} else if (page < leaf->key[0]) {
 		uintptr_t right_pg = leaf->key[0];
-		count_t right_cnt = (count_t) leaf->value[0];
+		size_t right_cnt = (size_t) leaf->value[0];
 	
 		/*
@@ -1514,6 +1514,6 @@
 		uintptr_t left_pg = leaf->key[leaf->keys - 1];
 		uintptr_t right_pg = node->key[0];
-		count_t left_cnt = (count_t) leaf->value[leaf->keys - 1];
-		count_t right_cnt = (count_t) node->value[0];
+		size_t left_cnt = (size_t) leaf->value[leaf->keys - 1];
+		size_t right_cnt = (size_t) node->value[0];
 		
 		/*
@@ -1569,5 +1569,5 @@
 	} else if (page >= leaf->key[leaf->keys - 1]) {
 		uintptr_t left_pg = leaf->key[leaf->keys - 1];
-		count_t left_cnt = (count_t) leaf->value[leaf->keys - 1];
+		size_t left_cnt = (size_t) leaf->value[leaf->keys - 1];
 	
 		/*
@@ -1607,6 +1607,6 @@
 			uintptr_t left_pg = leaf->key[i - 1];
 			uintptr_t right_pg = leaf->key[i];
-			count_t left_cnt = (count_t) leaf->value[i - 1];
-			count_t right_cnt = (count_t) leaf->value[i];
+			size_t left_cnt = (size_t) leaf->value[i - 1];
+			size_t right_cnt = (size_t) leaf->value[i];
 
 			/*
@@ -1666,5 +1666,5 @@
 	}
 
-	panic("Inconsistency detected while adding %" PRIc " pages of used "
+	panic("Inconsistency detected while adding %" PRIs " pages of used "
 	    "space at %p.", count, page);
 }
@@ -1680,8 +1680,8 @@
  * @return		Zero on failure and non-zero on success.
  */
-int used_space_remove(as_area_t *a, uintptr_t page, count_t count)
+int used_space_remove(as_area_t *a, uintptr_t page, size_t count)
 {
 	btree_node_t *leaf, *node;
-	count_t pages;
+	size_t pages;
 	unsigned int i;
 
@@ -1689,5 +1689,5 @@
 	ASSERT(count);
 
-	pages = (count_t) btree_search(&a->used_space, page, &leaf);
+	pages = (size_t) btree_search(&a->used_space, page, &leaf);
 	if (pages) {
 		/*
@@ -1718,5 +1718,5 @@
 	if (node && page < leaf->key[0]) {
 		uintptr_t left_pg = node->key[node->keys - 1];
-		count_t left_cnt = (count_t) node->value[node->keys - 1];
+		size_t left_cnt = (size_t) node->value[node->keys - 1];
 
 		if (overlaps(left_pg, left_cnt * PAGE_SIZE, page,
@@ -1734,5 +1734,5 @@
 			} else if (page + count * PAGE_SIZE <
 			    left_pg + left_cnt*PAGE_SIZE) {
-				count_t new_cnt;
+				size_t new_cnt;
 				
 				/*
@@ -1758,5 +1758,5 @@
 	if (page > leaf->key[leaf->keys - 1]) {
 		uintptr_t left_pg = leaf->key[leaf->keys - 1];
-		count_t left_cnt = (count_t) leaf->value[leaf->keys - 1];
+		size_t left_cnt = (size_t) leaf->value[leaf->keys - 1];
 
 		if (overlaps(left_pg, left_cnt * PAGE_SIZE, page,
@@ -1773,5 +1773,5 @@
 			} else if (page + count * PAGE_SIZE < left_pg +
 			    left_cnt * PAGE_SIZE) {
-				count_t new_cnt;
+				size_t new_cnt;
 				
 				/*
@@ -1800,5 +1800,5 @@
 		if (page < leaf->key[i]) {
 			uintptr_t left_pg = leaf->key[i - 1];
-			count_t left_cnt = (count_t) leaf->value[i - 1];
+			size_t left_cnt = (size_t) leaf->value[i - 1];
 
 			/*
@@ -1820,5 +1820,5 @@
 				} else if (page + count * PAGE_SIZE <
 				    left_pg + left_cnt * PAGE_SIZE) {
-					count_t new_cnt;
+					size_t new_cnt;
 				
 					/*
@@ -1845,5 +1845,5 @@
 
 error:
-	panic("Inconsistency detected while removing %" PRIc " pages of used "
+	panic("Inconsistency detected while removing %" PRIs " pages of used "
 	    "space from %p.", count, page);
 }
@@ -1944,5 +1944,5 @@
 		
 			mutex_lock(&area->lock);
-			printf("as_area: %p, base=%p, pages=%" PRIc
+			printf("as_area: %p, base=%p, pages=%" PRIs
 			    " (%p - %p)\n", area, area->base, area->pages,
 			    area->base, area->base + FRAMES2SIZE(area->pages));
Index: kernel/generic/src/mm/backend_anon.c
===================================================================
--- kernel/generic/src/mm/backend_anon.c	(revision bf1fb9f49ca7a033e969484ce601cf42dfbecd12)
+++ kernel/generic/src/mm/backend_anon.c	(revision cc27c8c5e6462ab97fd46b844e8591be59e37ac6)
@@ -196,5 +196,5 @@
 		for (i = 0; i < node->keys; i++) {
 			uintptr_t base = node->key[i];
-			count_t count = (count_t) node->value[i];
+			size_t count = (size_t) node->value[i];
 			unsigned int j;
 			
Index: kernel/generic/src/mm/backend_elf.c
===================================================================
--- kernel/generic/src/mm/backend_elf.c	(revision bf1fb9f49ca7a033e969484ce601cf42dfbecd12)
+++ kernel/generic/src/mm/backend_elf.c	(revision cc27c8c5e6462ab97fd46b844e8591be59e37ac6)
@@ -83,5 +83,5 @@
 	btree_node_t *leaf;
 	uintptr_t base, frame, page, start_anon;
-	index_t i;
+	size_t i;
 	bool dirty = false;
 
@@ -235,5 +235,5 @@
 	elf_segment_header_t *entry = area->backend_data.segment;
 	uintptr_t base, start_anon;
-	index_t i;
+	size_t i;
 
 	ASSERT((page >= ALIGN_DOWN(entry->p_vaddr, PAGE_SIZE)) &&
@@ -305,5 +305,5 @@
 		for (i = 0; i < node->keys; i++) {
 			uintptr_t base = node->key[i];
-			count_t count = (count_t) node->value[i];
+			size_t count = (size_t) node->value[i];
 			unsigned int j;
 			
Index: kernel/generic/src/mm/frame.c
===================================================================
--- kernel/generic/src/mm/frame.c	(revision bf1fb9f49ca7a033e969484ce601cf42dfbecd12)
+++ kernel/generic/src/mm/frame.c	(revision cc27c8c5e6462ab97fd46b844e8591be59e37ac6)
@@ -68,6 +68,6 @@
 mutex_t mem_avail_mtx;
 condvar_t mem_avail_cv;
-count_t mem_avail_req = 0;  /**< Number of frames requested. */
-count_t mem_avail_gen = 0;  /**< Generation counter. */
+size_t mem_avail_req = 0;  /**< Number of frames requested. */
+size_t mem_avail_gen = 0;  /**< Generation counter. */
 
 /********************/
@@ -75,20 +75,20 @@
 /********************/
 
-static inline index_t frame_index(zone_t *zone, frame_t *frame)
-{
-	return (index_t) (frame - zone->frames);
-}
-
-static inline index_t frame_index_abs(zone_t *zone, frame_t *frame)
-{
-	return (index_t) (frame - zone->frames) + zone->base;
-}
-
-static inline bool frame_index_valid(zone_t *zone, index_t index)
+static inline size_t frame_index(zone_t *zone, frame_t *frame)
+{
+	return (size_t) (frame - zone->frames);
+}
+
+static inline size_t frame_index_abs(zone_t *zone, frame_t *frame)
+{
+	return (size_t) (frame - zone->frames) + zone->base;
+}
+
+static inline bool frame_index_valid(zone_t *zone, size_t index)
 {
 	return (index < zone->count);
 }
 
-static inline index_t make_frame_index(zone_t *zone, frame_t *frame)
+static inline size_t make_frame_index(zone_t *zone, frame_t *frame)
 {
 	return (frame - zone->frames);
@@ -121,12 +121,12 @@
  *
  */
-static count_t zones_insert_zone(pfn_t base, count_t count)
+static size_t zones_insert_zone(pfn_t base, size_t count)
 {
 	if (zones.count + 1 == ZONES_MAX) {
 		printf("Maximum zone count %u exceeded!\n", ZONES_MAX);
-		return (count_t) -1;
-	}
-	
-	count_t i;
+		return (size_t) -1;
+	}
+	
+	size_t i;
 	for (i = 0; i < zones.count; i++) {
 		/* Check for overlap */
@@ -134,5 +134,5 @@
 		    zones.info[i].base, zones.info[i].count)) {
 			printf("Zones overlap!\n");
-			return (count_t) -1;
+			return (size_t) -1;
 		}
 		if (base < zones.info[i].base)
@@ -141,5 +141,5 @@
 	
 	/* Move other zones up */
-	count_t j;
+	size_t j;
 	for (j = zones.count; j > i; j--) {
 		zones.info[j] = zones.info[j - 1];
@@ -162,8 +162,8 @@
  */
 #ifdef CONFIG_DEBUG
-static count_t total_frames_free(void)
-{
-	count_t total = 0;
-	count_t i;
+static size_t total_frames_free(void)
+{
+	size_t total = 0;
+	size_t i;
 	for (i = 0; i < zones.count; i++)
 		total += zones.info[i].free_count;
@@ -185,10 +185,10 @@
  *
  */
-count_t find_zone(pfn_t frame, count_t count, count_t hint)
+size_t find_zone(pfn_t frame, size_t count, size_t hint)
 {
 	if (hint >= zones.count)
 		hint = 0;
 	
-	count_t i = hint;
+	size_t i = hint;
 	do {
 		if ((zones.info[i].base <= frame)
@@ -201,5 +201,5 @@
 	} while (i != hint);
 	
-	return (count_t) -1;
+	return (size_t) -1;
 }
 
@@ -221,10 +221,10 @@
  *
  */
-static count_t find_free_zone(uint8_t order, zone_flags_t flags, count_t hint)
+static size_t find_free_zone(uint8_t order, zone_flags_t flags, size_t hint)
 {
 	if (hint >= zones.count)
 		hint = 0;
 	
-	count_t i = hint;
+	size_t i = hint;
 	do {
 		/*
@@ -244,5 +244,5 @@
 	} while (i != hint);
 	
-	return (count_t) -1;
+	return (size_t) -1;
 }
 
@@ -266,5 +266,5 @@
 	zone_t *zone = (zone_t *) buddy->data;
 	
-	index_t index = frame_index(zone, frame);
+	size_t index = frame_index(zone, frame);
 	do {
 		if (zone->frames[index].buddy_order != order)
@@ -292,5 +292,5 @@
 	bool is_left = IS_BUDDY_LEFT_BLOCK_ABS(zone, frame);
 	
-	index_t index;
+	size_t index;
 	if (is_left) {
 		index = (frame_index(zone, frame)) +
@@ -447,5 +447,5 @@
  *
  */
-static void zone_frame_free(zone_t *zone, index_t frame_idx)
+static void zone_frame_free(zone_t *zone, size_t frame_idx)
 {
 	ASSERT(zone_flags_available(zone->flags));
@@ -468,5 +468,5 @@
 
 /** Return frame from zone. */
-static frame_t *zone_get_frame(zone_t *zone, index_t frame_idx)
+static frame_t *zone_get_frame(zone_t *zone, size_t frame_idx)
 {
 	ASSERT(frame_idx < zone->count);
@@ -475,5 +475,5 @@
 
 /** Mark frame in zone unavailable to allocation. */
-static void zone_mark_unavailable(zone_t *zone, index_t frame_idx)
+static void zone_mark_unavailable(zone_t *zone, size_t frame_idx)
 {
 	ASSERT(zone_flags_available(zone->flags));
@@ -504,5 +504,5 @@
  *
  */
-static void zone_merge_internal(count_t z1, count_t z2, zone_t *old_z1, buddy_system_t *buddy)
+static void zone_merge_internal(size_t z1, size_t z2, zone_t *old_z1, buddy_system_t *buddy)
 {
 	ASSERT(zone_flags_available(zones.info[z1].flags));
@@ -530,5 +530,5 @@
 	
 	/* This marks all frames busy */
-	count_t i;
+	size_t i;
 	for (i = 0; i < zones.info[z1].count; i++)
 		frame_initialize(&zones.info[z1].frames[i]);
@@ -600,9 +600,9 @@
  *
  */
-static void return_config_frames(count_t znum, pfn_t pfn, count_t count)
+static void return_config_frames(size_t znum, pfn_t pfn, size_t count)
 {
 	ASSERT(zone_flags_available(zones.info[znum].flags));
 	
-	count_t cframes = SIZE2FRAMES(zone_conf_size(count));
+	size_t cframes = SIZE2FRAMES(zone_conf_size(count));
 	
 	if ((pfn < zones.info[znum].base)
@@ -615,5 +615,5 @@
 	ASSERT(!frame->buddy_order);
 	
-	count_t i;
+	size_t i;
 	for (i = 0; i < cframes; i++) {
 		zones.info[znum].busy_count++;
@@ -635,5 +635,5 @@
  *
  */
-static void zone_reduce_region(count_t znum, pfn_t frame_idx, count_t count)
+static void zone_reduce_region(size_t znum, pfn_t frame_idx, size_t count)
 {
 	ASSERT(zone_flags_available(zones.info[znum].flags));
@@ -641,9 +641,9 @@
 	
 	uint8_t order = zones.info[znum].frames[frame_idx].buddy_order;
-	ASSERT((count_t) (1 << order) >= count);
+	ASSERT((size_t) (1 << order) >= count);
 	
 	/* Reduce all blocks to order 0 */
-	count_t i;
-	for (i = 0; i < (count_t) (1 << order); i++) {
+	size_t i;
+	for (i = 0; i < (size_t) (1 << order); i++) {
 		frame_t *frame = &zones.info[znum].frames[i + frame_idx];
 		frame->buddy_order = 0;
@@ -654,5 +654,5 @@
 	
 	/* Free unneeded frames */
-	for (i = count; i < (count_t) (1 << order); i++)
+	for (i = count; i < (size_t) (1 << order); i++)
 		zone_frame_free(&zones.info[znum], i + frame_idx);
 }
@@ -671,5 +671,5 @@
  *
  */
-bool zone_merge(count_t z1, count_t z2)
+bool zone_merge(size_t z1, size_t z2)
 {
 	ipl_t ipl = interrupts_disable();
@@ -734,5 +734,5 @@
 	
 	/* Move zones down */
-	count_t i;
+	size_t i;
 	for (i = z2 + 1; i < zones.count; i++) {
 		zones.info[i - 1] = zones.info[i];
@@ -759,5 +759,5 @@
 void zone_merge_all(void)
 {
-	count_t i = 0;
+	size_t i = 0;
 	while (i < zones.count) {
 		if (!zone_merge(i, i + 1))
@@ -777,5 +777,5 @@
  *
  */
-static void zone_construct(zone_t *zone, buddy_system_t *buddy, pfn_t start, count_t count, zone_flags_t flags)
+static void zone_construct(zone_t *zone, buddy_system_t *buddy, pfn_t start, size_t count, zone_flags_t flags)
 {
 	zone->base = start;
@@ -800,5 +800,5 @@
 		    buddy_conf_size(order));
 		
-		count_t i;
+		size_t i;
 		for (i = 0; i < count; i++)
 			frame_initialize(&zone->frames[i]);
@@ -820,5 +820,5 @@
  *
  */
-uintptr_t zone_conf_size(count_t count)
+uintptr_t zone_conf_size(size_t count)
 {
 	return (count * sizeof(frame_t) + buddy_conf_size(fnzb(count)));
@@ -841,5 +841,5 @@
  *
  */
-count_t zone_create(pfn_t start, count_t count, pfn_t confframe, zone_flags_t flags)
+size_t zone_create(pfn_t start, size_t count, pfn_t confframe, zone_flags_t flags)
 {
 	ipl_t ipl = interrupts_disable();
@@ -856,5 +856,5 @@
 		 * it does not span kernel & init
 		 */
-		count_t confcount = SIZE2FRAMES(zone_conf_size(count));
+		size_t confcount = SIZE2FRAMES(zone_conf_size(count));
 		if ((confframe >= start) && (confframe < start + count)) {
 			for (; confframe < start + count; confframe++) {
@@ -869,5 +869,5 @@
 				
 				bool overlap = false;
-				count_t i;
+				size_t i;
 				for (i = 0; i < init.cnt; i++)
 					if (overlaps(addr, PFN2ADDR(confcount),
@@ -887,9 +887,9 @@
 		}
 		
-		count_t znum = zones_insert_zone(start, count);
-		if (znum == (count_t) -1) {
+		size_t znum = zones_insert_zone(start, count);
+		if (znum == (size_t) -1) {
 			spinlock_unlock(&zones.lock);
 			interrupts_restore(ipl);
-			return (count_t) -1;
+			return (size_t) -1;
 		}
 		
@@ -899,5 +899,5 @@
 		/* If confdata in zone, mark as unavailable */
 		if ((confframe >= start) && (confframe < start + count)) {
-			count_t i;
+			size_t i;
 			for (i = confframe; i < confframe + confcount; i++)
 				zone_mark_unavailable(&zones.info[znum],
@@ -912,9 +912,9 @@
 	
 	/* Non-available zone */
-	count_t znum = zones_insert_zone(start, count);
-	if (znum == (count_t) -1) {
+	size_t znum = zones_insert_zone(start, count);
+	if (znum == (size_t) -1) {
 		spinlock_unlock(&zones.lock);
 		interrupts_restore(ipl);
-		return (count_t) -1;
+		return (size_t) -1;
 	}
 	zone_construct(&zones.info[znum], NULL, start, count, flags);
@@ -931,12 +931,12 @@
 
 /** Set parent of frame. */
-void frame_set_parent(pfn_t pfn, void *data, count_t hint)
+void frame_set_parent(pfn_t pfn, void *data, size_t hint)
 {
 	ipl_t ipl = interrupts_disable();
 	spinlock_lock(&zones.lock);
 	
-	count_t znum = find_zone(pfn, 1, hint);
-	
-	ASSERT(znum != (count_t) -1);
+	size_t znum = find_zone(pfn, 1, hint);
+	
+	ASSERT(znum != (size_t) -1);
 	
 	zone_get_frame(&zones.info[znum],
@@ -947,12 +947,12 @@
 }
 
-void *frame_get_parent(pfn_t pfn, count_t hint)
+void *frame_get_parent(pfn_t pfn, size_t hint)
 {
 	ipl_t ipl = interrupts_disable();
 	spinlock_lock(&zones.lock);
 	
-	count_t znum = find_zone(pfn, 1, hint);
-	
-	ASSERT(znum != (count_t) -1);
+	size_t znum = find_zone(pfn, 1, hint);
+	
+	ASSERT(znum != (size_t) -1);
 	
 	void *res = zone_get_frame(&zones.info[znum],
@@ -974,9 +974,9 @@
  *
  */
-void *frame_alloc_generic(uint8_t order, frame_flags_t flags, count_t *pzone)
-{
-	count_t size = ((count_t) 1) << order;
+void *frame_alloc_generic(uint8_t order, frame_flags_t flags, size_t *pzone)
+{
+	size_t size = ((size_t) 1) << order;
 	ipl_t ipl;
-	count_t hint = pzone ? (*pzone) : 0;
+	size_t hint = pzone ? (*pzone) : 0;
 	
 loop:
@@ -987,14 +987,14 @@
 	 * First, find suitable frame zone.
 	 */
-	count_t znum = find_free_zone(order,
+	size_t znum = find_free_zone(order,
 	    FRAME_TO_ZONE_FLAGS(flags), hint);
 	
 	/* If no memory, reclaim some slab memory,
 	   if it does not help, reclaim all */
-	if ((znum == (count_t) -1) && (!(flags & FRAME_NO_RECLAIM))) {
+	if ((znum == (size_t) -1) && (!(flags & FRAME_NO_RECLAIM))) {
 		spinlock_unlock(&zones.lock);
 		interrupts_restore(ipl);
 		
-		count_t freed = slab_reclaim(0);
+		size_t freed = slab_reclaim(0);
 		
 		ipl = interrupts_disable();
@@ -1005,5 +1005,5 @@
 			    FRAME_TO_ZONE_FLAGS(flags), hint);
 		
-		if (znum == (count_t) -1) {
+		if (znum == (size_t) -1) {
 			spinlock_unlock(&zones.lock);
 			interrupts_restore(ipl);
@@ -1020,5 +1020,5 @@
 	}
 	
-	if (znum == (count_t) -1) {
+	if (znum == (size_t) -1) {
 		if (flags & FRAME_ATOMIC) {
 			spinlock_unlock(&zones.lock);
@@ -1028,5 +1028,5 @@
 		
 #ifdef CONFIG_DEBUG
-		count_t avail = total_frames_free();
+		size_t avail = total_frames_free();
 #endif
 		
@@ -1039,6 +1039,6 @@
 		
 #ifdef CONFIG_DEBUG
-		printf("Thread %" PRIu64 " waiting for %" PRIc " frames, "
-		    "%" PRIc " available.\n", THREAD->tid, size, avail);
+		printf("Thread %" PRIu64 " waiting for %" PRIs " frames, "
+		    "%" PRIs " available.\n", THREAD->tid, size, avail);
 #endif
 		
@@ -1049,5 +1049,5 @@
 		else
 			mem_avail_req = size;
-		count_t gen = mem_avail_gen;
+		size_t gen = mem_avail_gen;
 		
 		while (gen == mem_avail_gen)
@@ -1096,7 +1096,7 @@
 	 */
 	pfn_t pfn = ADDR2PFN(frame);
-	count_t znum = find_zone(pfn, 1, NULL);
-	
-	ASSERT(znum != (count_t) -1);
+	size_t znum = find_zone(pfn, 1, NULL);
+	
+	ASSERT(znum != (size_t) -1);
 	
 	zone_frame_free(&zones.info[znum], pfn - zones.info[znum].base);
@@ -1135,7 +1135,7 @@
 	 * First, find host frame zone for addr.
 	 */
-	count_t znum = find_zone(pfn, 1, NULL);
-	
-	ASSERT(znum != (count_t) -1);
+	size_t znum = find_zone(pfn, 1, NULL);
+	
+	ASSERT(znum != (size_t) -1);
 	
 	zones.info[znum].frames[pfn - zones.info[znum].base].refcount++;
@@ -1146,13 +1146,13 @@
 
 /** Mark given range unavailable in frame zones. */
-void frame_mark_unavailable(pfn_t start, count_t count)
+void frame_mark_unavailable(pfn_t start, size_t count)
 {
 	ipl_t ipl = interrupts_disable();
 	spinlock_lock(&zones.lock);
 	
-	count_t i;
+	size_t i;
 	for (i = 0; i < count; i++) {
-		count_t znum = find_zone(start + i, 1, 0);
-		if (znum == (count_t) -1)  /* PFN not found */
+		size_t znum = find_zone(start + i, 1, 0);
+		if (znum == (size_t) -1)  /* PFN not found */
 			continue;
 		
@@ -1183,5 +1183,5 @@
 		    SIZE2FRAMES(config.stack_size));
 		
-		count_t i;
+		size_t i;
 		for (i = 0; i < init.cnt; i++) {
 			pfn_t pfn = ADDR2PFN(KA2PA(init.tasks[i].addr));
@@ -1208,5 +1208,5 @@
 	
 	uint64_t total = 0;
-	count_t i;
+	size_t i;
 	for (i = 0; i < zones.count; i++)
 		total += (uint64_t) FRAMES2SIZE(zones.info[i].count);
@@ -1242,5 +1242,5 @@
 	 */
 	
-	count_t i;
+	size_t i;
 	for (i = 0;; i++) {
 		ipl_t ipl = interrupts_disable();
@@ -1254,8 +1254,8 @@
 		
 		uintptr_t base = PFN2ADDR(zones.info[i].base);
-		count_t count = zones.info[i].count;
+		size_t count = zones.info[i].count;
 		zone_flags_t flags = zones.info[i].flags;
-		count_t free_count = zones.info[i].free_count;
-		count_t busy_count = zones.info[i].busy_count;
+		size_t free_count = zones.info[i].free_count;
+		size_t busy_count = zones.info[i].busy_count;
 		
 		spinlock_unlock(&zones.lock);
@@ -1264,5 +1264,5 @@
 		bool available = zone_flags_available(flags);
 		
-		printf("%-2" PRIc, i);
+		printf("%-2" PRIs, i);
 		
 #ifdef __32_BITS__
@@ -1274,5 +1274,5 @@
 #endif
 		
-		printf(" %12" PRIc " %c%c%c      ", count,
+		printf(" %12" PRIs " %c%c%c      ", count,
 		    available ? 'A' : ' ',
 		    (flags & ZONE_RESERVED) ? 'R' : ' ',
@@ -1280,5 +1280,5 @@
 		
 		if (available)
-			printf("%12" PRIc " %12" PRIc,
+			printf("%12" PRIs " %12" PRIs,
 			    free_count, busy_count);
 		
@@ -1292,11 +1292,11 @@
  *
  */
-void zone_print_one(count_t num)
+void zone_print_one(size_t num)
 {
 	ipl_t ipl = interrupts_disable();
 	spinlock_lock(&zones.lock);
-	count_t znum = (count_t) -1;
-	
-	count_t i;
+	size_t znum = (size_t) -1;
+	
+	size_t i;
 	for (i = 0; i < zones.count; i++) {
 		if ((i == num) || (PFN2ADDR(zones.info[i].base) == num)) {
@@ -1306,5 +1306,5 @@
 	}
 	
-	if (znum == (count_t) -1) {
+	if (znum == (size_t) -1) {
 		spinlock_unlock(&zones.lock);
 		interrupts_restore(ipl);
@@ -1315,7 +1315,7 @@
 	uintptr_t base = PFN2ADDR(zones.info[i].base);
 	zone_flags_t flags = zones.info[i].flags;
-	count_t count = zones.info[i].count;
-	count_t free_count = zones.info[i].free_count;
-	count_t busy_count = zones.info[i].busy_count;
+	size_t count = zones.info[i].count;
+	size_t free_count = zones.info[i].free_count;
+	size_t busy_count = zones.info[i].busy_count;
 	
 	spinlock_unlock(&zones.lock);
@@ -1324,7 +1324,7 @@
 	bool available = zone_flags_available(flags);
 	
-	printf("Zone number:       %" PRIc "\n", znum);
+	printf("Zone number:       %" PRIs "\n", znum);
 	printf("Zone base address: %p\n", base);
-	printf("Zone size:         %" PRIc " frames (%" PRIs " KiB)\n", count,
+	printf("Zone size:         %" PRIs " frames (%" PRIs " KiB)\n", count,
 	    SIZE2KB(FRAMES2SIZE(count)));
 	printf("Zone flags:        %c%c%c\n",
@@ -1334,7 +1334,7 @@
 	
 	if (available) {
-		printf("Allocated space:   %" PRIc " frames (%" PRIs " KiB)\n",
+		printf("Allocated space:   %" PRIs " frames (%" PRIs " KiB)\n",
 		    busy_count, SIZE2KB(FRAMES2SIZE(busy_count)));
-		printf("Available space:   %" PRIc " frames (%" PRIs " KiB)\n",
+		printf("Available space:   %" PRIs " frames (%" PRIs " KiB)\n",
 		    free_count, SIZE2KB(FRAMES2SIZE(free_count)));
 	}
Index: kernel/generic/src/mm/slab.c
===================================================================
--- kernel/generic/src/mm/slab.c	(revision bf1fb9f49ca7a033e969484ce601cf42dfbecd12)
+++ kernel/generic/src/mm/slab.c	(revision cc27c8c5e6462ab97fd46b844e8591be59e37ac6)
@@ -157,6 +157,6 @@
 	link_t link;       	/**< List of full/partial slabs. */
 	void *start;       	/**< Start address of first available item. */
-	count_t available; 	/**< Count of available items in this slab. */
-	index_t nextavail; 	/**< The index of next available item. */
+	size_t available; 	/**< Count of available items in this slab. */
+	size_t nextavail; 	/**< The index of next available item. */
 } slab_t;
 
@@ -178,5 +178,5 @@
 	size_t fsize;
 	unsigned int i;
-	count_t zone = 0;
+	size_t zone = 0;
 	
 	data = frame_alloc_generic(cache->order, FRAME_KA | flags, &zone);
@@ -216,5 +216,5 @@
  * @return number of freed frames
  */
-static count_t slab_space_free(slab_cache_t *cache, slab_t *slab)
+static size_t slab_space_free(slab_cache_t *cache, slab_t *slab)
 {
 	frame_free(KA2PA(slab->start));
@@ -244,5 +244,5 @@
  * @return Number of freed pages
  */
-static count_t slab_obj_destroy(slab_cache_t *cache, void *obj, slab_t *slab)
+static size_t slab_obj_destroy(slab_cache_t *cache, void *obj, slab_t *slab)
 {
 	int freed = 0;
@@ -372,8 +372,8 @@
  * @return Number of freed pages
  */
-static count_t magazine_destroy(slab_cache_t *cache, slab_magazine_t *mag)
+static size_t magazine_destroy(slab_cache_t *cache, slab_magazine_t *mag)
 {
 	unsigned int i;
-	count_t frames = 0;
+	size_t frames = 0;
 
 	for (i = 0; i < mag->busy; i++) {
@@ -650,9 +650,9 @@
  * @return Number of freed pages
  */
-static count_t _slab_reclaim(slab_cache_t *cache, int flags)
+static size_t _slab_reclaim(slab_cache_t *cache, int flags)
 {
 	unsigned int i;
 	slab_magazine_t *mag;
-	count_t frames = 0;
+	size_t frames = 0;
 	int magcount;
 	
@@ -772,9 +772,9 @@
 
 /* Go through all caches and reclaim what is possible */
-count_t slab_reclaim(int flags)
+size_t slab_reclaim(int flags)
 {
 	slab_cache_t *cache;
 	link_t *cur;
-	count_t frames = 0;
+	size_t frames = 0;
 
 	spinlock_lock(&slab_cache_lock);
Index: kernel/generic/src/mm/tlb.c
===================================================================
--- kernel/generic/src/mm/tlb.c	(revision bf1fb9f49ca7a033e969484ce601cf42dfbecd12)
+++ kernel/generic/src/mm/tlb.c	(revision cc27c8c5e6462ab97fd46b844e8591be59e37ac6)
@@ -80,5 +80,5 @@
  */
 void tlb_shootdown_start(tlb_invalidate_type_t type, asid_t asid,
-    uintptr_t page, count_t count)
+    uintptr_t page, size_t count)
 {
 	unsigned int i;
@@ -109,5 +109,5 @@
 			 * Enqueue the message.
 			 */
-			index_t idx = cpu->tlb_messages_count++;
+			size_t idx = cpu->tlb_messages_count++;
 			cpu->tlb_messages[idx].type = type;
 			cpu->tlb_messages[idx].asid = asid;
@@ -144,5 +144,5 @@
 	asid_t asid;
 	uintptr_t page;
-	count_t count;
+	size_t count;
 	unsigned int i;
 	
Index: kernel/generic/src/printf/printf_core.c
===================================================================
--- kernel/generic/src/printf/printf_core.c	(revision bf1fb9f49ca7a033e969484ce601cf42dfbecd12)
+++ kernel/generic/src/printf/printf_core.c	(revision cc27c8c5e6462ab97fd46b844e8591be59e37ac6)
@@ -175,5 +175,5 @@
 static int print_char(const char ch, int width, uint32_t flags, printf_spec_t *ps)
 {
-	count_t counter = 0;
+	size_t counter = 0;
 	if (!(flags & __PRINTF_FLAG_LEFTALIGNED)) {
 		while (--width > 0) {
@@ -213,5 +213,5 @@
 static int print_wchar(const wchar_t ch, int width, uint32_t flags, printf_spec_t *ps)
 {
-	count_t counter = 0;
+	size_t counter = 0;
 	if (!(flags & __PRINTF_FLAG_LEFTALIGNED)) {
 		while (--width > 0) {
@@ -256,10 +256,10 @@
 
 	/* Print leading spaces. */
-	count_t strw = str_length(str);
+	size_t strw = str_length(str);
 	if (precision == 0)
 		precision = strw;
 
 	/* Left padding */
-	count_t counter = 0;
+	size_t counter = 0;
 	width -= precision;
 	if (!(flags & __PRINTF_FLAG_LEFTALIGNED)) {
@@ -312,5 +312,5 @@
 	
 	/* Left padding */
-	count_t counter = 0;
+	size_t counter = 0;
 	width -= precision;
 	if (!(flags & __PRINTF_FLAG_LEFTALIGNED)) {
@@ -434,5 +434,5 @@
 	
 	width -= precision + size - number_size;
-	count_t counter = 0;
+	size_t counter = 0;
 	
 	if (!(flags & __PRINTF_FLAG_LEFTALIGNED)) {
@@ -597,5 +597,5 @@
 	size_t j = 0;    /* Index to the first not printed nonformating character */
 	
-	count_t counter = 0;  /* Number of characters printed */
+	size_t counter = 0;   /* Number of characters printed */
 	int retval;           /* Return values from nested functions */
 	
Index: kernel/generic/src/printf/vprintf.c
===================================================================
--- kernel/generic/src/printf/vprintf.c	(revision bf1fb9f49ca7a033e969484ce601cf42dfbecd12)
+++ kernel/generic/src/printf/vprintf.c	(revision cc27c8c5e6462ab97fd46b844e8591be59e37ac6)
@@ -47,5 +47,5 @@
 {
 	size_t offset = 0;
-	count_t chars = 0;
+	size_t chars = 0;
 	
 	while (offset < size) {
@@ -60,5 +60,5 @@
 {
 	size_t offset = 0;
-	count_t chars = 0;
+	size_t chars = 0;
 	
 	while (offset < size) {
@@ -74,5 +74,5 @@
 {
 	size_t offset = 0;
-	count_t chars = 0;
+	size_t chars = 0;
 	wchar_t uc;
 	
Index: kernel/generic/src/printf/vsnprintf.c
===================================================================
--- kernel/generic/src/printf/vsnprintf.c	(revision bf1fb9f49ca7a033e969484ce601cf42dfbecd12)
+++ kernel/generic/src/printf/vsnprintf.c	(revision cc27c8c5e6462ab97fd46b844e8591be59e37ac6)
@@ -83,5 +83,5 @@
 		 * of string
 		 */
-		index_t index = 0;
+		size_t index = 0;
 		
 		while (index < size) {
@@ -131,5 +131,5 @@
 static int vsnprintf_wstr_write(const wchar_t *str, size_t size, vsnprintf_data_t *data)
 {
-	index_t index = 0;
+	size_t index = 0;
 	
 	while (index < (size / sizeof(wchar_t))) {
Index: kernel/generic/src/proc/scheduler.c
===================================================================
--- kernel/generic/src/proc/scheduler.c	(revision bf1fb9f49ca7a033e969484ce601cf42dfbecd12)
+++ kernel/generic/src/proc/scheduler.c	(revision cc27c8c5e6462ab97fd46b844e8591be59e37ac6)
@@ -709,5 +709,5 @@
 
 		spinlock_lock(&cpus[cpu].lock);
-		printf("cpu%u: address=%p, nrdy=%ld, needs_relink=%" PRIc "\n",
+		printf("cpu%u: address=%p, nrdy=%ld, needs_relink=%" PRIs "\n",
 		    cpus[cpu].id, &cpus[cpu], atomic_get(&cpus[cpu].nrdy),
 		    cpus[cpu].needs_relink);
Index: kernel/generic/src/synch/futex.c
===================================================================
--- kernel/generic/src/synch/futex.c	(revision bf1fb9f49ca7a033e969484ce601cf42dfbecd12)
+++ kernel/generic/src/synch/futex.c	(revision cc27c8c5e6462ab97fd46b844e8591be59e37ac6)
@@ -60,6 +60,6 @@
 
 static futex_t *futex_find(uintptr_t paddr);
-static index_t futex_ht_hash(unative_t *key);
-static bool futex_ht_compare(unative_t *key, count_t keys, link_t *item);
+static size_t futex_ht_hash(unative_t *key);
+static bool futex_ht_compare(unative_t *key, size_t keys, link_t *item);
 static void futex_ht_remove_callback(link_t *item);
 
@@ -289,7 +289,7 @@
  * @return Index into futex hash table.
  */
-index_t futex_ht_hash(unative_t *key)
-{
-	return *key & (FUTEX_HT_SIZE-1);
+size_t futex_ht_hash(unative_t *key)
+{
+	return (*key & (FUTEX_HT_SIZE - 1));
 }
 
@@ -301,5 +301,5 @@
  * @return True if the item matches the key. False otherwise.
  */
-bool futex_ht_compare(unative_t *key, count_t keys, link_t *item)
+bool futex_ht_compare(unative_t *key, size_t keys, link_t *item)
 {
 	futex_t *futex;
Index: kernel/generic/src/synch/spinlock.c
===================================================================
--- kernel/generic/src/synch/spinlock.c	(revision bf1fb9f49ca7a033e969484ce601cf42dfbecd12)
+++ kernel/generic/src/synch/spinlock.c	(revision cc27c8c5e6462ab97fd46b844e8591be59e37ac6)
@@ -76,5 +76,5 @@
 void spinlock_lock_debug(spinlock_t *sl)
 {
-	count_t i = 0;
+	size_t i = 0;
 	bool deadlock_reported = false;
 
Index: kernel/generic/src/synch/waitq.c
===================================================================
--- kernel/generic/src/synch/waitq.c	(revision bf1fb9f49ca7a033e969484ce601cf42dfbecd12)
+++ kernel/generic/src/synch/waitq.c	(revision cc27c8c5e6462ab97fd46b844e8591be59e37ac6)
@@ -416,5 +416,5 @@
 {
 	thread_t *t;
-	count_t count = 0;
+	size_t count = 0;
 
 loop:	
Index: kernel/generic/src/time/clock.c
===================================================================
--- kernel/generic/src/time/clock.c	(revision bf1fb9f49ca7a033e969484ce601cf42dfbecd12)
+++ kernel/generic/src/time/clock.c	(revision cc27c8c5e6462ab97fd46b844e8591be59e37ac6)
@@ -135,5 +135,5 @@
 	timeout_handler_t f;
 	void *arg;
-	count_t missed_clock_ticks = CPU->missed_clock_ticks;
+	size_t missed_clock_ticks = CPU->missed_clock_ticks;
 	unsigned int i;
 
