Index: kernel/arch/ia64/Makefile.inc
===================================================================
--- kernel/arch/ia64/Makefile.inc	(revision a1b9f63c506357f379bb6f1d9f633d5a740e941c)
+++ kernel/arch/ia64/Makefile.inc	(revision 7328ff41dcbe15332d62c013417ec72bbb613ee6)
@@ -58,4 +58,5 @@
 	arch/$(KARCH)/src/proc/scheduler.c \
 	arch/$(KARCH)/src/ddi/ddi.c \
+	arch/$(KARCH)/src/smc.c \
 	arch/$(KARCH)/src/smp/smp.c \
 	arch/$(KARCH)/src/smp/smp_call.c \
Index: kernel/arch/ia64/include/arch/barrier.h
===================================================================
--- kernel/arch/ia64/include/arch/barrier.h	(revision a1b9f63c506357f379bb6f1d9f633d5a740e941c)
+++ kernel/arch/ia64/include/arch/barrier.h	(revision 7328ff41dcbe15332d62c013417ec72bbb613ee6)
@@ -36,13 +36,5 @@
 #define KERN_ia64_BARRIER_H_
 
-/*
- * TODO: Implement true IA-64 memory barriers for macros below.
- */
-#define CS_ENTER_BARRIER()	memory_barrier()
-#define CS_LEAVE_BARRIER()	memory_barrier()
-
-#define memory_barrier()	asm volatile ("mf\n" ::: "memory")
-#define read_barrier()		memory_barrier()
-#define write_barrier()		memory_barrier()
+#define mf()	asm volatile ("mf\n" ::: "memory")
 
 #define srlz_i()		\
@@ -56,18 +48,4 @@
 	asm volatile (";; sync.i\n" ::: "memory")
 
-#ifdef KERNEL
-
-#define FC_INVAL_MIN		32
-#define smc_coherence(a, l)		\
-{						\
-	unsigned long i;			\
-	for (i = 0; i < (l); i += FC_INVAL_MIN)	\
-		fc_i((void *)(a) + i);		\
-	sync_i();				\
-	srlz_i();				\
-}
-
-#endif	/* KERNEL */
-
 #endif
 
Index: kernel/arch/ia64/include/arch/cpu.h
===================================================================
--- kernel/arch/ia64/include/arch/cpu.h	(revision a1b9f63c506357f379bb6f1d9f633d5a740e941c)
+++ kernel/arch/ia64/include/arch/cpu.h	(revision 7328ff41dcbe15332d62c013417ec72bbb613ee6)
@@ -38,4 +38,5 @@
 #include <arch/register.h>
 #include <arch/asm.h>
+#include <arch/barrier.h>
 #include <arch/bootinfo.h>
 #include <stdint.h>
Index: kernel/arch/ia64/src/mm/vhpt.c
===================================================================
--- kernel/arch/ia64/src/mm/vhpt.c	(revision a1b9f63c506357f379bb6f1d9f633d5a740e941c)
+++ kernel/arch/ia64/src/mm/vhpt.c	(revision 7328ff41dcbe15332d62c013417ec72bbb613ee6)
@@ -34,4 +34,5 @@
 
 #include <mem.h>
+#include <arch/barrier.h>
 #include <arch/mm/vhpt.h>
 #include <mm/frame.h>
Index: kernel/arch/ia64/src/smc.c
===================================================================
--- kernel/arch/ia64/src/smc.c	(revision 7328ff41dcbe15332d62c013417ec72bbb613ee6)
+++ kernel/arch/ia64/src/smc.c	(revision 7328ff41dcbe15332d62c013417ec72bbb613ee6)
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2005 Jakub Jermar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <barrier.h>
+#include <arch/barrier.h>
+
+#define FC_INVAL_MIN		32
+
+void smc_coherence(void *a, size_t l)
+{
+	unsigned long i;
+	for (i = 0; i < (l); i += FC_INVAL_MIN)
+		fc_i(a + i);
+	sync_i();
+	srlz_i();
+}
+
