diff options
author | jhb <jhb@FreeBSD.org> | 2001-03-28 02:31:54 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2001-03-28 02:31:54 +0000 |
commit | 3e4166569d016eb336a76bfb079024dbfe30b695 (patch) | |
tree | 3c573685f1d602eaf162bbad2536ac337e2fd5a1 /sys/amd64/include/cpufunc.h | |
parent | 07d30bc01eb16ab706b0a136a5a9066b7b8dc322 (diff) | |
download | FreeBSD-src-3e4166569d016eb336a76bfb079024dbfe30b695.zip FreeBSD-src-3e4166569d016eb336a76bfb079024dbfe30b695.tar.gz |
- Add the new critical_t type used to save state inside of critical
sections.
- Add implementations of the critical_enter() and critical_exit() functions
and remove restore_intr() and save_intr().
- Remove the somewhat bogus disable_intr() and enable_intr() functions on
the alpha as the alpha actually uses a priority level and not simple bit
flag on the CPU.
Diffstat (limited to 'sys/amd64/include/cpufunc.h')
-rw-r--r-- | sys/amd64/include/cpufunc.h | 33 |
1 files changed, 18 insertions, 15 deletions
diff --git a/sys/amd64/include/cpufunc.h b/sys/amd64/include/cpufunc.h index 8941ba1..7f0804f 100644 --- a/sys/amd64/include/cpufunc.h +++ b/sys/amd64/include/cpufunc.h @@ -90,21 +90,6 @@ enable_intr(void) __asm __volatile("sti"); } -static __inline u_int -save_intr(void) -{ - u_int ef; - - __asm __volatile("pushfl; popl %0" : "=r" (ef)); - return (ef); -} - -static __inline void -restore_intr(u_int ef) -{ - __asm __volatile("pushl %0; popfl" : : "r" (ef) : "memory" ); -} - #define HAVE_INLINE_FFS static __inline int @@ -495,6 +480,22 @@ rdr7(void) return (data); } +static __inline critical_t +critical_enter(void) +{ + critical_t eflags; + + eflags = read_eflags(); + disable_intr(); + return (eflags); +} + +static __inline void +critical_exit(critical_t eflags) +{ + write_eflags(eflags); +} + #else /* !__GNUC__ */ int breakpoint __P((void)); @@ -529,6 +530,8 @@ u_int rfs __P((void)); u_int rgs __P((void)); void load_fs __P((u_int sel)); void load_gs __P((u_int sel)); +critical_t critical_enter __P((void)); +void critical_exit __P((critical_t eflags)); #endif /* __GNUC__ */ |