]> git.saurik.com Git - apple/xnu.git/blobdiff - osfmk/i386/loose_ends.c
xnu-201.tar.gz
[apple/xnu.git] / osfmk / i386 / loose_ends.c
index 305bc37ea0ad5503d44019dc868005d5a2dd4134..abf2750bec38d158547404513626334728235d47 100644 (file)
@@ -54,6 +54,7 @@
 #include <string.h>
 #include <mach/boolean.h>
 #include <mach/i386/vm_types.h>
+#include <mach/i386/vm_param.h>
 #include <kern/kern_types.h>
 #include <kern/misc_protos.h>
 #include <i386/misc_protos.h>
        /*
         * Should be rewritten in asm anyway.
         */
+
+/*
+ * bcopy_phys - like bcopy but copies from/to physical addresses.
+ *              this is trivial since all phys mem is mapped into 
+ *              kernel virtual space
+ */
+
+void
+bcopy_phys(const char *from, char *to, vm_size_t bytes)
+{
+  bcopy((char *)phystokv(from), (char *)phystokv(to), bytes);
+}
+
+
 /* 
  * ovbcopy - like bcopy, but recognizes overlapping ranges and handles 
  *           them correctly.
@@ -111,6 +126,34 @@ int bcmp(
        return len;
 }
 
+int
+memcmp(s1, s2, n)
+       register char *s1, *s2;
+       register n;
+{
+       while (--n >= 0)
+               if (*s1++ != *s2++)
+                       return (*--s1 - *--s2);
+       return (0);
+}
+
+/*
+ * Abstract:
+ * strlen returns the number of characters in "string" preceeding
+ * the terminating null character.
+ */
+
+size_t
+strlen(
+       register const char *string)
+{
+       register const char *ret = string;
+
+       while (*string++ != '\0')
+               continue;
+       return string - 1 - ret;
+}
+
 #if    MACH_ASSERT
 
 /*