This commit was manufactured by cvs2svn to create tag 'FreeBSD-release/1.0'.
[unix-history] / sys / i386 / include / cpufunc.h
index e3b4a8c..db5cf95 100644 (file)
@@ -1,6 +1,8 @@
 /*
  * Functions to provide access to special i386 instructions.
  * XXX - bezillions more are defined in locore.s but are not declared anywhere.
 /*
  * Functions to provide access to special i386 instructions.
  * XXX - bezillions more are defined in locore.s but are not declared anywhere.
+ *
+ *     $Id$
  */
 
 #include <sys/cdefs.h>
  */
 
 #include <sys/cdefs.h>
@@ -58,6 +60,116 @@ outb(u_int port, u_char data)
        __asm __volatile("outb %0,%%dx" : : "a" (al), "d" (port));
 }
 
        __asm __volatile("outb %0,%%dx" : : "a" (al), "d" (port));
 }
 
+static __inline__
+imin(a, b)
+       int a, b;
+{
+
+       return (a < b ? a : b);
+}
+
+static __inline__
+imax(a, b)
+       int a, b;
+{
+
+       return (a > b ? a : b);
+}
+
+static __inline__
+unsigned int
+min(a, b)
+       unsigned int a, b;
+{
+
+       return (a < b ? a : b);
+}
+
+static __inline__
+unsigned int
+max(a, b)
+       unsigned int a, b;
+{
+
+       return (a > b ? a : b);
+}
+
+static __inline__
+long
+lmin(a, b)
+       long a, b;
+{
+
+       return (a < b ? a : b);
+}
+
+static __inline__
+long
+lmax(a, b)
+       long a, b;
+{
+
+       return (a > b ? a : b);
+}
+
+static __inline__
+unsigned long
+ulmin(a, b)
+       unsigned long a, b;
+{
+
+       return (a < b ? a : b);
+}
+
+static __inline__
+unsigned long
+ulmax(a, b)
+       unsigned long a, b;
+{
+
+       return (a > b ? a : b);
+}
+
+static __inline__
+ffs(mask)
+       register long mask;
+{
+       register int bit;
+
+       if (!mask)
+               return(0);
+       for (bit = 1;; ++bit) {
+               if (mask&0x01)
+                       return(bit);
+               mask >>= 1;
+       }
+}
+
+static __inline__
+bcmp(v1, v2, len)
+       void *v1, *v2;
+       register unsigned len;
+{
+       register u_char *s1 = v1, *s2 = v2;
+
+       while (len--)
+               if (*s1++ != *s2++)
+                       return (1);
+       return (0);
+}
+
+static __inline__
+size_t
+strlen(s1)
+       register __const__ char *s1;
+{
+       register size_t len;
+
+       for (len = 0; *s1++ != '\0'; len++)
+               ;
+       return (len);
+}
+
 #else /* not __GNUC__ */
 
 int    bdb             __P((void));
 #else /* not __GNUC__ */
 
 int    bdb             __P((void));
@@ -80,3 +192,4 @@ really_void  setidt  __P((int idx, /*XXX*/caddr_t func, int typ, int dpl));
 
 #undef really_u_int
 #undef really_void
 
 #undef really_u_int
 #undef really_void
+