Index: libcfa/src/concurrency/coroutine.cfa
===================================================================
--- libcfa/src/concurrency/coroutine.cfa	(revision b4aa1ab49003d184ed679ab13d03dfca28529bae)
+++ libcfa/src/concurrency/coroutine.cfa	(revision 97229d6d4d0603b4f97fac22b55c583eb89341e1)
@@ -29,4 +29,6 @@
 #include "exception.hfa"
 #include "math.hfa"
+
+#define CFA_COROUTINE_USE_MMAP 0
 
 #define __CFA_INVOKE_PRIVATE__
@@ -110,16 +112,4 @@
 	if ( ! userStack && this.storage ) {
 		__stack_clean( &this );
-		// __attribute__((may_alias)) intptr_t * istorage = (intptr_t *)&this.storage;
-		// *istorage &= (intptr_t)-1;
-
-		// void * storage = this.storage->limit;
-		// __cfaabi_dbg_debug_do(
-		// 	storage = (char*)(storage) - __page_size;
-		// 	if ( mprotect( storage, __page_size, PROT_READ | PROT_WRITE ) == -1 ) {
-		// 		abort( "(coStack_t *)%p.^?{}() : internal error, mprotect failure, error(%d) %s.", &this, errno, strerror( errno ) );
-		// 	}
-		// );
-		// __cfaabi_dbg_print_safe("Kernel : Deleting stack %p\n", storage);
-		// free( storage );
 	}
 }
@@ -174,26 +164,29 @@
 	// If we are running debug, we also need to allocate a guardpage to catch stack overflows.
 	void * storage;
-	// __cfaabi_dbg_debug_do(
-	// 	storage = memalign( __page_size, size + __page_size );
-	// );
-	// __cfaabi_dbg_no_debug_do(
-	// 	storage = (void*)malloc(size);
-	// );
-
-	// __cfaabi_dbg_print_safe("Kernel : Created stack %p of size %zu\n", storage, size);
-	// __cfaabi_dbg_debug_do(
-	// 	if ( mprotect( storage, __page_size, PROT_NONE ) == -1 ) {
-	// 		abort( "__stack_alloc : internal error, mprotect failure, error(%d) %s.", (int)errno, strerror( (int)errno ) );
-	// 	}
-	// 	storage = (void *)(((intptr_t)storage) + __page_size);
-	// );
-	storage = mmap(0p, size + __page_size, PROT_EXEC | PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, 0, 0);
-	if(storage == ((void*)-1)) {
-		abort( "coroutine stack creation : internal error, mmap failure, error(%d) %s.", errno, strerror( errno ) );
-	}
-	if ( mprotect( storage, __page_size, PROT_NONE ) == -1 ) {
-		abort( "coroutine stack creation : internal error, mprotect failure, error(%d) %s.", errno, strerror( errno ) );
-	} // if
-	storage = (void *)(((intptr_t)storage) + __page_size);
+	#if CFA_COROUTINE_USE_MMAP
+		storage = mmap(0p, size + __page_size, PROT_EXEC | PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, 0, 0);
+		if(storage == ((void*)-1)) {
+			abort( "coroutine stack creation : internal error, mmap failure, error(%d) %s.", errno, strerror( errno ) );
+		}
+		if ( mprotect( storage, __page_size, PROT_NONE ) == -1 ) {
+			abort( "coroutine stack creation : internal error, mprotect failure, error(%d) %s.", errno, strerror( errno ) );
+		} // if
+		storage = (void *)(((intptr_t)storage) + __page_size);
+	#else
+		__cfaabi_dbg_debug_do(
+			storage = memalign( __page_size, size + __page_size );
+		);
+		__cfaabi_dbg_no_debug_do(
+			storage = (void*)malloc(size);
+		);
+
+		__cfaabi_dbg_debug_do(
+			if ( mprotect( storage, __page_size, PROT_NONE ) == -1 ) {
+				abort( "__stack_alloc : internal error, mprotect failure, error(%d) %s.", (int)errno, strerror( (int)errno ) );
+			}
+			storage = (void *)(((intptr_t)storage) + __page_size);
+		);
+	#endif
+	__cfaabi_dbg_print_safe("Kernel : Created stack %p of size %zu\n", storage, size);
 
 	verify( ((intptr_t)storage & (libAlign() - 1)) == 0ul );
@@ -205,8 +198,20 @@
 	void * storage = this->storage->limit;
 
-	storage = (void *)(((intptr_t)storage) - __page_size);
-	if(munmap(storage, size + __page_size) == -1) {
-		abort( "coroutine stack destruction : internal error, munmap failure, error(%d) %s.", errno, strerror( errno ) );
-	}
+	#if CFA_COROUTINE_USE_MMAP
+		storage = (void *)(((intptr_t)storage) - __page_size);
+		if(munmap(storage, size + __page_size) == -1) {
+			abort( "coroutine stack destruction : internal error, munmap failure, error(%d) %s.", errno, strerror( errno ) );
+		}
+	#else
+		__cfaabi_dbg_debug_do(
+			storage = (char*)(storage) - __page_size;
+			if ( mprotect( storage, __page_size, PROT_READ | PROT_WRITE ) == -1 ) {
+				abort( "(coStack_t *)%p.^?{}() : internal error, mprotect failure, error(%d) %s.", &this, errno, strerror( errno ) );
+			}
+		);
+
+		free( storage );
+	#endif
+	__cfaabi_dbg_print_safe("Kernel : Deleting stack %p\n", storage);
 }
 
Index: libcfa/src/concurrency/kernel/startup.cfa
===================================================================
--- libcfa/src/concurrency/kernel/startup.cfa	(revision b4aa1ab49003d184ed679ab13d03dfca28529bae)
+++ libcfa/src/concurrency/kernel/startup.cfa	(revision 97229d6d4d0603b4f97fac22b55c583eb89341e1)
@@ -30,4 +30,6 @@
 #include "startup.hfa"          // STARTUP_PRIORITY_XXX
 #include "math.hfa"
+
+#define CFA_PROCESSOR_USE_MMAP 0
 
 //-----------------------------------------------------------------------------
@@ -677,23 +679,26 @@
 
 	void * stack;
-	#warning due to the thunk problem, stack creation uses mmap, revert to malloc once this goes away
-	// __cfaabi_dbg_debug_do(
-	// 	stack = memalign( __page_size, stacksize + __page_size );
-	// 	// pthread has no mechanism to create the guard page in user supplied stack.
-	// 	if ( mprotect( stack, __page_size, PROT_NONE ) == -1 ) {
-	// 		abort( "mprotect : internal error, mprotect failure, error(%d) %s.", errno, strerror( errno ) );
-	// 	} // if
-	// );
-	// __cfaabi_dbg_no_debug_do(
-	// 	stack = malloc( stacksize );
-	// );
-	stacksize = ceiling( stacksize, __page_size ) + __page_size;
-	stack = mmap(0p, stacksize, PROT_EXEC | PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, 0, 0);
-	if(stack == ((void*)-1)) {
-		abort( "pthread stack creation : internal error, mmap failure, error(%d) %s.", errno, strerror( errno ) );
-	}
-	if ( mprotect( stack, __page_size, PROT_NONE ) == -1 ) {
-		abort( "pthread stack creation : internal error, mprotect failure, error(%d) %s.", errno, strerror( errno ) );
-	} // if
+	#if CFA_PROCESSOR_USE_MMAP
+		stacksize = ceiling( stacksize, __page_size ) + __page_size;
+		stack = mmap(0p, stacksize, PROT_EXEC | PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, 0, 0);
+		if(stack == ((void*)-1)) {
+			abort( "pthread stack creation : internal error, mmap failure, error(%d) %s.", errno, strerror( errno ) );
+		}
+		if ( mprotect( stack, __page_size, PROT_NONE ) == -1 ) {
+			abort( "pthread stack creation : internal error, mprotect failure, error(%d) %s.", errno, strerror( errno ) );
+		} // if
+	#else
+		__cfaabi_dbg_debug_do(
+			stack = memalign( __page_size, stacksize + __page_size );
+			// pthread has no mechanism to create the guard page in user supplied stack.
+			if ( mprotect( stack, __page_size, PROT_NONE ) == -1 ) {
+				abort( "mprotect : internal error, mprotect failure, error(%d) %s.", errno, strerror( errno ) );
+			} // if
+		);
+		__cfaabi_dbg_no_debug_do(
+			stack = malloc( stacksize );
+		);
+	#endif
+
 
 	check( pthread_attr_setstack( &attr, stack, stacksize ), "pthread_attr_setstack" );
@@ -707,17 +712,21 @@
 	if( err != 0 ) abort("KERNEL ERROR: joining pthread %p caused error %s\n", (void*)pthread, strerror(err));
 
-	pthread_attr_t attr;
-
-	check( pthread_attr_init( &attr ), "pthread_attr_init" ); // initialize attribute
-
-	size_t stacksize;
-	// default stack size, normally defined by shell limit
-	check( pthread_attr_getstacksize( &attr, &stacksize ), "pthread_attr_getstacksize" );
-	assert( stacksize >= PTHREAD_STACK_MIN );
-	stacksize += __page_size;
-
-	if(munmap(stack, stacksize) == -1) {
-		abort( "pthread stack destruction : internal error, munmap failure, error(%d) %s.", errno, strerror( errno ) );
-	}
+	#if CFA_PROCESSOR_USE_MMAP
+		pthread_attr_t attr;
+
+		check( pthread_attr_init( &attr ), "pthread_attr_init" ); // initialize attribute
+
+		size_t stacksize;
+		// default stack size, normally defined by shell limit
+		check( pthread_attr_getstacksize( &attr, &stacksize ), "pthread_attr_getstacksize" );
+		assert( stacksize >= PTHREAD_STACK_MIN );
+		stacksize += __page_size;
+
+		if(munmap(stack, stacksize) == -1) {
+			abort( "pthread stack destruction : internal error, munmap failure, error(%d) %s.", errno, strerror( errno ) );
+		}
+	#else
+		free( stack );
+	#endif
 }
 
