cpufunc.h (93018) | cpufunc.h (93264) |
---|---|
1/*- 2 * Copyright (c) 1993 The Regents of the University of California. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 16 unchanged lines hidden (view full) --- 25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 * | 1/*- 2 * Copyright (c) 1993 The Regents of the University of California. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 16 unchanged lines hidden (view full) --- 25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 * |
33 * $FreeBSD: head/sys/i386/include/cpufunc.h 93018 2002-03-23 15:09:35Z bde $ | 33 * $FreeBSD: head/sys/i386/include/cpufunc.h 93264 2002-03-27 05:39:23Z dillon $ |
34 */ 35 36/* 37 * Functions to provide access to special i386 instructions. 38 * This in included in sys/systm.h, and that file should be 39 * used in preference to this. 40 */ 41 42#ifndef _MACHINE_CPUFUNC_H_ 43#define _MACHINE_CPUFUNC_H_ 44 45#include <sys/cdefs.h> 46#include <machine/psl.h> 47 | 34 */ 35 36/* 37 * Functions to provide access to special i386 instructions. 38 * This in included in sys/systm.h, and that file should be 39 * used in preference to this. 40 */ 41 42#ifndef _MACHINE_CPUFUNC_H_ 43#define _MACHINE_CPUFUNC_H_ 44 45#include <sys/cdefs.h> 46#include <machine/psl.h> 47 |
48struct thread; 49 |
|
48__BEGIN_DECLS 49#define readb(va) (*(volatile u_int8_t *) (va)) 50#define readw(va) (*(volatile u_int16_t *) (va)) 51#define readl(va) (*(volatile u_int32_t *) (va)) 52 53#define writeb(va, d) (*(volatile u_int8_t *) (va) = (d)) 54#define writew(va, d) (*(volatile u_int16_t *) (va) = (d)) 55#define writel(va, d) (*(volatile u_int32_t *) (va) = (d)) 56 | 50__BEGIN_DECLS 51#define readb(va) (*(volatile u_int8_t *) (va)) 52#define readw(va) (*(volatile u_int16_t *) (va)) 53#define readl(va) (*(volatile u_int32_t *) (va)) 54 55#define writeb(va, d) (*(volatile u_int8_t *) (va) = (d)) 56#define writew(va, d) (*(volatile u_int16_t *) (va) = (d)) 57#define writel(va, d) (*(volatile u_int32_t *) (va) = (d)) 58 |
57#define CRITICAL_FORK (read_eflags() | PSL_I) 58 | |
59#ifdef __GNUC__ 60 61#ifdef SWTCH_OPTIM_STATS 62extern int tlb_flush_count; /* XXX */ 63#endif 64 65static __inline void 66breakpoint(void) --- 490 unchanged lines hidden (view full) --- 557} 558 559static __inline void 560load_dr7(u_int sel) 561{ 562 __asm __volatile("movl %0,%%dr7" : : "r" (sel)); 563} 564 | 59#ifdef __GNUC__ 60 61#ifdef SWTCH_OPTIM_STATS 62extern int tlb_flush_count; /* XXX */ 63#endif 64 65static __inline void 66breakpoint(void) --- 490 unchanged lines hidden (view full) --- 557} 558 559static __inline void 560load_dr7(u_int sel) 561{ 562 __asm __volatile("movl %0,%%dr7" : : "r" (sel)); 563} 564 |
565static __inline critical_t 566cpu_critical_enter(void) 567{ 568 critical_t eflags; 569 570 eflags = read_eflags(); 571 disable_intr(); 572 return (eflags); 573} 574 575static __inline void 576cpu_critical_exit(critical_t eflags) 577{ 578 write_eflags(eflags); 579} 580 | |
581static __inline register_t 582intr_disable(void) 583{ 584 register_t eflags; 585 586 eflags = read_eflags(); 587 disable_intr(); 588 return (eflags); --- 35 unchanged lines hidden (view full) --- 624u_int read_eflags(void); 625void wbinvd(void); 626void write_eflags(u_int ef); 627void wrmsr(u_int msr, u_int64_t newval); 628u_int rfs(void); 629u_int rgs(void); 630void load_fs(u_int sel); 631void load_gs(u_int sel); | 565static __inline register_t 566intr_disable(void) 567{ 568 register_t eflags; 569 570 eflags = read_eflags(); 571 disable_intr(); 572 return (eflags); --- 35 unchanged lines hidden (view full) --- 608u_int read_eflags(void); 609void wbinvd(void); 610void write_eflags(u_int ef); 611void wrmsr(u_int msr, u_int64_t newval); 612u_int rfs(void); 613u_int rgs(void); 614void load_fs(u_int sel); 615void load_gs(u_int sel); |
632critical_t cpu_critical_enter(void); 633void cpu_critical_exit(critical_t eflags); | |
634 635#endif /* __GNUC__ */ 636 637void load_cr0(u_int cr0); 638void load_cr3(u_int cr3); 639void load_cr4(u_int cr4); 640void ltr(u_short sel); 641u_int rcr0(void); 642u_int rcr3(void); 643u_int rcr4(void); 644void reset_dbregs(void); | 616 617#endif /* __GNUC__ */ 618 619void load_cr0(u_int cr0); 620void load_cr3(u_int cr3); 621void load_cr4(u_int cr4); 622void ltr(u_short sel); 623u_int rcr0(void); 624u_int rcr3(void); 625u_int rcr4(void); 626void reset_dbregs(void); |
627void cpu_critical_enter(void); 628void cpu_critical_exit(void); 629void cpu_critical_fork_exit(void); 630void cpu_thread_link(struct thread *td); 631 |
|
645__END_DECLS 646 647#endif /* !_MACHINE_CPUFUNC_H_ */ | 632__END_DECLS 633 634#endif /* !_MACHINE_CPUFUNC_H_ */ |