Index: generic/src/lib/func.c
===================================================================
--- generic/src/lib/func.c	(revision 5a95b250eab5a685e75ce5687dc7f7ef519367ad)
+++ generic/src/lib/func.c	(revision c43fa55776e570818cc110af5b944e2bc0d14546)
@@ -35,5 +35,5 @@
 #include <console/kconsole.h>
 
-__u32 volatile haltstate = 0; /**< Halt flag */
+atomic_t haltstate = {0}; /**< Halt flag */
 
 
@@ -43,13 +43,26 @@
  *
  */
-void halt(void)
+void halt()
 {
-	haltstate = 1;
+#ifdef CONFIG_DEBUG
+	bool rundebugger;
+
+//      TODO test_and_set not defined on all arches
+//	if (!test_and_set(&haltstate))
+	if (!atomic_get(&haltstate)) {
+		atomic_set(&haltstate, 1);
+		rundebugger = true;
+	}
+#else
+	atomic_set(haltstate, 1);
+#endif
+
 	interrupts_disable();
 #ifdef CONFIG_DEBUG
-	printf("\n");
-	kconsole("panic"); /* Run kconsole as a last resort to user */
+	if (rundebugger) {
+		printf("\n");
+		kconsole("panic"); /* Run kconsole as a last resort to user */
+	}
 #endif      
-
 	if (CPU)
 		printf("cpu%d: halted\n", CPU->id);
