mirror of
https://github.com/reactos/reactos.git
synced 2025-06-05 09:20:30 +00:00
- Implement InterlockedExchangeAdd/Decrement/Increment16.
- Fix MM_EXTEND_INFO definition. - Fix MMWSLE definition. - Fix EPROCESS definition. - Add quota functions to NDK. - Add one more parameter to PspMapSystemDll to support mapping large pages. - Don't make the quota functions do anything for the system process. - Add page file quota functions. - Other misc small fixes. svn path=/trunk/; revision=29214
This commit is contained in:
parent
cb82475b6d
commit
432625614e
17 changed files with 250 additions and 49 deletions
|
@ -9686,6 +9686,20 @@ MmMapLockedPages(
|
||||||
IN PMDL MemoryDescriptorList,
|
IN PMDL MemoryDescriptorList,
|
||||||
IN KPROCESSOR_MODE AccessMode);
|
IN KPROCESSOR_MODE AccessMode);
|
||||||
|
|
||||||
|
NTKERNELAPI
|
||||||
|
PVOID
|
||||||
|
NTAPI
|
||||||
|
MmLockPageableDataSection (
|
||||||
|
IN PVOID AddressWithinSection
|
||||||
|
);
|
||||||
|
|
||||||
|
NTKERNELAPI
|
||||||
|
VOID
|
||||||
|
NTAPI
|
||||||
|
MmUnlockPageableImageSection(
|
||||||
|
IN PVOID ImageSectionHandle
|
||||||
|
);
|
||||||
|
|
||||||
NTKERNELAPI
|
NTKERNELAPI
|
||||||
PVOID
|
PVOID
|
||||||
NTAPI
|
NTAPI
|
||||||
|
@ -9748,6 +9762,9 @@ MmUnsecureVirtualMemory(
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define MmGetProcedureAddress(Address) (Address)
|
||||||
|
#define MmLockPagableCodeSection(Address) MmLockPagableDataSection(Address)
|
||||||
|
|
||||||
NTKERNELAPI
|
NTKERNELAPI
|
||||||
VOID
|
VOID
|
||||||
NTAPI
|
NTAPI
|
||||||
|
|
|
@ -247,20 +247,6 @@ typedef struct _MMPTE
|
||||||
} u;
|
} u;
|
||||||
} MMPTE, *PMMPTE;
|
} MMPTE, *PMMPTE;
|
||||||
|
|
||||||
//
|
|
||||||
// Section Information structure
|
|
||||||
//
|
|
||||||
typedef struct _MI_EXTRA_IMAGE_INFORMATION
|
|
||||||
{
|
|
||||||
ULONG SizeOfHeaders;
|
|
||||||
} MI_EXTRA_IMAGE_INFORMATION, *PMI_EXTRA_IMAGE_INFORMATION;
|
|
||||||
|
|
||||||
typedef struct _MI_SECTION_IMAGE_INFORMATION
|
|
||||||
{
|
|
||||||
SECTION_IMAGE_INFORMATION ExportedImageInformation;
|
|
||||||
MI_EXTRA_IMAGE_INFORMATION InternalImageInformation;
|
|
||||||
} MI_SECTION_IMAGE_INFORMATION, *PMI_SECTION_IMAGE_INFORMATION;
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Section Extension Information
|
// Section Extension Information
|
||||||
//
|
//
|
||||||
|
@ -295,12 +281,12 @@ typedef struct _SEGMENT
|
||||||
PVOID BaseAddress;
|
PVOID BaseAddress;
|
||||||
union
|
union
|
||||||
{
|
{
|
||||||
ULONG ImageCommitment;
|
SIZE_T ImageCommitment;
|
||||||
PEPROCESS CreatingProcess;
|
PEPROCESS CreatingProcess;
|
||||||
} u1;
|
} u1;
|
||||||
union
|
union
|
||||||
{
|
{
|
||||||
PMI_SECTION_IMAGE_INFORMATION ImageInformation;
|
PSECTION_IMAGE_INFORMATION ImageInformation;
|
||||||
PVOID FirstMappedVa;
|
PVOID FirstMappedVa;
|
||||||
} u2;
|
} u2;
|
||||||
PMMPTE PrototypePte;
|
PMMPTE PrototypePte;
|
||||||
|
@ -545,7 +531,7 @@ typedef struct _MMWSLE
|
||||||
PVOID VirtualAddress;
|
PVOID VirtualAddress;
|
||||||
ULONG Long;
|
ULONG Long;
|
||||||
MMWSLENTRY e1;
|
MMWSLENTRY e1;
|
||||||
};
|
} u1;
|
||||||
} MMWSLE, *PMMWSLE;
|
} MMWSLE, *PMMWSLE;
|
||||||
|
|
||||||
typedef struct _MMWSLE_HASH
|
typedef struct _MMWSLE_HASH
|
||||||
|
|
|
@ -132,6 +132,68 @@ PsIsProtectedProcess(
|
||||||
IN PEPROCESS Process
|
IN PEPROCESS Process
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Quota Functions
|
||||||
|
//
|
||||||
|
NTKERNELAPI
|
||||||
|
VOID
|
||||||
|
NTAPI
|
||||||
|
PsChargePoolQuota(
|
||||||
|
IN PEPROCESS Process,
|
||||||
|
IN POOL_TYPE PoolType,
|
||||||
|
IN ULONG Amount
|
||||||
|
);
|
||||||
|
|
||||||
|
NTKERNELAPI
|
||||||
|
NTSTATUS
|
||||||
|
NTAPI
|
||||||
|
PsChargeProcessNonPagedPoolQuota(
|
||||||
|
IN PEPROCESS Process,
|
||||||
|
IN ULONG_PTR Amount
|
||||||
|
);
|
||||||
|
|
||||||
|
NTKERNELAPI
|
||||||
|
NTSTATUS
|
||||||
|
NTAPI
|
||||||
|
PsChargeProcessPagedPoolQuota(
|
||||||
|
IN PEPROCESS Process,
|
||||||
|
IN ULONG_PTR Amount
|
||||||
|
);
|
||||||
|
|
||||||
|
NTKERNELAPI
|
||||||
|
NTSTATUS
|
||||||
|
NTAPI
|
||||||
|
PsChargeProcessPoolQuota(
|
||||||
|
IN PEPROCESS Process,
|
||||||
|
IN POOL_TYPE PoolType,
|
||||||
|
IN ULONG Amount
|
||||||
|
);
|
||||||
|
|
||||||
|
NTKERNELAPI
|
||||||
|
VOID
|
||||||
|
NTAPI
|
||||||
|
PsReturnPoolQuota(
|
||||||
|
IN PEPROCESS Process,
|
||||||
|
IN POOL_TYPE PoolType,
|
||||||
|
IN ULONG_PTR Amount
|
||||||
|
);
|
||||||
|
|
||||||
|
NTKERNELAPI
|
||||||
|
VOID
|
||||||
|
NTAPI
|
||||||
|
PsReturnProcessNonPagedPoolQuota(
|
||||||
|
IN PEPROCESS Process,
|
||||||
|
IN ULONG_PTR Amount
|
||||||
|
);
|
||||||
|
|
||||||
|
NTKERNELAPI
|
||||||
|
VOID
|
||||||
|
NTAPI
|
||||||
|
PsReturnProcessPagedPoolQuota(
|
||||||
|
IN PEPROCESS Process,
|
||||||
|
IN ULONG_PTR Amount
|
||||||
|
);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
@ -1177,16 +1177,12 @@ typedef struct _EPROCESS
|
||||||
EX_PUSH_LOCK AddressCreationLock;
|
EX_PUSH_LOCK AddressCreationLock;
|
||||||
PETHREAD RotateInProgress;
|
PETHREAD RotateInProgress;
|
||||||
#else
|
#else
|
||||||
FAST_MUTEX AddressCreationLock; // FIXME: FAST_MUTEX for XP, KGUARDED_MUTEX for 2K3
|
KGUARDED_MUTEX AddressCreationLock;
|
||||||
KSPIN_LOCK HyperSpaceLock;
|
KSPIN_LOCK HyperSpaceLock;
|
||||||
#endif
|
#endif
|
||||||
PETHREAD ForkInProgress;
|
PETHREAD ForkInProgress;
|
||||||
ULONG HardwareTrigger;
|
ULONG HardwareTrigger;
|
||||||
#if (NTDDI_VERSION >= NTDDI_LONGHORN)
|
PMM_AVL_TABLE PhysicalVadRoot;
|
||||||
PMM_AVL_TABLE PhysicalVadroot;
|
|
||||||
#else
|
|
||||||
MM_AVL_TABLE PhysicalVadroot;
|
|
||||||
#endif
|
|
||||||
PVOID CloneRoot;
|
PVOID CloneRoot;
|
||||||
ULONG NumberOfPrivatePages;
|
ULONG NumberOfPrivatePages;
|
||||||
ULONG NumberOfLockedPages;
|
ULONG NumberOfLockedPages;
|
||||||
|
|
|
@ -128,6 +128,11 @@ static __inline__ __attribute__((always_inline)) void * _InterlockedExchangePoin
|
||||||
return __sync_lock_test_and_set(Target, Value);
|
return __sync_lock_test_and_set(Target, Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static __inline__ __attribute__((always_inline)) long _InterlockedExchangeAdd16(volatile short * const Addend, const short Value)
|
||||||
|
{
|
||||||
|
return __sync_fetch_and_add(Addend, Value);
|
||||||
|
}
|
||||||
|
|
||||||
static __inline__ __attribute__((always_inline)) long _InterlockedExchangeAdd(volatile long * const Addend, const long Value)
|
static __inline__ __attribute__((always_inline)) long _InterlockedExchangeAdd(volatile long * const Addend, const long Value)
|
||||||
{
|
{
|
||||||
return __sync_fetch_and_add(Addend, Value);
|
return __sync_fetch_and_add(Addend, Value);
|
||||||
|
@ -239,6 +244,13 @@ static __inline__ __attribute__((always_inline)) void * _InterlockedExchangePoin
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static __inline__ __attribute__((always_inline)) long _InterlockedExchangeAdd16(volatile short * const Addend, const short Value)
|
||||||
|
{
|
||||||
|
long retval = Value;
|
||||||
|
__asm__("lock; xaddw %[retval], %[Addend]" : [retval] "+r" (retval) : [Addend] "m" (*Addend) : "memory");
|
||||||
|
return retval;
|
||||||
|
}
|
||||||
|
|
||||||
static __inline__ __attribute__((always_inline)) long _InterlockedExchangeAdd(volatile long * const Addend, const long Value)
|
static __inline__ __attribute__((always_inline)) long _InterlockedExchangeAdd(volatile long * const Addend, const long Value)
|
||||||
{
|
{
|
||||||
long retval = Value;
|
long retval = Value;
|
||||||
|
@ -426,6 +438,16 @@ static __inline__ __attribute__((always_inline)) long _InterlockedIncrement(vola
|
||||||
return _InterlockedExchangeAdd(lpAddend, 1) + 1;
|
return _InterlockedExchangeAdd(lpAddend, 1) + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static __inline__ __attribute__((always_inline)) long _InterlockedDecrement16(volatile short * const lpAddend)
|
||||||
|
{
|
||||||
|
return _InterlockedExchangeAdd16(lpAddend, -1) - 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static __inline__ __attribute__((always_inline)) long _InterlockedIncrement16(volatile short * const lpAddend)
|
||||||
|
{
|
||||||
|
return _InterlockedExchangeAdd16(lpAddend, 1) + 1;
|
||||||
|
}
|
||||||
|
|
||||||
static __inline__ __attribute__((always_inline)) unsigned char _interlockedbittestandreset(volatile long * a, const long b)
|
static __inline__ __attribute__((always_inline)) unsigned char _interlockedbittestandreset(volatile long * a, const long b)
|
||||||
{
|
{
|
||||||
unsigned char retval;
|
unsigned char retval;
|
||||||
|
|
|
@ -80,6 +80,9 @@ static inline void Ki386Cpuid(ULONG Op, PULONG Eax, PULONG Ebx, PULONG Ecx, PULO
|
||||||
|
|
||||||
#define Ke386FnInit() __asm__("fninit\n\t");
|
#define Ke386FnInit() __asm__("fninit\n\t");
|
||||||
|
|
||||||
|
#define Ke386WbInvd() __asm__("wbinvd\n\t");
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// CR Macros
|
// CR Macros
|
||||||
//
|
//
|
||||||
|
|
|
@ -751,6 +751,15 @@ VOID
|
||||||
NTAPI
|
NTAPI
|
||||||
KeFlushCurrentTb(VOID);
|
KeFlushCurrentTb(VOID);
|
||||||
|
|
||||||
|
BOOLEAN
|
||||||
|
NTAPI
|
||||||
|
KeInvalidateAllCaches(VOID);
|
||||||
|
|
||||||
|
VOID
|
||||||
|
FASTCALL
|
||||||
|
KeZeroPages(IN PVOID Address,
|
||||||
|
IN ULONG Size);
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
NTAPI
|
NTAPI
|
||||||
KeRosDumpStackFrames(
|
KeRosDumpStackFrames(
|
||||||
|
|
|
@ -96,7 +96,7 @@ Ke386SanitizeDr(IN PVOID DrAddress,
|
||||||
PKTHREAD _Thread = KeGetCurrentThread(); \
|
PKTHREAD _Thread = KeGetCurrentThread(); \
|
||||||
\
|
\
|
||||||
/* Sanity checks */ \
|
/* Sanity checks */ \
|
||||||
ASSERT_IRQL_LESS_OR_EQUAL(APC_LEVEL); \
|
ASSERT(KeGetCurrentIrql() <= APC_LEVEL); \
|
||||||
ASSERT(_Thread == KeGetCurrentThread()); \
|
ASSERT(_Thread == KeGetCurrentThread()); \
|
||||||
ASSERT((_Thread->SpecialApcDisable <= 0) && \
|
ASSERT((_Thread->SpecialApcDisable <= 0) && \
|
||||||
(_Thread->SpecialApcDisable != -32768)); \
|
(_Thread->SpecialApcDisable != -32768)); \
|
||||||
|
@ -113,7 +113,7 @@ Ke386SanitizeDr(IN PVOID DrAddress,
|
||||||
PKTHREAD _Thread = KeGetCurrentThread(); \
|
PKTHREAD _Thread = KeGetCurrentThread(); \
|
||||||
\
|
\
|
||||||
/* Sanity checks */ \
|
/* Sanity checks */ \
|
||||||
ASSERT_IRQL_LESS_OR_EQUAL(APC_LEVEL); \
|
ASSERT(KeGetCurrentIrql() <= APC_LEVEL); \
|
||||||
ASSERT(_Thread == KeGetCurrentThread()); \
|
ASSERT(_Thread == KeGetCurrentThread()); \
|
||||||
ASSERT(_Thread->SpecialApcDisable < 0); \
|
ASSERT(_Thread->SpecialApcDisable < 0); \
|
||||||
\
|
\
|
||||||
|
@ -1540,3 +1540,11 @@ KeGetPreviousMode(VOID)
|
||||||
return KeGetCurrentThread()->PreviousMode;
|
return KeGetCurrentThread()->PreviousMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VOID
|
||||||
|
FORCEINLINE
|
||||||
|
KeFlushProcessTb(VOID)
|
||||||
|
{
|
||||||
|
/* Flush the TLB by resetting CR3 */
|
||||||
|
__writecr3(__readcr3());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -1457,4 +1457,14 @@ MmCheckSystemImage(
|
||||||
IN BOOLEAN PurgeSection
|
IN BOOLEAN PurgeSection
|
||||||
);
|
);
|
||||||
|
|
||||||
|
FORCEINLINE
|
||||||
|
VOID
|
||||||
|
NTAPI
|
||||||
|
MiSyncThreadProcessViews(IN PKPROCESS Process,
|
||||||
|
IN PVOID Address,
|
||||||
|
IN ULONG Size)
|
||||||
|
{
|
||||||
|
MmUpdatePageDir((PEPROCESS)Process, Address, Size);
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -105,7 +105,8 @@ NTSTATUS
|
||||||
NTAPI
|
NTAPI
|
||||||
PspMapSystemDll(
|
PspMapSystemDll(
|
||||||
IN PEPROCESS Process,
|
IN PEPROCESS Process,
|
||||||
OUT PVOID *DllBase
|
OUT PVOID *DllBase,
|
||||||
|
IN BOOLEAN UseLargePages
|
||||||
);
|
);
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
|
@ -349,6 +350,23 @@ PsSuspendThread(
|
||||||
OUT PULONG PreviousCount OPTIONAL
|
OUT PULONG PreviousCount OPTIONAL
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Process Quotas
|
||||||
|
//
|
||||||
|
NTSTATUS
|
||||||
|
NTAPI
|
||||||
|
PsReturnProcessPageFileQuota(
|
||||||
|
IN PEPROCESS Process,
|
||||||
|
IN SIZE_T Amount
|
||||||
|
);
|
||||||
|
|
||||||
|
NTSTATUS
|
||||||
|
NTAPI
|
||||||
|
PsChargeProcessPageFileQuota(
|
||||||
|
IN PEPROCESS Process,
|
||||||
|
IN SIZE_T Amount
|
||||||
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Global data inside the Process Manager
|
// Global data inside the Process Manager
|
||||||
//
|
//
|
||||||
|
|
|
@ -19,12 +19,6 @@
|
||||||
#define PspQuantumLengthFromMask(Mask) \
|
#define PspQuantumLengthFromMask(Mask) \
|
||||||
((Mask) & 48)
|
((Mask) & 48)
|
||||||
|
|
||||||
//
|
|
||||||
// Set Process Flag routines
|
|
||||||
//
|
|
||||||
#define PspSetProcessFlag(Process, Flag) \
|
|
||||||
InterlockedOr((PLONG)&Process->Flags, Flag)
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Cross Thread Flag routines
|
// Cross Thread Flag routines
|
||||||
//
|
//
|
||||||
|
@ -33,6 +27,14 @@
|
||||||
#define PspClearCrossThreadFlag(Thread, Flag) \
|
#define PspClearCrossThreadFlag(Thread, Flag) \
|
||||||
InterlockedAnd((PLONG)&Thread->CrossThreadFlags, ~Flag)
|
InterlockedAnd((PLONG)&Thread->CrossThreadFlags, ~Flag)
|
||||||
|
|
||||||
|
//
|
||||||
|
// Process flag routines
|
||||||
|
//
|
||||||
|
#define PspSetProcessFlag(Process, Flag) \
|
||||||
|
InterlockedOr((PLONG)&Process->Flags, Flag)
|
||||||
|
#define PspClearProcessFlag(Process, Flag) \
|
||||||
|
InterlockedAnd((PLONG)&Process->Flags, ~Flag)
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
FORCEINLINE
|
FORCEINLINE
|
||||||
PspRunCreateThreadNotifyRoutines(IN PETHREAD CurrentThread,
|
PspRunCreateThreadNotifyRoutines(IN PETHREAD CurrentThread,
|
||||||
|
|
|
@ -78,6 +78,9 @@ BOOLEAN KiSMTProcessorsPresent;
|
||||||
KIRQL KiOldIrql;
|
KIRQL KiOldIrql;
|
||||||
ULONG KiFreezeFlag;
|
ULONG KiFreezeFlag;
|
||||||
|
|
||||||
|
/* Flush data */
|
||||||
|
volatile LONG KiTbFlushTimeStamp;
|
||||||
|
|
||||||
/* CPU Signatures */
|
/* CPU Signatures */
|
||||||
static const CHAR CmpIntelID[] = "GenuineIntel";
|
static const CHAR CmpIntelID[] = "GenuineIntel";
|
||||||
static const CHAR CmpAmdID[] = "AuthenticAMD";
|
static const CHAR CmpAmdID[] = "AuthenticAMD";
|
||||||
|
@ -882,6 +885,27 @@ KeThawExecution(IN BOOLEAN Enable)
|
||||||
if (Enable) _enable();
|
if (Enable) _enable();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOOLEAN
|
||||||
|
NTAPI
|
||||||
|
KeInvalidateAllCaches(VOID)
|
||||||
|
{
|
||||||
|
/* Only supported on Pentium Pro and higher */
|
||||||
|
if (KeI386CpuType < 6) return FALSE;
|
||||||
|
|
||||||
|
/* Invalidate all caches */
|
||||||
|
Ke386WbInvd();
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID
|
||||||
|
FASTCALL
|
||||||
|
KeZeroPages(IN PVOID Address,
|
||||||
|
IN ULONG Size)
|
||||||
|
{
|
||||||
|
/* Not using XMMI in this routine */
|
||||||
|
RtlZeroMemory(Address, Size);
|
||||||
|
}
|
||||||
|
|
||||||
/* PUBLIC FUNCTIONS **********************************************************/
|
/* PUBLIC FUNCTIONS **********************************************************/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -39,11 +39,11 @@ MmLockAddressSpace(PMADDRESS_SPACE AddressSpace)
|
||||||
|
|
||||||
if (AddressSpace->Process)
|
if (AddressSpace->Process)
|
||||||
{
|
{
|
||||||
ExEnterCriticalRegionAndAcquireFastMutexUnsafe(&AddressSpace->Process->AddressCreationLock);
|
ExEnterCriticalRegionAndAcquireFastMutexUnsafe((PFAST_MUTEX)&AddressSpace->Process->AddressCreationLock);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ExEnterCriticalRegionAndAcquireFastMutexUnsafe(&KernelAddressSpaceLock);
|
ExEnterCriticalRegionAndAcquireFastMutexUnsafe((PFAST_MUTEX)&KernelAddressSpaceLock);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,11 +60,11 @@ MmUnlockAddressSpace(PMADDRESS_SPACE AddressSpace)
|
||||||
}
|
}
|
||||||
if (AddressSpace->Process)
|
if (AddressSpace->Process)
|
||||||
{
|
{
|
||||||
ExReleaseFastMutexUnsafeAndLeaveCriticalRegion(&AddressSpace->Process->AddressCreationLock);
|
ExReleaseFastMutexUnsafeAndLeaveCriticalRegion((PFAST_MUTEX)&AddressSpace->Process->AddressCreationLock);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ExReleaseFastMutexUnsafeAndLeaveCriticalRegion(&KernelAddressSpaceLock);
|
ExReleaseFastMutexUnsafeAndLeaveCriticalRegion((PFAST_MUTEX)&KernelAddressSpaceLock);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,11 +98,11 @@ MmInitializeAddressSpace(PEPROCESS Process,
|
||||||
AddressSpace->MemoryAreaRoot = NULL;
|
AddressSpace->MemoryAreaRoot = NULL;
|
||||||
if (Process)
|
if (Process)
|
||||||
{
|
{
|
||||||
ExInitializeFastMutex(&Process->AddressCreationLock);
|
ExInitializeFastMutex((PFAST_MUTEX)&Process->AddressCreationLock);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ExInitializeFastMutex(&KernelAddressSpaceLock);
|
ExInitializeFastMutex((PFAST_MUTEX)&KernelAddressSpaceLock);
|
||||||
}
|
}
|
||||||
if (Process != NULL)
|
if (Process != NULL)
|
||||||
{
|
{
|
||||||
|
|
|
@ -15,6 +15,8 @@
|
||||||
|
|
||||||
/* FUNCTIONS *****************************************************************/
|
/* FUNCTIONS *****************************************************************/
|
||||||
|
|
||||||
|
#undef MmLockPagableDataSection
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
VOID
|
VOID
|
||||||
MmUnlockPagableImageSection(IN PVOID ImageSectionHandle)
|
MmUnlockPagableImageSection(IN PVOID ImageSectionHandle)
|
||||||
|
|
|
@ -592,7 +592,7 @@ PspCreateProcess(OUT PHANDLE ProcessHandle,
|
||||||
if (!NT_SUCCESS(Status)) goto CleanupWithRef;
|
if (!NT_SUCCESS(Status)) goto CleanupWithRef;
|
||||||
|
|
||||||
/* Check if we have a section object and map the system DLL */
|
/* Check if we have a section object and map the system DLL */
|
||||||
if (SectionObject) PspMapSystemDll(Process, NULL);
|
if (SectionObject) PspMapSystemDll(Process, NULL, FALSE);
|
||||||
|
|
||||||
/* Create a handle for the Process */
|
/* Create a handle for the Process */
|
||||||
CidEntry.Object = Process;
|
CidEntry.Object = Process;
|
||||||
|
|
|
@ -218,13 +218,14 @@ PspLookupKernelUserEntryPoints(VOID)
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
NTAPI
|
NTAPI
|
||||||
PspMapSystemDll(IN PEPROCESS Process,
|
PspMapSystemDll(IN PEPROCESS Process,
|
||||||
IN PVOID *DllBase)
|
IN PVOID *DllBase,
|
||||||
|
IN BOOLEAN UseLargePages)
|
||||||
{
|
{
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
LARGE_INTEGER Offset = {{0}};
|
LARGE_INTEGER Offset = {{0}};
|
||||||
SIZE_T ViewSize = 0;
|
SIZE_T ViewSize = 0;
|
||||||
PVOID ImageBase = 0;
|
PVOID ImageBase = 0;
|
||||||
|
|
||||||
/* Map the System DLL */
|
/* Map the System DLL */
|
||||||
Status = MmMapViewOfSection(PspSystemDllSection,
|
Status = MmMapViewOfSection(PspSystemDllSection,
|
||||||
Process,
|
Process,
|
||||||
|
@ -236,7 +237,12 @@ PspMapSystemDll(IN PEPROCESS Process,
|
||||||
ViewShare,
|
ViewShare,
|
||||||
0,
|
0,
|
||||||
PAGE_READWRITE);
|
PAGE_READWRITE);
|
||||||
|
if (Status != STATUS_SUCCESS)
|
||||||
|
{
|
||||||
|
/* Normalize status code */
|
||||||
|
Status = STATUS_CONFLICTING_ADDRESSES;
|
||||||
|
}
|
||||||
|
|
||||||
/* Write the image base and return status */
|
/* Write the image base and return status */
|
||||||
if (DllBase) *DllBase = ImageBase;
|
if (DllBase) *DllBase = ImageBase;
|
||||||
return Status;
|
return Status;
|
||||||
|
@ -316,7 +322,7 @@ PsLocateSystemDll(VOID)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Map it */
|
/* Map it */
|
||||||
Status = PspMapSystemDll(PsGetCurrentProcess(), &PspSystemDllBase);
|
Status = PspMapSystemDll(PsGetCurrentProcess(), &PspSystemDllBase, FALSE);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
/* Failed, bugcheck */
|
/* Failed, bugcheck */
|
||||||
|
|
|
@ -59,6 +59,19 @@ PspDestroyQuotaBlock(PEPROCESS Process)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NTSTATUS
|
||||||
|
NTAPI
|
||||||
|
PsChargeProcessPageFileQuota(IN PEPROCESS Process,
|
||||||
|
IN SIZE_T Amount)
|
||||||
|
{
|
||||||
|
/* Don't do anything for the system process */
|
||||||
|
if (Process == PsInitialSystemProcess) return STATUS_SUCCESS;
|
||||||
|
|
||||||
|
/* Otherwise, not implemented */
|
||||||
|
UNIMPLEMENTED;
|
||||||
|
return STATUS_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @implemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
|
@ -70,14 +83,12 @@ PsChargePoolQuota(IN PEPROCESS Process,
|
||||||
{
|
{
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
|
/* Don't do anything for the system process */
|
||||||
|
if (Process == PsInitialSystemProcess) return;
|
||||||
|
|
||||||
/* Charge the usage */
|
/* Charge the usage */
|
||||||
Status = PsChargeProcessPoolQuota(Process, PoolType, Amount);
|
Status = PsChargeProcessPoolQuota(Process, PoolType, Amount);
|
||||||
|
if (!NT_SUCCESS(Status)) ExRaiseStatus(Status);
|
||||||
/* Raise Exception */
|
|
||||||
if (!NT_SUCCESS(Status))
|
|
||||||
{
|
|
||||||
ExRaiseStatus(Status);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -113,6 +124,9 @@ PsChargeProcessPoolQuota(IN PEPROCESS Process,
|
||||||
IN POOL_TYPE PoolType,
|
IN POOL_TYPE PoolType,
|
||||||
IN ULONG Amount)
|
IN ULONG Amount)
|
||||||
{
|
{
|
||||||
|
/* Don't do anything for the system process */
|
||||||
|
if (Process == PsInitialSystemProcess) return STATUS_SUCCESS;
|
||||||
|
|
||||||
UNIMPLEMENTED;
|
UNIMPLEMENTED;
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -126,6 +140,9 @@ PsReturnPoolQuota(IN PEPROCESS Process,
|
||||||
IN POOL_TYPE PoolType,
|
IN POOL_TYPE PoolType,
|
||||||
IN ULONG_PTR Amount)
|
IN ULONG_PTR Amount)
|
||||||
{
|
{
|
||||||
|
/* Don't do anything for the system process */
|
||||||
|
if (Process == PsInitialSystemProcess) return;
|
||||||
|
|
||||||
UNIMPLEMENTED;
|
UNIMPLEMENTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -137,6 +154,9 @@ STDCALL
|
||||||
PsReturnProcessNonPagedPoolQuota(IN PEPROCESS Process,
|
PsReturnProcessNonPagedPoolQuota(IN PEPROCESS Process,
|
||||||
IN ULONG_PTR Amount)
|
IN ULONG_PTR Amount)
|
||||||
{
|
{
|
||||||
|
/* Don't do anything for the system process */
|
||||||
|
if (Process == PsInitialSystemProcess) return;
|
||||||
|
|
||||||
UNIMPLEMENTED;
|
UNIMPLEMENTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -148,7 +168,23 @@ STDCALL
|
||||||
PsReturnProcessPagedPoolQuota(IN PEPROCESS Process,
|
PsReturnProcessPagedPoolQuota(IN PEPROCESS Process,
|
||||||
IN ULONG_PTR Amount)
|
IN ULONG_PTR Amount)
|
||||||
{
|
{
|
||||||
|
/* Don't do anything for the system process */
|
||||||
|
if (Process == PsInitialSystemProcess) return;
|
||||||
|
|
||||||
UNIMPLEMENTED;
|
UNIMPLEMENTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NTSTATUS
|
||||||
|
NTAPI
|
||||||
|
PsReturnProcessPageFileQuota(IN PEPROCESS Process,
|
||||||
|
IN SIZE_T Amount)
|
||||||
|
{
|
||||||
|
/* Don't do anything for the system process */
|
||||||
|
if (Process == PsInitialSystemProcess) return STATUS_SUCCESS;
|
||||||
|
|
||||||
|
/* Otherwise, not implemented */
|
||||||
|
UNIMPLEMENTED;
|
||||||
|
return STATUS_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
Loading…
Reference in a new issue