Index: arch/ia32/include/memstr.h
===================================================================
--- arch/ia32/include/memstr.h	(revision ce031f07ead21cd492a302c2b305510e36f8dfb5)
+++ arch/ia32/include/memstr.h	(revision 8e3f47b39ca2e552e1a80721744728dc6811ce38)
@@ -32,6 +32,4 @@
 extern void memsetw(__address dst, size_t cnt, __u16 x);
 extern void memsetb(__address dst, size_t cnt, __u8 x);
-
-extern int memcmp(__address src, __address dst, int cnt);
 
 /** Copy memory
@@ -72,4 +70,32 @@
 
 
+/** Compare memory
+ *
+ * Compare a given number of bytes (3rd argument)
+ * at memory locations defined by 1st and 2nd argument
+ * for equality. If memory is equal, returns 0.
+ *
+ * @param pointer 1
+ * @param pointer 2
+ * @param number of bytes
+ * @return 0 on match or non-zero if different
+ */
+static inline int memcmp(const void * mem1, const void * mem2, size_t cnt)
+{
+	__u32 d0, d1, d2;
+	int ret;
+	
+	__asm__ (
+		"repe cmpsb\n\t"
+		"je 1f\n\t"
+		"movl %3, %0\n\t"
+		"addl $1, %0\n\t"
+		"1:\n"
+		: "=a" (ret), "=%S" (d0), "=&D" (d1), "=&c" (d2)
+		: "0" (0), "1" (mem1), "2" (mem2), "3" (cnt)
+	);
+	
+	return ret;
+}
 
 #endif
Index: arch/ia32/src/asm.S
===================================================================
--- arch/ia32/src/asm.S	(revision ce031f07ead21cd492a302c2b305510e36f8dfb5)
+++ arch/ia32/src/asm.S	(revision 8e3f47b39ca2e552e1a80721744728dc6811ce38)
@@ -40,6 +40,4 @@
 .global memsetb
 .global memsetw
-.global memcmp
-
 
 ## Turn paging on
@@ -200,30 +198,4 @@
 	pop %eax
 
-	ret
-
-
-## Compare memory regions for equality
-#
-# Compare a given number of bytes (3rd argument)
-# at memory locations defined by 1st and 2nd argument
-# for equality. If the bytes are equal, EAX contains 0.
-#
-SRC=12
-DST=16
-CNT=20
-memcmp:
-	push %esi
-	push %edi
-
-	movl CNT(%esp),%ecx
-	movl DST(%esp),%edi
-	movl SRC(%esp),%esi
-
-	repe cmpsb %es:(%edi),%ds:(%esi)
-	movl %ecx,%eax		# %ecx contains the return value (zero on success)
-
-	pop %edi
-	pop %esi
-	
 	ret
 
