Index: libcfa/src/concurrency/kernel/startup.cfa
===================================================================
--- libcfa/src/concurrency/kernel/startup.cfa	(revision bfcf6b93d595af7bc5fcb05405720c63f503db8f)
+++ libcfa/src/concurrency/kernel/startup.cfa	(revision aa1d13cda79dced5a40cd4a8bd7adef8a30e614d)
@@ -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
 }
 
