Deleted Added
full compact
cpufunc.h (69006) cpufunc.h (74897)
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/amd64/include/cpufunc.h 69006 2000-11-21 20:16:49Z markm $
33 * $FreeBSD: head/sys/amd64/include/cpufunc.h 74897 2001-03-28 02:31:54Z jhb $
34 */
35
36/*
37 * Functions to provide access to special i386 instructions.
38 */
39
40#ifndef _MACHINE_CPUFUNC_H_
41#define _MACHINE_CPUFUNC_H_

--- 43 unchanged lines hidden (view full) ---

85}
86
87static __inline void
88enable_intr(void)
89{
90 __asm __volatile("sti");
91}
92
34 */
35
36/*
37 * Functions to provide access to special i386 instructions.
38 */
39
40#ifndef _MACHINE_CPUFUNC_H_
41#define _MACHINE_CPUFUNC_H_

--- 43 unchanged lines hidden (view full) ---

85}
86
87static __inline void
88enable_intr(void)
89{
90 __asm __volatile("sti");
91}
92
93static __inline u_int
94save_intr(void)
95{
96 u_int ef;
97
98 __asm __volatile("pushfl; popl %0" : "=r" (ef));
99 return (ef);
100}
101
102static __inline void
103restore_intr(u_int ef)
104{
105 __asm __volatile("pushl %0; popfl" : : "r" (ef) : "memory" );
106}
107
108#define HAVE_INLINE_FFS
109
110static __inline int
111ffs(int mask)
112{
113 /*
114 * Note that gcc-2's builtin ffs would be used if we didn't declare
115 * this inline or turn off the builtin. The builtin is faster but

--- 374 unchanged lines hidden (view full) ---

490static __inline u_int
491rdr7(void)
492{
493 u_int data;
494 __asm __volatile("movl %%dr7,%0" : "=r" (data));
495 return (data);
496}
497
93#define HAVE_INLINE_FFS
94
95static __inline int
96ffs(int mask)
97{
98 /*
99 * Note that gcc-2's builtin ffs would be used if we didn't declare
100 * this inline or turn off the builtin. The builtin is faster but

--- 374 unchanged lines hidden (view full) ---

475static __inline u_int
476rdr7(void)
477{
478 u_int data;
479 __asm __volatile("movl %%dr7,%0" : "=r" (data));
480 return (data);
481}
482
483static __inline critical_t
484critical_enter(void)
485{
486 critical_t eflags;
487
488 eflags = read_eflags();
489 disable_intr();
490 return (eflags);
491}
492
493static __inline void
494critical_exit(critical_t eflags)
495{
496 write_eflags(eflags);
497}
498
498#else /* !__GNUC__ */
499
500int breakpoint __P((void));
501u_int bsfl __P((u_int mask));
502u_int bsrl __P((u_int mask));
503void disable_intr __P((void));
504void enable_intr __P((void));
505u_char inb __P((u_int port));

--- 18 unchanged lines hidden (view full) ---

524u_int read_eflags __P((void));
525void wbinvd __P((void));
526void write_eflags __P((u_int ef));
527void wrmsr __P((u_int msr, u_int64_t newval));
528u_int rfs __P((void));
529u_int rgs __P((void));
530void load_fs __P((u_int sel));
531void load_gs __P((u_int sel));
499#else /* !__GNUC__ */
500
501int breakpoint __P((void));
502u_int bsfl __P((u_int mask));
503u_int bsrl __P((u_int mask));
504void disable_intr __P((void));
505void enable_intr __P((void));
506u_char inb __P((u_int port));

--- 18 unchanged lines hidden (view full) ---

525u_int read_eflags __P((void));
526void wbinvd __P((void));
527void write_eflags __P((u_int ef));
528void wrmsr __P((u_int msr, u_int64_t newval));
529u_int rfs __P((void));
530u_int rgs __P((void));
531void load_fs __P((u_int sel));
532void load_gs __P((u_int sel));
533critical_t critical_enter __P((void));
534void critical_exit __P((critical_t eflags));
532
533#endif /* __GNUC__ */
534
535void load_cr0 __P((u_int cr0));
536void load_cr3 __P((u_int cr3));
537void load_cr4 __P((u_int cr4));
538void ltr __P((u_short sel));
539u_int rcr0 __P((void));
540u_int rcr3 __P((void));
541u_int rcr4 __P((void));
542void load_dr6 __P((u_int dr6));
543void reset_dbregs __P((void));
544
545#endif /* !_MACHINE_CPUFUNC_H_ */
535
536#endif /* __GNUC__ */
537
538void load_cr0 __P((u_int cr0));
539void load_cr3 __P((u_int cr3));
540void load_cr4 __P((u_int cr4));
541void ltr __P((u_short sel));
542u_int rcr0 __P((void));
543u_int rcr3 __P((void));
544u_int rcr4 __P((void));
545void load_dr6 __P((u_int dr6));
546void reset_dbregs __P((void));
547
548#endif /* !_MACHINE_CPUFUNC_H_ */