Author: fireball
Date: Mon Sep 24 18:01:54 2007
New Revision: 29188
URL:
http://svn.reactos.org/svn/reactos?rev=29188&view=rev
Log:
- Add Ex*Spinlock macros and FLUSH_MULTIPLE_MAXIMUM definitions missing from DDK
- Add KeAcquireQueuedSpinLock / KeAcquireReleaseQueuedSpinLock, RtlCompareMemoryUlong
definitions missing from IFS.
- Add actual section object definition to NDK
- More NDK fixes
- Fix incorrect definition of MMPTE_LIST
- Fix incorrect prototype of NtFlushVirtualMemory
- Fix incorrect prototypes of KeAcquire / ReleaseQueuedSpinLock
- Add a second parameter to MmCreateKernelStack to select the NUMA node on which the stack
should be allocated
- Avoid usage of PROS_SECTION_OBJECT in Ps where possible
- Unimplement PsChargeProcessQuota. It was not working right
- Use PFN_NUMBER defined in DDK instead of PFN_TYPE internal ROS Type.
Modified:
trunk/reactos/hal/halx86/mp/spinlock.c
trunk/reactos/include/ddk/ntifs.h
trunk/reactos/include/ddk/winddk.h
trunk/reactos/include/ndk/i386/mmtypes.h
trunk/reactos/include/ndk/mmfuncs.h
trunk/reactos/include/ndk/mmtypes.h
trunk/reactos/include/ndk/pstypes.h
trunk/reactos/ntoskrnl/include/internal/ke.h
trunk/reactos/ntoskrnl/include/internal/mm.h
trunk/reactos/ntoskrnl/include/internal/ps.h
trunk/reactos/ntoskrnl/include/internal/ps_x.h
trunk/reactos/ntoskrnl/io/iomgr/iomdl.c
trunk/reactos/ntoskrnl/ke/i386/kiinit.c
trunk/reactos/ntoskrnl/ke/spinlock.c
trunk/reactos/ntoskrnl/ke/thrdobj.c
trunk/reactos/ntoskrnl/mm/procsup.c
trunk/reactos/ntoskrnl/mm/virtual.c
trunk/reactos/ntoskrnl/ps/query.c
trunk/reactos/ntoskrnl/ps/quota.c
trunk/reactos/ntoskrnl/ps/win32.c
Modified: trunk/reactos/hal/halx86/mp/spinlock.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/mp/spinlock.c?r…
==============================================================================
--- trunk/reactos/hal/halx86/mp/spinlock.c (original)
+++ trunk/reactos/hal/halx86/mp/spinlock.c Mon Sep 24 18:01:54 2007
@@ -170,7 +170,7 @@
*/
KIRQL
FASTCALL
-KeAcquireQueuedSpinLock(IN PKLOCK_QUEUE_HANDLE LockHandle)
+KeAcquireQueuedSpinLock(IN KSPIN_LOCK_QUEUE_NUMBER Number)
{
UNIMPLEMENTED;
return 0;
@@ -192,7 +192,7 @@
*/
VOID
FASTCALL
-KeReleaseQueuedSpinLock(IN PKLOCK_QUEUE_HANDLE LockHandle,
+KeReleaseQueuedSpinLock(IN KSPIN_LOCK_QUEUE_NUMBER Number,
IN KIRQL OldIrql)
{
UNIMPLEMENTED;
Modified: trunk/reactos/include/ddk/ntifs.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ddk/ntifs.h?rev=29…
==============================================================================
--- trunk/reactos/include/ddk/ntifs.h (original)
+++ trunk/reactos/include/ddk/ntifs.h Mon Sep 24 18:01:54 2007
@@ -3460,6 +3460,21 @@
IN BOOLEAN AllowRawMount
);
+NTHALAPI
+KIRQL
+FASTCALL
+KeAcquireQueuedSpinLock (
+ IN KSPIN_LOCK_QUEUE_NUMBER Number
+);
+
+NTHALAPI
+VOID
+FASTCALL
+KeReleaseQueuedSpinLock (
+ IN KSPIN_LOCK_QUEUE_NUMBER Number,
+ IN KIRQL OldIrql
+);
+
NTKERNELAPI
VOID
NTAPI
@@ -3885,6 +3900,15 @@
IN ULONG FramesToCapture,
OUT PVOID *BackTrace,
OUT PULONG BackTraceHash OPTIONAL
+);
+
+NTSYSAPI
+SIZE_T
+NTAPI
+RtlCompareMemoryUlong (
+ PVOID Source,
+ SIZE_T Length,
+ ULONG Pattern
);
NTSYSAPI
Modified: trunk/reactos/include/ddk/winddk.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ddk/winddk.h?rev=2…
==============================================================================
--- trunk/reactos/include/ddk/winddk.h (original)
+++ trunk/reactos/include/ddk/winddk.h Mon Sep 24 18:01:54 2007
@@ -4743,6 +4743,8 @@
typedef LONG SPFN_NUMBER, *PSPFN_NUMBER;
typedef ULONG PFN_NUMBER, *PPFN_NUMBER;
+#define FLUSH_MULTIPLE_MAXIMUM 32
+
typedef enum _MM_SYSTEM_SIZE {
MmSmallSystem,
MmMediumSystem,
@@ -8899,6 +8901,11 @@
*/
#define KeFlushIoBuffers(_Mdl, _ReadOperation, _DmaOperation)
+#define ExAcquireSpinLock(Lock, OldIrql) KeAcquireSpinLock((Lock), (OldIrql))
+#define ExReleaseSpinLock(Lock, OldIrql) KeReleaseSpinLock((Lock), (OldIrql))
+#define ExAcquireSpinLockAtDpcLevel(Lock) KeAcquireSpinLockAtDpcLevel(Lock)
+#define ExReleaseSpinLockFromDpcLevel(Lock) KeReleaseSpinLockFromDpcLevel(Lock)
+
NTHALAPI
VOID
NTAPI
Modified: trunk/reactos/include/ndk/i386/mmtypes.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ndk/i386/mmtypes.h…
==============================================================================
--- trunk/reactos/include/ndk/i386/mmtypes.h (original)
+++ trunk/reactos/include/ndk/i386/mmtypes.h Mon Sep 24 18:01:54 2007
@@ -114,8 +114,10 @@
{
ULONG Valid:1;
ULONG OneEntry:1;
- ULONG filler10:10;
+ ULONG filler0:8;
ULONG NextEntry:20;
+ ULONG Prototype:1;
+ ULONG filler1:1;
} MMPTE_LIST;
#ifndef CONFIG_SMP
Modified: trunk/reactos/include/ndk/mmfuncs.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ndk/mmfuncs.h?rev=…
==============================================================================
--- trunk/reactos/include/ndk/mmfuncs.h (original)
+++ trunk/reactos/include/ndk/mmfuncs.h Mon Sep 24 18:01:54 2007
@@ -133,9 +133,9 @@
NTAPI
NtFlushVirtualMemory(
IN HANDLE ProcessHandle,
- IN PVOID BaseAddress,
- IN ULONG NumberOfBytesToFlush,
- OUT PULONG NumberOfBytesFlushed OPTIONAL
+ IN OUT PVOID *BaseAddress,
+ IN OUT PSIZE_T RegionSize,
+ OUT PIO_STATUS_BLOCK IoStatus
);
NTSTATUS
Modified: trunk/reactos/include/ndk/mmtypes.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ndk/mmtypes.h?rev=…
==============================================================================
--- trunk/reactos/include/ndk/mmtypes.h (original)
+++ trunk/reactos/include/ndk/mmtypes.h Mon Sep 24 18:01:54 2007
@@ -508,6 +508,22 @@
} MM_AVL_TABLE, *PMM_AVL_TABLE;
//
+// Actual Section Object
+//
+typedef struct _SECTION
+{
+ MMADDRESS_NODE Address;
+ PSEGMENT Segment;
+ LARGE_INTEGER SizeOfSection;
+ union
+ {
+ ULONG LongFlags;
+ MMSECTION_FLAGS Flags;
+ } u;
+ ULONG InitialPageProtection;
+} SECTION, *PSECTION;
+
+//
// Memory Manager Working Set Structures
//
typedef struct _MMWSLENTRY
@@ -567,11 +583,14 @@
ULONG BeingTrimmed:1;
ULONG SessionLeader:1;
ULONG TrimHard:1;
- ULONG WorkingSetHard:1;
- ULONG AddressSpaceBeingDeleted :1;
- ULONG Available:10;
- ULONG AllowWorkingSetAdjustment:8;
+ ULONG MaximumWorkingSetHard:1;
+ ULONG ForceTrim:1;
+ ULONG MinimumworkingSetHard:1;
+ ULONG Available0:1;
ULONG MemoryPriority:8;
+ ULONG GrowWsleHash:1;
+ ULONG AcquiredUnsafe:1;
+ ULONG Available:14;
} MMSUPPORT_FLAGS, *PMMSUPPORT_FLAGS;
//
Modified: trunk/reactos/include/ndk/pstypes.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ndk/pstypes.h?rev=…
==============================================================================
--- trunk/reactos/include/ndk/pstypes.h (original)
+++ trunk/reactos/include/ndk/pstypes.h Mon Sep 24 18:01:54 2007
@@ -191,6 +191,7 @@
#define STA_LPC_RECEIVED_MSG_ID_VALID_BIT 0x1
#define STA_LPC_EXIT_THREAD_CALLED_BIT 0x2
#define STA_ADDRESS_SPACE_OWNER_BIT 0x4
+#define STA_OWNS_WORKING_SET_BITS 0x1F8
#endif
#define TLS_EXPANSION_SLOTS 1024
Modified: trunk/reactos/ntoskrnl/include/internal/ke.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
==============================================================================
--- trunk/reactos/ntoskrnl/include/internal/ke.h (original)
+++ trunk/reactos/ntoskrnl/include/internal/ke.h Mon Sep 24 18:01:54 2007
@@ -941,6 +941,18 @@
VOID
);
+VOID
+FASTCALL
+KeAcquireQueuedSpinLockAtDpcLevel(
+ IN OUT PKSPIN_LOCK_QUEUE LockQueue
+);
+
+VOID
+FASTCALL
+KeReleaseQueuedSpinLockFromDpcLevel(
+ IN OUT PKSPIN_LOCK_QUEUE LockQueue
+);
+
#include "ke_x.h"
#endif /* __NTOSKRNL_INCLUDE_INTERNAL_KE_H */
Modified: trunk/reactos/ntoskrnl/include/internal/mm.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
==============================================================================
--- trunk/reactos/ntoskrnl/include/internal/mm.h (original)
+++ trunk/reactos/ntoskrnl/include/internal/mm.h Mon Sep 24 18:01:54 2007
@@ -802,7 +802,7 @@
PVOID
NTAPI
-MmCreateKernelStack(BOOLEAN GuiStack);
+MmCreateKernelStack(BOOLEAN GuiStack, UCHAR Node);
VOID
NTAPI
Modified: trunk/reactos/ntoskrnl/include/internal/ps.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
==============================================================================
--- trunk/reactos/ntoskrnl/include/internal/ps.h (original)
+++ trunk/reactos/ntoskrnl/include/internal/ps.h Mon Sep 24 18:01:54 2007
@@ -57,10 +57,6 @@
#define PSTRACE(x, ...) DPRINT(__VA_ARGS__);
#define PSREFTRACE(x)
#endif
-
-#define PspSetProcessFlag(Process, Flag) \
- InterlockedOr((PLONG)&Process->Flags, Flag)
-
//
// Maximum Count of Notification Routines
Modified: trunk/reactos/ntoskrnl/include/internal/ps_x.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
==============================================================================
--- trunk/reactos/ntoskrnl/include/internal/ps_x.h (original)
+++ trunk/reactos/ntoskrnl/include/internal/ps_x.h Mon Sep 24 18:01:54 2007
@@ -18,6 +18,12 @@
#define PspQuantumLengthFromMask(Mask) \
((Mask) & 48)
+
+//
+// Set Process Flag routines
+//
+#define PspSetProcessFlag(Process, Flag) \
+ InterlockedOr((PLONG)&Process->Flags, Flag)
//
// Cross Thread Flag routines
Modified: trunk/reactos/ntoskrnl/io/iomgr/iomdl.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/iomgr/iomdl.c?…
==============================================================================
--- trunk/reactos/ntoskrnl/io/iomgr/iomdl.c (original)
+++ trunk/reactos/ntoskrnl/io/iomgr/iomdl.c Mon Sep 24 18:01:54 2007
@@ -95,8 +95,8 @@
IN PVOID VirtualAddress,
IN ULONG Length)
{
- PPFN_TYPE TargetPages = (PPFN_TYPE)(TargetMdl + 1);
- PPFN_TYPE SourcePages = (PPFN_TYPE)(SourceMdl + 1);
+ PPFN_NUMBER TargetPages = (PPFN_NUMBER)(TargetMdl + 1);
+ PPFN_NUMBER SourcePages = (PPFN_NUMBER)(SourceMdl + 1);
ULONG Offset;
/* Calculate the offset */
@@ -131,7 +131,7 @@
Offset = ((ULONG_PTR)TargetMdl->StartVa - (ULONG_PTR)SourceMdl->StartVa)
>>
PAGE_SHIFT;
SourcePages += Offset;
- RtlCopyMemory(TargetPages, SourcePages, Length * sizeof(PFN_TYPE));
+ RtlCopyMemory(TargetPages, SourcePages, Length * sizeof(PFN_NUMBER));
}
/*
Modified: trunk/reactos/ntoskrnl/ke/i386/kiinit.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/i386/kiinit.c?…
==============================================================================
--- trunk/reactos/ntoskrnl/ke/i386/kiinit.c (original)
+++ trunk/reactos/ntoskrnl/ke/i386/kiinit.c Mon Sep 24 18:01:54 2007
@@ -580,7 +580,7 @@
Prcb->AdjustDpcThreshold = KiAdjustDpcThreshold;
/* Allocate the DPC Stack */
- DpcStack = MmCreateKernelStack(FALSE);
+ DpcStack = MmCreateKernelStack(FALSE, 0);
if (!DpcStack) KeBugCheckEx(NO_PAGES_AVAILABLE, 1, 0, 0, 0);
Prcb->DpcStack = (PVOID)((ULONG_PTR)DpcStack + KERNEL_STACK_SIZE);
Modified: trunk/reactos/ntoskrnl/ke/spinlock.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/spinlock.c?rev…
==============================================================================
--- trunk/reactos/ntoskrnl/ke/spinlock.c (original)
+++ trunk/reactos/ntoskrnl/ke/spinlock.c Mon Sep 24 18:01:54 2007
@@ -19,7 +19,7 @@
VOID
FASTCALL
-KeAcquireQueuedSpinLockAtDpcLevel(IN PKLOCK_QUEUE_HANDLE LockHandle)
+KeAcquireQueuedSpinLockAtDpcLevel(IN PKSPIN_LOCK_QUEUE LockHandle)
{
#ifdef CONFIG_SMP
PKSPIN_LOCK_QUEUE Prev;
@@ -49,7 +49,7 @@
VOID
FASTCALL
-KeReleaseQueuedSpinLockFromDpcLevel(IN PKLOCK_QUEUE_HANDLE LockHandle)
+KeReleaseQueuedSpinLockFromDpcLevel(IN PKSPIN_LOCK_QUEUE LockHandle)
{
#ifdef CONFIG_SMP
KSPIN_LOCK LockVal;
Modified: trunk/reactos/ntoskrnl/ke/thrdobj.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/thrdobj.c?rev=…
==============================================================================
--- trunk/reactos/ntoskrnl/ke/thrdobj.c (original)
+++ trunk/reactos/ntoskrnl/ke/thrdobj.c Mon Sep 24 18:01:54 2007
@@ -797,7 +797,7 @@
if (!KernelStack)
{
/* We don't, allocate one */
- KernelStack = (PVOID)((ULONG_PTR)MmCreateKernelStack(FALSE) +
+ KernelStack = (PVOID)((ULONG_PTR)MmCreateKernelStack(FALSE, 0) +
KERNEL_STACK_SIZE);
if (!KernelStack) return STATUS_INSUFFICIENT_RESOURCES;
Modified: trunk/reactos/ntoskrnl/mm/procsup.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/procsup.c?rev=…
==============================================================================
--- trunk/reactos/ntoskrnl/mm/procsup.c (original)
+++ trunk/reactos/ntoskrnl/mm/procsup.c Mon Sep 24 18:01:54 2007
@@ -180,7 +180,8 @@
PVOID
STDCALL
-MmCreateKernelStack(BOOLEAN GuiStack)
+MmCreateKernelStack(BOOLEAN GuiStack,
+ UCHAR Node)
{
PMEMORY_AREA StackArea;
ULONG i;
Modified: trunk/reactos/ntoskrnl/mm/virtual.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/virtual.c?rev=…
==============================================================================
--- trunk/reactos/ntoskrnl/mm/virtual.c (original)
+++ trunk/reactos/ntoskrnl/mm/virtual.c Mon Sep 24 18:01:54 2007
@@ -19,9 +19,9 @@
NTSTATUS STDCALL
NtFlushVirtualMemory(IN HANDLE ProcessHandle,
- IN PVOID BaseAddress,
- IN ULONG NumberOfBytesToFlush,
- OUT PULONG NumberOfBytesFlushed OPTIONAL)
+ IN OUT PVOID *BaseAddress,
+ IN OUT PSIZE_T NumberOfBytesToFlush,
+ OUT PIO_STATUS_BLOCK IoStatusBlock)
/*
* FUNCTION: Flushes virtual memory to file
* ARGUMENTS:
Modified: trunk/reactos/ntoskrnl/ps/query.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ps/query.c?rev=29…
==============================================================================
--- trunk/reactos/ntoskrnl/ps/query.c (original)
+++ trunk/reactos/ntoskrnl/ps/query.c Mon Sep 24 18:01:54 2007
@@ -26,18 +26,18 @@
PsReferenceProcessFilePointer(IN PEPROCESS Process,
OUT PFILE_OBJECT *FileObject)
{
- PROS_SECTION_OBJECT Section;
+ PSECTION Section;
PAGED_CODE();
/* Lock the process */
ExAcquireRundownProtection(&Process->RundownProtect);
/* Get the section */
- Section = (PROS_SECTION_OBJECT)Process->SectionObject;
+ Section = Process->SectionObject;
if (Section)
{
/* Get the file object and reference it */
- *FileObject = MmGetFileObjectForSection(Section);
+ *FileObject = MmGetFileObjectForSection((PVOID)Section);
ObReferenceObject(*FileObject);
}
Modified: trunk/reactos/ntoskrnl/ps/quota.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ps/quota.c?rev=29…
==============================================================================
--- trunk/reactos/ntoskrnl/ps/quota.c (original)
+++ trunk/reactos/ntoskrnl/ps/quota.c Mon Sep 24 18:01:54 2007
@@ -113,49 +113,8 @@
IN POOL_TYPE PoolType,
IN ULONG Amount)
{
- PEPROCESS_QUOTA_BLOCK QuotaBlock;
- ULONG NewUsageSize;
- ULONG NewMaxQuota;
-
- /* Get current Quota Block */
- QuotaBlock = Process->QuotaBlock;
-
- /* Quota Operations are not to be done on the SYSTEM Process */
- if (Process == PsInitialSystemProcess) return STATUS_SUCCESS;
-
- /* New Size in use */
- NewUsageSize = QuotaBlock->QuotaEntry[PoolType].Usage + Amount;
-
- /* Does this size respect the quota? */
- if (NewUsageSize > QuotaBlock->QuotaEntry[PoolType].Limit)
- {
- /* It doesn't, so keep raising the Quota */
- while (MiRaisePoolQuota(PoolType,
- QuotaBlock->QuotaEntry[PoolType].Limit,
- &NewMaxQuota))
- {
- /* Save new Maximum Quota */
- QuotaBlock->QuotaEntry[PoolType].Limit = NewMaxQuota;
-
- /* See if the new Maximum Quota fulfills our need */
- if (NewUsageSize <= NewMaxQuota) goto QuotaChanged;
- }
-
- return STATUS_QUOTA_EXCEEDED;
- }
-
-QuotaChanged:
- /* Save new Usage */
- QuotaBlock->QuotaEntry[PoolType].Usage = NewUsageSize;
-
- /* Is this a new peak? */
- if (NewUsageSize > QuotaBlock->QuotaEntry[PoolType].Peak)
- {
- QuotaBlock->QuotaEntry[PoolType].Peak = NewUsageSize;
- }
-
- /* All went well */
- return STATUS_SUCCESS;
+ UNIMPLEMENTED;
+ return STATUS_NOT_IMPLEMENTED;
}
/*
Modified: trunk/reactos/ntoskrnl/ps/win32.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ps/win32.c?rev=29…
==============================================================================
--- trunk/reactos/ntoskrnl/ps/win32.c (original)
+++ trunk/reactos/ntoskrnl/ps/win32.c Mon Sep 24 18:01:54 2007
@@ -52,7 +52,8 @@
if (!Thread->Tcb.LargeStack)
{
/* We don't create one */
- NewStack = (ULONG_PTR)MmCreateKernelStack(TRUE) + KERNEL_LARGE_STACK_SIZE;
+ NewStack = (ULONG_PTR)MmCreateKernelStack(TRUE, 0) +
+ KERNEL_LARGE_STACK_SIZE;
if (!NewStack)
{
/* Panic in user-mode */