- 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.
This commit is contained in:
John Baldwin 2001-03-28 02:31:54 +00:00
parent 646672fe82
commit 034dc442ad
7 changed files with 57 additions and 58 deletions

View File

@ -45,29 +45,14 @@ breakpoint(void)
#endif
/*
* Bogus interrupt manipulation
*/
static __inline void
disable_intr(void)
static __inline critical_t
critical_enter(void)
{
alpha_pal_swpipl(ALPHA_PSL_IPL_HIGH);
return (alpha_pal_swpipl(ALPHA_PSL_IPL_HIGH));
}
static __inline void
enable_intr(void)
{
alpha_pal_swpipl(ALPHA_PSL_IPL_0);
}
static __inline u_int
save_intr(void)
{
return alpha_pal_rdps() & ALPHA_PSL_IPL_MASK;
}
static __inline void
restore_intr(u_int ipl)
critical_exit(critical_t ipl)
{
alpha_pal_swpipl(ipl);
}

View File

@ -64,6 +64,9 @@ typedef long intfptr_t;
typedef unsigned long uintfptr_t;
#endif
/* Critical section value */
typedef register_t critical_t;
/* Interrupt mask (spl, xxx_imask, etc) */
typedef __uint32_t intrmask_t;

View File

@ -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__ */

View File

@ -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__ */

View File

@ -60,6 +60,9 @@ typedef int intfptr_t;
typedef unsigned int uintfptr_t;
#endif
/* Critical section value */
typedef register_t critical_t;
/* Interrupt mask (spl, xxx_imask, etc) */
typedef __uint32_t intrmask_t;

View File

@ -163,9 +163,6 @@ writel(u_int addr, u_int32_t data)
return; /* TODO: implement this */
}
/*
* Bogus interrupt manipulation
*/
static __inline void
disable_intr(void)
{
@ -178,16 +175,18 @@ enable_intr(void)
__asm __volatile (";; ssm psr.i;; srlz.d");
}
static __inline u_int
save_intr(void)
static __inline critical_t
critical_enter(void)
{
u_int psr;
critical_t psr;
__asm __volatile ("mov %0=psr;;" : "=r" (psr));
return psr;
disable_intr();
return (psr);
}
static __inline void
restore_intr(u_int psr)
critical_exit(critical_t psr)
{
__asm __volatile ("mov psr.l=%0;; srlz.d" :: "r" (psr));
}

View File

@ -64,8 +64,11 @@ typedef long intfptr_t;
typedef unsigned long uintfptr_t;
#endif
/* Critical section value */
typedef register_t critical_t;
/* Interrupt mask (spl, xxx_imask, etc) */
typedef __uint32_t intrmask_t;
typedef __uint64_t intrmask_t;
/* Interrupt handler function type */
typedef void inthand2_t(void *);