diff options
author | marcel <marcel@FreeBSD.org> | 2003-05-24 21:44:24 +0000 |
---|---|---|
committer | marcel <marcel@FreeBSD.org> | 2003-05-24 21:44:24 +0000 |
commit | d19c2253df745a6a44053e55eb0b8810ead2caab (patch) | |
tree | 020a7b8fcf6ca943fd2af9b41396428fcd72512a /sys | |
parent | 7b4ed28b3c2cf450122063ab1b4e6dc7a01c1c9d (diff) | |
download | FreeBSD-src-d19c2253df745a6a44053e55eb0b8810ead2caab.zip FreeBSD-src-d19c2253df745a6a44053e55eb0b8810ead2caab.tar.gz |
Be more careful how we restore interrupts. Don't rewrite most of the
PSR only to achieve setting PSR.i back to it's previous value. It
makes it impossible to change any of the 30+ other unrelated bits
when done between intr_disable() and intr_restore(). That's bad.
Instead have intr_disable() return 1 when interrupts were previously
enabled and 0 otherwise and only enable interrupts in intr_restore()
when given a non-0 value.
This change specifically disallows using intr_restore() to disable
interrupts. The reason is simple: interrupts only need to be restored
after they are being disabled, which means that intr_restore() is
called with interrupts disabled and we only need to enable them if
they were previously enabled.
This change does not fix any bugs, other than that it bugged me...
Approved by: re@ (blanket)
Diffstat (limited to 'sys')
-rw-r--r-- | sys/ia64/include/cpufunc.h | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/sys/ia64/include/cpufunc.h b/sys/ia64/include/cpufunc.h index 932ca89..5de8341 100644 --- a/sys/ia64/include/cpufunc.h +++ b/sys/ia64/include/cpufunc.h @@ -193,13 +193,14 @@ intr_disable(void) register_t psr; __asm __volatile ("mov %0=psr;;" : "=r"(psr)); disable_intr(); - return (psr); + return ((psr & IA64_PSR_I) ? 1 : 0); } static __inline void -intr_restore(critical_t psr) +intr_restore(register_t ie) { - __asm __volatile ("mov psr.l=%0;; srlz.d" :: "r"(psr)); + if (ie) + enable_intr(); } #endif /* _KERNEL */ |