Index: kernel/arch/amd64/include/atomic.h
===================================================================
--- kernel/arch/amd64/include/atomic.h	(revision 209faf93503c78d1423ac244db45224381577454)
+++ kernel/arch/amd64/include/atomic.h	(revision 228666c006a3414de772f08f77335c546dd21aab)
@@ -40,5 +40,6 @@
 #include <preemption.h>
 
-static inline void atomic_inc(atomic_t *val) {
+static inline void atomic_inc(atomic_t *val)
+{
 #ifdef CONFIG_SMP
 	asm volatile (
@@ -54,5 +55,6 @@
 }
 
-static inline void atomic_dec(atomic_t *val) {
+static inline void atomic_dec(atomic_t *val)
+{
 #ifdef CONFIG_SMP
 	asm volatile (
@@ -68,11 +70,12 @@
 }
 
-static inline long atomic_postinc(atomic_t *val) 
+static inline atomic_count_t atomic_postinc(atomic_t *val)
 {
-	long r = 1;
+	atomic_count_t r = 1;
 	
 	asm volatile (
 		"lock xaddq %[r], %[count]\n"
-		: [count] "+m" (val->count), [r] "+r" (r)
+		: [count] "+m" (val->count),
+		  [r] "+r" (r)
 	);
 	
@@ -80,11 +83,12 @@
 }
 
-static inline long atomic_postdec(atomic_t *val) 
+static inline atomic_count_t atomic_postdec(atomic_t *val)
 {
-	long r = -1;
+	atomic_count_t r = -1;
 	
 	asm volatile (
 		"lock xaddq %[r], %[count]\n"
-		: [count] "+m" (val->count), [r] "+r" (r)
+		: [count] "+m" (val->count),
+		  [r] "+r" (r)
 	);
 	
@@ -95,11 +99,13 @@
 #define atomic_predec(val)  (atomic_postdec(val) - 1)
 
-static inline uint64_t test_and_set(atomic_t *val) {
-	uint64_t v;
+static inline atomic_count_t test_and_set(atomic_t *val)
+{
+	atomic_count_t v;
 	
 	asm volatile (
 		"movq $1, %[v]\n"
 		"xchgq %[v], %[count]\n"
-		: [v] "=r" (v), [count] "+m" (val->count)
+		: [v] "=r" (v),
+		  [count] "+m" (val->count)
 	);
 	
@@ -107,9 +113,8 @@
 }
 
-
 /** amd64 specific fast spinlock */
 static inline void atomic_lock_arch(atomic_t *val)
 {
-	uint64_t tmp;
+	atomic_count_t tmp;
 	
 	preemption_disable();
@@ -125,6 +130,8 @@
 		"testq %[tmp], %[tmp]\n"
 		"jnz 0b\n"
-		: [count] "+m" (val->count), [tmp] "=&r" (tmp)
+		: [count] "+m" (val->count),
+		  [tmp] "=&r" (tmp)
 	);
+	
 	/*
 	 * Prevent critical section code from bleeding out this way up.
Index: kernel/arch/amd64/include/types.h
===================================================================
--- kernel/arch/amd64/include/types.h	(revision 209faf93503c78d1423ac244db45224381577454)
+++ kernel/arch/amd64/include/types.h	(revision 228666c006a3414de772f08f77335c546dd21aab)
@@ -55,4 +55,5 @@
 typedef uint64_t unative_t;
 typedef int64_t native_t;
+typedef uint64_t atomic_count_t;
 
 typedef struct {
