Deleted Added
full compact
cpufunc.h (78903) cpufunc.h (88088)
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 78903 2001-06-28 02:08:13Z bsd $
33 * $FreeBSD: head/sys/i386/include/cpufunc.h 88088 2001-12-18 00:27:18Z 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_
42
43#include <sys/cdefs.h>
34 */
35
36/*
37 * Functions to provide access to special i386 instructions.
38 */
39
40#ifndef _MACHINE_CPUFUNC_H_
41#define _MACHINE_CPUFUNC_H_
42
43#include <sys/cdefs.h>
44#include <machine/psl.h>
44
45__BEGIN_DECLS
46#define readb(va) (*(volatile u_int8_t *) (va))
47#define readw(va) (*(volatile u_int16_t *) (va))
48#define readl(va) (*(volatile u_int32_t *) (va))
49
50#define writeb(va, d) (*(volatile u_int8_t *) (va) = (d))
51#define writew(va, d) (*(volatile u_int16_t *) (va) = (d))
52#define writel(va, d) (*(volatile u_int32_t *) (va) = (d))
53
45
46__BEGIN_DECLS
47#define readb(va) (*(volatile u_int8_t *) (va))
48#define readw(va) (*(volatile u_int16_t *) (va))
49#define readl(va) (*(volatile u_int32_t *) (va))
50
51#define writeb(va, d) (*(volatile u_int8_t *) (va) = (d))
52#define writew(va, d) (*(volatile u_int16_t *) (va) = (d))
53#define writel(va, d) (*(volatile u_int32_t *) (va) = (d))
54
55#define CRITICAL_FORK (read_eflags() | PSL_I)
56
54#ifdef __GNUC__
55
56#ifdef SWTCH_OPTIM_STATS
57extern int tlb_flush_count; /* XXX */
58#endif
59
60static __inline void
61breakpoint(void)

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

543
544static __inline void
545load_dr7(u_int sel)
546{
547 __asm __volatile("movl %0,%%dr7" : : "r" (sel));
548}
549
550static __inline critical_t
57#ifdef __GNUC__
58
59#ifdef SWTCH_OPTIM_STATS
60extern int tlb_flush_count; /* XXX */
61#endif
62
63static __inline void
64breakpoint(void)

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

546
547static __inline void
548load_dr7(u_int sel)
549{
550 __asm __volatile("movl %0,%%dr7" : : "r" (sel));
551}
552
553static __inline critical_t
551critical_enter(void)
554cpu_critical_enter(void)
552{
553 critical_t eflags;
554
555 eflags = read_eflags();
556 disable_intr();
557 return (eflags);
558}
559
560static __inline void
555{
556 critical_t eflags;
557
558 eflags = read_eflags();
559 disable_intr();
560 return (eflags);
561}
562
563static __inline void
561critical_exit(critical_t eflags)
564cpu_critical_exit(critical_t eflags)
562{
563 write_eflags(eflags);
564}
565
566#else /* !__GNUC__ */
567
568int breakpoint __P((void));
569u_int bsfl __P((u_int mask));

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

592u_int read_eflags __P((void));
593void wbinvd __P((void));
594void write_eflags __P((u_int ef));
595void wrmsr __P((u_int msr, u_int64_t newval));
596u_int rfs __P((void));
597u_int rgs __P((void));
598void load_fs __P((u_int sel));
599void load_gs __P((u_int sel));
565{
566 write_eflags(eflags);
567}
568
569#else /* !__GNUC__ */
570
571int breakpoint __P((void));
572u_int bsfl __P((u_int mask));

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

595u_int read_eflags __P((void));
596void wbinvd __P((void));
597void write_eflags __P((u_int ef));
598void wrmsr __P((u_int msr, u_int64_t newval));
599u_int rfs __P((void));
600u_int rgs __P((void));
601void load_fs __P((u_int sel));
602void load_gs __P((u_int sel));
600critical_t critical_enter __P((void));
601void critical_exit __P((critical_t eflags));
603critical_t cpu_critical_enter __P((void));
604void cpu_critical_exit __P((critical_t eflags));
602
603#endif /* __GNUC__ */
604
605void load_cr0 __P((u_int cr0));
606void load_cr3 __P((u_int cr3));
607void load_cr4 __P((u_int cr4));
608void ltr __P((u_short sel));
609u_int rcr0 __P((void));
610u_int rcr3 __P((void));
611u_int rcr4 __P((void));
612void reset_dbregs __P((void));
613__END_DECLS
614
615#endif /* !_MACHINE_CPUFUNC_H_ */
605
606#endif /* __GNUC__ */
607
608void load_cr0 __P((u_int cr0));
609void load_cr3 __P((u_int cr3));
610void load_cr4 __P((u_int cr4));
611void ltr __P((u_short sel));
612u_int rcr0 __P((void));
613u_int rcr3 __P((void));
614u_int rcr4 __P((void));
615void reset_dbregs __P((void));
616__END_DECLS
617
618#endif /* !_MACHINE_CPUFUNC_H_ */