Index: generic/src/lib/func.c
===================================================================
--- generic/src/lib/func.c	(revision ad64a2ddba551153ce5b45ee7d5dc1eaadecce1a)
+++ generic/src/lib/func.c	(revision 53f98219259f3ae305745185632cbe185fb7c871)
@@ -55,5 +55,5 @@
 	}
 #else
-	atomic_set(haltstate, 1);
+	atomic_set(&haltstate, 1);
 #endif
 
Index: generic/src/synch/spinlock.c
===================================================================
--- generic/src/synch/spinlock.c	(revision ad64a2ddba551153ce5b45ee7d5dc1eaadecce1a)
+++ generic/src/synch/spinlock.c	(revision 53f98219259f3ae305745185632cbe185fb7c871)
@@ -52,5 +52,4 @@
 }
 
-#ifdef CONFIG_DEBUG_SPINLOCK
 /** Lock spinlock
  *
@@ -61,5 +60,6 @@
  * @param sl Pointer to spinlock_t structure.
  */
-void spinlock_lock(spinlock_t *sl)
+#ifdef CONFIG_DEBUG_SPINLOCK
+void spinlock_lock_debug(spinlock_t *sl)
 {
 	count_t i = 0;
@@ -83,29 +83,4 @@
 	if (deadlock_reported)
 		printf("cpu%d: not deadlocked\n", CPU->id);
-
-	/*
-	 * Prevent critical section code from bleeding out this way up.
-	 */
-	CS_ENTER_BARRIER();
-
-}
-
-#else
-
-/** Lock spinlock
- *
- * Lock spinlock.
- *
- * @param sl Pointer to spinlock_t structure.
- */
-void spinlock_lock(spinlock_t *sl)
-{
-	preemption_disable();
-
-	/*
-	 * Each architecture has its own efficient/recommended
-	 * implementation of spinlock.
-	 */
-	spinlock_arch(&sl->val);
 
 	/*
@@ -144,22 +119,3 @@
 }
 
-/** Unlock spinlock
- *
- * Unlock spinlock.
- *
- * @param sl Pointer to spinlock_t structure.
- */
-void spinlock_unlock(spinlock_t *sl)
-{
-	ASSERT(atomic_get(&sl->val) != 0);
-
-	/*
-	 * Prevent critical section code from bleeding out this way down.
-	 */
-	CS_LEAVE_BARRIER();
-	
-	atomic_set(&sl->val,0);
-	preemption_enable();
-}
-
 #endif
Index: generic/src/syscall/syscall.c
===================================================================
--- generic/src/syscall/syscall.c	(revision ad64a2ddba551153ce5b45ee7d5dc1eaadecce1a)
+++ generic/src/syscall/syscall.c	(revision 53f98219259f3ae305745185632cbe185fb7c871)
@@ -63,4 +63,14 @@
 }
 
+/** Dispatch system call */
+__native syscall_handler(__native a1, __native a2, __native a3,
+			 __native a4, __native id)
+{
+	if (id < SYSCALL_END)
+		return syscall_table[id](a1,a2,a3,a4);
+	else
+		panic("Undefined syscall %d", id);
+}
+
 syshandler_t syscall_table[SYSCALL_END] = {
 	sys_io,
