mirror of
https://github.com/freebsd/freebsd-src.git
synced 2024-12-03 14:48:57 +00:00
Disable interrupts first and then set spinlock_count to 1.
Otherwise interrupt can be generated just after setting spinlock_count and before disabling interrupts. Sponsored by: DARPA, AFRL
This commit is contained in:
parent
75cf8837a9
commit
bf03b1f1f9
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=347226
@ -457,11 +457,13 @@ void
|
|||||||
spinlock_enter(void)
|
spinlock_enter(void)
|
||||||
{
|
{
|
||||||
struct thread *td;
|
struct thread *td;
|
||||||
|
register_t reg;
|
||||||
|
|
||||||
td = curthread;
|
td = curthread;
|
||||||
if (td->td_md.md_spinlock_count == 0) {
|
if (td->td_md.md_spinlock_count == 0) {
|
||||||
|
reg = intr_disable();
|
||||||
td->td_md.md_spinlock_count = 1;
|
td->td_md.md_spinlock_count = 1;
|
||||||
td->td_md.md_saved_sstatus_ie = intr_disable();
|
td->td_md.md_saved_sstatus_ie = reg;
|
||||||
} else
|
} else
|
||||||
td->td_md.md_spinlock_count++;
|
td->td_md.md_spinlock_count++;
|
||||||
critical_enter();
|
critical_enter();
|
||||||
|
Loading…
Reference in New Issue
Block a user