13c4dd356SDavid Greenman /*- 23c4dd356SDavid Greenman * Copyright (c) 1993 The Regents of the University of California. 33c4dd356SDavid Greenman * All rights reserved. 43c4dd356SDavid Greenman * 53c4dd356SDavid Greenman * Redistribution and use in source and binary forms, with or without 63c4dd356SDavid Greenman * modification, are permitted provided that the following conditions 73c4dd356SDavid Greenman * are met: 83c4dd356SDavid Greenman * 1. Redistributions of source code must retain the above copyright 93c4dd356SDavid Greenman * notice, this list of conditions and the following disclaimer. 103c4dd356SDavid Greenman * 2. Redistributions in binary form must reproduce the above copyright 113c4dd356SDavid Greenman * notice, this list of conditions and the following disclaimer in the 123c4dd356SDavid Greenman * documentation and/or other materials provided with the distribution. 133c4dd356SDavid Greenman * 3. All advertising materials mentioning features or use of this software 143c4dd356SDavid Greenman * must display the following acknowledgement: 153c4dd356SDavid Greenman * This product includes software developed by the University of 163c4dd356SDavid Greenman * California, Berkeley and its contributors. 173c4dd356SDavid Greenman * 4. Neither the name of the University nor the names of its contributors 183c4dd356SDavid Greenman * may be used to endorse or promote products derived from this software 193c4dd356SDavid Greenman * without specific prior written permission. 203c4dd356SDavid Greenman * 213c4dd356SDavid Greenman * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 223c4dd356SDavid Greenman * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 233c4dd356SDavid Greenman * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 243c4dd356SDavid Greenman * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 253c4dd356SDavid Greenman * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 263c4dd356SDavid Greenman * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 273c4dd356SDavid Greenman * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 283c4dd356SDavid Greenman * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 293c4dd356SDavid Greenman * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 303c4dd356SDavid Greenman * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 313c4dd356SDavid Greenman * SUCH DAMAGE. 323c4dd356SDavid Greenman * 3320233f27SSteve Passe * $Id: cpufunc.h,v 1.3 1997/09/05 20:20:31 smp Exp smp $ 343c4dd356SDavid Greenman */ 353c4dd356SDavid Greenman 365b81b6b3SRodney W. Grimes /* 375b81b6b3SRodney W. Grimes * Functions to provide access to special i386 instructions. 385b81b6b3SRodney W. Grimes */ 395b81b6b3SRodney W. Grimes 406e393973SGarrett Wollman #ifndef _MACHINE_CPUFUNC_H_ 41004bedebSBruce Evans #define _MACHINE_CPUFUNC_H_ 426e393973SGarrett Wollman 435b81b6b3SRodney W. Grimes #include <sys/cdefs.h> 445b81b6b3SRodney W. Grimes #include <sys/types.h> 455b81b6b3SRodney W. Grimes 4678292efeSSteve Passe #include <machine/lock.h> 4778292efeSSteve Passe 4878292efeSSteve Passe 495b81b6b3SRodney W. Grimes #ifdef __GNUC__ 505b81b6b3SRodney W. Grimes 515dbd168eSBruce Evans static __inline void 525dbd168eSBruce Evans breakpoint(void) 53004bedebSBruce Evans { 54004bedebSBruce Evans __asm __volatile("int $3"); 555b81b6b3SRodney W. Grimes } 565b81b6b3SRodney W. Grimes 57004bedebSBruce Evans static __inline void 585b81b6b3SRodney W. Grimes disable_intr(void) 595b81b6b3SRodney W. Grimes { 608966b85cSJohn Dyson __asm __volatile("cli" : : : "memory"); 6120233f27SSteve Passe MPINTR_LOCK(); 625b81b6b3SRodney W. Grimes } 635b81b6b3SRodney W. Grimes 64004bedebSBruce Evans static __inline void 655b81b6b3SRodney W. Grimes enable_intr(void) 665b81b6b3SRodney W. Grimes { 6720233f27SSteve Passe MPINTR_UNLOCK(); 68fadc51bdSBruce Evans __asm __volatile("sti"); 695b81b6b3SRodney W. Grimes } 705b81b6b3SRodney W. Grimes 71004bedebSBruce Evans #define HAVE_INLINE_FFS 72004bedebSBruce Evans 73004bedebSBruce Evans static __inline int 74004bedebSBruce Evans ffs(int mask) 75004bedebSBruce Evans { 76004bedebSBruce Evans int result; 77004bedebSBruce Evans /* 78004bedebSBruce Evans * bsfl turns out to be not all that slow on 486's. It can beaten 79004bedebSBruce Evans * using a binary search to reduce to 4 bits and then a table lookup, 80004bedebSBruce Evans * but only if the code is inlined and in the cache, and the code 81004bedebSBruce Evans * is quite large so inlining it probably busts the cache. 82004bedebSBruce Evans * 83004bedebSBruce Evans * Note that gcc-2's builtin ffs would be used if we didn't declare 84004bedebSBruce Evans * this inline or turn off the builtin. The builtin is faster but 85004bedebSBruce Evans * broken in gcc-2.4.5 and slower but working in gcc-2.5 and 2.6. 86004bedebSBruce Evans */ 87004bedebSBruce Evans __asm __volatile("testl %0,%0; je 1f; bsfl %0,%0; incl %0; 1:" 88004bedebSBruce Evans : "=r" (result) : "0" (mask)); 89004bedebSBruce Evans return (result); 90004bedebSBruce Evans } 91004bedebSBruce Evans 9213f588f8SGarrett Wollman #define HAVE_INLINE_FLS 9313f588f8SGarrett Wollman 9413f588f8SGarrett Wollman static __inline int 9513f588f8SGarrett Wollman fls(int mask) 9613f588f8SGarrett Wollman { 9713f588f8SGarrett Wollman int result; 9813f588f8SGarrett Wollman __asm __volatile("testl %0,%0; je 1f; bsrl %0,%0; incl %0; 1:" 9913f588f8SGarrett Wollman : "=r" (result) : "0" (mask)); 10013f588f8SGarrett Wollman return (result); 10113f588f8SGarrett Wollman } 10213f588f8SGarrett Wollman 103004bedebSBruce Evans #if __GNUC__ < 2 104004bedebSBruce Evans 105004bedebSBruce Evans #define inb(port) inbv(port) 106004bedebSBruce Evans #define outb(port, data) outbv(port, data) 107004bedebSBruce Evans 108004bedebSBruce Evans #else /* __GNUC >= 2 */ 109004bedebSBruce Evans 110004bedebSBruce Evans /* 1118089a043SBruce Evans * The following complications are to get around gcc not having a 1128089a043SBruce Evans * constraint letter for the range 0..255. We still put "d" in the 1138089a043SBruce Evans * constraint because "i" isn't a valid constraint when the port 1148089a043SBruce Evans * isn't constant. This only matters for -O0 because otherwise 1158089a043SBruce Evans * the non-working version gets optimized away. 1168089a043SBruce Evans * 117004bedebSBruce Evans * Use an expression-statement instead of a conditional expression 118004bedebSBruce Evans * because gcc-2.6.0 would promote the operands of the conditional 119004bedebSBruce Evans * and produce poor code for "if ((inb(var) & const1) == const2)". 120388dfa71SBruce Evans * 121388dfa71SBruce Evans * The unnecessary test `(port) < 0x10000' is to generate a warning if 122388dfa71SBruce Evans * the `port' has type u_short or smaller. Such types are pessimal. 123388dfa71SBruce Evans * This actually only works for signed types. The range check is 124388dfa71SBruce Evans * careful to avoid generating warnings. 125004bedebSBruce Evans */ 126388dfa71SBruce Evans #define inb(port) __extension__ ({ \ 127004bedebSBruce Evans u_char _data; \ 128388dfa71SBruce Evans if (__builtin_constant_p(port) && ((port) & 0xffff) < 0x100 \ 129388dfa71SBruce Evans && (port) < 0x10000) \ 130004bedebSBruce Evans _data = inbc(port); \ 131004bedebSBruce Evans else \ 132004bedebSBruce Evans _data = inbv(port); \ 133004bedebSBruce Evans _data; }) 134004bedebSBruce Evans 135388dfa71SBruce Evans #define outb(port, data) ( \ 136388dfa71SBruce Evans __builtin_constant_p(port) && ((port) & 0xffff) < 0x100 \ 137388dfa71SBruce Evans && (port) < 0x10000 \ 138004bedebSBruce Evans ? outbc(port, data) : outbv(port, data)) 139004bedebSBruce Evans 140004bedebSBruce Evans static __inline u_char 141004bedebSBruce Evans inbc(u_int port) 142004bedebSBruce Evans { 143004bedebSBruce Evans u_char data; 144004bedebSBruce Evans 1458089a043SBruce Evans __asm __volatile("inb %1,%0" : "=a" (data) : "id" ((u_short)(port))); 146004bedebSBruce Evans return (data); 147004bedebSBruce Evans } 148004bedebSBruce Evans 149004bedebSBruce Evans static __inline void 150004bedebSBruce Evans outbc(u_int port, u_char data) 151004bedebSBruce Evans { 1528089a043SBruce Evans __asm __volatile("outb %0,%1" : : "a" (data), "id" ((u_short)(port))); 153004bedebSBruce Evans } 154004bedebSBruce Evans 155004bedebSBruce Evans #endif /* __GNUC <= 2 */ 156004bedebSBruce Evans 157004bedebSBruce Evans static __inline u_char 158004bedebSBruce Evans inbv(u_int port) 159004bedebSBruce Evans { 160004bedebSBruce Evans u_char data; 161004bedebSBruce Evans /* 162004bedebSBruce Evans * We use %%dx and not %1 here because i/o is done at %dx and not at 163004bedebSBruce Evans * %edx, while gcc generates inferior code (movw instead of movl) 164004bedebSBruce Evans * if we tell it to load (u_short) port. 165004bedebSBruce Evans */ 166004bedebSBruce Evans __asm __volatile("inb %%dx,%0" : "=a" (data) : "d" (port)); 167004bedebSBruce Evans return (data); 168004bedebSBruce Evans } 169004bedebSBruce Evans 170004bedebSBruce Evans static __inline u_long 171004bedebSBruce Evans inl(u_int port) 172004bedebSBruce Evans { 173004bedebSBruce Evans u_long data; 174004bedebSBruce Evans 175004bedebSBruce Evans __asm __volatile("inl %%dx,%0" : "=a" (data) : "d" (port)); 176004bedebSBruce Evans return (data); 177004bedebSBruce Evans } 178004bedebSBruce Evans 179004bedebSBruce Evans static __inline void 180004bedebSBruce Evans insb(u_int port, void *addr, size_t cnt) 181004bedebSBruce Evans { 182004bedebSBruce Evans __asm __volatile("cld; rep; insb" 183004bedebSBruce Evans : : "d" (port), "D" (addr), "c" (cnt) 184004bedebSBruce Evans : "di", "cx", "memory"); 185004bedebSBruce Evans } 186004bedebSBruce Evans 187004bedebSBruce Evans static __inline void 188004bedebSBruce Evans insw(u_int port, void *addr, size_t cnt) 189004bedebSBruce Evans { 190004bedebSBruce Evans __asm __volatile("cld; rep; insw" 191004bedebSBruce Evans : : "d" (port), "D" (addr), "c" (cnt) 192004bedebSBruce Evans : "di", "cx", "memory"); 193004bedebSBruce Evans } 194004bedebSBruce Evans 195004bedebSBruce Evans static __inline void 196004bedebSBruce Evans insl(u_int port, void *addr, size_t cnt) 197004bedebSBruce Evans { 198004bedebSBruce Evans __asm __volatile("cld; rep; insl" 199004bedebSBruce Evans : : "d" (port), "D" (addr), "c" (cnt) 200004bedebSBruce Evans : "di", "cx", "memory"); 201004bedebSBruce Evans } 202004bedebSBruce Evans 203ece15d78SBruce Evans static __inline void 2044c024bbdSKATO Takenori invd(void) 2054c024bbdSKATO Takenori { 2064c024bbdSKATO Takenori __asm __volatile("invd"); 2074c024bbdSKATO Takenori } 2084c024bbdSKATO Takenori 2092c5d02ffSSteve Passe #ifdef KERNEL 2102c5d02ffSSteve Passe #ifdef SMP 211477a642cSPeter Wemm 212477a642cSPeter Wemm /* 213f40e6078SPeter Wemm * When using APIC IPI's, the inlining cost is prohibitive since the call 214f40e6078SPeter Wemm * executes into the IPI transmission system. 215477a642cSPeter Wemm */ 216477a642cSPeter Wemm void invlpg __P((u_int addr)); 217477a642cSPeter Wemm void invltlb __P((void)); 218477a642cSPeter Wemm 2192c5d02ffSSteve Passe #else /* !SMP */ 220477a642cSPeter Wemm 2214c024bbdSKATO Takenori static __inline void 222ece15d78SBruce Evans invlpg(u_int addr) 223ece15d78SBruce Evans { 224ece15d78SBruce Evans __asm __volatile("invlpg (%0)" : : "r" (addr) : "memory"); 225ece15d78SBruce Evans } 226ece15d78SBruce Evans 227ece15d78SBruce Evans static __inline void 228ece15d78SBruce Evans invltlb(void) 229ece15d78SBruce Evans { 230ece15d78SBruce Evans u_long temp; 231ece15d78SBruce Evans /* 232ece15d78SBruce Evans * This should be implemented as load_cr3(rcr3()) when load_cr3() 233ece15d78SBruce Evans * is inlined. 234ece15d78SBruce Evans */ 235ece15d78SBruce Evans __asm __volatile("movl %%cr3, %0; movl %0, %%cr3" : "=r" (temp) 236ece15d78SBruce Evans : : "memory"); 237ece15d78SBruce Evans } 2382c5d02ffSSteve Passe 2392c5d02ffSSteve Passe #endif /* SMP */ 2402c5d02ffSSteve Passe #endif /* KERNEL */ 241ece15d78SBruce Evans 242004bedebSBruce Evans static __inline u_short 243004bedebSBruce Evans inw(u_int port) 244004bedebSBruce Evans { 245004bedebSBruce Evans u_short data; 246004bedebSBruce Evans 247004bedebSBruce Evans __asm __volatile("inw %%dx,%0" : "=a" (data) : "d" (port)); 248004bedebSBruce Evans return (data); 249004bedebSBruce Evans } 250004bedebSBruce Evans 2515dbd168eSBruce Evans static __inline u_int 2520ee893ebSBruce Evans loadandclear(u_int *addr) 2530ee893ebSBruce Evans { 2540ee893ebSBruce Evans u_int result; 2550ee893ebSBruce Evans 2560ee893ebSBruce Evans __asm __volatile("xorl %0,%0; xchgl %1,%0" 25730fd0561SDavid Greenman : "=&r" (result) : "m" (*addr)); 2580ee893ebSBruce Evans return (result); 2590ee893ebSBruce Evans } 2600ee893ebSBruce Evans 261004bedebSBruce Evans static __inline void 262004bedebSBruce Evans outbv(u_int port, u_char data) 263004bedebSBruce Evans { 264004bedebSBruce Evans u_char al; 265004bedebSBruce Evans /* 266004bedebSBruce Evans * Use an unnecessary assignment to help gcc's register allocator. 267004bedebSBruce Evans * This make a large difference for gcc-1.40 and a tiny difference 268004bedebSBruce Evans * for gcc-2.6.0. For gcc-1.40, al had to be ``asm("ax")'' for 269004bedebSBruce Evans * best results. gcc-2.6.0 can't handle this. 270004bedebSBruce Evans */ 271004bedebSBruce Evans al = data; 272004bedebSBruce Evans __asm __volatile("outb %0,%%dx" : : "a" (al), "d" (port)); 273004bedebSBruce Evans } 274004bedebSBruce Evans 275004bedebSBruce Evans static __inline void 276004bedebSBruce Evans outl(u_int port, u_long data) 277004bedebSBruce Evans { 278004bedebSBruce Evans /* 279004bedebSBruce Evans * outl() and outw() aren't used much so we haven't looked at 280004bedebSBruce Evans * possible micro-optimizations such as the unnecessary 281004bedebSBruce Evans * assignment for them. 282004bedebSBruce Evans */ 283004bedebSBruce Evans __asm __volatile("outl %0,%%dx" : : "a" (data), "d" (port)); 284004bedebSBruce Evans } 285004bedebSBruce Evans 286004bedebSBruce Evans static __inline void 287004bedebSBruce Evans outsb(u_int port, void *addr, size_t cnt) 288004bedebSBruce Evans { 289004bedebSBruce Evans __asm __volatile("cld; rep; outsb" 290004bedebSBruce Evans : : "d" (port), "S" (addr), "c" (cnt) 291b5ba45f6SDavid Greenman : "si", "cx"); 292004bedebSBruce Evans } 293004bedebSBruce Evans 294004bedebSBruce Evans static __inline void 295004bedebSBruce Evans outsw(u_int port, void *addr, size_t cnt) 296004bedebSBruce Evans { 297004bedebSBruce Evans __asm __volatile("cld; rep; outsw" 298004bedebSBruce Evans : : "d" (port), "S" (addr), "c" (cnt) 299b5ba45f6SDavid Greenman : "si", "cx"); 300004bedebSBruce Evans } 301004bedebSBruce Evans 302004bedebSBruce Evans static __inline void 303004bedebSBruce Evans outsl(u_int port, void *addr, size_t cnt) 304004bedebSBruce Evans { 305004bedebSBruce Evans __asm __volatile("cld; rep; outsl" 306004bedebSBruce Evans : : "d" (port), "S" (addr), "c" (cnt) 307b5ba45f6SDavid Greenman : "si", "cx"); 308004bedebSBruce Evans } 309004bedebSBruce Evans 310004bedebSBruce Evans static __inline void 311004bedebSBruce Evans outw(u_int port, u_short data) 312004bedebSBruce Evans { 313004bedebSBruce Evans __asm __volatile("outw %0,%%dx" : : "a" (data), "d" (port)); 314004bedebSBruce Evans } 315004bedebSBruce Evans 316004bedebSBruce Evans static __inline u_long 317004bedebSBruce Evans rcr2(void) 318004bedebSBruce Evans { 319004bedebSBruce Evans u_long data; 320004bedebSBruce Evans 321004bedebSBruce Evans __asm __volatile("movl %%cr2,%0" : "=r" (data)); 322004bedebSBruce Evans return (data); 323004bedebSBruce Evans } 324004bedebSBruce Evans 325004bedebSBruce Evans static __inline u_long 326004bedebSBruce Evans read_eflags(void) 3275b81b6b3SRodney W. Grimes { 3288db02de8SPaul Richards u_long ef; 329004bedebSBruce Evans 330004bedebSBruce Evans __asm __volatile("pushfl; popl %0" : "=r" (ef)); 3318db02de8SPaul Richards return (ef); 3325b81b6b3SRodney W. Grimes } 3335b81b6b3SRodney W. Grimes 3345dbd168eSBruce Evans static __inline quad_t 3355dbd168eSBruce Evans rdmsr(u_int msr) 3365dbd168eSBruce Evans { 3375dbd168eSBruce Evans quad_t rv; 3385dbd168eSBruce Evans 3395dbd168eSBruce Evans __asm __volatile(".byte 0x0f, 0x32" : "=A" (rv) : "c" (msr)); 3405dbd168eSBruce Evans return (rv); 3415dbd168eSBruce Evans } 3425dbd168eSBruce Evans 3435dbd168eSBruce Evans static __inline quad_t 3445dbd168eSBruce Evans rdpmc(u_int pmc) 3455dbd168eSBruce Evans { 3465dbd168eSBruce Evans quad_t rv; 3475dbd168eSBruce Evans 3485dbd168eSBruce Evans __asm __volatile(".byte 0x0f, 0x33" : "=A" (rv) : "c" (pmc)); 3495dbd168eSBruce Evans return (rv); 3505dbd168eSBruce Evans } 3515dbd168eSBruce Evans 3525dbd168eSBruce Evans static __inline quad_t 3535dbd168eSBruce Evans rdtsc(void) 3545dbd168eSBruce Evans { 3555dbd168eSBruce Evans quad_t rv; 3565dbd168eSBruce Evans 3575dbd168eSBruce Evans __asm __volatile(".byte 0x0f, 0x31" : "=A" (rv)); 3585dbd168eSBruce Evans return (rv); 3595dbd168eSBruce Evans } 3605dbd168eSBruce Evans 361004bedebSBruce Evans static __inline void 3627baccf64SBruce Evans setbits(volatile unsigned *addr, u_int bits) 3637baccf64SBruce Evans { 364713da3edSJohn Polstra __asm __volatile( 365713da3edSJohn Polstra #ifdef SMP 366713da3edSJohn Polstra "lock; " 367713da3edSJohn Polstra #endif 368713da3edSJohn Polstra "orl %1,%0" : "=m" (*addr) : "ir" (bits)); 3697baccf64SBruce Evans } 3707baccf64SBruce Evans 3717baccf64SBruce Evans static __inline void 3724c024bbdSKATO Takenori wbinvd(void) 3734c024bbdSKATO Takenori { 3744c024bbdSKATO Takenori __asm __volatile("wbinvd"); 3754c024bbdSKATO Takenori } 3764c024bbdSKATO Takenori 3774c024bbdSKATO Takenori static __inline void 3788db02de8SPaul Richards write_eflags(u_long ef) 3795b81b6b3SRodney W. Grimes { 380004bedebSBruce Evans __asm __volatile("pushl %0; popfl" : : "r" (ef)); 3815b81b6b3SRodney W. Grimes } 3825b81b6b3SRodney W. Grimes 383d69e8502SGarrett Wollman static __inline void 3845dbd168eSBruce Evans wrmsr(u_int msr, quad_t newval) 385d69e8502SGarrett Wollman { 38628dc3d27SGarrett Wollman __asm __volatile(".byte 0x0f, 0x30" : : "A" (newval), "c" (msr)); 387d69e8502SGarrett Wollman } 388d69e8502SGarrett Wollman 389004bedebSBruce Evans #else /* !__GNUC__ */ 3905b81b6b3SRodney W. Grimes 3915dbd168eSBruce Evans int breakpoint __P((void)); 3925b81b6b3SRodney W. Grimes void disable_intr __P((void)); 3935b81b6b3SRodney W. Grimes void enable_intr __P((void)); 3945b81b6b3SRodney W. Grimes u_char inb __P((u_int port)); 395004bedebSBruce Evans u_long inl __P((u_int port)); 396004bedebSBruce Evans void insb __P((u_int port, void *addr, size_t cnt)); 397004bedebSBruce Evans void insl __P((u_int port, void *addr, size_t cnt)); 398004bedebSBruce Evans void insw __P((u_int port, void *addr, size_t cnt)); 3994c024bbdSKATO Takenori void invd __P((void)); 400ece15d78SBruce Evans void invlpg __P((u_int addr)); 401ece15d78SBruce Evans void invltlb __P((void)); 402004bedebSBruce Evans u_short inw __P((u_int port)); 4030ee893ebSBruce Evans u_int loadandclear __P((u_int *addr)); 404004bedebSBruce Evans void outb __P((u_int port, u_char data)); 405004bedebSBruce Evans void outl __P((u_int port, u_long data)); 406004bedebSBruce Evans void outsb __P((u_int port, void *addr, size_t cnt)); 407004bedebSBruce Evans void outsl __P((u_int port, void *addr, size_t cnt)); 408004bedebSBruce Evans void outsw __P((u_int port, void *addr, size_t cnt)); 409004bedebSBruce Evans void outw __P((u_int port, u_short data)); 410004bedebSBruce Evans u_long rcr2 __P((void)); 4115dbd168eSBruce Evans quad_t rdmsr __P((u_int msr)); 4125dbd168eSBruce Evans quad_t rdpmc __P((u_int pmc)); 413d69e8502SGarrett Wollman quad_t rdtsc __P((void)); 4145dbd168eSBruce Evans u_long read_eflags __P((void)); 4157baccf64SBruce Evans void setbits __P((volatile unsigned *addr, u_int bits)); 4164c024bbdSKATO Takenori void wbinvd __P((void)); 4175dbd168eSBruce Evans void write_eflags __P((u_long ef)); 4185dbd168eSBruce Evans void wrmsr __P((u_int msr, quad_t newval)); 419004bedebSBruce Evans 4205b81b6b3SRodney W. Grimes #endif /* __GNUC__ */ 4215b81b6b3SRodney W. Grimes 422004bedebSBruce Evans void load_cr0 __P((u_long cr0)); 423004bedebSBruce Evans void load_cr3 __P((u_long cr3)); 4240a0a85b3SJohn Dyson void load_cr4 __P((u_long cr4)); 425004bedebSBruce Evans void ltr __P((u_short sel)); 426aaf08d94SGarrett Wollman u_int rcr0 __P((void)); 427004bedebSBruce Evans u_long rcr3 __P((void)); 4280a0a85b3SJohn Dyson u_long rcr4 __P((void)); 4295b81b6b3SRodney W. Grimes 430004bedebSBruce Evans #endif /* !_MACHINE_CPUFUNC_H_ */ 431