cpufunc.h (1321) | cpufunc.h (1549) |
---|---|
1/* 2 * Functions to provide access to special i386 instructions. 3 * XXX - bezillions more are defined in locore.s but are not declared anywhere. 4 * 5 * $Id: cpufunc.h,v 1.9 1994/01/31 23:48:23 davidg Exp $ 6 */ 7 8#ifndef _MACHINE_CPUFUNC_H_ --- 57 unchanged lines hidden (view full) --- 66} 67 68static inline void 69tlbflush() 70{ 71 __asm __volatile("movl %%cr3, %%eax; movl %%eax, %%cr3" : : : "ax"); 72} 73 | 1/* 2 * Functions to provide access to special i386 instructions. 3 * XXX - bezillions more are defined in locore.s but are not declared anywhere. 4 * 5 * $Id: cpufunc.h,v 1.9 1994/01/31 23:48:23 davidg Exp $ 6 */ 7 8#ifndef _MACHINE_CPUFUNC_H_ --- 57 unchanged lines hidden (view full) --- 66} 67 68static inline void 69tlbflush() 70{ 71 __asm __volatile("movl %%cr3, %%eax; movl %%eax, %%cr3" : : : "ax"); 72} 73 |
74static inline 75int 76imin(a, b) 77 int a, b; 78{ 79 80 return (a < b ? a : b); 81} 82 83static inline 84int 85imax(a, b) 86 int a, b; 87{ 88 89 return (a > b ? a : b); 90} 91 92static inline 93unsigned int 94min(a, b) 95 unsigned int a, b; 96{ 97 98 return (a < b ? a : b); 99} 100 101static inline 102unsigned int 103max(a, b) 104 unsigned int a, b; 105{ 106 107 return (a > b ? a : b); 108} 109 110static inline 111long 112lmin(a, b) 113 long a, b; 114{ 115 116 return (a < b ? a : b); 117} 118 119static inline 120long 121lmax(a, b) 122 long a, b; 123{ 124 125 return (a > b ? a : b); 126} 127 128static inline 129unsigned long 130ulmin(a, b) 131 unsigned long a, b; 132{ 133 134 return (a < b ? a : b); 135} 136 137static inline 138unsigned long 139ulmax(a, b) 140 unsigned long a, b; 141{ 142 143 return (a > b ? a : b); 144} 145 146static inline 147int 148ffs(mask) 149 register long mask; 150{ 151 register int bit; 152 153 if (!mask) 154 return(0); 155 for (bit = 1;; ++bit) { 156 if (mask&0x01) 157 return(bit); 158 mask >>= 1; 159 } 160} 161 162static inline 163int 164bcmp(v1, v2, len) 165 void *v1, *v2; 166 register unsigned len; 167{ 168 register u_char *s1 = v1, *s2 = v2; 169 170 while (len--) 171 if (*s1++ != *s2++) 172 return (1); 173 return (0); 174} 175 176static inline 177size_t 178strlen(s1) 179 register const char *s1; 180{ 181 register size_t len; 182 183 for (len = 0; *s1++ != '\0'; len++) 184 ; 185 return (len); 186} 187 188struct quehead { 189 struct quehead *qh_link; 190 struct quehead *qh_rlink; 191}; 192 193static inline void 194insque(void *a, void *b) 195{ 196 register struct quehead *element = a, *head = b; 197 element->qh_link = head->qh_link; 198 head->qh_link = (struct quehead *)element; 199 element->qh_rlink = (struct quehead *)head; 200 ((struct quehead *)(element->qh_link))->qh_rlink 201 = (struct quehead *)element; 202} 203 204static inline void 205remque(void *a) 206{ 207 register struct quehead *element = a; 208 ((struct quehead *)(element->qh_link))->qh_rlink = element->qh_rlink; 209 ((struct quehead *)(element->qh_rlink))->qh_link = element->qh_link; 210 element->qh_rlink = 0; 211} 212 | |
213#else /* not __GNUC__ */ 214extern void insque __P((void *, void *)); 215extern void remque __P((void *)); 216 217int bdb __P((void)); 218void disable_intr __P((void)); 219void enable_intr __P((void)); 220u_char inb __P((u_int port)); --- 20 unchanged lines hidden --- | 74#else /* not __GNUC__ */ 75extern void insque __P((void *, void *)); 76extern void remque __P((void *)); 77 78int bdb __P((void)); 79void disable_intr __P((void)); 80void enable_intr __P((void)); 81u_char inb __P((u_int port)); --- 20 unchanged lines hidden --- |