mirror of
https://github.com/reactos/reactos.git
synced 2025-08-07 02:22:57 +00:00
[TCPIP] Fix global synchronization on SMP
We cannot just raise IRQL! Instead use a global ERESOURCE, which allows to be acquired recursively, as required by LWIP.
This commit is contained in:
parent
b4731b7f8f
commit
069fc049db
2 changed files with 10 additions and 4 deletions
|
@ -15,7 +15,7 @@ typedef struct _sys_mbox_t
|
||||||
int Valid;
|
int Valid;
|
||||||
} sys_mbox_t;
|
} sys_mbox_t;
|
||||||
|
|
||||||
typedef KIRQL sys_prot_t;
|
typedef u32_t sys_prot_t;
|
||||||
|
|
||||||
typedef u32_t sys_thread_t;
|
typedef u32_t sys_thread_t;
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,8 @@
|
||||||
|
|
||||||
static LIST_ENTRY ThreadListHead;
|
static LIST_ENTRY ThreadListHead;
|
||||||
static KSPIN_LOCK ThreadListLock;
|
static KSPIN_LOCK ThreadListLock;
|
||||||
|
static ERESOURCE GlobalLock;
|
||||||
|
static ULONG GlobalLockLevel = 0;
|
||||||
|
|
||||||
KEVENT TerminationEvent;
|
KEVENT TerminationEvent;
|
||||||
NPAGED_LOOKASIDE_LIST MessageLookasideList;
|
NPAGED_LOOKASIDE_LIST MessageLookasideList;
|
||||||
|
@ -32,14 +34,18 @@ u32_t sys_now(void)
|
||||||
void
|
void
|
||||||
sys_arch_protect(sys_prot_t *lev)
|
sys_arch_protect(sys_prot_t *lev)
|
||||||
{
|
{
|
||||||
/* Preempt the dispatcher */
|
/* Acquire the global resource to prevent other CPUs from running */
|
||||||
KeRaiseIrql(DISPATCH_LEVEL, lev);
|
ExEnterCriticalRegionAndAcquireResourceExclusive(&GlobalLock);
|
||||||
|
*lev = ++GlobalLockLevel;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
sys_arch_unprotect(sys_prot_t lev)
|
sys_arch_unprotect(sys_prot_t lev)
|
||||||
{
|
{
|
||||||
KeLowerIrql(lev);
|
/* Release the global resource */
|
||||||
|
ASSERT((GlobalLockLevel > 0) && (lev == GlobalLockLevel));
|
||||||
|
GlobalLockLevel--;
|
||||||
|
ExReleaseResourceAndLeaveCriticalRegion(&GlobalLock);
|
||||||
}
|
}
|
||||||
|
|
||||||
err_t
|
err_t
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue