Index: src/libcfa/bits/locks.h
===================================================================
--- src/libcfa/bits/locks.h	(revision 65deb18a7ffff4dccefdf2611afde3cadd19efb0)
+++ src/libcfa/bits/locks.h	(revision 7416d46ae4c80902ec659807c72c4b3d78cdba5c)
@@ -9,7 +9,7 @@
 // Author           : Thierry Delisle
 // Created On       : Tue Oct 31 15:14:38 2017
-// Last Modified By : --
-// Last Modified On : --
-// Update Count     : 0
+// Last Modified By : Peter A. Buhr
+// Last Modified On : Fri Dec  8 16:02:22 2017
+// Update Count     : 1
 //
 
@@ -24,9 +24,11 @@
 #elif defined( __i386 ) || defined( __x86_64 )
 	#define Pause() __asm__ __volatile__ ( "pause" : : : )
+#elif defined( __ARM_ARCH )
+	#define Pause() __asm__ __volatile__ ( "nop" : : : )
 #else
 	#error unsupported architecture
 #endif
 
-#if defined( __i386 ) || defined( __x86_64 )
+#if defined( __i386 ) || defined( __x86_64 ) || defined( __ARM_ARCH )
 	// Intel recommendation
 	#define __ALIGN__ __attribute__(( aligned (128) ))
@@ -37,8 +39,8 @@
 #endif
 
-#if defined( __x86_64 )
+#if __SIZEOF_SIZE_T__ == 8
 	#define __lock_test_and_test_and_set( lock ) (lock) == 0 && __sync_lock_test_and_set_8( &(lock), 1 ) == 0
 	#define __lock_release( lock ) __sync_lock_release_8( &(lock) );
-#elif defined( __i386 )
+#elif __SIZEOF_SIZE_T__ == 4
 	#define __lock_test_and_test_and_set( lock ) (lock) == 0 && __sync_lock_test_and_set_4( &(lock), 1 ) == 0
 	#define __lock_release( lock ) __sync_lock_release_4( &(lock) );
@@ -48,5 +50,5 @@
 
 struct __spinlock_t {
-	__ALIGN__ volatile uintptr_t lock;
+	__ALIGN__ volatile size_t lock;
 	#ifdef __CFA_DEBUG__
 		const char * prev_name;
@@ -56,6 +58,12 @@
 
 #ifdef __cforall
+	extern "C" {
+		extern void disable_interrupts();
+		extern void enable_interrupts_noPoll();
+	}
+
 	extern void yield( unsigned int );
 	extern thread_local struct thread_desc *    volatile this_thread;
+	extern thread_local struct processor *      volatile this_processor;
 
 	static inline void ?{}( __spinlock_t & this ) {
@@ -66,10 +74,11 @@
 	static inline _Bool try_lock  ( __spinlock_t & this __cfaabi_dbg_ctx_param2 ) {
 		_Bool result = __lock_test_and_test_and_set( this.lock );
-		__cfaabi_dbg_debug_do(
-			if( result ) {
+		if( result ) {
+			disable_interrupts();
+			__cfaabi_dbg_debug_do(
 				this.prev_name = caller;
 				this.prev_thrd = this_thread;
-			}
-		)
+			)
+		}
 		return result;
 	}
@@ -97,4 +106,5 @@
 			#endif
 		}
+		disable_interrupts();
 		__cfaabi_dbg_debug_do(
 			this.prev_name = caller;
@@ -103,17 +113,19 @@
 	}
 
-	// Lock the spinlock, spin if already acquired
-	static inline void lock_yield( __spinlock_t & this __cfaabi_dbg_ctx_param2 ) {
-		for ( unsigned int i = 1;; i += 1 ) {
-			if ( __lock_test_and_test_and_set( this.lock ) ) break;
-			yield( i );
-		}
-		__cfaabi_dbg_debug_do(
-			this.prev_name = caller;
-			this.prev_thrd = this_thread;
-		)
-	}
+	// // Lock the spinlock, yield if already acquired
+	// static inline void lock_yield( __spinlock_t & this __cfaabi_dbg_ctx_param2 ) {
+	// 	for ( unsigned int i = 1;; i += 1 ) {
+	// 		if ( __lock_test_and_test_and_set( this.lock ) ) break;
+	// 		yield( i );
+	// 	}
+	// 	disable_interrupts();
+	// 	__cfaabi_dbg_debug_do(
+	// 		this.prev_name = caller;
+	// 		this.prev_thrd = this_thread;
+	// 	)
+	// }
 
 	static inline void unlock( __spinlock_t & this ) {
+		enable_interrupts_noPoll();
 		__lock_release( this.lock );
 	}
Index: src/libcfa/bits/signal.h
===================================================================
--- src/libcfa/bits/signal.h	(revision 7416d46ae4c80902ec659807c72c4b3d78cdba5c)
+++ src/libcfa/bits/signal.h	(revision 7416d46ae4c80902ec659807c72c4b3d78cdba5c)
@@ -0,0 +1,65 @@
+//
+// Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
+//
+// The contents of this file are covered under the licence agreement in the
+// file "LICENCE" distributed with Cforall.
+//
+// bits/signal.h -- Helper functions and defines to use signals
+//
+// Author           : Thierry Delisle
+// Created On       : Thu Jan 25 16:06:29 2018
+// Last Modified By :
+// Last Modified On :
+// Update Count     :
+//
+
+#pragma once
+
+#include "bits/debug.h"
+#include "bits/defs.h"
+
+extern "C" {
+#include <errno.h>
+#define __USE_GNU
+#include <signal.h>
+#undef __USE_GNU
+#include <stdlib.h>
+#include <string.h>
+}
+
+// Short hands for signal context information
+#define __CFA_SIGCXT__ ucontext_t *
+#define __CFA_SIGPARMS__ __attribute__((unused)) int sig, __attribute__((unused)) siginfo_t *sfp, __attribute__((unused)) __CFA_SIGCXT__ cxt
+
+// Sigaction wrapper : register an signal handler
+static void __kernel_sigaction( int sig, void (*handler)(__CFA_SIGPARMS__), int flags ) {
+	struct sigaction act;
+
+	act.sa_sigaction = (void (*)(int, siginfo_t *, void *))handler;
+	act.sa_flags = flags;
+
+	if ( sigaction( sig, &act, NULL ) == -1 ) {
+		__cfaabi_dbg_print_buffer_decl(
+			" __kernel_sigaction( sig:%d, handler:%p, flags:%d ), problem installing signal handler, error(%d) %s.\n",
+			sig, handler, flags, errno, strerror( errno )
+		);
+		_exit( EXIT_FAILURE );
+	}
+}
+
+// Sigaction wrapper : restore default handler
+static void __kernel_sigdefault( int sig ) {
+	struct sigaction act;
+
+	act.sa_handler = SIG_DFL;
+	act.sa_flags = 0;
+	sigemptyset( &act.sa_mask );
+
+	if ( sigaction( sig, &act, NULL ) == -1 ) {
+		__cfaabi_dbg_print_buffer_decl(
+			" __kernel_sigdefault( sig:%d ), problem reseting signal handler, error(%d) %s.\n",
+			sig, errno, strerror( errno )
+		);
+		_exit( EXIT_FAILURE );
+	}
+}
Index: src/libcfa/concurrency/CtxSwitch-armv7l.S
===================================================================
--- src/libcfa/concurrency/CtxSwitch-armv7l.S	(revision 7416d46ae4c80902ec659807c72c4b3d78cdba5c)
+++ src/libcfa/concurrency/CtxSwitch-armv7l.S	(revision 7416d46ae4c80902ec659807c72c4b3d78cdba5c)
@@ -0,0 +1,62 @@
+	@ 32 bit ARM context switch
+	@ This function assumes that r9 has no special meaning on the platform it's
+	@ being built on.
+	@ If r9 is special, uncomment the following line and it will be left alone
+
+	@ #define R9_SPECIAL
+
+	#define PTR_BYTE        4
+	#define SP_OFFSET       ( 0 * PTR_BYTE )
+	#define FP_OFFSET       ( 1 * PTR_BYTE )
+	#define PC_OFFSET       ( 2 * PTR_BYTE )
+
+	.text
+	.align  2
+	.global CtxSwitch
+	.type   CtxSwitch, %function
+
+CtxSwitch:
+	@ save callee-saved registers: r4-r8, r10, r11, r13(sp) (plus r9 depending on platform specification)
+	@ I've seen reference to 31 registers on 64-bit, if this is the case, more need to be saved
+	@ save thread state registers: r14(lr)
+	@ r12(ip) is intra-procedure-call scratch register, does not need saving between function calls
+
+	#ifdef R9_SPECIAL
+	stmfd r13!, {r4-r8,r10,r11,r14}
+	#else
+	stmfd r13!, {r4-r11,r14}
+	#endif // R9_SPECIAL
+
+	@ save floating point registers: s16-s31
+	vstmdb r13!, {s16-s31}
+
+	@ save frame pointer and stack pointer to outgoing datastructure
+	str sp, [r0, #SP_OFFSET]
+	str fp, [r0, #FP_OFFSET]
+
+	@ restore frame pointer and stack pointer from incoming datastructure
+	ldr fp, [r1, #FP_OFFSET]
+	ldr sp, [r1, #SP_OFFSET]
+
+	@ restore floating point registers: s16-s31
+	vldm r13!, {s16-s31}
+	@ restore r14(lr)
+	@ restore 64-bit extra registers?
+	@ restore callee-saved registers: r4-r8, r10, r11, r13
+
+	#ifdef R9_SPECIAL
+	ldmfd r13!, {r4-r8,r10,r11,r15}
+	#else
+	ldmfd r13!, {r4-r11,r14}    @ loading r14 back into r15 returns
+
+	mov r15, r14
+	#endif // R9_SPECIAL
+	
+	.text
+	.align  2
+	.global CtxInvokeStub
+	.type   CtxInvokeStub, %function
+
+CtxInvokeStub:
+        ldmfd r13!, {r0-r1}
+	mov r15, r1
Index: src/libcfa/concurrency/invoke.c
===================================================================
--- src/libcfa/concurrency/invoke.c	(revision 65deb18a7ffff4dccefdf2611afde3cadd19efb0)
+++ src/libcfa/concurrency/invoke.c	(revision 7416d46ae4c80902ec659807c72c4b3d78cdba5c)
@@ -10,6 +10,6 @@
 // Created On       : Tue Jan 17 12:27:26 2016
 // Last Modified By : Peter A. Buhr
-// Last Modified On : Fri Jul 21 22:28:33 2017
-// Update Count     : 1
+// Last Modified On : Tue Jan 23 14:04:56 2018
+// Update Count     : 2
 //
 
@@ -133,4 +133,21 @@
 	((struct FakeStack *)(((struct machine_context_t *)stack->context)->SP))->mxcr = 0x1F80; //Vol. 2A 3-520
 	((struct FakeStack *)(((struct machine_context_t *)stack->context)->SP))->fcw = 0x037F;  //Vol. 1 8-7
+
+#elif defined( __ARM_ARCH )
+
+	struct FakeStack {
+		float fpRegs[16];			// floating point registers
+		void *intRegs[9];			// integer/pointer registers
+		void *arg[2];				// placeholder for this pointer
+	};
+
+	((struct machine_context_t *)stack->context)->SP = (char *)stack->base - sizeof( struct FakeStack );
+	((struct machine_context_t *)stack->context)->FP = NULL;
+
+	struct FakeStack *fs = (struct FakeStack *)((struct machine_context_t *)stack->context)->SP;
+
+	fs->intRegs[8] = CtxInvokeStub;
+	fs->arg[0] = this;
+	fs->arg[1] = invoke;
 #else
 	#error Only __i386__ and __x86_64__ is supported for threads in cfa
Index: src/libcfa/concurrency/invoke.h
===================================================================
--- src/libcfa/concurrency/invoke.h	(revision 65deb18a7ffff4dccefdf2611afde3cadd19efb0)
+++ src/libcfa/concurrency/invoke.h	(revision 7416d46ae4c80902ec659807c72c4b3d78cdba5c)
@@ -10,6 +10,6 @@
 // Created On       : Tue Jan 17 12:27:26 2016
 // Last Modified By : Peter A. Buhr
-// Last Modified On : Fri Jul 21 22:28:56 2017
-// Update Count     : 1
+// Last Modified On : Tue Jan 23 14:55:46 2018
+// Update Count     : 3
 //
 
@@ -134,4 +134,10 @@
 		// instrusive link field for threads
 		struct thread_desc * next;
+
+		__cfaabi_dbg_debug_do(
+			// instrusive link field for debugging
+			struct thread_desc * dbg_next;
+			struct thread_desc * dbg_prev;
+		)
      };
 
@@ -203,4 +209,9 @@
 			"movl %%ebp,%1\n"   \
 		: "=rm" (ctx.SP), "=rm" (ctx.FP) )
+	#elif defined( __ARM_ARCH )
+	#define CtxGet( ctx ) __asm__ ( \
+			"mov %0,%%sp\n"   \
+			"mov %1,%%r11\n"   \
+		: "=rm" (ctx.SP), "=rm" (ctx.FP) )
 	#endif
 
Index: src/libcfa/concurrency/kernel.c
===================================================================
--- src/libcfa/concurrency/kernel.c	(revision 65deb18a7ffff4dccefdf2611afde3cadd19efb0)
+++ src/libcfa/concurrency/kernel.c	(revision 7416d46ae4c80902ec659807c72c4b3d78cdba5c)
@@ -10,10 +10,11 @@
 // Created On       : Tue Jan 17 12:27:26 2017
 // Last Modified By : Peter A. Buhr
-// Last Modified On : Fri Jul 21 22:33:18 2017
-// Update Count     : 2
+// Last Modified On : Fri Dec  8 16:23:33 2017
+// Update Count     : 3
 //
 
 //C Includes
 #include <stddef.h>
+#define ftype `ftype`
 extern "C" {
 #include <stdio.h>
@@ -23,4 +24,5 @@
 #include <unistd.h>
 }
+#undef ftype
 
 //CFA Includes
@@ -240,4 +242,5 @@
 void finishRunning(processor * this) with( this->finish ) {
 	if( action_code == Release ) {
+		verify( disable_preempt_count > 1 );
 		unlock( *lock );
 	}
@@ -246,8 +249,10 @@
 	}
 	else if( action_code == Release_Schedule ) {
+		verify( disable_preempt_count > 1 );
 		unlock( *lock );
 		ScheduleThread( thrd );
 	}
 	else if( action_code == Release_Multi ) {
+		verify( disable_preempt_count > lock_count );
 		for(int i = 0; i < lock_count; i++) {
 			unlock( *locks[i] );
@@ -363,5 +368,5 @@
 	this_processor->finish.lock        = lock;
 
-	verify( disable_preempt_count > 0 );
+	verify( disable_preempt_count > 1 );
 	suspend();
 	verify( disable_preempt_count > 0 );
@@ -389,5 +394,5 @@
 	this_processor->finish.thrd        = thrd;
 
-	verify( disable_preempt_count > 0 );
+	verify( disable_preempt_count > 1 );
 	suspend();
 	verify( disable_preempt_count > 0 );
@@ -514,4 +519,9 @@
 }
 
+//=============================================================================================
+// Unexpected Terminating logic
+//=============================================================================================
+
+
 static __spinlock_t kernel_abort_lock;
 static __spinlock_t kernel_debug_lock;
@@ -609,4 +619,37 @@
 }
 
+//-----------------------------------------------------------------------------
+// Debug
+__cfaabi_dbg_debug_do(
+	struct {
+		thread_desc * tail;
+	} __cfaabi_dbg_thread_list = { NULL };
+
+	void __cfaabi_dbg_thread_register( thread_desc * thrd ) {
+		if( !__cfaabi_dbg_thread_list.tail ) {
+			__cfaabi_dbg_thread_list.tail = thrd;
+			return;
+		}
+		__cfaabi_dbg_thread_list.tail->dbg_next = thrd;
+		thrd->dbg_prev = __cfaabi_dbg_thread_list.tail;
+		__cfaabi_dbg_thread_list.tail = thrd;
+	}
+
+	void __cfaabi_dbg_thread_unregister( thread_desc * thrd ) {
+		thread_desc * prev = thrd->dbg_prev;
+		thread_desc * next = thrd->dbg_next;
+
+		if( next ) { next->dbg_prev = prev; }
+		else       {
+			assert( __cfaabi_dbg_thread_list.tail == thrd );
+			__cfaabi_dbg_thread_list.tail = prev;
+		}
+
+		if( prev ) { prev->dbg_next = next; }
+
+		thrd->dbg_prev = NULL;
+		thrd->dbg_next = NULL;
+	}
+)
 // Local Variables: //
 // mode: c //
Index: src/libcfa/concurrency/kernel_private.h
===================================================================
--- src/libcfa/concurrency/kernel_private.h	(revision 65deb18a7ffff4dccefdf2611afde3cadd19efb0)
+++ src/libcfa/concurrency/kernel_private.h	(revision 7416d46ae4c80902ec659807c72c4b3d78cdba5c)
@@ -85,4 +85,9 @@
 extern void ThreadCtxSwitch(coroutine_desc * src, coroutine_desc * dst);
 
+__cfaabi_dbg_debug_do(
+	extern void __cfaabi_dbg_thread_register  ( thread_desc * thrd );
+	extern void __cfaabi_dbg_thread_unregister( thread_desc * thrd );
+)
+
 //-----------------------------------------------------------------------------
 // Utils
Index: src/libcfa/concurrency/monitor.c
===================================================================
--- src/libcfa/concurrency/monitor.c	(revision 65deb18a7ffff4dccefdf2611afde3cadd19efb0)
+++ src/libcfa/concurrency/monitor.c	(revision 7416d46ae4c80902ec659807c72c4b3d78cdba5c)
@@ -53,10 +53,4 @@
 static inline __lock_size_t aggregate    ( monitor_desc * storage [], const __waitfor_mask_t & mask );
 
-#ifndef __CFA_LOCK_NO_YIELD
-#define DO_LOCK lock_yield
-#else
-#define DO_LOCK lock
-#endif
-
 //-----------------------------------------------------------------------------
 // Useful defines
@@ -90,6 +84,8 @@
 	static void __enter_monitor_desc( monitor_desc * this, const __monitor_group_t & group ) {
 		// Lock the monitor spinlock
-		DO_LOCK( this->lock __cfaabi_dbg_ctx2 );
+		lock( this->lock __cfaabi_dbg_ctx2 );
 		thread_desc * thrd = this_thread;
+
+		verify( disable_preempt_count > 0 );
 
 		__cfaabi_dbg_print_safe("Kernel : %10p Entering mon %p (%p)\n", thrd, this, this->owner);
@@ -121,4 +117,7 @@
 			// Some one else has the monitor, wait in line for it
 			append( this->entry_queue, thrd );
+
+			verify( disable_preempt_count > 0 );
+
 			BlockInternal( &this->lock );
 
@@ -138,5 +137,5 @@
 	static void __enter_monitor_dtor( monitor_desc * this, fptr_t func ) {
 		// Lock the monitor spinlock
-		DO_LOCK( this->lock __cfaabi_dbg_ctx2 );
+		lock( this->lock __cfaabi_dbg_ctx2 );
 		thread_desc * thrd = this_thread;
 
@@ -201,6 +200,6 @@
 	// Leave single monitor
 	void __leave_monitor_desc( monitor_desc * this ) {
-		// Lock the monitor spinlock, DO_LOCK to reduce contention
-		DO_LOCK( this->lock __cfaabi_dbg_ctx2 );
+		// Lock the monitor spinlock
+		lock( this->lock __cfaabi_dbg_ctx2 );
 
 		__cfaabi_dbg_print_safe("Kernel : %10p Leaving mon %p (%p)\n", this_thread, this, this->owner);
@@ -248,5 +247,5 @@
 
 		// Lock the monitor now
-		DO_LOCK( this->lock __cfaabi_dbg_ctx2 );
+		lock( this->lock __cfaabi_dbg_ctx2 );
 
 		disable_interrupts();
@@ -397,6 +396,11 @@
 	append( this.blocked, &waiter );
 
+	verify( disable_preempt_count == 0 );
+
 	// Lock all monitors (aggregates the locks as well)
 	lock_all( monitors, locks, count );
+
+	// verifyf( disable_preempt_count == count, "Got %d, expected %d\n", disable_preempt_count, count );
+	if(disable_preempt_count != count) { __cfaabi_dbg_print_buffer_decl("----------Gonna crash\n"); }
 
 	// Find the next thread(s) to run
@@ -473,6 +477,12 @@
 	monitor_ctx( this.monitors, this.monitor_count );
 
+	verify( disable_preempt_count == 0 );
+
 	// Lock all monitors (aggregates the locks them as well)
 	lock_all( monitors, locks, count );
+
+	// verify( disable_preempt_count == count );
+	if(disable_preempt_count != count) { __cfaabi_dbg_print_buffer_decl("----------Gonna crash\n"); }
+
 
 	// Create the node specific to this wait operation
@@ -737,5 +747,5 @@
 static inline void lock_all( __spinlock_t * locks [], __lock_size_t count ) {
 	for( __lock_size_t i = 0; i < count; i++ ) {
-		DO_LOCK( *locks[i] __cfaabi_dbg_ctx2 );
+		lock( *locks[i] __cfaabi_dbg_ctx2 );
 	}
 }
@@ -744,5 +754,5 @@
 	for( __lock_size_t i = 0; i < count; i++ ) {
 		__spinlock_t * l = &source[i]->lock;
-		DO_LOCK( *l __cfaabi_dbg_ctx2 );
+		lock( *l __cfaabi_dbg_ctx2 );
 		if(locks) locks[i] = l;
 	}
Index: src/libcfa/concurrency/preemption.c
===================================================================
--- src/libcfa/concurrency/preemption.c	(revision 65deb18a7ffff4dccefdf2611afde3cadd19efb0)
+++ src/libcfa/concurrency/preemption.c	(revision 7416d46ae4c80902ec659807c72c4b3d78cdba5c)
@@ -10,25 +10,20 @@
 // Created On       : Mon Jun 5 14:20:42 2017
 // Last Modified By : Peter A. Buhr
-// Last Modified On : Fri Jul 21 22:36:05 2017
-// Update Count     : 2
+// Last Modified On : Tue Jan 23 17:59:30 2018
+// Update Count     : 7
 //
 
 #include "preemption.h"
 
+#define ftype `ftype`
 extern "C" {
 #include <errno.h>
-#include <execinfo.h>
-#define __USE_GNU
-#include <signal.h>
-#undef __USE_GNU
 #include <stdio.h>
 #include <string.h>
 #include <unistd.h>
 }
-
-
-#ifdef __USE_STREAM__
-#include "fstream"
-#endif
+#undef ftype
+
+#include "bits/signal.h"
 
 //TODO move to defaults
@@ -39,8 +34,4 @@
 	return __CFA_DEFAULT_PREEMPTION__;
 }
-
-// Short hands for signal context information
-#define __CFA_SIGCXT__ ucontext_t *
-#define __CFA_SIGPARMS__ __attribute__((unused)) int sig, __attribute__((unused)) siginfo_t *sfp, __attribute__((unused)) __CFA_SIGCXT__ cxt
 
 // FwdDeclarations : timeout handlers
@@ -53,15 +44,14 @@
 void sigHandler_abort    ( __CFA_SIGPARMS__ );
 
-// FwdDeclarations : sigaction wrapper
-static void __kernel_sigaction( int sig, void (*handler)(__CFA_SIGPARMS__), int flags );
-
 // FwdDeclarations : alarm thread main
 void * alarm_loop( __attribute__((unused)) void * args );
 
 // Machine specific register name
-#ifdef __x86_64__
+#if   defined(__x86_64__)
 #define CFA_REG_IP REG_RIP
-#else
+#elif defined(__i386__)
 #define CFA_REG_IP REG_EIP
+#elif defined(__ARM_ARCH__)
+#define CFA_REG_IP REG_R15
 #endif
 
@@ -179,5 +169,5 @@
 	void enable_interrupts_noPoll() {
 		__attribute__((unused)) unsigned short prev = __atomic_fetch_add_2( &disable_preempt_count, -1, __ATOMIC_SEQ_CST );
-		verify( prev != 0u );                     // If this triggers someone is enabled already enabled interrupts
+		verifyf( prev != 0u, "Incremented from %u\n", prev );                     // If this triggers someone is enabled already enabled interrupts
 	}
 }
@@ -243,6 +233,4 @@
 	// Setup proper signal handlers
 	__kernel_sigaction( SIGUSR1, sigHandler_ctxSwitch, SA_SIGINFO | SA_RESTART );         // CtxSwitch handler
-	// __kernel_sigaction( SIGSEGV, sigHandler_segv     , SA_SIGINFO );      // Failure handler
-	// __kernel_sigaction( SIGBUS , sigHandler_segv     , SA_SIGINFO );      // Failure handler
 
 	signal_block( SIGALRM );
@@ -296,8 +284,14 @@
 // Receives SIGUSR1 signal and causes the current thread to yield
 void sigHandler_ctxSwitch( __CFA_SIGPARMS__ ) {
+#if defined( __ARM_ARCH )
+	__cfaabi_dbg_debug_do( last_interrupt = (void *)(cxt->uc_mcontext.arm_pc); )
+#else
 	__cfaabi_dbg_debug_do( last_interrupt = (void *)(cxt->uc_mcontext.gregs[CFA_REG_IP]); )
-
-	// Check if it is safe to preempt here
+#endif
+
+		// Check if it is safe to preempt here
 	if( !preemption_ready() ) { return; }
+
+	__cfaabi_dbg_print_buffer_decl(" KERNEL: preempting core %p (%p).\n", this_processor, this_thread);
 
 	preemption_in_progress = true;                      // Sync flag : prevent recursive calls to the signal handler
@@ -371,133 +365,4 @@
 }
 
-// Sigaction wrapper : register an signal handler
-static void __kernel_sigaction( int sig, void (*handler)(__CFA_SIGPARMS__), int flags ) {
-	struct sigaction act;
-
-	act.sa_sigaction = (void (*)(int, siginfo_t *, void *))handler;
-	act.sa_flags = flags;
-
-	if ( sigaction( sig, &act, NULL ) == -1 ) {
-		__cfaabi_dbg_print_buffer_decl(
-			" __kernel_sigaction( sig:%d, handler:%p, flags:%d ), problem installing signal handler, error(%d) %s.\n",
-			sig, handler, flags, errno, strerror( errno )
-		);
-		_exit( EXIT_FAILURE );
-	}
-}
-
-// Sigaction wrapper : restore default handler
-static void __kernel_sigdefault( int sig ) {
-	struct sigaction act;
-
-	act.sa_handler = SIG_DFL;
-	act.sa_flags = 0;
-	sigemptyset( &act.sa_mask );
-
-	if ( sigaction( sig, &act, NULL ) == -1 ) {
-		__cfaabi_dbg_print_buffer_decl(
-			" __kernel_sigdefault( sig:%d ), problem reseting signal handler, error(%d) %s.\n",
-			sig, errno, strerror( errno )
-		);
-		_exit( EXIT_FAILURE );
-	}
-}
-
-//=============================================================================================
-// Terminating Signals logic
-//=============================================================================================
-
-__cfaabi_dbg_debug_do(
-	static void __kernel_backtrace( int start ) {
-		// skip first N stack frames
-
-		enum { Frames = 50 };
-		void * array[Frames];
-		int size = backtrace( array, Frames );
-		char ** messages = backtrace_symbols( array, size );
-
-		// find executable name
-		*index( messages[0], '(' ) = '\0';
-		#ifdef __USE_STREAM__
-		serr | "Stack back trace for:" | messages[0] | endl;
-		#else
-		fprintf( stderr, "Stack back trace for: %s\n", messages[0]);
-		#endif
-
-		// skip last 2 stack frames after main
-		for ( int i = start; i < size && messages != NULL; i += 1 ) {
-			char * name = NULL;
-			char * offset_begin = NULL;
-			char * offset_end = NULL;
-
-			for ( char *p = messages[i]; *p; ++p ) {
-				// find parantheses and +offset
-				if ( *p == '(' ) {
-					name = p;
-				}
-				else if ( *p == '+' ) {
-					offset_begin = p;
-				}
-				else if ( *p == ')' ) {
-					offset_end = p;
-					break;
-				}
-			}
-
-			// if line contains symbol print it
-			int frameNo = i - start;
-			if ( name && offset_begin && offset_end && name < offset_begin ) {
-				// delimit strings
-				*name++ = '\0';
-				*offset_begin++ = '\0';
-				*offset_end++ = '\0';
-
-				#ifdef __USE_STREAM__
-				serr 	| "("  | frameNo | ")" | messages[i] | ":"
-					| name | "+" | offset_begin | offset_end | endl;
-				#else
-				fprintf( stderr, "(%i) %s : %s + %s %s\n", frameNo, messages[i], name, offset_begin, offset_end);
-				#endif
-			}
-			// otherwise, print the whole line
-			else {
-				#ifdef __USE_STREAM__
-				serr | "(" | frameNo | ")" | messages[i] | endl;
-				#else
-				fprintf( stderr, "(%i) %s\n", frameNo, messages[i] );
-				#endif
-			}
-		}
-
-		free( messages );
-	}
-)
-
-// void sigHandler_segv( __CFA_SIGPARMS__ ) {
-// 	__cfaabi_dbg_debug_do(
-// 		#ifdef __USE_STREAM__
-// 		serr 	| "*CFA runtime error* program cfa-cpp terminated with"
-// 			| (sig == SIGSEGV ? "segment fault." : "bus error.")
-// 			| endl;
-// 		#else
-// 		fprintf( stderr, "*CFA runtime error* program cfa-cpp terminated with %s\n", sig == SIGSEGV ? "segment fault." : "bus error." );
-// 		#endif
-
-// 		// skip first 2 stack frames
-// 		__kernel_backtrace( 1 );
-// 	)
-// 	exit( EXIT_FAILURE );
-// }
-
-// void sigHandler_abort( __CFA_SIGPARMS__ ) {
-// 	// skip first 6 stack frames
-// 	__cfaabi_dbg_debug_do( __kernel_backtrace( 6 ); )
-
-// 	// reset default signal handler
-// 	__kernel_sigdefault( SIGABRT );
-
-// 	raise( SIGABRT );
-// }
-
 // Local Variables: //
 // mode: c //
Index: src/libcfa/concurrency/thread.c
===================================================================
--- src/libcfa/concurrency/thread.c	(revision 65deb18a7ffff4dccefdf2611afde3cadd19efb0)
+++ src/libcfa/concurrency/thread.c	(revision 7416d46ae4c80902ec659807c72c4b3d78cdba5c)
@@ -38,4 +38,9 @@
 	self_mon_p = &self_mon;
 	next = NULL;
+	__cfaabi_dbg_debug_do(
+		dbg_next = NULL;
+		dbg_prev = NULL;
+		__cfaabi_dbg_thread_register(&this);
+	)
 
 	monitors{ &self_mon_p, 1, (fptr_t)0 };
Index: src/libcfa/interpose.c
===================================================================
--- src/libcfa/interpose.c	(revision 65deb18a7ffff4dccefdf2611afde3cadd19efb0)
+++ src/libcfa/interpose.c	(revision 7416d46ae4c80902ec659807c72c4b3d78cdba5c)
@@ -22,11 +22,16 @@
 #include <dlfcn.h>
 #include <unistd.h>
+#define __USE_GNU
+#include <signal.h>
+#undef __USE_GNU
+#include <execinfo.h>
 }
 
 #include "bits/debug.h"
 #include "bits/defs.h"
+#include "bits/signal.h"
 #include "startup.h"
 
-void interpose_startup(void)  __attribute__(( constructor( STARTUP_PRIORITY_CORE ) ));
+void __cfaabi_interpose_startup(void)  __attribute__(( constructor( STARTUP_PRIORITY_CORE ) ));
 
 typedef void (*generic_fptr_t)(void);
@@ -84,10 +89,21 @@
 #define INIT_REALRTN( x, ver ) assign_ptr( (void**)&libc_##x, #x, ver)
 
-void interpose_startup() {
+void sigHandler_segv ( __CFA_SIGPARMS__ );
+void sigHandler_abort( __CFA_SIGPARMS__ );
+
+void __cfaabi_interpose_startup() {
 	const char *version = NULL;
 
 	INIT_REALRTN( abort, version );
 	INIT_REALRTN( exit, version );
-}
+
+	__kernel_sigaction( SIGSEGV, sigHandler_segv , SA_SIGINFO );      // Failure handler
+	__kernel_sigaction( SIGBUS , sigHandler_segv , SA_SIGINFO );      // Failure handler
+	__kernel_sigaction( SIGABRT, sigHandler_abort, SA_SIGINFO );      // Failure handler
+}
+
+//=============================================================================================
+// Terminating Signals logic
+//=============================================================================================
 
 extern "C" {
@@ -137,4 +153,71 @@
 		libc_abort();
 	}
+}
+
+// skip first 6 stack frames by default
+static void __kernel_backtrace() {
+	// skip first N stack frames
+	int start = 6;
+
+	enum { Frames = 50 };
+	void * array[Frames];
+	int size = backtrace( array, Frames );
+	char ** messages = backtrace_symbols( array, size );
+
+	// find executable name
+	*index( messages[0], '(' ) = '\0';
+	__cfaabi_dbg_bits_print_nolock( "Stack back trace for: %s\n", messages[0]);
+
+	// skip last 2 stack frames after main
+	for ( int i = start; i < size && messages != NULL; i += 1 ) {
+		char * name = NULL;
+		char * offset_begin = NULL;
+		char * offset_end = NULL;
+
+		for ( char *p = messages[i]; *p; ++p ) {
+			// find parantheses and +offset
+			if ( *p == '(' ) {
+				name = p;
+			}
+			else if ( *p == '+' ) {
+				offset_begin = p;
+			}
+			else if ( *p == ')' ) {
+				offset_end = p;
+				break;
+			}
+		}
+
+		// if line contains symbol print it
+		int frameNo = i - start;
+		if ( name && offset_begin && offset_end && name < offset_begin ) {
+			// delimit strings
+			*name++ = '\0';
+			*offset_begin++ = '\0';
+			*offset_end++ = '\0';
+
+			__cfaabi_dbg_bits_print_nolock( "(%i) %s : %s + %s %s\n", frameNo, messages[i], name, offset_begin, offset_end);
+		}
+		// otherwise, print the whole line
+		else {
+			__cfaabi_dbg_bits_print_nolock( "(%i) %s\n", frameNo, messages[i] );
+		}
+	}
+
+	free( messages );
+}
+
+void sigHandler_segv( __CFA_SIGPARMS__ ) {
+	// skip first only 1 stack frames in case of segfault.
+	abortf( "*CFA runtime error* program cfa-cpp terminated with %s\n", sig == SIGSEGV ? "segment fault." : "bus error." );
+}
+
+void sigHandler_abort( __CFA_SIGPARMS__ ) {
+	__kernel_backtrace();
+
+	// reset default signal handler
+	__kernel_sigdefault( SIGABRT );
+
+	raise( SIGABRT );
 }
 
Index: src/libcfa/iostream
===================================================================
--- src/libcfa/iostream	(revision 65deb18a7ffff4dccefdf2611afde3cadd19efb0)
+++ src/libcfa/iostream	(revision 7416d46ae4c80902ec659807c72c4b3d78cdba5c)
@@ -10,6 +10,6 @@
 // Created On       : Wed May 27 17:56:53 2015
 // Last Modified By : Peter A. Buhr
-// Last Modified On : Thu Dec 21 13:55:41 2017
-// Update Count     : 145
+// Last Modified On : Thu Jan 25 13:08:39 2018
+// Update Count     : 149
 //
 
@@ -124,4 +124,6 @@
 }; // readable
 
+forall( dtype istype | istream( istype ) ) istype & ?|?( istype &, _Bool & );
+
 forall( dtype istype | istream( istype ) ) istype & ?|?( istype &, char & );
 forall( dtype istype | istream( istype ) ) istype & ?|?( istype &, signed char & );
@@ -145,4 +147,8 @@
 forall( dtype istype | istream( istype ) ) istype & ?|?( istype &, long double _Complex & );
 
+// manipulators
+forall( dtype istype | istream( istype ) ) istype & ?|?( istype &, istype & (*)( istype & ) );
+forall( dtype istype | istream( istype ) ) istype & endl( istype & is );
+
 struct _Istream_cstrUC { char * s; };
 _Istream_cstrUC cstr( char * );
Index: src/libcfa/iostream.c
===================================================================
--- src/libcfa/iostream.c	(revision 65deb18a7ffff4dccefdf2611afde3cadd19efb0)
+++ src/libcfa/iostream.c	(revision 7416d46ae4c80902ec659807c72c4b3d78cdba5c)
@@ -10,6 +10,6 @@
 // Created On       : Wed May 27 17:56:53 2015
 // Last Modified By : Peter A. Buhr
-// Last Modified On : Thu Dec 21 13:55:09 2017
-// Update Count     : 427
+// Last Modified On : Thu Jan 25 13:09:28 2018
+// Update Count     : 467
 //
 
@@ -19,5 +19,7 @@
 #include <stdio.h>
 #include <stdbool.h>									// true/false
-#include <string.h>										// strlen
+//#include <string.h>										// strlen, strcmp
+extern int strcmp (const char *__s1, const char *__s2) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2)));
+extern size_t strlen (const char *__s) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1)));
 #include <float.h>										// DBL_DIG, LDBL_DIG
 #include <complex.h>									// creal, cimag
@@ -301,4 +303,17 @@
 
 forall( dtype istype | istream( istype ) )
+istype & ?|?( istype & is, _Bool & b ) {
+	char val[6];
+	fmt( is, "%5s", val );
+	if ( strcmp( val, "true" ) == 0 ) b = true;
+	else if ( strcmp( val, "false" ) == 0 ) b = false;
+	else {
+		fprintf( stderr, "invalid _Bool constant\n" );
+		abort();
+	} // if
+	return is;
+} // ?|?
+
+forall( dtype istype | istream( istype ) )
 istype & ?|?( istype & is, char & c ) {
 	fmt( is, "%c", &c );								// must pass pointer through varg to fmt
@@ -410,4 +425,15 @@
 } // ?|?
 
+forall( dtype istype | istream( istype ) )
+istype & ?|?( istype & is, istype & (* manip)( istype & ) ) {
+	return manip( is );
+} // ?|?
+
+forall( dtype istype | istream( istype ) )
+istype & endl( istype & is ) {
+	fmt( is, "%*[ \t\f\n\r\v]" );						// ignore whitespace
+	return is;
+} // endl
+
 _Istream_cstrUC cstr( char * str ) { return (_Istream_cstrUC){ str }; }
 forall( dtype istype | istream( istype ) )
Index: src/libcfa/stdlib.c
===================================================================
--- src/libcfa/stdlib.c	(revision 65deb18a7ffff4dccefdf2611afde3cadd19efb0)
+++ src/libcfa/stdlib.c	(revision 7416d46ae4c80902ec659807c72c4b3d78cdba5c)
@@ -5,11 +5,11 @@
 // file "LICENCE" distributed with Cforall.
 //
-// algorithm.c --
+// stdlib.c --
 //
 // Author           : Peter A. Buhr
 // Created On       : Thu Jan 28 17:10:29 2016
 // Last Modified By : Peter A. Buhr
-// Last Modified On : Tue Jan  2 12:20:32 2018
-// Update Count     : 441
+// Last Modified On : Wed Jan  3 08:29:29 2018
+// Update Count     : 444
 //
 
@@ -24,4 +24,6 @@
 #include <complex.h>									// _Complex_I
 #include <assert.h>
+
+//---------------------------------------
 
 // resize, non-array types
@@ -257,5 +259,5 @@
 //---------------------------------------
 
-extern "C" { void srandom( unsigned int seed ) { srand48( seed ); } } // override C version
+extern "C" { void srandom( unsigned int seed ) { srand48( (long int)seed ); } } // override C version
 char random( void ) { return (unsigned long int)random(); }
 char random( char u ) { return random( (unsigned long int)u ); }
