Modified: trunk/reactos/ntoskrnl/include/internal/i386/ke.h
Modified: trunk/reactos/ntoskrnl/include/internal/ke.h
Modified: trunk/reactos/ntoskrnl/include/internal/ps.h
Modified: trunk/reactos/ntoskrnl/ke/dpc.c
Modified: trunk/reactos/ntoskrnl/ke/event.c
Modified: trunk/reactos/ntoskrnl/ke/i386/ldt.c
Modified: trunk/reactos/ntoskrnl/ke/i386/v86m.c
Modified: trunk/reactos/ntoskrnl/ke/i386/vdm.c
Modified: trunk/reactos/ntoskrnl/ke/kthread.c
Modified: trunk/reactos/ntoskrnl/ke/process.c
Modified: trunk/reactos/ntoskrnl/mm/i386/page.c
Modified: trunk/reactos/ntoskrnl/ps/psmgr.c
Modified: trunk/reactos/w32api/include/ddk/ntifs.h
--- trunk/reactos/ntoskrnl/include/internal/i386/ke.h 2005-05-05 22:36:25 UTC (rev 15026)
+++ trunk/reactos/ntoskrnl/include/internal/i386/ke.h 2005-05-05 22:40:05 UTC (rev 15027)
@@ -179,6 +179,38 @@
ULONG Eflags;
} KIRQ_TRAPFRAME, *PKIRQ_TRAPFRAME;
+typedef struct _KGDTENTRY {
+ USHORT LimitLow;
+ USHORT BaseLow;
+ union {
+ struct {
+ UCHAR BaseMid;
+ UCHAR Flags1;
+ UCHAR Flags2;
+ UCHAR BaseHi;
+ } Bytes;
+ struct {
+ ULONG BaseMid : 8;
+ ULONG Type : 5;
+ ULONG Dpl : 2;
+ ULONG Pres : 1;
+ ULONG LimitHi : 4;
+ ULONG Sys : 1;
+ ULONG Reserved_0 : 1;
+ ULONG Default_Big : 1;
+ ULONG Granularity : 1;
+ ULONG BaseHi : 8;
+ } Bits;
+ } HighWord;
+} KGDTENTRY, *PKGDTENTRY;
+
+typedef struct _KIDTENTRY {
+ USHORT Offset;
+ USHORT Selector;
+ USHORT Access;
+ USHORT ExtendedOffset;
+} KIDTENTRY, *PKIDTENTRY;
+
extern ULONG Ke386CacheAlignment;
struct _KPCR;
--- trunk/reactos/ntoskrnl/include/internal/ke.h 2005-05-05 22:36:25 UTC (rev 15026)
+++ trunk/reactos/ntoskrnl/include/internal/ke.h 2005-05-05 22:40:05 UTC (rev 15027)
@@ -29,6 +29,191 @@
#include "arch/ke.h"
+/* INTERNAL KERNEL TYPES ****************************************************/
+
+#ifndef __ASM__
+
+#ifndef __USE_W32API
+
+typedef struct _KPROCESS *PKPROCESS;
+
+#endif /* __USE_W32API */
+
+typedef struct _HARDWARE_PTE_X86 {
+ ULONG Valid : 1;
+ ULONG Write : 1;
+ ULONG Owner : 1;
+ ULONG WriteThrough : 1;
+ ULONG CacheDisable : 1;
+ ULONG Accessed : 1;
+ ULONG Dirty : 1;
+ ULONG LargePage : 1;
+ ULONG Global : 1;
+ ULONG CopyOnWrite : 1;
+ ULONG Prototype : 1;
+ ULONG reserved : 1;
+ ULONG PageFrameNumber : 20;
+} HARDWARE_PTE_X86, *PHARDWARE_PTE_X86;
+
+typedef struct _WOW64_PROCESS
+{
+ PVOID Wow64;
+} WOW64_PROCESS, *PWOW64_PROCESS;
+
+#include <pshpack1.h>
+
+typedef struct _KTHREAD
+{
+ /* For waiting on thread exit */
+ DISPATCHER_HEADER DispatcherHeader; /* 00 */
+
+ /* List of mutants owned by the thread */
+ LIST_ENTRY MutantListHead; /* 10 */
+ PVOID InitialStack; /* 18 */
+ ULONG_PTR StackLimit; /* 1C */
+
+ /* Pointer to the thread's environment block in user memory */
+ struct _TEB *Teb; /* 20 */
+
+ /* Pointer to the thread's TLS array */
+ PVOID TlsArray; /* 24 */
+ PVOID KernelStack; /* 28 */
+ UCHAR DebugActive; /* 2C */
+
+ /* Thread state (one of THREAD_STATE_xxx constants below) */
+ UCHAR State; /* 2D */
+ BOOLEAN Alerted[2]; /* 2E */
+ UCHAR Iopl; /* 30 */
+ UCHAR NpxState; /* 31 */
+ CHAR Saturation; /* 32 */
+ CHAR Priority; /* 33 */
+ KAPC_STATE ApcState; /* 34 */
+ ULONG ContextSwitches; /* 4C */
+ LONG WaitStatus; /* 50 */
+ KIRQL WaitIrql; /* 54 */
+ CHAR WaitMode; /* 55 */
+ UCHAR WaitNext; /* 56 */
+ UCHAR WaitReason; /* 57 */
+ union { /* 58 */
+ PKWAIT_BLOCK WaitBlockList; /* 58 */
+ PKGATE GateObject; /* 58 */
+ }; /* 58 */
+ LIST_ENTRY WaitListEntry; /* 5C */
+ ULONG WaitTime; /* 64 */
+ CHAR BasePriority; /* 68 */
+ UCHAR DecrementCount; /* 69 */
+ UCHAR PriorityDecrement; /* 6A */
+ CHAR Quantum; /* 6B */
+ KWAIT_BLOCK WaitBlock[4]; /* 6C */
+ PVOID LegoData; /* CC */
+ union {
+ struct {
+ USHORT KernelApcDisable;
+ USHORT SpecialApcDisable;
+ };
+ ULONG CombinedApcDisable; /* D0 */
+ };
+ KAFFINITY UserAffinity; /* D4 */
+ UCHAR SystemAffinityActive;/* D8 */
+ UCHAR PowerState; /* D9 */
+ UCHAR NpxIrql; /* DA */
+ UCHAR Pad[1]; /* DB */
+ PVOID ServiceTable; /* DC */
+ PKQUEUE Queue; /* E0 */
+ KSPIN_LOCK ApcQueueLock; /* E4 */
+ KTIMER Timer; /* E8 */
+ LIST_ENTRY QueueListEntry; /* 110 */
+ KAFFINITY Affinity; /* 118 */
+ UCHAR Preempted; /* 11C */
+ UCHAR ProcessReadyQueue; /* 11D */
+ UCHAR KernelStackResident; /* 11E */
+ UCHAR NextProcessor; /* 11F */
+ PVOID CallbackStack; /* 120 */
+ struct _W32THREAD *Win32Thread; /* 124 */
+ struct _KTRAP_FRAME *TrapFrame; /* 128 */
+ PKAPC_STATE ApcStatePointer[2]; /* 12C */
+ UCHAR EnableStackSwap; /* 134 */
+ UCHAR LargeStack; /* 135 */
+ UCHAR ResourceIndex; /* 136 */
+ UCHAR PreviousMode; /* 137 */
+ ULONG KernelTime; /* 138 */
+ ULONG UserTime; /* 13C */
+ KAPC_STATE SavedApcState; /* 140 */
+ UCHAR Alertable; /* 158 */
+ UCHAR ApcStateIndex; /* 159 */
+ UCHAR ApcQueueable; /* 15A */
+ UCHAR AutoAlignment; /* 15B */
+ PVOID StackBase; /* 15C */
+ KAPC SuspendApc; /* 160 */
+ KSEMAPHORE SuspendSemaphore; /* 190 */
+ LIST_ENTRY ThreadListEntry; /* 1A4 */
+ CHAR FreezeCount; /* 1AC */
+ UCHAR SuspendCount; /* 1AD */
+ UCHAR IdealProcessor; /* 1AE */
+ UCHAR DisableBoost; /* 1AF */
+ UCHAR QuantumReset; /* 1B0 */
+} KTHREAD;
+
+#include <poppack.h>
+
+typedef struct _KEXECUTE_OPTIONS
+{
+ UCHAR ExecuteDisable:1;
+ UCHAR ExecuteEnable:1;
+ UCHAR DisableThunkEmulation:1;
+ UCHAR Permanent:1;
+ UCHAR ExecuteDispatchEnable:1;
+ UCHAR ImageDispatchEnable:1;
+ UCHAR Spare:2;
+} KEXECUTE_OPTIONS, *PKEXECUTE_OPTIONS;
+
+/*
+ * NAME: KPROCESS
+ * DESCRIPTION: Internal Kernel Process Structure.
+ * PORTABILITY: Architecture Dependent.
+ * KERNEL VERSION: 5.2
+ * DOCUMENTATION: http://reactos.com/wiki/index.php/KPROCESS
+ */
+typedef struct _KPROCESS
+{
+ DISPATCHER_HEADER Header; /* 000 */
+ LIST_ENTRY ProfileListHead; /* 010 */
+ PHYSICAL_ADDRESS DirectoryTableBase; /* 018 */
+ KGDTENTRY LdtDescriptor; /* 020 */
+ KIDTENTRY Int21Descriptor; /* 028 */
+ USHORT IopmOffset; /* 030 */
+ UCHAR Iopl; /* 032 */
+ UCHAR Unused; /* 033 */
+ ULONG ActiveProcessors; /* 034 */
+ ULONG KernelTime; /* 038 */
+ ULONG UserTime; /* 03C */
+ LIST_ENTRY ReadyListHead; /* 040 */
+ LIST_ENTRY SwapListEntry; /* 048 */
+ PVOID VdmTrapcHandler; /* 04C */
+ LIST_ENTRY ThreadListHead; /* 050 */
+ KSPIN_LOCK ProcessLock; /* 058 */
+ KAFFINITY Affinity; /* 05C */
+ union {
+ struct {
+ ULONG AutoAlignment:1; /* 060.0 */
+ ULONG DisableBoost:1; /* 060.1 */
+ ULONG DisableQuantum:1; /* 060.2 */
+ ULONG ReservedFlags:29; /* 060.3 */
+ };
+ ULONG ProcessFlags; /* 060 */
+ };
+ CHAR BasePriority; /* 064 */
+ CHAR QuantumReset; /* 065 */
+ UCHAR State; /* 066 */
+ UCHAR ThreadSeed; /* 067 */
+ UCHAR PowerState; /* 068 */
+ UCHAR IdealNode; /* 069 */
+ UCHAR Visited; /* 06A */
+ KEXECUTE_OPTIONS Flags; /* 06B */
+ ULONG StackCount; /* 06C */
+ LIST_ENTRY ProcessListEntry; /* 070 */
+} KPROCESS;
+
/* INTERNAL KERNEL FUNCTIONS ************************************************/
#ifdef __USE_W32API
@@ -36,9 +221,6 @@
VOID KeSetGdtSelector(ULONG Entry, ULONG Value1, ULONG Value2);
#endif
-#ifndef __ASM__
-
-struct _KTHREAD;
struct _KIRQ_TRAPFRAME;
struct _KPCR;
struct _KPRCB;
@@ -82,6 +264,10 @@
} \
}
+#ifndef __USE_W32API
+#define KeGetCurrentProcessorNumber() (KeGetCurrentKPCR()->ProcessorNumber)
+#endif
+
/* threadsch.c ********************************************************************/
/* Thread Scheduler Functions */
--- trunk/reactos/ntoskrnl/include/internal/ps.h 2005-05-05 22:36:25 UTC (rev 15026)
+++ trunk/reactos/ntoskrnl/include/internal/ps.h 2005-05-05 22:40:05 UTC (rev 15027)
@@ -42,110 +42,12 @@
#ifndef __ASM__
#include <internal/mm.h>
+#include <internal/ke.h>
#include <napi/teb.h>
-#ifndef KeGetCurrentProcessorNumber
-#define KeGetCurrentProcessorNumber() (KeGetCurrentKPCR()->ProcessorNumber)
-#endif
-
extern LCID PsDefaultThreadLocaleId;
extern LCID PsDefaultSystemLocaleId;
-#include <pshpack1.h>
-
-typedef struct _KTHREAD
-{
- /* For waiting on thread exit */
- DISPATCHER_HEADER DispatcherHeader; /* 00 */
-
- /* List of mutants owned by the thread */
- LIST_ENTRY MutantListHead; /* 10 */
- PVOID InitialStack; /* 18 */
- ULONG_PTR StackLimit; /* 1C */
-
- /* Pointer to the thread's environment block in user memory */
- PTEB Teb; /* 20 */
-
- /* Pointer to the thread's TLS array */
- PVOID TlsArray; /* 24 */
- PVOID KernelStack; /* 28 */
- UCHAR DebugActive; /* 2C */
-
- /* Thread state (one of THREAD_STATE_xxx constants below) */
- UCHAR State; /* 2D */
- BOOLEAN Alerted[2]; /* 2E */
- UCHAR Iopl; /* 30 */
- UCHAR NpxState; /* 31 */
- CHAR Saturation; /* 32 */
- CHAR Priority; /* 33 */
- KAPC_STATE ApcState; /* 34 */
- ULONG ContextSwitches; /* 4C */
- LONG WaitStatus; /* 50 */
- KIRQL WaitIrql; /* 54 */
- CHAR WaitMode; /* 55 */
- UCHAR WaitNext; /* 56 */
- UCHAR WaitReason; /* 57 */
- union { /* 58 */
- PKWAIT_BLOCK WaitBlockList; /* 58 */
- PKGATE GateObject; /* 58 */
- }; /* 58 */
- LIST_ENTRY WaitListEntry; /* 5C */
- ULONG WaitTime; /* 64 */
- CHAR BasePriority; /* 68 */
- UCHAR DecrementCount; /* 69 */
- UCHAR PriorityDecrement; /* 6A */
- CHAR Quantum; /* 6B */
- KWAIT_BLOCK WaitBlock[4]; /* 6C */
- PVOID LegoData; /* CC */
- union {
- struct {
- USHORT KernelApcDisable;
- USHORT SpecialApcDisable;
- };
- ULONG CombinedApcDisable; /* D0 */
- };
- KAFFINITY UserAffinity; /* D4 */
- UCHAR SystemAffinityActive;/* D8 */
- UCHAR PowerState; /* D9 */
- UCHAR NpxIrql; /* DA */
- UCHAR Pad[1]; /* DB */
- SSDT_ENTRY *ServiceTable; /* DC */
- PKQUEUE Queue; /* E0 */
- KSPIN_LOCK ApcQueueLock; /* E4 */
- KTIMER Timer; /* E8 */
- LIST_ENTRY QueueListEntry; /* 110 */
- KAFFINITY Affinity; /* 118 */
- UCHAR Preempted; /* 11C */
- UCHAR ProcessReadyQueue; /* 11D */
- UCHAR KernelStackResident; /* 11E */
- UCHAR NextProcessor; /* 11F */
- PVOID CallbackStack; /* 120 */
- struct _W32THREAD *Win32Thread; /* 124 */
- struct _KTRAP_FRAME *TrapFrame; /* 128 */
- PKAPC_STATE ApcStatePointer[2]; /* 12C */
- UCHAR EnableStackSwap; /* 134 */
- UCHAR LargeStack; /* 135 */
- UCHAR ResourceIndex; /* 136 */
- UCHAR PreviousMode; /* 137 */
- ULONG KernelTime; /* 138 */
- ULONG UserTime; /* 13C */
- KAPC_STATE SavedApcState; /* 140 */
- UCHAR Alertable; /* 158 */
- UCHAR ApcStateIndex; /* 159 */
- UCHAR ApcQueueable; /* 15A */
- UCHAR AutoAlignment; /* 15B */
- PVOID StackBase; /* 15C */
- KAPC SuspendApc; /* 160 */
- KSEMAPHORE SuspendSemaphore; /* 190 */
- LIST_ENTRY ThreadListEntry; /* 1A4 */
- CHAR FreezeCount; /* 1AC */
- UCHAR SuspendCount; /* 1AD */
- UCHAR IdealProcessor; /* 1AE */
- UCHAR DisableBoost; /* 1AF */
-} KTHREAD;
-
-#include <poppack.h>
-
/* Top level irp definitions. */
#define FSRTL_FSP_TOP_LEVEL_IRP (0x01)
#define FSRTL_CACHE_TOP_LEVEL_IRP (0x02)
@@ -219,105 +121,12 @@
#include <poppack.h>
-
#ifndef __USE_W32API
typedef struct _ETHREAD *PETHREAD;
#endif /* __USE_W32API */
-
-typedef struct _KPROCESS
-{
- /* So it's possible to wait for the process to terminate */
- DISPATCHER_HEADER DispatcherHeader; /* 000 */
- /*
- * Presumably a list of profile objects associated with this process,
- * currently unused.
- */
- LIST_ENTRY ProfileListHead; /* 010 */
- /*
- * We use the first member of this array to hold the physical address of
- * the page directory for this process.
- */
- PHYSICAL_ADDRESS DirectoryTableBase; /* 018 */
- /*
- * Presumably a descriptor for the process's LDT, currently unused.
- */
- ULONG LdtDescriptor[2]; /* 020 */
- /*
- * Virtual Dos Machine flag.
- */
- ULONG NtVdmFlag; /* 028 */
- ULONG VdmUnused; /* 02C */
- /* Is the i/o permission map enabled for the process. */
- USHORT IopmOffset; /* 030 */
- /*
- * Presumably I/O privilege level to be used for this process, currently
- * unused.
- */
- UCHAR Iopl; /* 032 */
- /* Set if this process is a virtual dos machine? */
- UCHAR VdmFlag; /* 033 */
- /* Bitmask of the processors being used by this process's threads? */
- ULONG ActiveProcessors; /* 034 */
- /* Aggregate of the time this process's threads have spent in kernel mode? */
- ULONG KernelTime; /* 038 */
- /* Aggregate of the time this process's threads have spent in user mode? */
- ULONG UserTime; /* 03C */
- /* List of this process's threads that are ready for execution? */
- LIST_ENTRY ReadyListHead; /* 040 */
- /* List of this process's threads that have their stacks swapped out? */
- LIST_ENTRY SwapListEntry; /* 048 */
- /* List of this process's threads? */
- LIST_ENTRY ThreadListHead; /* 050 */
- /* Maybe a lock for this data structure, the type is assumed. */
- KSPIN_LOCK ProcessLock; /* 058 */
- /* Default affinity mask for this process's threads? */
- ULONG Affinity; /* 05C */
- /* Count of the stacks allocated for this process's threads? */
- USHORT StackCount; /* 060 */
- /* Base priority for this process's threads? */
- KPRIORITY BasePriority; /* 062 */
- /* Default quantum for this process's threads */
- UCHAR ThreadQuantum; /* 063 */
- /* Unknown. */
- UCHAR AutoAlignment; /* 064 */
- /* Process execution state, currently either active or terminated. */
- UCHAR State; /* 065 */
- /* Seed for generating thread ids for this process's threads? */
- UCHAR ThreadSeed; /* 066 */
- /* Disable priority boosts? */
- UCHAR DisableBoost; /* 067 */
-} KPROCESS;
-
-#ifndef __USE_W32API
-
-typedef struct _KPROCESS *PKPROCESS;
-
-typedef struct _HARDWARE_PTE_X86 {
- ULONG Valid : 1;
- ULONG Write : 1;
- ULONG Owner : 1;
- ULONG WriteThrough : 1;
- ULONG CacheDisable : 1;
- ULONG Accessed : 1;
- ULONG Dirty : 1;
- ULONG LargePage : 1;
- ULONG Global : 1;
- ULONG CopyOnWrite : 1;
- ULONG Prototype : 1;
- ULONG reserved : 1;
- ULONG PageFrameNumber : 20;
-} HARDWARE_PTE_X86, *PHARDWARE_PTE_X86;
-
-typedef struct _WOW64_PROCESS
-{
- PVOID Wow64;
-} WOW64_PROCESS, *PWOW64_PROCESS;
-
-#endif /* __USE_W32API */
-
struct _EPROCESS
{
/* Microkernel specific process state. */
--- trunk/reactos/ntoskrnl/ke/dpc.c 2005-05-05 22:36:25 UTC (rev 15026)
+++ trunk/reactos/ntoskrnl/ke/dpc.c 2005-05-05 22:40:05 UTC (rev 15027)
@@ -444,9 +444,10 @@
/* Check if Quantum expired */
if (CurrentThread->Quantum <= 0) {
- /* Set the new Quantum */
- CurrentThread->Quantum = Process->ThreadQuantum;
+ /* Reset the new Quantum */
+ CurrentThread->Quantum = CurrentThread->QuantumReset;
+
/* Calculate new priority */
OldPriority = CurrentThread->Priority;
if (OldPriority < LOW_REALTIME_PRIORITY) {
--- trunk/reactos/ntoskrnl/ke/event.c 2005-05-05 22:36:25 UTC (rev 15026)
+++ trunk/reactos/ntoskrnl/ke/event.c 2005-05-05 22:40:05 UTC (rev 15027)
@@ -259,7 +259,7 @@
if ARGUMENT_PRESENT(Thread) *Thread = WaitingThread;
/* Reset the Quantum and Unwait the Thread */
- WaitingThread->Quantum = WaitingThread->ApcState.Process->ThreadQuantum;
+ WaitingThread->Quantum = WaitingThread->QuantumReset;
KiAbortWaitThread(WaitingThread, STATUS_SUCCESS, EVENT_INCREMENT);
}
--- trunk/reactos/ntoskrnl/ke/i386/ldt.c 2005-05-05 22:36:25 UTC (rev 15026)
+++ trunk/reactos/ntoskrnl/ke/i386/ldt.c 2005-05-05 22:40:05 UTC (rev 15027)
@@ -84,7 +84,7 @@
KeAcquireSpinLock(&LdtLock, &oldIrql);
- LdtDescriptor = (PUSHORT) &KeGetCurrentProcess()->LdtDescriptor[0];
+ LdtDescriptor = (PUSHORT) &KeGetCurrentProcess()->LdtDescriptor;
LdtBase = LdtDescriptor[1] |
((LdtDescriptor[2] & 0xff) << 16) |
((LdtDescriptor[3] & ~0xff) << 16);
--- trunk/reactos/ntoskrnl/ke/i386/v86m.c 2005-05-05 22:36:25 UTC (rev 15026)
+++ trunk/reactos/ntoskrnl/ke/i386/v86m.c 2005-05-05 22:40:05 UTC (rev 15027)
@@ -688,7 +688,8 @@
VTf = (PKV86M_TRAP_FRAME)Tf;
- if(KeGetCurrentProcess()->NtVdmFlag)
+ /* FIXME: This should use ->VdmObjects */
+ if(KeGetCurrentProcess()->Unused)
{
VTf->regs->PStatus = (PNTSTATUS) ExceptionNr;
if(ExceptionNr != 14) return 1;
@@ -799,7 +800,8 @@
Tf->ErrorCode);
if (!NT_SUCCESS(Status))
{
- if(KeGetCurrentProcess()->NtVdmFlag)
+ /* FIXME: This should use ->VdmObjects */
+ if(KeGetCurrentProcess()->Unused)
{
VTf->regs->PStatus = (PNTSTATUS) STATUS_NONCONTINUABLE_EXCEPTION;
return 1;
--- trunk/reactos/ntoskrnl/ke/i386/vdm.c 2005-05-05 22:36:25 UTC (rev 15026)
+++ trunk/reactos/ntoskrnl/ke/i386/vdm.c 2005-05-05 22:40:05 UTC (rev 15027)
@@ -64,9 +64,12 @@
sizeof(KV86M_REGISTERS));
if(!NT_SUCCESS(ret)) return ret;
- KeGetCurrentProcess()->NtVdmFlag = 1;
+ /* FIXME: This should use ->VdmObjects */
+ KeGetCurrentProcess()->Unused = 1;
Ki386RetToV86Mode(&V86Registers, &V86Registers);
- KeGetCurrentProcess()->NtVdmFlag = 0;
+
+ /* FIXME: This should use ->VdmObjects */
+ KeGetCurrentProcess()->Unused = 0;
ret = MmCopyToCaller(ControlData,
&V86Registers,
--- trunk/reactos/ntoskrnl/ke/kthread.c 2005-05-05 22:36:25 UTC (rev 15026)
+++ trunk/reactos/ntoskrnl/ke/kthread.c 2005-05-05 22:40:05 UTC (rev 15027)
@@ -272,7 +272,7 @@
} else {
- Thread->Quantum = Thread->ApcState.Process->ThreadQuantum;
+ Thread->Quantum = Thread->QuantumReset;
}
if (WaitStatus != NULL) {
@@ -771,7 +771,8 @@
/* Setup scheduler Fields based on Parent */
DPRINT("Thread context created, setting Scheduler Data\n");
Thread->BasePriority = Process->BasePriority;
- Thread->Quantum = Process->ThreadQuantum;
+ Thread->Quantum = Process->QuantumReset;
+ Thread->QuantumReset = Process->QuantumReset;
Thread->Affinity = Process->Affinity;
Thread->Priority = Process->BasePriority;
Thread->UserAffinity = Process->Affinity;
--- trunk/reactos/ntoskrnl/ke/process.c 2005-05-05 22:36:25 UTC (rev 15026)
+++ trunk/reactos/ntoskrnl/ke/process.c 2005-05-05 22:40:05 UTC (rev 15027)
@@ -73,7 +73,7 @@
DPRINT("KeInitializeProcess. Process: %x, DirectoryTableBase: %x\n", Process, DirectoryTableBase);
/* Initialize the Dispatcher Header */
- KeInitializeDispatcherHeader(&Process->DispatcherHeader,
+ KeInitializeDispatcherHeader(&Process->Header,
ProcessObject,
sizeof(KPROCESS),
FALSE);
@@ -81,7 +81,7 @@
/* Initialize Scheduler Data, Disable Alignment Faults and Set the PDE */
Process->Affinity = Affinity;
Process->BasePriority = Priority;
- Process->ThreadQuantum = 6;
+ Process->QuantumReset = 6;
Process->DirectoryTableBase = DirectoryTableBase;
Process->AutoAlignment = TRUE;
Process->IopmOffset = 0xFFFF;
@@ -104,11 +104,11 @@
OldIrql = KeAcquireDispatcherDatabaseLock();
/* Get Old State */
- OldState = Process->DispatcherHeader.SignalState;
+ OldState = Process->Header.SignalState;
/* Signal the Process */
- Process->DispatcherHeader.SignalState = TRUE;
- if ((OldState == 0) && IsListEmpty(&Process->DispatcherHeader.WaitListHead) != TRUE) {
+ Process->Header.SignalState = TRUE;
+ if ((OldState == 0) && IsListEmpty(&Process->Header.WaitListHead) != TRUE) {
/* Satisfy waits */
KiWaitTest((PVOID)Process, Increment);
@@ -198,19 +198,12 @@
VOID
STDCALL
-KiSwapProcess(PKPROCESS NewProcess, PKPROCESS OldProcess)
+KiSwapProcess(PKPROCESS NewProcess,
+ PKPROCESS OldProcess)
{
- //PKPCR Pcr = KeGetCurrentKpcr();
-
- /* Do they have an LDT? */
- if ((NewProcess->LdtDescriptor) || (OldProcess->LdtDescriptor)) {
-
- /* FIXME : SWitch GDT/IDT */
- }
+ /* FIXME: Write this in ASM. Much easier */
DPRINT("Switching CR3 to: %x\n", NewProcess->DirectoryTableBase.u.LowPart);
Ke386SetPageTableDirectory(NewProcess->DirectoryTableBase.u.LowPart);
-
- /* FIXME: Set IopmOffset in TSS */
}
/*
--- trunk/reactos/ntoskrnl/mm/i386/page.c 2005-05-05 22:36:25 UTC (rev 15026)
+++ trunk/reactos/ntoskrnl/mm/i386/page.c 2005-05-05 22:40:05 UTC (rev 15027)
@@ -203,7 +203,7 @@
DPRINT("Mmi386ReleaseMmInfo(Process %x)\n",Process);
- LdtDescriptor = (PUSHORT) &Process->Pcb.LdtDescriptor[0];
+ LdtDescriptor = (PUSHORT) &Process->Pcb.LdtDescriptor;
LdtBase = LdtDescriptor[1] |
((LdtDescriptor[2] & 0xff) << 16) |
((LdtDescriptor[3] & ~0xff) << 16);
--- trunk/reactos/ntoskrnl/ps/psmgr.c 2005-05-05 22:36:25 UTC (rev 15026)
+++ trunk/reactos/ntoskrnl/ps/psmgr.c 2005-05-05 22:40:05 UTC (rev 15027)
@@ -182,14 +182,12 @@
PsIdleProcess->Pcb.Affinity = 0xFFFFFFFF;
PsIdleProcess->Pcb.IopmOffset = 0xffff;
- PsIdleProcess->Pcb.LdtDescriptor[0] = 0;
- PsIdleProcess->Pcb.LdtDescriptor[1] = 0;
PsIdleProcess->Pcb.BasePriority = PROCESS_PRIO_IDLE;
- PsIdleProcess->Pcb.ThreadQuantum = 6;
+ PsIdleProcess->Pcb.QuantumReset = 6;
InitializeListHead(&PsIdleProcess->Pcb.ThreadListHead);
InitializeListHead(&PsIdleProcess->ThreadListHead);
InitializeListHead(&PsIdleProcess->ProcessListEntry);
- KeInitializeDispatcherHeader(&PsIdleProcess->Pcb.DispatcherHeader,
+ KeInitializeDispatcherHeader(&PsIdleProcess->Pcb.Header,
ProcessObject,
sizeof(EPROCESS),
FALSE);
@@ -217,14 +215,13 @@
}
/* System threads may run on any processor. */
+ RtlZeroMemory(PsInitialSystemProcess, sizeof(EPROCESS));
PsInitialSystemProcess->Pcb.Affinity = 0xFFFFFFFF;
PsInitialSystemProcess->Pcb.IopmOffset = 0xffff;
- PsInitialSystemProcess->Pcb.LdtDescriptor[0] = 0;
- PsInitialSystemProcess->Pcb.LdtDescriptor[1] = 0;
PsInitialSystemProcess->Pcb.BasePriority = PROCESS_PRIO_NORMAL;
- PsInitialSystemProcess->Pcb.ThreadQuantum = 6;
+ PsInitialSystemProcess->Pcb.QuantumReset = 6;
InitializeListHead(&PsInitialSystemProcess->Pcb.ThreadListHead);
- KeInitializeDispatcherHeader(&PsInitialSystemProcess->Pcb.DispatcherHeader,
+ KeInitializeDispatcherHeader(&PsInitialSystemProcess->Pcb.Header,
ProcessObject,
sizeof(EPROCESS),
FALSE);
@@ -234,8 +231,6 @@
&PsInitialSystemProcess->AddressSpace);
KeInitializeEvent(&PsInitialSystemProcess->LockEvent, SynchronizationEvent, FALSE);
- PsInitialSystemProcess->LockCount = 0;
- PsInitialSystemProcess->LockOwner = NULL;
#if defined(__GNUC__)
KProcess->DirectoryTableBase =
--- trunk/reactos/w32api/include/ddk/ntifs.h 2005-05-05 22:36:25 UTC (rev 15026)
+++ trunk/reactos/w32api/include/ddk/ntifs.h 2005-05-05 22:40:05 UTC (rev 15027)
@@ -464,7 +464,6 @@
typedef PVOID PEJOB;
typedef PVOID OPLOCK, *POPLOCK;
-typedef PVOID PWOW64_PROCESS;
typedef struct _CACHE_MANAGER_CALLBACKS *PCACHE_MANAGER_CALLBACKS;
typedef struct _EPROCESS_QUOTA_BLOCK *PEPROCESS_QUOTA_BLOCK;
@@ -530,22 +529,6 @@
ObjectProtectionInfo
} OBJECT_INFO_CLASS;
-typedef struct _HARDWARE_PTE_X86 {
- ULONG Valid : 1;
- ULONG Write : 1;
- ULONG Owner : 1;
- ULONG WriteThrough : 1;
- ULONG CacheDisable : 1;
- ULONG Accessed : 1;
- ULONG Dirty : 1;
- ULONG LargePage : 1;
- ULONG Global : 1;
- ULONG CopyOnWrite : 1;
- ULONG Prototype : 1;
- ULONG reserved : 1;
- ULONG PageFrameNumber : 20;
-} HARDWARE_PTE_X86, *PHARDWARE_PTE_X86;
-
typedef struct _KAPC_STATE {
LIST_ENTRY ApcListHead[2];
PKPROCESS Process;
@@ -554,38 +537,6 @@
BOOLEAN UserApcPending;
} KAPC_STATE, *PKAPC_STATE, *__restrict PRKAPC_STATE;
-typedef struct _KGDTENTRY {
- USHORT LimitLow;
- USHORT BaseLow;
- union {
- struct {
- UCHAR BaseMid;
- UCHAR Flags1;
- UCHAR Flags2;
- UCHAR BaseHi;
- } Bytes;
- struct {
- ULONG BaseMid : 8;
- ULONG Type : 5;
- ULONG Dpl : 2;
- ULONG Pres : 1;
- ULONG LimitHi : 4;
- ULONG Sys : 1;
- ULONG Reserved_0 : 1;
- ULONG Default_Big : 1;
- ULONG Granularity : 1;
- ULONG BaseHi : 8;
- } Bits;
- } HighWord;
-} KGDTENTRY, *PKGDTENTRY;
-
-typedef struct _KIDTENTRY {
- USHORT Offset;
- USHORT Selector;
- USHORT Access;
- USHORT ExtendedOffset;
-} KIDTENTRY, *PKIDTENTRY;
-
#if (VER_PRODUCTBUILD >= 2600)
typedef struct _MMSUPPORT_FLAGS {