Index: uspace/drv/uhci-hcd/Makefile
===================================================================
--- uspace/drv/uhci-hcd/Makefile	(revision 05ead5c8a051ae9d64bfdd149a54544ccd91311b)
+++ uspace/drv/uhci-hcd/Makefile	(revision 001b15281fc711d0d14335e07ce5c8e30f8b3548)
@@ -40,4 +40,5 @@
 	root_hub.c \
 	hw_struct/transfer_descriptor.c \
+	utils/slab.c \
 	pci.c \
 	batch.c
Index: uspace/drv/uhci-hcd/hc.c
===================================================================
--- uspace/drv/uhci-hcd/hc.c	(revision 05ead5c8a051ae9d64bfdd149a54544ccd91311b)
+++ uspace/drv/uhci-hcd/hc.c	(revision 001b15281fc711d0d14335e07ce5c8e30f8b3548)
@@ -223,5 +223,5 @@
 	ret = instance ? EOK : ENOMEM;
 	CHECK_RET_DEST_CMDS_RETURN(ret, "Failed to get frame list page.\n");
-	usb_log_debug("Initialized frame list.\n");
+	usb_log_debug("Initialized frame list at %p.\n", instance->frame_list);
 
 	/* Set all frames to point to the first queue head */
Index: uspace/drv/uhci-hcd/transfer_list.c
===================================================================
--- uspace/drv/uhci-hcd/transfer_list.c	(revision 05ead5c8a051ae9d64bfdd149a54544ccd91311b)
+++ uspace/drv/uhci-hcd/transfer_list.c	(revision 001b15281fc711d0d14335e07ce5c8e30f8b3548)
@@ -58,4 +58,6 @@
 	}
 	instance->queue_head_pa = addr_to_phys(instance->queue_head);
+	usb_log_debug2("Transfer list %s setup with QH: %p(%p).\n",
+	    name, instance->queue_head, instance->queue_head_pa);
 
 	qh_init(instance->queue_head);
@@ -118,4 +120,7 @@
 	qh_set_next_qh(last_qh, pa);
 
+	asm volatile ("": : :"memory");
+//	asm volatile("clflush (%0)": : "r"(last_qh));
+
 	/* Add to the driver list */
 	list_append(&batch->link, &instance->batch_list);
@@ -159,4 +164,5 @@
 	fibril_mutex_unlock(&instance->guard);
 
+	async_usleep(1000);
 	while (!list_empty(&done)) {
 		link_t *item = done.next;
@@ -212,4 +218,5 @@
 		    == addr_to_phys(batch_qh(batch)));
 		instance->queue_head->next = batch_qh(batch)->next;
+//		asm volatile("clflush (%0)" : : "r"(instance->queue_head));
 		qpos = "FIRST";
 	} else {
@@ -220,6 +227,8 @@
 		    == addr_to_phys(batch_qh(batch)));
 		batch_qh(prev)->next = batch_qh(batch)->next;
+//		asm volatile("clflush (%0)" : : "r"(batch_qh(prev)));
 		qpos = "NOT FIRST";
 	}
+	asm volatile ("": : :"memory");
 	/* Remove from the batch list */
 	list_remove(&batch->link);
Index: uspace/drv/uhci-hcd/utils/malloc32.h
===================================================================
--- uspace/drv/uhci-hcd/utils/malloc32.h	(revision 05ead5c8a051ae9d64bfdd149a54544ccd91311b)
+++ uspace/drv/uhci-hcd/utils/malloc32.h	(revision 001b15281fc711d0d14335e07ce5c8e30f8b3548)
@@ -40,6 +40,9 @@
 #include <as.h>
 
+#include "slab.h"
+
 #define UHCI_STRCUTURES_ALIGNMENT 16
 #define UHCI_REQUIRED_PAGE_SIZE 4096
+
 
 /** Get physical address translation
@@ -54,5 +57,6 @@
 
 	uintptr_t result;
-	int ret = as_get_physical_mapping(addr, &result);
+	const int ret = as_get_physical_mapping(addr, &result);
+	assert(ret == EOK);
 
 	if (ret != EOK)
@@ -66,6 +70,10 @@
  * @return Address of the alligned and big enough memory place, NULL on failure.
  */
-static inline void * malloc32(size_t size)
-	{ return memalign(UHCI_STRCUTURES_ALIGNMENT, size); }
+static inline void * malloc32(size_t size) {
+	if (size <= SLAB_ELEMENT_SIZE)
+		return slab_malloc_g();
+	assert(false);
+	return memalign(UHCI_STRCUTURES_ALIGNMENT, size);
+}
 /*----------------------------------------------------------------------------*/
 /** Physical mallocator simulator
@@ -73,6 +81,11 @@
  * @param[in] addr Address of the place allocated by malloc32
  */
-static inline void free32(void *addr)
-	{ if (addr) free(addr); }
+static inline void free32(void *addr) {
+	if (!addr)
+		return;
+	if (slab_in_range_g(addr))
+		return slab_free_g(addr);
+	free(addr);
+}
 /*----------------------------------------------------------------------------*/
 /** Create 4KB page mapping
@@ -82,10 +95,9 @@
 static inline void * get_page(void)
 {
-	void * free_address = as_get_mappable_page(UHCI_REQUIRED_PAGE_SIZE);
-	assert(free_address);
+	void *free_address = as_get_mappable_page(UHCI_REQUIRED_PAGE_SIZE);
+	assert(free_address); /* TODO: remove this assert */
 	if (free_address == 0)
 		return NULL;
-	void* ret =
-	  as_area_create(free_address, UHCI_REQUIRED_PAGE_SIZE,
+	void *ret = as_area_create(free_address, UHCI_REQUIRED_PAGE_SIZE,
 		  AS_AREA_READ | AS_AREA_WRITE);
 	if (ret != free_address)
Index: uspace/drv/uhci-hcd/utils/slab.c
===================================================================
--- uspace/drv/uhci-hcd/utils/slab.c	(revision 001b15281fc711d0d14335e07ce5c8e30f8b3548)
+++ uspace/drv/uhci-hcd/utils/slab.c	(revision 001b15281fc711d0d14335e07ce5c8e30f8b3548)
@@ -0,0 +1,146 @@
+/*
+ * Copyright (c) 2011 Jan Vesely
+ * 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 usb
+ * @{
+ */
+/** @file
+ * @brief UHCI driver
+ */
+#include <as.h>
+#include <assert.h>
+#include <fibril_synch.h>
+#include <usb/debug.h>
+
+#include "slab.h"
+
+#define SLAB_SIZE (PAGE_SIZE * 16)
+#define SLAB_ELEMENT_COUNT (SLAB_SIZE / SLAB_ELEMENT_SIZE)
+
+typedef struct slab {
+	void *page;
+	bool slabs[SLAB_ELEMENT_COUNT];
+	fibril_mutex_t guard;
+} slab_t;
+
+static slab_t global_slab;
+
+static void * slab_malloc(slab_t *intance);
+static bool slab_in_range(slab_t *intance, void *addr);
+static void slab_free(slab_t *intance, void *addr);
+/*----------------------------------------------------------------------------*/
+void * slab_malloc_g(void)
+{
+	return slab_malloc(&global_slab);
+}
+/*----------------------------------------------------------------------------*/
+void slab_free_g(void *addr)
+{
+	return slab_free(&global_slab, addr);
+}
+/*----------------------------------------------------------------------------*/
+bool slab_in_range_g(void *addr)
+{
+	return slab_in_range(&global_slab, addr);
+}
+/*----------------------------------------------------------------------------*/
+static void slab_init(slab_t *instance)
+{
+	static FIBRIL_MUTEX_INITIALIZE(init_mutex);
+	assert(instance);
+	fibril_mutex_lock(&init_mutex);
+	if (instance->page != NULL) {
+		/* already initialized */
+		fibril_mutex_unlock(&init_mutex);
+		return;
+	}
+	fibril_mutex_initialize(&instance->guard);
+	size_t i = 0;
+	for (;i < SLAB_ELEMENT_COUNT; ++i) {
+		instance->slabs[i] = true;
+	}
+	instance->page = as_get_mappable_page(SLAB_SIZE);
+	if (instance->page != NULL) {
+		void* ret =
+		    as_area_create(instance->page, SLAB_SIZE, AS_AREA_READ | AS_AREA_WRITE);
+		if (ret != instance->page) {
+			instance->page = NULL;
+		}
+	}
+	memset(instance->page, 0xa, SLAB_SIZE);
+	fibril_mutex_unlock(&init_mutex);
+	usb_log_fatal("SLAB initialized at %p.\n", instance->page);
+}
+/*----------------------------------------------------------------------------*/
+static void * slab_malloc(slab_t *instance) {
+	assert(instance);
+	if (instance->page == NULL)
+		slab_init(instance);
+
+	fibril_mutex_lock(&instance->guard);
+	void *addr = NULL;
+	size_t i = 0;
+	for (; i < SLAB_ELEMENT_COUNT; ++i) {
+		if (instance->slabs[i]) {
+			instance->slabs[i] = false;
+			addr = (instance->page + (i * SLAB_ELEMENT_SIZE));
+			break;
+		}
+	}
+	fibril_mutex_unlock(&instance->guard);
+
+	usb_log_fatal("SLAB allocated address element %zu(%p).\n", i, addr);
+	return addr;
+}
+/*----------------------------------------------------------------------------*/
+static bool slab_in_range(slab_t *instance, void *addr) {
+	assert(instance);
+	bool in_range = (instance->page != NULL) &&
+		(addr >= instance->page) && (addr < instance->page + SLAB_SIZE);
+//	usb_log_fatal("SLAB address %sin range %p(%p-%p).\n",
+//	    in_range ? "" : "NOT ", addr, instance->page, instance->page + SLAB_SIZE);
+	return in_range;
+}
+/*----------------------------------------------------------------------------*/
+static void slab_free(slab_t *instance, void *addr)
+{
+	assert(instance);
+	assert(slab_in_range(instance, addr));
+	memset(addr, 0xa, SLAB_ELEMENT_SIZE);
+
+	const size_t pos = (addr - instance->page) /  SLAB_ELEMENT_SIZE;
+
+	fibril_mutex_lock(&instance->guard);
+	assert(instance->slabs[pos] == false);
+	instance->slabs[pos] = true;
+	fibril_mutex_unlock(&instance->guard);
+
+	usb_log_fatal("SLAB freed element %zu(%p).\n", pos, addr);
+}
+/**
+ * @}
+ */
Index: uspace/drv/uhci-hcd/utils/slab.h
===================================================================
--- uspace/drv/uhci-hcd/utils/slab.h	(revision 001b15281fc711d0d14335e07ce5c8e30f8b3548)
+++ uspace/drv/uhci-hcd/utils/slab.h	(revision 001b15281fc711d0d14335e07ce5c8e30f8b3548)
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2011 Jan Vesely
+ * 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 usb
+ * @{
+ */
+/** @file
+ * @brief UHCI driver
+ */
+#ifndef DRV_UHCI_SLAB_H
+#define DRV_UHCI_SLAB_H
+
+#include <bool.h>
+
+#define SLAB_ELEMENT_SIZE 1024
+
+void * slab_malloc_g(void);
+
+void slab_free_g(void *addr);
+
+bool slab_in_range_g(void *addr);
+
+#endif
+/**
+ * @}
+ */
