- Change ULONG to ULONG_PTR for StackLimit.

- Move code from KiUpdateSystemTime to KeUpdateSystemTime.
- Move code from KiUpdateProcessThreadTime to KeUpdateRunTime.
- Honour thread quantums while scheduling.

svn path=/trunk/; revision=11488
This commit is contained in:
Filip Navara 2004-10-30 23:48:57 +00:00
parent 75d9d45c27
commit 095f2900e8
12 changed files with 245 additions and 243 deletions

View file

@ -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: kdb.c,v 1.32 2004/10/27 13:33:59 blight Exp $
/* $Id: kdb.c,v 1.33 2004/10/30 23:48:55 navaraf Exp $
*
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/dbg/kdb.c
@ -875,7 +875,7 @@ DbgProcessListCommand(ULONG Argc, PCH Argv[], PKTRAP_FRAME Tf)
}
VOID
DbgPrintBackTrace(PULONG Frame, ULONG StackBase, ULONG StackLimit)
DbgPrintBackTrace(PULONG Frame, ULONG_PTR StackBase, ULONG_PTR StackLimit)
{
PVOID Address;

View file

@ -145,7 +145,7 @@ typedef struct _KPRCB {
PVOID DpcThread;
struct _KEVENT *DpcEvent;
UCHAR ThreadDpcEnable;
UCHAR QuantumEnd;
BOOLEAN QuantumEnd;
UCHAR PrcbPad50;
UCHAR IdleSchedule;
ULONG DpcSetEventRequest;

View file

@ -67,14 +67,8 @@ KiIpiServiceRoutine(
IN PKEXCEPTION_FRAME ExceptionFrame
);*/
VOID
STDCALL
KeUpdateSystemTime(
IN PKTRAP_FRAME TrapFrame,
IN ULONG Increment
);
VOID KiUpdateSystemTime (KIRQL oldIrql, struct _KIRQ_TRAPFRAME* Tf);
VOID STDCALL KeUpdateSystemTime(PKTRAP_FRAME TrapFrame, KIRQL Irql);
VOID STDCALL KeUpdateRunTime(PKTRAP_FRAME TrapFrame, KIRQL Irql);
KIRQL KeAcquireDispatcherDatabaseLock(VOID);
VOID KeAcquireDispatcherDatabaseLockAtDpcLevel(VOID);
@ -154,15 +148,6 @@ KeBugCheckWithTf(ULONG BugCheckCode,
VOID
KiDumpTrapFrame(PKTRAP_FRAME Tf, ULONG ExceptionNr, ULONG cr2);
VOID
KiUpdateProcessThreadTime(KIRQL pldIrql, struct _KIRQ_TRAPFRAME* Tf);
VOID
STDCALL
KeUpdateRunTime(
IN PKTRAP_FRAME TrapFrame
);
VOID
STDCALL
KeFlushCurrentTb(VOID);

View file

@ -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: ps.h,v 1.71 2004/10/13 01:42:14 ion Exp $
/* $Id: ps.h,v 1.72 2004/10/30 23:48:56 navaraf Exp $
*
* FILE: ntoskrnl/ke/kthread.c
* PURPOSE: Process manager definitions
@ -81,7 +81,7 @@ typedef struct _KTHREAD
/* List of mutants owned by the thread */
LIST_ENTRY MutantListHead; /* 10 */
PVOID InitialStack; /* 18 */
ULONG StackLimit; /* 1C */
ULONG_PTR StackLimit; /* 1C */
/* Pointer to the thread's environment block in user memory */
PTEB Teb; /* 20 */
@ -111,7 +111,7 @@ typedef struct _KTHREAD
CHAR BasePriority; /* 68 */
UCHAR DecrementCount; /* 69 */
UCHAR PriorityDecrement; /* 6A */
UCHAR Quantum; /* 6B */
CHAR Quantum; /* 6B */
KWAIT_BLOCK WaitBlock[4]; /* 6C */
PVOID LegoData; /* CC */
ULONG KernelApcDisable; /* D0 */

View file

@ -18,7 +18,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: dpc.c,v 1.40 2004/10/23 14:52:51 blight Exp $
/* $Id: dpc.c,v 1.41 2004/10/30 23:48:56 navaraf Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -81,14 +81,30 @@ KiDispatchInterrupt(VOID)
PKDPC current;
KIRQL oldlvl;
PKPCR Pcr;
PKTHREAD CurrentThread;
PKPROCESS CurrentProcess;
ASSERT_IRQL(DISPATCH_LEVEL);
Pcr = KeGetCurrentKPCR();
if (Pcr->PrcbData.QuantumEnd)
{
/*
* FIXME: Various special cases should be handled here. The scripts
* from David B. Probert that describe it under KiQuantumEnd.
*/
CurrentThread = /* Pcr->PcrbData.CurrentThread */ KeGetCurrentThread();
CurrentProcess = CurrentThread->ApcState.Process;
CurrentThread->Quantum = CurrentProcess->ThreadQuantum;
Pcr->PrcbData.QuantumEnd = FALSE;
PsDispatchThread(THREAD_STATE_READY);
return;
}
if (Pcr->PrcbData.DpcData[0].DpcQueueDepth == 0)
{
return;
return;
}
KeRaiseIrql(HIGH_LEVEL, &oldlvl);

View file

@ -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: irq.c,v 1.48 2004/10/22 20:32:49 ekohl Exp $
/* $Id: irq.c,v 1.49 2004/10/30 23:48:56 navaraf Exp $
*
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/ke/i386/irq.c
@ -303,25 +303,18 @@ KiInterruptDispatch2 (ULONG vector, KIRQL old_level)
DPRINT1("I(0x%.08x, 0x%.08x)\n", vector, old_level);
if (vector == 0)
{
KiUpdateSystemTime(old_level, 0);
}
else
{
/*
* Iterate the list until one of the isr tells us its device interrupted
*/
current = isr_table[vector].Flink;
isr = CONTAINING_RECORD(current,KINTERRUPT,Entry);
/*
* Iterate the list until one of the isr tells us its device interrupted
*/
current = isr_table[vector].Flink;
isr = CONTAINING_RECORD(current,KINTERRUPT,Entry);
while (current != &isr_table[vector] &&
!isr->ServiceRoutine(isr, isr->ServiceContext))
{
current = current->Flink;
isr = CONTAINING_RECORD(current,KINTERRUPT,Entry);
}
}
while (current != &isr_table[vector] &&
!isr->ServiceRoutine(isr, isr->ServiceContext))
{
current = current->Flink;
isr = CONTAINING_RECORD(current,KINTERRUPT,Entry);
}
}
VOID
@ -335,16 +328,8 @@ KiInterruptDispatch (ULONG Vector, PKIRQ_TRAPFRAME Trapframe)
*/
{
KIRQL old_level;
#ifdef DBG
KTRAP_FRAME KernelTrapFrame;
KeIRQTrapFrameToTrapFrame(Trapframe, &KernelTrapFrame);
KeGetCurrentThread()->TrapFrame = &KernelTrapFrame;
#endif /* DBG */
DbgPrint("V(0x%.02x)", Vector);
/*
@ -368,10 +353,18 @@ KiInterruptDispatch (ULONG Vector, PKIRQ_TRAPFRAME Trapframe)
*/
Ke386EnableInterrupts();
/*
* Actually call the ISR.
*/
KiInterruptDispatch2(Vector, old_level);
if (Vector == 0)
{
KeIRQTrapFrameToTrapFrame(Trapframe, &KernelTrapFrame);
KeUpdateSystemTime(&KernelTrapFrame, PROFILE_LEVEL);
}
else
{
/*
* Actually call the ISR.
*/
KiInterruptDispatch2(Vector, old_level);
}
/*
* Disable interrupts
@ -466,7 +459,8 @@ KiInterruptDispatch (ULONG irq, PKIRQ_TRAPFRAME Trapframe)
if (irq == 0)
{
KiUpdateSystemTime(old_level, Trapframe);
KeIRQTrapFrameToTrapFrame(Trapframe, &KernelTrapFrame);
KeUpdateSystemTime(&KernelTrapFrame, PROFILE_LEVEL);
}
else
{
@ -483,15 +477,6 @@ KiInterruptDispatch (ULONG irq, PKIRQ_TRAPFRAME Trapframe)
}
#endif /* KDBG */
/*
* Maybe do a reschedule as well.
*/
if (old_level < DISPATCH_LEVEL && irq == 0)
{
KeLowerIrql(APC_LEVEL);
PsDispatchThread(THREAD_STATE_READY);
}
/*
* End the system interrupt.
*/

View file

@ -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: kthread.c,v 1.55 2004/10/22 20:30:47 ekohl Exp $
/* $Id: kthread.c,v 1.56 2004/10/30 23:48:56 navaraf Exp $
*
* FILE: ntoskrnl/ke/kthread.c
* PURPOSE: Microkernel thread support
@ -87,7 +87,7 @@ KeReleaseThread(PKTHREAD Thread)
/* FIXME - lock the process */
RemoveEntryList(&Thread->ThreadListEntry);
if (Thread->StackLimit != (ULONG)&init_stack)
if (Thread->StackLimit != (ULONG_PTR)&init_stack)
{
MmLockAddressSpace(MmGetKernelAddressSpace());
MmFreeMemoryArea(MmGetKernelAddressSpace(),
@ -189,17 +189,17 @@ KeInitializeThread(PKPROCESS Process, PKTHREAD Thread, BOOLEAN First)
{
KEBUGCHECK(0);
}
Thread->InitialStack = (char*)KernelStack + MM_STACK_SIZE;
Thread->StackBase = (char*)KernelStack + MM_STACK_SIZE;
Thread->StackLimit = (ULONG)KernelStack;
Thread->KernelStack = (char*)KernelStack + MM_STACK_SIZE;
Thread->InitialStack = (PCHAR)KernelStack + MM_STACK_SIZE;
Thread->StackBase = (PCHAR)KernelStack + MM_STACK_SIZE;
Thread->StackLimit = (ULONG_PTR)KernelStack;
Thread->KernelStack = (PCHAR)KernelStack + MM_STACK_SIZE;
}
else
{
Thread->InitialStack = (PVOID)&init_stack_top;
Thread->StackBase = (PVOID)&init_stack_top;
Thread->StackLimit = (ULONG)&init_stack;
Thread->KernelStack = (PVOID)&init_stack_top;
Thread->InitialStack = (PCHAR)&init_stack_top;
Thread->StackBase = (PCHAR)&init_stack_top;
Thread->StackLimit = (ULONG_PTR)&init_stack;
Thread->KernelStack = (PCHAR)&init_stack_top;
}
/*
@ -228,7 +228,7 @@ KeInitializeThread(PKPROCESS Process, PKTHREAD Thread, BOOLEAN First)
Thread->NpxState = 0;
Thread->Saturation = 0;
Thread->Priority = 0;
Thread->Priority = Process->BasePriority;
InitializeListHead(&Thread->ApcState.ApcListHead[0]);
InitializeListHead(&Thread->ApcState.ApcListHead[1]);
Thread->ApcState.Process = Process;
@ -244,10 +244,10 @@ KeInitializeThread(PKPROCESS Process, PKTHREAD Thread, BOOLEAN First)
Thread->WaitListEntry.Flink = NULL;
Thread->WaitListEntry.Blink = NULL;
Thread->WaitTime = 0;
Thread->BasePriority = 0;
Thread->BasePriority = Process->BasePriority;
Thread->DecrementCount = 0;
Thread->PriorityDecrement = 0;
Thread->Quantum = 0;
Thread->Quantum = Process->ThreadQuantum;
memset(Thread->WaitBlock, 0, sizeof(KWAIT_BLOCK)*4);
Thread->LegoData = 0;
@ -303,11 +303,10 @@ crashes. I'm disabling it again, until we fix the APC implementation...
Thread->Alertable = 1;
Thread->ApcStateIndex = OriginalApcEnvironment;
/* FIXME: not all thread are ApcQueueable! */
Thread->ApcQueueable = TRUE;
Thread->AutoAlignment = 0;
Thread->AutoAlignment = Process->AutoAlignment;
KeInitializeApc(&Thread->SuspendApc,
Thread,
OriginalApcEnvironment,

View file

@ -1,4 +1,4 @@
/* $Id: timer.c,v 1.84 2004/10/24 16:49:49 weiden Exp $
/* $Id: timer.c,v 1.85 2004/10/30 23:48:56 navaraf Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -628,9 +628,164 @@ KeExpireTimers(PKDPC Dpc,
}
VOID INIT_FUNCTION
KeInitializeTimerImpl(VOID)
/*
* FUNCTION: Initializes timer irq handling
* NOTE: This is only called once from main()
*/
{
TIME_FIELDS TimeFields;
DPRINT("KeInitializeTimerImpl()\n");
InitializeListHead(&AbsoluteTimerListHead);
InitializeListHead(&RelativeTimerListHead);
KeInitializeSpinLock(&TimerListLock);
KeInitializeSpinLock(&TimerValueLock);
KeInitializeDpc(&ExpireTimerDpc, KeExpireTimers, 0);
/*
* Calculate the starting time for the system clock
*/
HalQueryRealTimeClock(&TimeFields);
RtlTimeFieldsToTime(&TimeFields, &SystemBootTime);
SharedUserData->TickCountLow = 0;
SharedUserData->TickCountMultiplier = 167783691; // 2^24 * 1193182 / 119310
SharedUserData->InterruptTime.High2Part = 0;
SharedUserData->InterruptTime.LowPart = 0;
SharedUserData->InterruptTime.High1Part = 0;
SharedUserData->SystemTime.High2Part = SystemBootTime.u.HighPart;
SharedUserData->SystemTime.LowPart = SystemBootTime.u.LowPart;
SharedUserData->SystemTime.High1Part = SystemBootTime.u.HighPart;
TimerInitDone = TRUE;
DPRINT("Finished KeInitializeTimerImpl()\n");
}
/*
* @unimplemented
*/
VOID
KiUpdateSystemTime(KIRQL oldIrql,
PKIRQ_TRAPFRAME Tf)
FASTCALL
KeSetTimeUpdateNotifyRoutine(
IN PTIME_UPDATE_NOTIFY_ROUTINE NotifyRoutine
)
{
UNIMPLEMENTED;
}
/*
* NOTE: On Windows this function takes exactly one parameter and EBP is
* guaranteed to point to KTRAP_FRAME. The function is used only
* by HAL, so there's no point in keeping that prototype.
*
* @implemented
*/
VOID
STDCALL
KeUpdateRunTime(
IN PKTRAP_FRAME TrapFrame,
IN KIRQL Irql
)
{
PKPCR Pcr;
PKTHREAD CurrentThread;
PKPROCESS CurrentProcess;
#if 0
ULONG DpcLastCount;
#endif
Pcr = KeGetCurrentKPCR();
/*
* Make sure no counting can take place until Processes and Threads are
* running!
*/
if ((PsInitialSystemProcess == NULL) || (Pcr->PrcbData.IdleThread == NULL) ||
(KiTimerSystemAuditing == 0))
{
return;
}
DPRINT("KernelTime %u, UserTime %u \n", Pcr->PrcbData.KernelTime, Pcr->PrcbData.UserTime);
CurrentThread = /* Pcr->PcrbData.CurrentThread */ KeGetCurrentThread();
CurrentProcess = CurrentThread->ApcState.Process;
/*
* Cs bit 0 is always set for user mode if we are in protected mode.
* V86 mode is counted as user time.
*/
if (TrapFrame->Cs & 0x1 ||
TrapFrame->Eflags & X86_EFLAGS_VM)
{
InterlockedIncrement((PLONG)&CurrentThread->UserTime);
InterlockedIncrement((PLONG)&CurrentProcess->UserTime);
InterlockedIncrement((PLONG)&Pcr->PrcbData.UserTime);
}
else
{
if (Irql > DISPATCH_LEVEL)
{
Pcr->PrcbData.InterruptTime++;
}
else if (Irql == DISPATCH_LEVEL)
{
Pcr->PrcbData.DpcTime++;
}
else
{
InterlockedIncrement((PLONG)&CurrentThread->KernelTime);
InterlockedIncrement((PLONG)&CurrentProcess->KernelTime);
}
}
#if 0
DpcLastCount = Pcr->PrcbData.DpcLastCount;
Pcr->PrcbData.DpcLastCount = Pcr->PrcbData.DpcCount;
Pcr->PrcbData.DpcRequestRate = ((Pcr->PrcbData.DpcCount - DpcLastCount) +
Pcr->PrcbData.DpcRequestRate) / 2;
#endif
if (Pcr->PrcbData.DpcData[0].DpcQueueDepth > 0 &&
Pcr->PrcbData.DpcRoutineActive == FALSE &&
Pcr->PrcbData.DpcInterruptRequested == FALSE)
{
HalRequestSoftwareInterrupt(DISPATCH_LEVEL);
}
/* FIXME: Do DPC rate adjustments */
/*
* If we're at end of quantum request software interrupt. The rest
* is handled in KiDispatchInterrupt.
*/
if ((CurrentThread->Quantum -= 3) < 0)
{
if (CurrentThread != Pcr->PrcbData.IdleThread)
{
Pcr->PrcbData.QuantumEnd = TRUE;
HalRequestSoftwareInterrupt(DISPATCH_LEVEL);
}
}
}
/*
* NOTE: On Windows this function takes exactly zero parameters and EBP is
* guaranteed to point to KTRAP_FRAME. Also [esp+0] contains an IRQL.
* The function is used only by HAL, so there's no point in keeping
* that prototype.
*
* @implemented
*/
VOID
STDCALL
KeUpdateSystemTime(
IN PKTRAP_FRAME TrapFrame,
IN KIRQL Irql
)
/*
* FUNCTION: Handles a timer interrupt
*/
@ -666,157 +821,17 @@ KiUpdateSystemTime(KIRQL oldIrql,
SharedUserData->SystemTime.LowPart = Time.u.LowPart;
SharedUserData->SystemTime.High1Part = Time.u.HighPart;
/* FIXME: Here we should check for remote debugger break-ins */
KiReleaseSpinLock(&TimerValueLock);
/* Update process and thread times */
KiUpdateProcessThreadTime(oldIrql, Tf);
KeUpdateRunTime(TrapFrame, Irql);
/*
* Queue a DPC that will expire timers
*/
KeInsertQueueDpc(&ExpireTimerDpc, (PVOID)Tf->Eip, 0);
KeInsertQueueDpc(&ExpireTimerDpc, (PVOID)TrapFrame->Eip, 0);
}
VOID INIT_FUNCTION
KeInitializeTimerImpl(VOID)
/*
* FUNCTION: Initializes timer irq handling
* NOTE: This is only called once from main()
*/
{
TIME_FIELDS TimeFields;
DPRINT("KeInitializeTimerImpl()\n");
InitializeListHead(&AbsoluteTimerListHead);
InitializeListHead(&RelativeTimerListHead);
KeInitializeSpinLock(&TimerListLock);
KeInitializeSpinLock(&TimerValueLock);
KeInitializeDpc(&ExpireTimerDpc, KeExpireTimers, 0);
/*
* Calculate the starting time for the system clock
*/
HalQueryRealTimeClock(&TimeFields);
RtlTimeFieldsToTime(&TimeFields, &SystemBootTime);
SharedUserData->TickCountLow = 0;
SharedUserData->TickCountMultiplier = 167783691; // 2^24 * 1193182 / 119310
SharedUserData->InterruptTime.High2Part = 0;
SharedUserData->InterruptTime.LowPart = 0;
SharedUserData->InterruptTime.High1Part = 0;
SharedUserData->SystemTime.High2Part = SystemBootTime.u.HighPart;
SharedUserData->SystemTime.LowPart = SystemBootTime.u.LowPart;
SharedUserData->SystemTime.High1Part = SystemBootTime.u.HighPart;
TimerInitDone = TRUE;
DPRINT("Finished KeInitializeTimerImpl()\n");
}
VOID
KiUpdateProcessThreadTime(KIRQL oldIrql, PKIRQ_TRAPFRAME Tf)
{
PKTHREAD CurrentThread;
PEPROCESS ThreadsProcess;
PKPCR Pcr;
Pcr = KeGetCurrentKPCR();
/*
* Make sure no counting can take place until Processes and Threads are
* running!
*/
if ((PsInitialSystemProcess == NULL) || (Pcr->PrcbData.IdleThread == NULL) ||
(KiTimerSystemAuditing == 0))
{
return;
}
DPRINT("KernelTime %u, UserTime %u \n", Pcr->PrcbData.KernelTime, Pcr->PrcbData.UserTime);
if (oldIrql > DISPATCH_LEVEL)
{
Pcr->PrcbData.InterruptTime++;
}
else if (oldIrql == DISPATCH_LEVEL)
{
Pcr->PrcbData.DpcTime++;
}
else
{
CurrentThread = KeGetCurrentThread();
ThreadsProcess = ((PETHREAD)CurrentThread)->ThreadsProcess;
/*
* Cs bit 0 is always set for user mode if we are in protected mode.
* V86 mode is counted as user time.
*/
if (Tf->Cs & 0x1 ||
Tf->Eflags & X86_EFLAGS_VM)
{
#ifdef MP
InterlockedIncrement((PLONG)&ThreadsProcess->Pcb.UserTime);
#else
ThreadsProcess->Pcb.UserTime++;
#endif
CurrentThread->UserTime++;
Pcr->PrcbData.UserTime++;
}
else
{
#ifdef MP
InterlockedIncrement((PLONG)&ThreadsProcess->Pcb.KernelTime);
#else
ThreadsProcess->Pcb.KernelTime++;
#endif
CurrentThread->KernelTime++;
Pcr->PrcbData.KernelTime++;
}
}
}
/*
* @unimplemented
*/
VOID
FASTCALL
KeSetTimeUpdateNotifyRoutine(
IN PTIME_UPDATE_NOTIFY_ROUTINE NotifyRoutine
)
{
UNIMPLEMENTED;
}
/*
* @unimplemented
*/
VOID
STDCALL
KeUpdateRunTime(
IN PKTRAP_FRAME TrapFrame
)
{
KIRQL OldIrql = PASSIVE_LEVEL;
/* These are equivalent... we should just remove the Ki and stick it here... */
KiUpdateProcessThreadTime(OldIrql, (PKIRQ_TRAPFRAME)TrapFrame);
}
/*
* @unimplemented
*/
VOID
STDCALL
KeUpdateSystemTime(
IN PKTRAP_FRAME TrapFrame,
IN ULONG Increment
)
{
KIRQL OldIrql = PASSIVE_LEVEL;
/* These are equivalent... we should just remove the Ki and stick it here... */
KiUpdateSystemTime(OldIrql, (PKIRQ_TRAPFRAME)TrapFrame);
}
/*EOF*/
/* EOF */

View file

@ -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: pagefile.c,v 1.51 2004/10/09 12:17:53 gvg Exp $
/* $Id: pagefile.c,v 1.52 2004/10/30 23:48:56 navaraf Exp $
*
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/mm/pagefile.c
@ -494,7 +494,7 @@ MmDumpToPagingFile(ULONG BugCode,
UCHAR MdlBase[sizeof(MDL) + sizeof(ULONG)];
PMDL Mdl = (PMDL)MdlBase;
PETHREAD Thread = PsGetCurrentThread();
ULONG StackSize;
ULONG_PTR StackSize;
PULONG MdlMap;
LONGLONG NextOffset = 0;
ULONG i;
@ -531,8 +531,8 @@ MmDumpToPagingFile(ULONG BugCode,
Headers->BugCheckParameters[2] = BugCodeParameter3;
Headers->BugCheckParameters[3] = BugCodeParameter4;
Headers->FaultingStackBase = (PVOID)Thread->Tcb.StackLimit;
Headers->FaultingStackSize = StackSize =
(ULONG)((char*)Thread->Tcb.StackBase - Thread->Tcb.StackLimit);
Headers->FaultingStackSize =
StackSize = (ULONG_PTR)(Thread->Tcb.StackBase - Thread->Tcb.StackLimit);
Headers->PhysicalMemorySize = MmStats.NrTotalPages * PAGE_SIZE;
/* Initialize the dump device. */

View file

@ -1,4 +1,4 @@
; $Id: ntoskrnl.def,v 1.196 2004/10/18 20:56:22 navaraf Exp $
; $Id: ntoskrnl.def,v 1.197 2004/10/30 23:48:57 navaraf Exp $
;
; reactos/ntoskrnl/ntoskrnl.def
;
@ -644,7 +644,7 @@ KeStackAttachProcess@8
KeSynchronizeExecution@12
KeTerminateThread@4
KeTickCount DATA
KeUpdateRunTime@4
KeUpdateRunTime@8
KeUpdateSystemTime@8
KeUnstackDetachProcess@4
KeUserModeCallback@20

View file

@ -1,4 +1,4 @@
/* $Id: process.c,v 1.146 2004/10/24 20:37:27 weiden Exp $
/* $Id: process.c,v 1.147 2004/10/30 23:48:57 navaraf Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -673,6 +673,8 @@ NtCreateProcess(OUT PHANDLE ProcessHandle,
KProcess->LdtDescriptor[0] = 0;
KProcess->LdtDescriptor[1] = 0;
InitializeListHead(&KProcess->ThreadListHead);
KProcess->ThreadQuantum = 6;
KProcess->AutoAlignment = 0;
MmInitializeAddressSpace(Process,
&Process->AddressSpace);
Process->UniqueProcessId = InterlockedIncrement((LONG *)&PiNextProcessUniqueId); /* TODO */

View file

@ -1,4 +1,4 @@
/* $Id: w32call.c,v 1.16 2004/10/22 20:45:46 ekohl Exp $
/* $Id: w32call.c,v 1.17 2004/10/30 23:48:57 navaraf Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -36,7 +36,7 @@ void* _alloca(size_t size);
typedef struct _NTW32CALL_SAVED_STATE
{
ULONG SavedStackLimit;
ULONG_PTR SavedStackLimit;
PVOID SavedStackBase;
PVOID SavedInitialStack;
PVOID CallerResult;
@ -76,7 +76,7 @@ NtCallbackReturn (PVOID Result,
PVOID* CallerResult;
PVOID InitialStack;
PVOID StackBase;
ULONG StackLimit;
ULONG_PTR StackLimit;
KIRQL oldIrql;
PNTW32CALL_SAVED_STATE State;
PKTRAP_FRAME SavedTrapFrame;
@ -244,7 +244,7 @@ NtW32Call (IN ULONG RoutineIndex,
{
PETHREAD Thread;
PVOID NewStack;
ULONG StackSize;
ULONG_PTR StackSize;
PKTRAP_FRAME NewFrame;
PULONG UserEsp;
KIRQL oldIrql;
@ -258,7 +258,7 @@ NtW32Call (IN ULONG RoutineIndex,
Thread = PsGetCurrentThread();
/* Set up the new kernel and user environment. */
StackSize = (ULONG)((char*)Thread->Tcb.StackBase - Thread->Tcb.StackLimit);
StackSize = (ULONG_PTR)(Thread->Tcb.StackBase - Thread->Tcb.StackLimit);
KeAcquireSpinLock(&CallbackStackListLock, &oldIrql);
if (IsListEmpty(&CallbackStackListHead))
{
@ -305,7 +305,7 @@ NtW32Call (IN ULONG RoutineIndex,
SavedState.SavedTrapFrame = Thread->Tcb.TrapFrame;
SavedState.SavedCallbackStack = Thread->Tcb.CallbackStack;
Thread->Tcb.InitialStack = Thread->Tcb.StackBase = (char*)NewStack + StackSize;
Thread->Tcb.StackLimit = (ULONG)NewStack;
Thread->Tcb.StackLimit = (ULONG_PTR)NewStack;
Thread->Tcb.KernelStack = (char*)NewStack + StackSize - sizeof(KTRAP_FRAME);
KeGetCurrentKPCR()->TSS->Esp0 = (ULONG)Thread->Tcb.InitialStack;
KePushAndStackSwitchAndSysRet((ULONG)&SavedState, Thread->Tcb.KernelStack);