Index: arch/ia32/include/atomic.h
===================================================================
--- arch/ia32/include/atomic.h	(revision 49b6d32c4bf731f668a2569fb78160da0299283f)
+++ arch/ia32/include/atomic.h	(revision 36e7ee98b33f87f4fd7451460ffe749f290f85b7)
@@ -32,12 +32,12 @@
 #include <arch/types.h>
 
-typedef struct { volatile __u32 count; } atomic_t;
+typedef struct { volatile __u64 count; } atomic_t;
 
-static inline void atomic_set(atomic_t *val, __u32 i)
+static inline void atomic_set(atomic_t *val, __u64 i)
 {
 	val->count = i;
 }
 
-static inline __u32 atomic_get(atomic_t *val)
+static inline __u64 atomic_get(atomic_t *val)
 {
 	return val->count;
@@ -80,5 +80,5 @@
 		"movl $-1, %0\n"
 		"lock xaddl %0, %1\n"
-		: "=r" (r), "=m" (*val)
+		: "=r" (r), "=m" (val->count)
 	);
 	
Index: arch/mips32/src/debugger.c
===================================================================
--- arch/mips32/src/debugger.c	(revision 49b6d32c4bf731f668a2569fb78160da0299283f)
+++ arch/mips32/src/debugger.c	(revision 36e7ee98b33f87f4fd7451460ffe749f290f85b7)
@@ -257,6 +257,6 @@
 	printf("***Type 'exit' to exit kconsole.\n");
 	/* Umm..we should rather set some 'debugstate' here */
-	haltstate = 1;
+	atomic_set(&haltstate,1);
 	kconsole("debug");
-	haltstate = 0;
-}
+	atomic_set(&haltstate,0);
+}
Index: generic/include/func.h
===================================================================
--- generic/include/func.h	(revision 49b6d32c4bf731f668a2569fb78160da0299283f)
+++ generic/include/func.h	(revision 36e7ee98b33f87f4fd7451460ffe749f290f85b7)
@@ -32,6 +32,7 @@
 #include <arch/types.h>
 #include <typedefs.h>
+#include <arch/atomic.h>
 
-extern volatile __u32 haltstate;
+extern atomic_t haltstate;
 
 extern void halt(void);
Index: generic/src/console/console.c
===================================================================
--- generic/src/console/console.c	(revision 49b6d32c4bf731f668a2569fb78160da0299283f)
+++ generic/src/console/console.c	(revision 36e7ee98b33f87f4fd7451460ffe749f290f85b7)
@@ -37,4 +37,5 @@
 #include <func.h>
 #include <print.h>
+#include <arch/atomic.h>
 
 /** Standard input character device. */
@@ -53,5 +54,5 @@
 	ipl_t ipl;
 
-	if (haltstate) {
+	if (atomic_get(&haltstate)) {
 		/* If we are here, we are hopefully on the processor, that 
 		 * issued the 'halt' command, so proceed to read the character
@@ -61,5 +62,9 @@
 			return chardev->op->read(chardev);
 		/* no other way of interacting with user, halt */
-		printf("cpu: halted - no kconsole\n");
+		if (CPU)
+			printf("cpu%d: ", CPU->id);
+		else
+			printf("cpu: ");
+		printf("halted - no kconsole\n");
 		cpu_halt();
 	}
Index: generic/src/lib/func.c
===================================================================
--- generic/src/lib/func.c	(revision 49b6d32c4bf731f668a2569fb78160da0299283f)
+++ generic/src/lib/func.c	(revision 36e7ee98b33f87f4fd7451460ffe749f290f85b7)
@@ -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);
Index: generic/src/proc/scheduler.c
===================================================================
--- generic/src/proc/scheduler.c	(revision 49b6d32c4bf731f668a2569fb78160da0299283f)
+++ generic/src/proc/scheduler.c	(revision 36e7ee98b33f87f4fd7451460ffe749f290f85b7)
@@ -407,5 +407,5 @@
 	ipl = interrupts_disable();
 
-	if (haltstate)
+	if (atomic_get(&haltstate))
 		halt();
 
