mirror of
https://github.com/reactos/reactos.git
synced 2025-02-24 09:25:10 +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
|
VOID
|
||||||
KeApplicationProcessorInit(VOID)
|
KeApplicationProcessorInit(VOID)
|
||||||
{
|
{
|
||||||
PKPCR KPCR;
|
PKPCR Pcr;
|
||||||
ULONG Offset;
|
ULONG Offset;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Create a PCR for this processor
|
* Create a PCR for this processor
|
||||||
*/
|
*/
|
||||||
Offset = InterlockedIncrement((LONG *)&PcrsAllocated) - 1;
|
Offset = InterlockedIncrement((LONG *)&PcrsAllocated) - 1;
|
||||||
KPCR = (PKPCR)(KPCR_BASE + (Offset * PAGE_SIZE));
|
Pcr = (PKPCR)(KPCR_BASE + (Offset * PAGE_SIZE));
|
||||||
MmCreateVirtualMappingForKernel((PVOID)KPCR,
|
MmCreateVirtualMappingForKernel((PVOID)Pcr,
|
||||||
PAGE_READWRITE,
|
PAGE_READWRITE,
|
||||||
&PcrPages[Offset],
|
&PcrPages[Offset],
|
||||||
1);
|
1);
|
||||||
memset(KPCR, 0, PAGE_SIZE);
|
memset(Pcr, 0, PAGE_SIZE);
|
||||||
KPCR->ProcessorNumber = (UCHAR)Offset;
|
Pcr->ProcessorNumber = (UCHAR)Offset;
|
||||||
KPCR->Self = KPCR;
|
Pcr->Self = Pcr;
|
||||||
KPCR->Irql = HIGH_LEVEL;
|
Pcr->Tib.Self = &Pcr->Tib;
|
||||||
|
Pcr->Irql = HIGH_LEVEL;
|
||||||
|
|
||||||
/* Mark the end of the exception handler list */
|
/* Mark the end of the exception handler list */
|
||||||
KPCR->Tib.ExceptionList = (PVOID)-1;
|
Pcr->Tib.ExceptionList = (PVOID)-1;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Initialize the GDT
|
* Initialize the GDT
|
||||||
*/
|
*/
|
||||||
KiInitializeGdt(KPCR);
|
KiInitializeGdt(Pcr);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* It is now safe to process interrupts
|
* It is now safe to process interrupts
|
||||||
|
@ -215,6 +216,7 @@ KeInit1(PCHAR CommandLine, PULONG LastKernelAddress)
|
||||||
KPCR = (PKPCR)KPCR_BASE;
|
KPCR = (PKPCR)KPCR_BASE;
|
||||||
memset(KPCR, 0, PAGE_SIZE);
|
memset(KPCR, 0, PAGE_SIZE);
|
||||||
KPCR->Self = (PKPCR)KPCR_BASE;
|
KPCR->Self = (PKPCR)KPCR_BASE;
|
||||||
|
KPCR->Tib.Self = (PKPCR_TIB)KPCR_BASE;
|
||||||
KPCR->Irql = HIGH_LEVEL;
|
KPCR->Irql = HIGH_LEVEL;
|
||||||
KPCR->GDT = KiBootGdt;
|
KPCR->GDT = KiBootGdt;
|
||||||
KPCR->IDT = (PUSHORT)KiIdt;
|
KPCR->IDT = (PUSHORT)KiIdt;
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* 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
|
* PROJECT: ReactOS kernel
|
||||||
* FILE: ntoskrnl/ke/process.c
|
* FILE: ntoskrnl/ke/process.c
|
||||||
|
@ -138,8 +138,8 @@ KeStackAttachProcess (
|
||||||
KIRQL OldIrql;
|
KIRQL OldIrql;
|
||||||
PKTHREAD Thread;
|
PKTHREAD Thread;
|
||||||
|
|
||||||
Thread = KeGetCurrentThread();
|
|
||||||
OldIrql = KeAcquireDispatcherDatabaseLock();
|
OldIrql = KeAcquireDispatcherDatabaseLock();
|
||||||
|
Thread = KeGetCurrentThread();
|
||||||
|
|
||||||
/* Crash system if DPC is being executed! */
|
/* Crash system if DPC is being executed! */
|
||||||
if (KeIsExecutingDpc()) {
|
if (KeIsExecutingDpc()) {
|
||||||
|
|
Loading…
Reference in a new issue