mirror of
https://github.com/reactos/reactos.git
synced 2025-02-24 01:15:09 +00:00
KeStackAttach: Acquire lock before getting thread
svn path=/trunk/; revision=11305
This commit is contained in:
parent
1f59f1138b
commit
b3f049be4f
2 changed files with 13 additions and 11 deletions
|
@ -134,30 +134,31 @@ KePrepareForApplicationProcessorInit(ULONG Id)
|
|||
VOID
|
||||
KeApplicationProcessorInit(VOID)
|
||||
{
|
||||
PKPCR KPCR;
|
||||
PKPCR Pcr;
|
||||
ULONG Offset;
|
||||
|
||||
/*
|
||||
* Create a PCR for this processor
|
||||
*/
|
||||
Offset = InterlockedIncrement((LONG *)&PcrsAllocated) - 1;
|
||||
KPCR = (PKPCR)(KPCR_BASE + (Offset * PAGE_SIZE));
|
||||
MmCreateVirtualMappingForKernel((PVOID)KPCR,
|
||||
Pcr = (PKPCR)(KPCR_BASE + (Offset * PAGE_SIZE));
|
||||
MmCreateVirtualMappingForKernel((PVOID)Pcr,
|
||||
PAGE_READWRITE,
|
||||
&PcrPages[Offset],
|
||||
1);
|
||||
memset(KPCR, 0, PAGE_SIZE);
|
||||
KPCR->ProcessorNumber = (UCHAR)Offset;
|
||||
KPCR->Self = KPCR;
|
||||
KPCR->Irql = HIGH_LEVEL;
|
||||
memset(Pcr, 0, PAGE_SIZE);
|
||||
Pcr->ProcessorNumber = (UCHAR)Offset;
|
||||
Pcr->Self = Pcr;
|
||||
Pcr->Tib.Self = &Pcr->Tib;
|
||||
Pcr->Irql = HIGH_LEVEL;
|
||||
|
||||
/* Mark the end of the exception handler list */
|
||||
KPCR->Tib.ExceptionList = (PVOID)-1;
|
||||
Pcr->Tib.ExceptionList = (PVOID)-1;
|
||||
|
||||
/*
|
||||
* Initialize the GDT
|
||||
*/
|
||||
KiInitializeGdt(KPCR);
|
||||
KiInitializeGdt(Pcr);
|
||||
|
||||
/*
|
||||
* It is now safe to process interrupts
|
||||
|
@ -215,6 +216,7 @@ KeInit1(PCHAR CommandLine, PULONG LastKernelAddress)
|
|||
KPCR = (PKPCR)KPCR_BASE;
|
||||
memset(KPCR, 0, PAGE_SIZE);
|
||||
KPCR->Self = (PKPCR)KPCR_BASE;
|
||||
KPCR->Tib.Self = (PKPCR_TIB)KPCR_BASE;
|
||||
KPCR->Irql = HIGH_LEVEL;
|
||||
KPCR->GDT = KiBootGdt;
|
||||
KPCR->IDT = (PUSHORT)KiIdt;
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id: process.c,v 1.29 2004/10/13 22:27:03 ion Exp $
|
||||
/* $Id: process.c,v 1.30 2004/10/17 03:43:26 ion Exp $
|
||||
*
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: ntoskrnl/ke/process.c
|
||||
|
@ -138,8 +138,8 @@ KeStackAttachProcess (
|
|||
KIRQL OldIrql;
|
||||
PKTHREAD Thread;
|
||||
|
||||
Thread = KeGetCurrentThread();
|
||||
OldIrql = KeAcquireDispatcherDatabaseLock();
|
||||
Thread = KeGetCurrentThread();
|
||||
|
||||
/* Crash system if DPC is being executed! */
|
||||
if (KeIsExecutingDpc()) {
|
||||
|
|
Loading…
Reference in a new issue