mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 23:03:00 +00:00
- Fix some coverity errors.
- Use KeBugCheck(MEMORY_MANAGEMENT) instead of ASSERT(FALSE), so it dies on release builds too. - Enable support for Hyper-V. - Fix incorrect gate wait code -- fixes sporadic crashes in the network stack. - Mark KeBugCheck*, ExRaise* and RtlRaiseStatus as declspec(noreturn), for better optimization of functions which call them, less potential warnings in the compiler, and, assuming coverity understands it, less false CIDs. - Fix KiUpdateDr7, which resulted in broken support for hardware breakpoints. - Fix failure cases in EnumerateRootDevices which might've freed non-allocated memory. - Fix NtAddAtom/NtFindAtom logic when dealing with NULL or kernel Atom names. Patch by Alex Ionescu. svn path=/trunk/; revision=37668
This commit is contained in:
parent
1afa5e29a0
commit
24da6d32fe
16 changed files with 227 additions and 203 deletions
|
@ -7666,12 +7666,14 @@ ExNotifyCallback(
|
||||||
NTKERNELAPI
|
NTKERNELAPI
|
||||||
VOID
|
VOID
|
||||||
NTAPI
|
NTAPI
|
||||||
|
__declspec(noreturn)
|
||||||
ExRaiseAccessViolation(
|
ExRaiseAccessViolation(
|
||||||
VOID);
|
VOID);
|
||||||
|
|
||||||
NTKERNELAPI
|
NTKERNELAPI
|
||||||
VOID
|
VOID
|
||||||
NTAPI
|
NTAPI
|
||||||
|
__declspec(noreturn)
|
||||||
ExRaiseDatatypeMisalignment(
|
ExRaiseDatatypeMisalignment(
|
||||||
VOID);
|
VOID);
|
||||||
|
|
||||||
|
@ -7679,6 +7681,7 @@ DECLSPEC_NORETURN
|
||||||
NTKERNELAPI
|
NTKERNELAPI
|
||||||
VOID
|
VOID
|
||||||
NTAPI
|
NTAPI
|
||||||
|
__declspec(noreturn)
|
||||||
ExRaiseStatus(
|
ExRaiseStatus(
|
||||||
IN NTSTATUS Status);
|
IN NTSTATUS Status);
|
||||||
|
|
||||||
|
@ -9603,12 +9606,14 @@ KeAreApcsDisabled(
|
||||||
NTKERNELAPI
|
NTKERNELAPI
|
||||||
VOID
|
VOID
|
||||||
NTAPI
|
NTAPI
|
||||||
|
__declspec(noreturn)
|
||||||
KeBugCheck(
|
KeBugCheck(
|
||||||
IN ULONG BugCheckCode);
|
IN ULONG BugCheckCode);
|
||||||
|
|
||||||
NTKERNELAPI
|
NTKERNELAPI
|
||||||
VOID
|
VOID
|
||||||
NTAPI
|
NTAPI
|
||||||
|
__declspec(noreturn)
|
||||||
KeBugCheckEx(
|
KeBugCheckEx(
|
||||||
IN ULONG BugCheckCode,
|
IN ULONG BugCheckCode,
|
||||||
IN ULONG_PTR BugCheckParameter1,
|
IN ULONG_PTR BugCheckParameter1,
|
||||||
|
|
|
@ -431,6 +431,7 @@ RtlRaiseException(
|
||||||
NTSYSAPI
|
NTSYSAPI
|
||||||
VOID
|
VOID
|
||||||
NTAPI
|
NTAPI
|
||||||
|
__declspec(noreturn)
|
||||||
RtlRaiseStatus(
|
RtlRaiseStatus(
|
||||||
IN NTSTATUS Status
|
IN NTSTATUS Status
|
||||||
);
|
);
|
||||||
|
|
|
@ -603,7 +603,7 @@ DbgkpPostFakeThreadMessages(IN PEPROCESS Process,
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Get the first thread ourselves */
|
/* Get the first thread ourselves */
|
||||||
ThisThread = PsGetNextProcessThread(Process, OldThread);
|
ThisThread = PsGetNextProcessThread(Process, NULL);
|
||||||
IsFirstThread = TRUE;
|
IsFirstThread = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -92,7 +92,7 @@ NtAddAtom(IN PWSTR AtomName,
|
||||||
PRTL_ATOM_TABLE AtomTable = ExpGetGlobalAtomTable();
|
PRTL_ATOM_TABLE AtomTable = ExpGetGlobalAtomTable();
|
||||||
NTSTATUS Status = STATUS_SUCCESS;
|
NTSTATUS Status = STATUS_SUCCESS;
|
||||||
KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
|
KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
|
||||||
LPWSTR CapturedName = NULL;
|
LPWSTR CapturedName;
|
||||||
ULONG CapturedSize;
|
ULONG CapturedSize;
|
||||||
RTL_ATOM SafeAtom;
|
RTL_ATOM SafeAtom;
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
@ -107,6 +107,9 @@ NtAddAtom(IN PWSTR AtomName,
|
||||||
DPRINT1("Atom name too long\n");
|
DPRINT1("Atom name too long\n");
|
||||||
return STATUS_INVALID_PARAMETER;
|
return STATUS_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Re-use the given name if kernel mode or no atom name */
|
||||||
|
CapturedName = AtomName;
|
||||||
|
|
||||||
/* Check if we're called from user-mode*/
|
/* Check if we're called from user-mode*/
|
||||||
if (PreviousMode != KernelMode)
|
if (PreviousMode != KernelMode)
|
||||||
|
@ -148,11 +151,6 @@ NtAddAtom(IN PWSTR AtomName,
|
||||||
}
|
}
|
||||||
_SEH2_END;
|
_SEH2_END;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
/* Simplify code and re-use one variable */
|
|
||||||
if (AtomName) CapturedName = AtomName;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Make sure probe worked */
|
/* Make sure probe worked */
|
||||||
if (NT_SUCCESS(Status))
|
if (NT_SUCCESS(Status))
|
||||||
|
@ -261,6 +259,9 @@ NtFindAtom(IN PWSTR AtomName,
|
||||||
DPRINT1("Atom name too long\n");
|
DPRINT1("Atom name too long\n");
|
||||||
return STATUS_INVALID_PARAMETER;
|
return STATUS_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Re-use the given name if kernel mode or no atom name */
|
||||||
|
CapturedName = AtomName;
|
||||||
|
|
||||||
/* Check if we're called from user-mode*/
|
/* Check if we're called from user-mode*/
|
||||||
if (PreviousMode != KernelMode)
|
if (PreviousMode != KernelMode)
|
||||||
|
@ -302,11 +303,6 @@ NtFindAtom(IN PWSTR AtomName,
|
||||||
}
|
}
|
||||||
_SEH2_END;
|
_SEH2_END;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
/* Simplify code and re-use one variable */
|
|
||||||
if (AtomName) CapturedName = AtomName;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Make sure probe worked */
|
/* Make sure probe worked */
|
||||||
if (NT_SUCCESS(Status))
|
if (NT_SUCCESS(Status))
|
||||||
|
|
|
@ -32,6 +32,21 @@
|
||||||
#define INT_32_DPL0 0x8E00
|
#define INT_32_DPL0 0x8E00
|
||||||
#define INT_32_DPL3 0xEE00
|
#define INT_32_DPL3 0xEE00
|
||||||
|
|
||||||
|
//
|
||||||
|
// This table contains the prefix flags that are used by V86 emulation
|
||||||
|
//
|
||||||
|
.equ PREFIX_FLAG_ES, 0x00000100
|
||||||
|
.equ PREFIX_FLAG_CS, 0x00000200
|
||||||
|
.equ PREFIX_FLAG_SS, 0x00000400
|
||||||
|
.equ PREFIX_FLAG_DS, 0x00000800
|
||||||
|
.equ PREFIX_FLAG_FS, 0x00001000
|
||||||
|
.equ PREFIX_FLAG_GS, 0x00002000
|
||||||
|
.equ PREFIX_FLAG_OPER32, 0x00004000
|
||||||
|
.equ PREFIX_FLAG_ADDR32, 0x00008000
|
||||||
|
.equ PREFIX_FLAG_LOCK, 0x00010000
|
||||||
|
.equ PREFIX_FLAG_REPNE, 0x00020000
|
||||||
|
.equ PREFIX_FLAG_REP, 0x00040000
|
||||||
|
|
||||||
.intel_syntax noprefix
|
.intel_syntax noprefix
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -195,6 +210,23 @@ _KiUnexpectedInterrupt&Number:
|
||||||
.endr
|
.endr
|
||||||
.endm
|
.endm
|
||||||
|
|
||||||
|
//
|
||||||
|
// @name GENERATE_PREFIX_HANDLER
|
||||||
|
//
|
||||||
|
// This macro creates a prefix opcode handler.
|
||||||
|
//
|
||||||
|
// @param None.
|
||||||
|
//
|
||||||
|
// @remark None.
|
||||||
|
//
|
||||||
|
.macro GENERATE_PREFIX_HANDLER Name
|
||||||
|
.func Opcode&Name&PrefixV86
|
||||||
|
_Opcode&Name&PrefixV86:
|
||||||
|
or ebx, PREFIX_FLAG_&Name
|
||||||
|
jmp _OpcodeGenericPrefixV86
|
||||||
|
.endfunc
|
||||||
|
.endm
|
||||||
|
|
||||||
//
|
//
|
||||||
// @name INVALID_V86_OPCODE
|
// @name INVALID_V86_OPCODE
|
||||||
//
|
//
|
||||||
|
|
|
@ -519,6 +519,8 @@ IoAllocateIrp(IN CCHAR StackSize,
|
||||||
/* Set Charge Quota Flag */
|
/* Set Charge Quota Flag */
|
||||||
if (ChargeQuota) Flags |= IRP_QUOTA_CHARGED;
|
if (ChargeQuota) Flags |= IRP_QUOTA_CHARGED;
|
||||||
|
|
||||||
|
/* FIXME: Implement Lookaside Floats */
|
||||||
|
|
||||||
/* Figure out which Lookaside List to use */
|
/* Figure out which Lookaside List to use */
|
||||||
if ((StackSize <= 8) && (ChargeQuota == FALSE))
|
if ((StackSize <= 8) && (ChargeQuota == FALSE))
|
||||||
{
|
{
|
||||||
|
@ -579,9 +581,6 @@ IoAllocateIrp(IN CCHAR StackSize,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* We have an IRP from Lookaside */
|
|
||||||
if (ChargeQuota) Flags |= IRP_LOOKASIDE_ALLOCATION;
|
|
||||||
|
|
||||||
/* In this case there is no charge quota */
|
/* In this case there is no charge quota */
|
||||||
Flags &= ~IRP_QUOTA_CHARGED;
|
Flags &= ~IRP_QUOTA_CHARGED;
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
* FILE: ntoskrnl/io/pnpmgr/pnproot.c
|
* FILE: ntoskrnl/io/pnpmgr/pnproot.c
|
||||||
* PURPOSE: PnP manager root device
|
* PURPOSE: PnP manager root device
|
||||||
* PROGRAMMERS: Casper S. Hornstrup (chorns@users.sourceforge.net)
|
* PROGRAMMERS: Casper S. Hornstrup (chorns@users.sourceforge.net)
|
||||||
* Copyright 2007 Hervé Poussineau (hpoussin@reactos.org)
|
* Copyright 2007 Herv? Poussineau (hpoussin@reactos.org)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* INCLUDES ******************************************************************/
|
/* INCLUDES ******************************************************************/
|
||||||
|
@ -503,8 +503,10 @@ cleanup:
|
||||||
ZwClose(SubKeyHandle);
|
ZwClose(SubKeyHandle);
|
||||||
if (KeyHandle != INVALID_HANDLE_VALUE)
|
if (KeyHandle != INVALID_HANDLE_VALUE)
|
||||||
ZwClose(KeyHandle);
|
ZwClose(KeyHandle);
|
||||||
ExFreePoolWithTag(KeyInfo, TAG_PNP_ROOT);
|
if (KeyInfo)
|
||||||
ExFreePoolWithTag(SubKeyInfo, TAG_PNP_ROOT);
|
ExFreePoolWithTag(KeyInfo, TAG_PNP_ROOT);
|
||||||
|
if (SubKeyInfo)
|
||||||
|
ExFreePoolWithTag(SubKeyInfo, TAG_PNP_ROOT);
|
||||||
KeReleaseGuardedMutex(&DeviceExtension->DeviceListLock);
|
KeReleaseGuardedMutex(&DeviceExtension->DeviceListLock);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,6 +90,7 @@ KiInsertQueueApc(IN PKAPC Apc,
|
||||||
KPROCESSOR_MODE ApcMode;
|
KPROCESSOR_MODE ApcMode;
|
||||||
PLIST_ENTRY ListHead, NextEntry;
|
PLIST_ENTRY ListHead, NextEntry;
|
||||||
PKAPC QueuedApc;
|
PKAPC QueuedApc;
|
||||||
|
PKGATE Gate;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
BOOLEAN RequestInterrupt = FALSE;
|
BOOLEAN RequestInterrupt = FALSE;
|
||||||
|
|
||||||
|
@ -211,24 +212,42 @@ KiInsertQueueApc(IN PKAPC Apc,
|
||||||
}
|
}
|
||||||
else if (Thread->State == GateWait)
|
else if (Thread->State == GateWait)
|
||||||
{
|
{
|
||||||
/* We were in a gate wait. Handle this. */
|
/* Lock the thread */
|
||||||
DPRINT1("A thread was in a gate wait\n");
|
KiAcquireThreadLock(Thread);
|
||||||
|
|
||||||
|
/* Essentially do the same check as above */
|
||||||
|
if ((Thread->State == GateWait) &&
|
||||||
|
(Thread->WaitIrql == PASSIVE_LEVEL) &&
|
||||||
|
!(Thread->SpecialApcDisable) &&
|
||||||
|
(!(Apc->NormalRoutine) ||
|
||||||
|
(!(Thread->KernelApcDisable) &&
|
||||||
|
!(Thread->ApcState.KernelApcInProgress))))
|
||||||
|
{
|
||||||
|
/* We were in a gate wait. Handle this. */
|
||||||
|
DPRINT1("A thread was in a gate wait\n");
|
||||||
|
|
||||||
|
/* Get the gate */
|
||||||
|
Gate = Thread->GateObject;
|
||||||
|
|
||||||
/* Lock the gate */
|
/* Lock the gate */
|
||||||
KiAcquireDispatcherObject(&Thread->GateObject->Header);
|
KiAcquireDispatcherObject(&Gate->Header);
|
||||||
|
|
||||||
/* Remove it from the waiters list */
|
/* Remove it from the waiters list */
|
||||||
RemoveEntryList(&Thread->WaitBlock[0].WaitListEntry);
|
RemoveEntryList(&Thread->WaitBlock[0].WaitListEntry);
|
||||||
|
|
||||||
/* Unlock the gate */
|
/* Unlock the gate */
|
||||||
KiReleaseDispatcherObject(&Thread->GateObject->Header);
|
KiReleaseDispatcherObject(&Gate->Header);
|
||||||
|
|
||||||
/* Increase the queue counter if needed */
|
/* Increase the queue counter if needed */
|
||||||
if (Thread->Queue) Thread->Queue->CurrentCount++;
|
if (Thread->Queue) Thread->Queue->CurrentCount++;
|
||||||
|
|
||||||
/* Put into deferred ready list with this status */
|
/* Put into deferred ready list with this status */
|
||||||
Status = STATUS_KERNEL_APC;
|
Status = STATUS_KERNEL_APC;
|
||||||
KiInsertDeferredReadyList(Thread);
|
KiInsertDeferredReadyList(Thread);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Release the thread lock */
|
||||||
|
KiReleaseThreadLock(Thread);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ((Thread->State == Waiting) &&
|
else if ((Thread->State == Waiting) &&
|
||||||
|
|
|
@ -546,11 +546,13 @@ KiDoBugCheckCallbacks(VOID)
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
NTAPI
|
NTAPI
|
||||||
|
__declspec(noreturn)
|
||||||
KiBugCheckDebugBreak(IN ULONG StatusCode)
|
KiBugCheckDebugBreak(IN ULONG StatusCode)
|
||||||
{
|
{
|
||||||
/* If KDBG isn't connected, freeze the CPU, otherwise, break */
|
/* If KDBG isn't connected, freeze the CPU, otherwise, break */
|
||||||
if (KdDebuggerNotPresent) for (;;) KeArchHaltProcessor();
|
if (KdDebuggerNotPresent) for (;;) KeArchHaltProcessor();
|
||||||
DbgBreakPointWithStatus(StatusCode);
|
DbgBreakPointWithStatus(StatusCode);
|
||||||
|
while (TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
PCHAR
|
PCHAR
|
||||||
|
@ -604,13 +606,9 @@ KiDumpParameterImages(IN PCHAR Message,
|
||||||
&InSystem);
|
&InSystem);
|
||||||
if (!ImageBase)
|
if (!ImageBase)
|
||||||
{
|
{
|
||||||
/* Driver wasn't found, check for unloaded driver */
|
/* FIXME: Add code to check for unloaded drivers */
|
||||||
DriverName = NULL; // FIXME: ROS can't
|
DPRINT1("Potentially unloaded driver!\n");
|
||||||
if (!DriverName) continue;
|
continue;
|
||||||
|
|
||||||
/* Convert the driver name */
|
|
||||||
ImageBase = (PVOID)Parameters[i];
|
|
||||||
ConversionRoutine(DriverName, AnsiName, sizeof(AnsiName));
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -751,6 +749,7 @@ KiDisplayBlueScreen(IN ULONG MessageId,
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
NTAPI
|
NTAPI
|
||||||
|
__declspec(noreturn)
|
||||||
KeBugCheckWithTf(IN ULONG BugCheckCode,
|
KeBugCheckWithTf(IN ULONG BugCheckCode,
|
||||||
IN ULONG_PTR BugCheckParameter1,
|
IN ULONG_PTR BugCheckParameter1,
|
||||||
IN ULONG_PTR BugCheckParameter2,
|
IN ULONG_PTR BugCheckParameter2,
|
||||||
|
|
|
@ -124,7 +124,7 @@ KiRecordDr7(OUT PULONG Dr7Ptr,
|
||||||
NewMask |= DR_MASK(DR7_OVERRIDE_V);
|
NewMask |= DR_MASK(DR7_OVERRIDE_V);
|
||||||
|
|
||||||
/* Set DR7 override */
|
/* Set DR7 override */
|
||||||
*DrMask |= DR7_OVERRIDE_MASK;
|
*Dr7Ptr |= DR7_OVERRIDE_MASK;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
|
|
||||||
#include <asm.h>
|
#include <asm.h>
|
||||||
#include <internal/i386/asmmacro.S>
|
#include <internal/i386/asmmacro.S>
|
||||||
|
#undef LOCK
|
||||||
.intel_syntax noprefix
|
.intel_syntax noprefix
|
||||||
|
|
||||||
/* FIXME: Can we make a nice macro to generate V86 Opcode handlers? */
|
/* FIXME: Can we make a nice macro to generate V86 Opcode handlers? */
|
||||||
|
@ -139,45 +140,17 @@ _Opcode0FV86:
|
||||||
UNHANDLED_V86_OPCODE
|
UNHANDLED_V86_OPCODE
|
||||||
.endfunc
|
.endfunc
|
||||||
|
|
||||||
.func OpcodeESPrefixV86
|
GENERATE_PREFIX_HANDLER ES
|
||||||
_OpcodeESPrefixV86:
|
GENERATE_PREFIX_HANDLER CS
|
||||||
UNHANDLED_V86_OPCODE
|
GENERATE_PREFIX_HANDLER DS
|
||||||
.endfunc
|
GENERATE_PREFIX_HANDLER FS
|
||||||
|
GENERATE_PREFIX_HANDLER GS
|
||||||
.func OpcodeCSPrefixV86
|
GENERATE_PREFIX_HANDLER SS
|
||||||
_OpcodeCSPrefixV86:
|
GENERATE_PREFIX_HANDLER OPER32
|
||||||
UNHANDLED_V86_OPCODE
|
GENERATE_PREFIX_HANDLER ADDR32
|
||||||
.endfunc
|
GENERATE_PREFIX_HANDLER LOCK
|
||||||
|
GENERATE_PREFIX_HANDLER REP
|
||||||
.func OpcodeSSPrefixV86
|
GENERATE_PREFIX_HANDLER REPNE
|
||||||
_OpcodeSSPrefixV86:
|
|
||||||
UNHANDLED_V86_OPCODE
|
|
||||||
.endfunc
|
|
||||||
|
|
||||||
.func OpcodeDSPrefixV86
|
|
||||||
_OpcodeDSPrefixV86:
|
|
||||||
UNHANDLED_V86_OPCODE
|
|
||||||
.endfunc
|
|
||||||
|
|
||||||
.func OpcodeFSPrefixV86
|
|
||||||
_OpcodeFSPrefixV86:
|
|
||||||
UNHANDLED_V86_OPCODE
|
|
||||||
.endfunc
|
|
||||||
|
|
||||||
.func OpcodeGSPrefixV86
|
|
||||||
_OpcodeGSPrefixV86:
|
|
||||||
UNHANDLED_V86_OPCODE
|
|
||||||
.endfunc
|
|
||||||
|
|
||||||
.func OpcodeOPER32PrefixV86
|
|
||||||
_OpcodeOPER32PrefixV86:
|
|
||||||
UNHANDLED_V86_OPCODE
|
|
||||||
.endfunc
|
|
||||||
|
|
||||||
.func OpcodeADDR32PrefixV86
|
|
||||||
_OpcodeADDR32PrefixV86:
|
|
||||||
UNHANDLED_V86_OPCODE
|
|
||||||
.endfunc
|
|
||||||
|
|
||||||
.func OpcodeINSBV86
|
.func OpcodeINSBV86
|
||||||
_OpcodeINSBV86:
|
_OpcodeINSBV86:
|
||||||
|
@ -224,7 +197,7 @@ _OpcodePUSHFV86:
|
||||||
sub dx, 2
|
sub dx, 2
|
||||||
|
|
||||||
/* Check if there is an OPER32 prefix */
|
/* Check if there is an OPER32 prefix */
|
||||||
test ebx, 0x4000
|
test ebx, PREFIX_FLAG_OPER32
|
||||||
jnz SkipPrefix
|
jnz SkipPrefix
|
||||||
|
|
||||||
/* Push EFLAGS */
|
/* Push EFLAGS */
|
||||||
|
@ -264,7 +237,7 @@ _OpcodePOPFV86:
|
||||||
add edx, 4
|
add edx, 4
|
||||||
|
|
||||||
/* Check for OPER32 prefix */
|
/* Check for OPER32 prefix */
|
||||||
test ebx, 0x4000
|
test ebx, PREFIX_FLAG_OPER32
|
||||||
jnz NoPrefix
|
jnz NoPrefix
|
||||||
|
|
||||||
/* Skip 2 bytes */
|
/* Skip 2 bytes */
|
||||||
|
@ -431,7 +404,7 @@ _OpcodeIRETV86:
|
||||||
add ecx, edx
|
add ecx, edx
|
||||||
|
|
||||||
/* Check for OPER32 prefix */
|
/* Check for OPER32 prefix */
|
||||||
test ebx, 0x4000
|
test ebx, PREFIX_FLAG_OPER32
|
||||||
jnz Iret32
|
jnz Iret32
|
||||||
|
|
||||||
/* Get flat IP */
|
/* Get flat IP */
|
||||||
|
@ -576,21 +549,6 @@ _OpcodeOUTWV86:
|
||||||
UNHANDLED_V86_OPCODE
|
UNHANDLED_V86_OPCODE
|
||||||
.endfunc
|
.endfunc
|
||||||
|
|
||||||
.func OpcodeLOCKPrefixV86
|
|
||||||
_OpcodeLOCKPrefixV86:
|
|
||||||
UNHANDLED_V86_OPCODE
|
|
||||||
.endfunc
|
|
||||||
|
|
||||||
.func OpcodeREPNEPrefixV86
|
|
||||||
_OpcodeREPNEPrefixV86:
|
|
||||||
UNHANDLED_V86_OPCODE
|
|
||||||
.endfunc
|
|
||||||
|
|
||||||
.func OpcodeREPPrefixV86
|
|
||||||
_OpcodeREPPrefixV86:
|
|
||||||
UNHANDLED_V86_OPCODE
|
|
||||||
.endfunc
|
|
||||||
|
|
||||||
.func OpcodeCLIV86
|
.func OpcodeCLIV86
|
||||||
_OpcodeCLIV86:
|
_OpcodeCLIV86:
|
||||||
|
|
||||||
|
@ -633,6 +591,23 @@ _OpcodeSTIV86:
|
||||||
ret
|
ret
|
||||||
.endfunc
|
.endfunc
|
||||||
|
|
||||||
|
.func OpcodeGenericPrefixV86
|
||||||
|
_OpcodeGenericPrefixV86:
|
||||||
|
|
||||||
|
/* Skip instruction */
|
||||||
|
inc esi
|
||||||
|
inc edi
|
||||||
|
|
||||||
|
/* Get the instruction */
|
||||||
|
movzx ecx, byte ptr [esi]
|
||||||
|
|
||||||
|
/* Get the opcode index */
|
||||||
|
movzx edx, byte ptr OpcodeIndex[ecx]
|
||||||
|
|
||||||
|
/* Dispatch it */
|
||||||
|
jmp OpcodeDispatchV86[edx*4]
|
||||||
|
.endfunc
|
||||||
|
|
||||||
.func OpcodeHLTV86
|
.func OpcodeHLTV86
|
||||||
_OpcodeHLTV86:
|
_OpcodeHLTV86:
|
||||||
UNHANDLED_V86_OPCODE
|
UNHANDLED_V86_OPCODE
|
||||||
|
|
|
@ -256,6 +256,7 @@ LpcRequestWaitReplyPort(IN PVOID PortObject,
|
||||||
/* FIXME: TODO */
|
/* FIXME: TODO */
|
||||||
Semaphore = NULL; // we'd use the Thread Semaphore here
|
Semaphore = NULL; // we'd use the Thread Semaphore here
|
||||||
ASSERT(FALSE);
|
ASSERT(FALSE);
|
||||||
|
return STATUS_NOT_IMPLEMENTED;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -97,7 +97,7 @@ ProtectToPTE(ULONG flProtect)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DPRINT1("Unknown main protection type.\n");
|
DPRINT1("Unknown main protection type.\n");
|
||||||
ASSERT(FALSE);
|
KeBugCheck(MEMORY_MANAGEMENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flProtect & PAGE_SYSTEM)
|
if (flProtect & PAGE_SYSTEM)
|
||||||
|
@ -241,7 +241,7 @@ MmDeletePageTable(PEPROCESS Process, PVOID Address)
|
||||||
|
|
||||||
if (Address >= MmSystemRangeStart)
|
if (Address >= MmSystemRangeStart)
|
||||||
{
|
{
|
||||||
ASSERT(FALSE);
|
KeBugCheck(MEMORY_MANAGEMENT);
|
||||||
// MmGlobalKernelPageDirectory[ADDR_TO_PDE_OFFSET(Address)] = 0;
|
// MmGlobalKernelPageDirectory[ADDR_TO_PDE_OFFSET(Address)] = 0;
|
||||||
}
|
}
|
||||||
if (Process != NULL && Process != CurrentProcess)
|
if (Process != NULL && Process != CurrentProcess)
|
||||||
|
@ -264,7 +264,7 @@ MmGetPageTableForProcess(PEPROCESS Process, PVOID Address, BOOLEAN Create)
|
||||||
PageDir = MmCreateHyperspaceMapping(PTE_TO_PFN(Process->Pcb.DirectoryTableBase[0]));
|
PageDir = MmCreateHyperspaceMapping(PTE_TO_PFN(Process->Pcb.DirectoryTableBase[0]));
|
||||||
if (PageDir == NULL)
|
if (PageDir == NULL)
|
||||||
{
|
{
|
||||||
ASSERT(FALSE);
|
KeBugCheck(MEMORY_MANAGEMENT);
|
||||||
}
|
}
|
||||||
if (0 == InterlockedCompareExchangePte(&PageDir[PdeOffset], 0, 0))
|
if (0 == InterlockedCompareExchangePte(&PageDir[PdeOffset], 0, 0))
|
||||||
{
|
{
|
||||||
|
@ -276,7 +276,7 @@ MmGetPageTableForProcess(PEPROCESS Process, PVOID Address, BOOLEAN Create)
|
||||||
Status = MmRequestPageMemoryConsumer(MC_NPPOOL, FALSE, &Pfn);
|
Status = MmRequestPageMemoryConsumer(MC_NPPOOL, FALSE, &Pfn);
|
||||||
if (!NT_SUCCESS(Status) || Pfn == 0)
|
if (!NT_SUCCESS(Status) || Pfn == 0)
|
||||||
{
|
{
|
||||||
ASSERT(FALSE);
|
KeBugCheck(MEMORY_MANAGEMENT);
|
||||||
}
|
}
|
||||||
Entry = InterlockedCompareExchangePte(&PageDir[PdeOffset], PFN_TO_PTE(Pfn) | PA_PRESENT | PA_READWRITE | PA_USER, 0);
|
Entry = InterlockedCompareExchangePte(&PageDir[PdeOffset], PFN_TO_PTE(Pfn) | PA_PRESENT | PA_READWRITE | PA_USER, 0);
|
||||||
if (Entry != 0)
|
if (Entry != 0)
|
||||||
|
@ -293,7 +293,7 @@ MmGetPageTableForProcess(PEPROCESS Process, PVOID Address, BOOLEAN Create)
|
||||||
Pt = MmCreateHyperspaceMapping(Pfn);
|
Pt = MmCreateHyperspaceMapping(Pfn);
|
||||||
if (Pt == NULL)
|
if (Pt == NULL)
|
||||||
{
|
{
|
||||||
ASSERT(FALSE);
|
KeBugCheck(MEMORY_MANAGEMENT);
|
||||||
}
|
}
|
||||||
return Pt + ADDR_TO_PTE_OFFSET(Address);
|
return Pt + ADDR_TO_PTE_OFFSET(Address);
|
||||||
}
|
}
|
||||||
|
@ -311,7 +311,7 @@ MmGetPageTableForProcess(PEPROCESS Process, PVOID Address, BOOLEAN Create)
|
||||||
Status = MmRequestPageMemoryConsumer(MC_NPPOOL, FALSE, &Pfn);
|
Status = MmRequestPageMemoryConsumer(MC_NPPOOL, FALSE, &Pfn);
|
||||||
if (!NT_SUCCESS(Status) || Pfn == 0)
|
if (!NT_SUCCESS(Status) || Pfn == 0)
|
||||||
{
|
{
|
||||||
ASSERT(FALSE);
|
KeBugCheck(MEMORY_MANAGEMENT);
|
||||||
}
|
}
|
||||||
Entry = PFN_TO_PTE(Pfn) | PA_PRESENT | PA_READWRITE;
|
Entry = PFN_TO_PTE(Pfn) | PA_PRESENT | PA_READWRITE;
|
||||||
if (Ke386GlobalPagesEnabled)
|
if (Ke386GlobalPagesEnabled)
|
||||||
|
@ -334,7 +334,7 @@ MmGetPageTableForProcess(PEPROCESS Process, PVOID Address, BOOLEAN Create)
|
||||||
Status = MmRequestPageMemoryConsumer(MC_NPPOOL, FALSE, &Pfn);
|
Status = MmRequestPageMemoryConsumer(MC_NPPOOL, FALSE, &Pfn);
|
||||||
if (!NT_SUCCESS(Status) || Pfn == 0)
|
if (!NT_SUCCESS(Status) || Pfn == 0)
|
||||||
{
|
{
|
||||||
ASSERT(FALSE);
|
KeBugCheck(MEMORY_MANAGEMENT);
|
||||||
}
|
}
|
||||||
Entry = InterlockedCompareExchangePte(PageDir, PFN_TO_PTE(Pfn) | PA_PRESENT | PA_READWRITE | PA_USER, 0);
|
Entry = InterlockedCompareExchangePte(PageDir, PFN_TO_PTE(Pfn) | PA_PRESENT | PA_READWRITE | PA_USER, 0);
|
||||||
if (Entry != 0)
|
if (Entry != 0)
|
||||||
|
@ -403,7 +403,7 @@ MmDisableVirtualMapping(PEPROCESS Process, PVOID Address, BOOLEAN* WasDirty, PPF
|
||||||
Pt = MmGetPageTableForProcess(Process, Address, FALSE);
|
Pt = MmGetPageTableForProcess(Process, Address, FALSE);
|
||||||
if (Pt == NULL)
|
if (Pt == NULL)
|
||||||
{
|
{
|
||||||
ASSERT(FALSE);
|
KeBugCheck(MEMORY_MANAGEMENT);
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* Atomically disable the present bit and get the old value.
|
* Atomically disable the present bit and get the old value.
|
||||||
|
@ -417,7 +417,7 @@ MmDisableVirtualMapping(PEPROCESS Process, PVOID Address, BOOLEAN* WasDirty, PPF
|
||||||
WasValid = (PAGE_MASK(Pte) != 0);
|
WasValid = (PAGE_MASK(Pte) != 0);
|
||||||
if (!WasValid)
|
if (!WasValid)
|
||||||
{
|
{
|
||||||
ASSERT(FALSE);
|
KeBugCheck(MEMORY_MANAGEMENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -582,14 +582,14 @@ MmSetCleanPage(PEPROCESS Process, PVOID Address)
|
||||||
if (Address < MmSystemRangeStart && Process == NULL)
|
if (Address < MmSystemRangeStart && Process == NULL)
|
||||||
{
|
{
|
||||||
DPRINT1("MmSetCleanPage is called for user space without a process.\n");
|
DPRINT1("MmSetCleanPage is called for user space without a process.\n");
|
||||||
ASSERT(FALSE);
|
KeBugCheck(MEMORY_MANAGEMENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
Pt = MmGetPageTableForProcess(Process, Address, FALSE);
|
Pt = MmGetPageTableForProcess(Process, Address, FALSE);
|
||||||
|
|
||||||
if (Pt == NULL)
|
if (Pt == NULL)
|
||||||
{
|
{
|
||||||
ASSERT(FALSE);
|
KeBugCheck(MEMORY_MANAGEMENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
do
|
do
|
||||||
|
@ -617,13 +617,13 @@ MmSetDirtyPage(PEPROCESS Process, PVOID Address)
|
||||||
if (Address < MmSystemRangeStart && Process == NULL)
|
if (Address < MmSystemRangeStart && Process == NULL)
|
||||||
{
|
{
|
||||||
DPRINT1("MmSetDirtyPage is called for user space without a process.\n");
|
DPRINT1("MmSetDirtyPage is called for user space without a process.\n");
|
||||||
ASSERT(FALSE);
|
KeBugCheck(MEMORY_MANAGEMENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
Pt = MmGetPageTableForProcess(Process, Address, FALSE);
|
Pt = MmGetPageTableForProcess(Process, Address, FALSE);
|
||||||
if (Pt == NULL)
|
if (Pt == NULL)
|
||||||
{
|
{
|
||||||
ASSERT(FALSE);
|
KeBugCheck(MEMORY_MANAGEMENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
do
|
do
|
||||||
|
@ -650,7 +650,7 @@ MmEnableVirtualMapping(PEPROCESS Process, PVOID Address)
|
||||||
Pt = MmGetPageTableForProcess(Process, Address, FALSE);
|
Pt = MmGetPageTableForProcess(Process, Address, FALSE);
|
||||||
if (Pt == NULL)
|
if (Pt == NULL)
|
||||||
{
|
{
|
||||||
ASSERT(FALSE);
|
KeBugCheck(MEMORY_MANAGEMENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
do
|
do
|
||||||
|
@ -704,7 +704,7 @@ MmCreateVirtualMappingForKernel(PVOID Address,
|
||||||
if (Address < MmSystemRangeStart)
|
if (Address < MmSystemRangeStart)
|
||||||
{
|
{
|
||||||
DPRINT1("MmCreateVirtualMappingForKernel is called for user space\n");
|
DPRINT1("MmCreateVirtualMappingForKernel is called for user space\n");
|
||||||
ASSERT(FALSE);
|
KeBugCheck(MEMORY_MANAGEMENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
Attributes = ProtectToPTE(flProtect);
|
Attributes = ProtectToPTE(flProtect);
|
||||||
|
@ -724,7 +724,7 @@ MmCreateVirtualMappingForKernel(PVOID Address,
|
||||||
Pt = MmGetPageTableForProcess(NULL, Addr, TRUE);
|
Pt = MmGetPageTableForProcess(NULL, Addr, TRUE);
|
||||||
if (Pt == NULL)
|
if (Pt == NULL)
|
||||||
{
|
{
|
||||||
ASSERT(FALSE);
|
KeBugCheck(MEMORY_MANAGEMENT);
|
||||||
}
|
}
|
||||||
Pt--;
|
Pt--;
|
||||||
|
|
||||||
|
@ -735,7 +735,7 @@ MmCreateVirtualMappingForKernel(PVOID Address,
|
||||||
DPRINT1("Setting physical address but not allowing access at address "
|
DPRINT1("Setting physical address but not allowing access at address "
|
||||||
"0x%.8X with attributes %x/%x.\n",
|
"0x%.8X with attributes %x/%x.\n",
|
||||||
Addr, Attributes, flProtect);
|
Addr, Attributes, flProtect);
|
||||||
ASSERT(FALSE);
|
KeBugCheck(MEMORY_MANAGEMENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
PdeOffset = ADDR_TO_PDE_OFFSET(Addr);
|
PdeOffset = ADDR_TO_PDE_OFFSET(Addr);
|
||||||
|
@ -744,7 +744,7 @@ MmCreateVirtualMappingForKernel(PVOID Address,
|
||||||
Pt = MmGetPageTableForProcess(NULL, Addr, TRUE);
|
Pt = MmGetPageTableForProcess(NULL, Addr, TRUE);
|
||||||
if (Pt == NULL)
|
if (Pt == NULL)
|
||||||
{
|
{
|
||||||
ASSERT(FALSE);
|
KeBugCheck(MEMORY_MANAGEMENT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -756,7 +756,7 @@ MmCreateVirtualMappingForKernel(PVOID Address,
|
||||||
Pte = *Pt;
|
Pte = *Pt;
|
||||||
if (Pte != 0)
|
if (Pte != 0)
|
||||||
{
|
{
|
||||||
ASSERT(FALSE);
|
KeBugCheck(MEMORY_MANAGEMENT);
|
||||||
}
|
}
|
||||||
InterlockedExchangePte(Pt, PFN_TO_PTE(Pages[i]) | Attributes);
|
InterlockedExchangePte(Pt, PFN_TO_PTE(Pages[i]) | Attributes);
|
||||||
}
|
}
|
||||||
|
@ -776,22 +776,22 @@ MmCreatePageFileMapping(PEPROCESS Process,
|
||||||
if (Process == NULL && Address < MmSystemRangeStart)
|
if (Process == NULL && Address < MmSystemRangeStart)
|
||||||
{
|
{
|
||||||
DPRINT1("No process\n");
|
DPRINT1("No process\n");
|
||||||
ASSERT(FALSE);
|
KeBugCheck(MEMORY_MANAGEMENT);
|
||||||
}
|
}
|
||||||
if (Process != NULL && Address >= MmSystemRangeStart)
|
if (Process != NULL && Address >= MmSystemRangeStart)
|
||||||
{
|
{
|
||||||
DPRINT1("Setting kernel address with process context\n");
|
DPRINT1("Setting kernel address with process context\n");
|
||||||
ASSERT(FALSE);
|
KeBugCheck(MEMORY_MANAGEMENT);
|
||||||
}
|
}
|
||||||
if (SwapEntry & (1 << 31))
|
if (SwapEntry & (1 << 31))
|
||||||
{
|
{
|
||||||
ASSERT(FALSE);
|
KeBugCheck(MEMORY_MANAGEMENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
Pt = MmGetPageTableForProcess(Process, Address, TRUE);
|
Pt = MmGetPageTableForProcess(Process, Address, TRUE);
|
||||||
if (Pt == NULL)
|
if (Pt == NULL)
|
||||||
{
|
{
|
||||||
ASSERT(FALSE);
|
KeBugCheck(MEMORY_MANAGEMENT);
|
||||||
}
|
}
|
||||||
Pte = *Pt;
|
Pte = *Pt;
|
||||||
if (PAGE_MASK((Pte)) != 0)
|
if (PAGE_MASK((Pte)) != 0)
|
||||||
|
@ -836,13 +836,13 @@ MmCreateVirtualMappingUnsafe(PEPROCESS Process,
|
||||||
if (Address < MmSystemRangeStart)
|
if (Address < MmSystemRangeStart)
|
||||||
{
|
{
|
||||||
DPRINT1("No process\n");
|
DPRINT1("No process\n");
|
||||||
ASSERT(FALSE);
|
KeBugCheck(MEMORY_MANAGEMENT);
|
||||||
}
|
}
|
||||||
if (PageCount > 0x10000 ||
|
if (PageCount > 0x10000 ||
|
||||||
(ULONG_PTR) Address / PAGE_SIZE + PageCount > 0x100000)
|
(ULONG_PTR) Address / PAGE_SIZE + PageCount > 0x100000)
|
||||||
{
|
{
|
||||||
DPRINT1("Page count to large\n");
|
DPRINT1("Page count to large\n");
|
||||||
ASSERT(FALSE);
|
KeBugCheck(MEMORY_MANAGEMENT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -850,14 +850,14 @@ MmCreateVirtualMappingUnsafe(PEPROCESS Process,
|
||||||
if (Address >= MmSystemRangeStart)
|
if (Address >= MmSystemRangeStart)
|
||||||
{
|
{
|
||||||
DPRINT1("Setting kernel address with process context\n");
|
DPRINT1("Setting kernel address with process context\n");
|
||||||
ASSERT(FALSE);
|
KeBugCheck(MEMORY_MANAGEMENT);
|
||||||
}
|
}
|
||||||
if (PageCount > (ULONG_PTR)MmSystemRangeStart / PAGE_SIZE ||
|
if (PageCount > (ULONG_PTR)MmSystemRangeStart / PAGE_SIZE ||
|
||||||
(ULONG_PTR) Address / PAGE_SIZE + PageCount >
|
(ULONG_PTR) Address / PAGE_SIZE + PageCount >
|
||||||
(ULONG_PTR)MmSystemRangeStart / PAGE_SIZE)
|
(ULONG_PTR)MmSystemRangeStart / PAGE_SIZE)
|
||||||
{
|
{
|
||||||
DPRINT1("Page Count to large\n");
|
DPRINT1("Page Count to large\n");
|
||||||
ASSERT(FALSE);
|
KeBugCheck(MEMORY_MANAGEMENT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -889,7 +889,7 @@ MmCreateVirtualMappingUnsafe(PEPROCESS Process,
|
||||||
DPRINT1("Setting physical address but not allowing access at address "
|
DPRINT1("Setting physical address but not allowing access at address "
|
||||||
"0x%.8X with attributes %x/%x.\n",
|
"0x%.8X with attributes %x/%x.\n",
|
||||||
Addr, Attributes, flProtect);
|
Addr, Attributes, flProtect);
|
||||||
ASSERT(FALSE);
|
KeBugCheck(MEMORY_MANAGEMENT);
|
||||||
}
|
}
|
||||||
PdeOffset = ADDR_TO_PDE_OFFSET(Addr);
|
PdeOffset = ADDR_TO_PDE_OFFSET(Addr);
|
||||||
if (oldPdeOffset != PdeOffset)
|
if (oldPdeOffset != PdeOffset)
|
||||||
|
@ -898,7 +898,7 @@ MmCreateVirtualMappingUnsafe(PEPROCESS Process,
|
||||||
Pt = MmGetPageTableForProcess(Process, Addr, TRUE);
|
Pt = MmGetPageTableForProcess(Process, Addr, TRUE);
|
||||||
if (Pt == NULL)
|
if (Pt == NULL)
|
||||||
{
|
{
|
||||||
ASSERT(FALSE);
|
KeBugCheck(MEMORY_MANAGEMENT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -911,7 +911,7 @@ MmCreateVirtualMappingUnsafe(PEPROCESS Process,
|
||||||
MmMarkPageMapped(Pages[i]);
|
MmMarkPageMapped(Pages[i]);
|
||||||
if (PAGE_MASK((Pte)) != 0 && !((Pte) & PA_PRESENT))
|
if (PAGE_MASK((Pte)) != 0 && !((Pte) & PA_PRESENT))
|
||||||
{
|
{
|
||||||
ASSERT(FALSE);
|
KeBugCheck(MEMORY_MANAGEMENT);
|
||||||
}
|
}
|
||||||
if (PAGE_MASK((Pte)) != 0)
|
if (PAGE_MASK((Pte)) != 0)
|
||||||
{
|
{
|
||||||
|
@ -950,7 +950,7 @@ MmCreateVirtualMapping(PEPROCESS Process,
|
||||||
if (!MmIsPageInUse(Pages[i]))
|
if (!MmIsPageInUse(Pages[i]))
|
||||||
{
|
{
|
||||||
DPRINT1("Page at address %x not in use\n", PFN_TO_PTE(Pages[i]));
|
DPRINT1("Page at address %x not in use\n", PFN_TO_PTE(Pages[i]));
|
||||||
ASSERT(FALSE);
|
KeBugCheck(MEMORY_MANAGEMENT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1035,7 +1035,7 @@ MmSetPageProtect(PEPROCESS Process, PVOID Address, ULONG flProtect)
|
||||||
Pt = MmGetPageTableForProcess(Process, Address, FALSE);
|
Pt = MmGetPageTableForProcess(Process, Address, FALSE);
|
||||||
if (Pt == NULL)
|
if (Pt == NULL)
|
||||||
{
|
{
|
||||||
ASSERT(FALSE);
|
KeBugCheck(MEMORY_MANAGEMENT);
|
||||||
}
|
}
|
||||||
InterlockedExchangePte(Pt, PAGE_MASK(*Pt) | Attributes | (*Pt & (PA_ACCESSED|PA_DIRTY)));
|
InterlockedExchangePte(Pt, PAGE_MASK(*Pt) | Attributes | (*Pt & (PA_ACCESSED|PA_DIRTY)));
|
||||||
MiFlushTlb(Pt, Address);
|
MiFlushTlb(Pt, Address);
|
||||||
|
@ -1099,7 +1099,7 @@ MmCreateHyperspaceMapping(PFN_TYPE Page)
|
||||||
}
|
}
|
||||||
if (i >= Page % 1024)
|
if (i >= Page % 1024)
|
||||||
{
|
{
|
||||||
ASSERT(FALSE);
|
KeBugCheck(MEMORY_MANAGEMENT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1124,7 +1124,7 @@ MmCreateHyperspaceMapping(PFN_TYPE Page)
|
||||||
}
|
}
|
||||||
if (i <= Page % 1024)
|
if (i <= Page % 1024)
|
||||||
{
|
{
|
||||||
ASSERT(FALSE);
|
KeBugCheck(MEMORY_MANAGEMENT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1158,7 +1158,7 @@ MmUpdatePageDir(PEPROCESS Process, PVOID Address, ULONG Size)
|
||||||
|
|
||||||
if (Address < MmSystemRangeStart)
|
if (Address < MmSystemRangeStart)
|
||||||
{
|
{
|
||||||
ASSERT(FALSE);
|
KeBugCheck(MEMORY_MANAGEMENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
StartOffset = ADDR_TO_PDE_OFFSET(Address);
|
StartOffset = ADDR_TO_PDE_OFFSET(Address);
|
||||||
|
@ -1237,7 +1237,7 @@ MiInitPageDirectoryMap(VOID)
|
||||||
BoundaryAddressMultiple);
|
BoundaryAddressMultiple);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
ASSERT(FALSE);
|
KeBugCheck(MEMORY_MANAGEMENT);
|
||||||
}
|
}
|
||||||
BaseAddress = (PVOID)HYPERSPACE;
|
BaseAddress = (PVOID)HYPERSPACE;
|
||||||
Status = MmCreateMemoryArea(MmGetKernelAddressSpace(),
|
Status = MmCreateMemoryArea(MmGetKernelAddressSpace(),
|
||||||
|
@ -1251,7 +1251,7 @@ MiInitPageDirectoryMap(VOID)
|
||||||
BoundaryAddressMultiple);
|
BoundaryAddressMultiple);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
ASSERT(FALSE);
|
KeBugCheck(MEMORY_MANAGEMENT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -291,7 +291,7 @@ MmFreeSectionSegments(PFILE_OBJECT FileObject)
|
||||||
{
|
{
|
||||||
DPRINT1("Image segment %d still referenced (was %d)\n", i,
|
DPRINT1("Image segment %d still referenced (was %d)\n", i,
|
||||||
SectionSegments[i].ReferenceCount);
|
SectionSegments[i].ReferenceCount);
|
||||||
ASSERT(FALSE);
|
KeBugCheck(MEMORY_MANAGEMENT);
|
||||||
}
|
}
|
||||||
MmFreePageTablesSectionSegment(&SectionSegments[i]);
|
MmFreePageTablesSectionSegment(&SectionSegments[i]);
|
||||||
}
|
}
|
||||||
|
@ -309,7 +309,7 @@ MmFreeSectionSegments(PFILE_OBJECT FileObject)
|
||||||
if (Segment->ReferenceCount != 0)
|
if (Segment->ReferenceCount != 0)
|
||||||
{
|
{
|
||||||
DPRINT1("Data segment still referenced\n");
|
DPRINT1("Data segment still referenced\n");
|
||||||
ASSERT(FALSE);
|
KeBugCheck(MEMORY_MANAGEMENT);
|
||||||
}
|
}
|
||||||
MmFreePageTablesSectionSegment(Segment);
|
MmFreePageTablesSectionSegment(Segment);
|
||||||
ExFreePool(Segment);
|
ExFreePool(Segment);
|
||||||
|
@ -357,7 +357,7 @@ MmSetPageEntrySectionSegment(PMM_SECTION_SEGMENT Segment,
|
||||||
TAG_SECTION_PAGE_TABLE);
|
TAG_SECTION_PAGE_TABLE);
|
||||||
if (Table == NULL)
|
if (Table == NULL)
|
||||||
{
|
{
|
||||||
ASSERT(FALSE);
|
KeBugCheck(MEMORY_MANAGEMENT);
|
||||||
}
|
}
|
||||||
memset(Table, 0, sizeof(SECTION_PAGE_TABLE));
|
memset(Table, 0, sizeof(SECTION_PAGE_TABLE));
|
||||||
DPRINT("Table %x\n", Table);
|
DPRINT("Table %x\n", Table);
|
||||||
|
@ -410,16 +410,16 @@ MmSharePageEntrySectionSegment(PMM_SECTION_SEGMENT Segment,
|
||||||
if (Entry == 0)
|
if (Entry == 0)
|
||||||
{
|
{
|
||||||
DPRINT1("Entry == 0 for MmSharePageEntrySectionSegment\n");
|
DPRINT1("Entry == 0 for MmSharePageEntrySectionSegment\n");
|
||||||
ASSERT(FALSE);
|
KeBugCheck(MEMORY_MANAGEMENT);
|
||||||
}
|
}
|
||||||
if (SHARE_COUNT_FROM_SSE(Entry) == MAX_SHARE_COUNT)
|
if (SHARE_COUNT_FROM_SSE(Entry) == MAX_SHARE_COUNT)
|
||||||
{
|
{
|
||||||
DPRINT1("Maximum share count reached\n");
|
DPRINT1("Maximum share count reached\n");
|
||||||
ASSERT(FALSE);
|
KeBugCheck(MEMORY_MANAGEMENT);
|
||||||
}
|
}
|
||||||
if (IS_SWAP_FROM_SSE(Entry))
|
if (IS_SWAP_FROM_SSE(Entry))
|
||||||
{
|
{
|
||||||
ASSERT(FALSE);
|
KeBugCheck(MEMORY_MANAGEMENT);
|
||||||
}
|
}
|
||||||
Entry = MAKE_SSE(PAGE_FROM_SSE(Entry), SHARE_COUNT_FROM_SSE(Entry) + 1);
|
Entry = MAKE_SSE(PAGE_FROM_SSE(Entry), SHARE_COUNT_FROM_SSE(Entry) + 1);
|
||||||
MmSetPageEntrySectionSegment(Segment, Offset, Entry);
|
MmSetPageEntrySectionSegment(Segment, Offset, Entry);
|
||||||
|
@ -440,16 +440,16 @@ MmUnsharePageEntrySectionSegment(PROS_SECTION_OBJECT Section,
|
||||||
if (Entry == 0)
|
if (Entry == 0)
|
||||||
{
|
{
|
||||||
DPRINT1("Entry == 0 for MmUnsharePageEntrySectionSegment\n");
|
DPRINT1("Entry == 0 for MmUnsharePageEntrySectionSegment\n");
|
||||||
ASSERT(FALSE);
|
KeBugCheck(MEMORY_MANAGEMENT);
|
||||||
}
|
}
|
||||||
if (SHARE_COUNT_FROM_SSE(Entry) == 0)
|
if (SHARE_COUNT_FROM_SSE(Entry) == 0)
|
||||||
{
|
{
|
||||||
DPRINT1("Zero share count for unshare\n");
|
DPRINT1("Zero share count for unshare\n");
|
||||||
ASSERT(FALSE);
|
KeBugCheck(MEMORY_MANAGEMENT);
|
||||||
}
|
}
|
||||||
if (IS_SWAP_FROM_SSE(Entry))
|
if (IS_SWAP_FROM_SSE(Entry))
|
||||||
{
|
{
|
||||||
ASSERT(FALSE);
|
KeBugCheck(MEMORY_MANAGEMENT);
|
||||||
}
|
}
|
||||||
Entry = MAKE_SSE(PAGE_FROM_SSE(Entry), SHARE_COUNT_FROM_SSE(Entry) - 1);
|
Entry = MAKE_SSE(PAGE_FROM_SSE(Entry), SHARE_COUNT_FROM_SSE(Entry) - 1);
|
||||||
/*
|
/*
|
||||||
|
@ -485,7 +485,7 @@ MmUnsharePageEntrySectionSegment(PROS_SECTION_OBJECT Section,
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT1("CcRosUnmapCacheSegment failed, status = %x\n", Status);
|
DPRINT1("CcRosUnmapCacheSegment failed, status = %x\n", Status);
|
||||||
ASSERT(FALSE);
|
KeBugCheck(MEMORY_MANAGEMENT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -534,7 +534,7 @@ MmUnsharePageEntrySectionSegment(PROS_SECTION_OBJECT Section,
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT1("MM: Failed to write to swap page (Status was 0x%.8X)\n", Status);
|
DPRINT1("MM: Failed to write to swap page (Status was 0x%.8X)\n", Status);
|
||||||
ASSERT(FALSE);
|
KeBugCheck(MEMORY_MANAGEMENT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
MmSetPageEntrySectionSegment(Segment, Offset, MAKE_SWAP_SSE(SavedSwapEntry));
|
MmSetPageEntrySectionSegment(Segment, Offset, MAKE_SWAP_SSE(SavedSwapEntry));
|
||||||
|
@ -545,7 +545,7 @@ MmUnsharePageEntrySectionSegment(PROS_SECTION_OBJECT Section,
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DPRINT1("Found a swapentry for a non private page in an image or data file sgment\n");
|
DPRINT1("Found a swapentry for a non private page in an image or data file sgment\n");
|
||||||
ASSERT(FALSE);
|
KeBugCheck(MEMORY_MANAGEMENT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -816,7 +816,7 @@ MmNotPresentFaultSectionView(PMM_AVL_TABLE AddressSpace,
|
||||||
if (PageOp == NULL)
|
if (PageOp == NULL)
|
||||||
{
|
{
|
||||||
DPRINT1("MmGetPageOp failed\n");
|
DPRINT1("MmGetPageOp failed\n");
|
||||||
ASSERT(FALSE);
|
KeBugCheck(MEMORY_MANAGEMENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -834,12 +834,12 @@ MmNotPresentFaultSectionView(PMM_AVL_TABLE AddressSpace,
|
||||||
if (Status != STATUS_SUCCESS)
|
if (Status != STATUS_SUCCESS)
|
||||||
{
|
{
|
||||||
DPRINT1("Failed to wait for page op, status = %x\n", Status);
|
DPRINT1("Failed to wait for page op, status = %x\n", Status);
|
||||||
ASSERT(FALSE);
|
KeBugCheck(MEMORY_MANAGEMENT);
|
||||||
}
|
}
|
||||||
if (PageOp->Status == STATUS_PENDING)
|
if (PageOp->Status == STATUS_PENDING)
|
||||||
{
|
{
|
||||||
DPRINT1("Woke for page op before completion\n");
|
DPRINT1("Woke for page op before completion\n");
|
||||||
ASSERT(FALSE);
|
KeBugCheck(MEMORY_MANAGEMENT);
|
||||||
}
|
}
|
||||||
MmLockAddressSpace(AddressSpace);
|
MmLockAddressSpace(AddressSpace);
|
||||||
/*
|
/*
|
||||||
|
@ -897,7 +897,7 @@ MmNotPresentFaultSectionView(PMM_AVL_TABLE AddressSpace,
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT1("Unable to create virtual mapping\n");
|
DPRINT1("Unable to create virtual mapping\n");
|
||||||
ASSERT(FALSE);
|
KeBugCheck(MEMORY_MANAGEMENT);
|
||||||
}
|
}
|
||||||
MmInsertRmap(Page, Process, (PVOID)PAddress);
|
MmInsertRmap(Page, Process, (PVOID)PAddress);
|
||||||
}
|
}
|
||||||
|
@ -926,7 +926,7 @@ MmNotPresentFaultSectionView(PMM_AVL_TABLE AddressSpace,
|
||||||
if (Segment->Flags & MM_PAGEFILE_SEGMENT)
|
if (Segment->Flags & MM_PAGEFILE_SEGMENT)
|
||||||
{
|
{
|
||||||
DPRINT1("Found a swaped out private page in a pagefile section.\n");
|
DPRINT1("Found a swaped out private page in a pagefile section.\n");
|
||||||
ASSERT(FALSE);
|
KeBugCheck(MEMORY_MANAGEMENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
MmUnlockSectionSegment(Segment);
|
MmUnlockSectionSegment(Segment);
|
||||||
|
@ -936,14 +936,14 @@ MmNotPresentFaultSectionView(PMM_AVL_TABLE AddressSpace,
|
||||||
Status = MmRequestPageMemoryConsumer(MC_USER, TRUE, &Page);
|
Status = MmRequestPageMemoryConsumer(MC_USER, TRUE, &Page);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
ASSERT(FALSE);
|
KeBugCheck(MEMORY_MANAGEMENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = MmReadFromSwapPage(SwapEntry, Page);
|
Status = MmReadFromSwapPage(SwapEntry, Page);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT1("MmReadFromSwapPage failed, status = %x\n", Status);
|
DPRINT1("MmReadFromSwapPage failed, status = %x\n", Status);
|
||||||
ASSERT(FALSE);
|
KeBugCheck(MEMORY_MANAGEMENT);
|
||||||
}
|
}
|
||||||
MmLockAddressSpace(AddressSpace);
|
MmLockAddressSpace(AddressSpace);
|
||||||
Status = MmCreateVirtualMapping(Process,
|
Status = MmCreateVirtualMapping(Process,
|
||||||
|
@ -954,7 +954,7 @@ MmNotPresentFaultSectionView(PMM_AVL_TABLE AddressSpace,
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT("MmCreateVirtualMapping failed, not out of memory\n");
|
DPRINT("MmCreateVirtualMapping failed, not out of memory\n");
|
||||||
ASSERT(FALSE);
|
KeBugCheck(MEMORY_MANAGEMENT);
|
||||||
return(Status);
|
return(Status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -999,7 +999,7 @@ MmNotPresentFaultSectionView(PMM_AVL_TABLE AddressSpace,
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT("MmCreateVirtualMappingUnsafe failed, not out of memory\n");
|
DPRINT("MmCreateVirtualMappingUnsafe failed, not out of memory\n");
|
||||||
ASSERT(FALSE);
|
KeBugCheck(MEMORY_MANAGEMENT);
|
||||||
return(Status);
|
return(Status);
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
|
@ -1035,7 +1035,7 @@ MmNotPresentFaultSectionView(PMM_AVL_TABLE AddressSpace,
|
||||||
}
|
}
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
ASSERT(FALSE);
|
KeBugCheck(MEMORY_MANAGEMENT);
|
||||||
}
|
}
|
||||||
Status = MmCreateVirtualMapping(Process,
|
Status = MmCreateVirtualMapping(Process,
|
||||||
Address,
|
Address,
|
||||||
|
@ -1045,7 +1045,7 @@ MmNotPresentFaultSectionView(PMM_AVL_TABLE AddressSpace,
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT("MmCreateVirtualMapping failed, not out of memory\n");
|
DPRINT("MmCreateVirtualMapping failed, not out of memory\n");
|
||||||
ASSERT(FALSE);
|
KeBugCheck(MEMORY_MANAGEMENT);
|
||||||
return(Status);
|
return(Status);
|
||||||
}
|
}
|
||||||
MmInsertRmap(Page, Process, (PVOID)PAddress);
|
MmInsertRmap(Page, Process, (PVOID)PAddress);
|
||||||
|
@ -1126,7 +1126,7 @@ MmNotPresentFaultSectionView(PMM_AVL_TABLE AddressSpace,
|
||||||
if (Entry != Entry1)
|
if (Entry != Entry1)
|
||||||
{
|
{
|
||||||
DPRINT1("Someone changed ppte entry while we slept\n");
|
DPRINT1("Someone changed ppte entry while we slept\n");
|
||||||
ASSERT(FALSE);
|
KeBugCheck(MEMORY_MANAGEMENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1145,7 +1145,7 @@ MmNotPresentFaultSectionView(PMM_AVL_TABLE AddressSpace,
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT1("Unable to create virtual mapping\n");
|
DPRINT1("Unable to create virtual mapping\n");
|
||||||
ASSERT(FALSE);
|
KeBugCheck(MEMORY_MANAGEMENT);
|
||||||
}
|
}
|
||||||
MmInsertRmap(Page, Process, (PVOID)PAddress);
|
MmInsertRmap(Page, Process, (PVOID)PAddress);
|
||||||
|
|
||||||
|
@ -1174,13 +1174,13 @@ MmNotPresentFaultSectionView(PMM_AVL_TABLE AddressSpace,
|
||||||
Status = MmRequestPageMemoryConsumer(MC_USER, TRUE, &Page);
|
Status = MmRequestPageMemoryConsumer(MC_USER, TRUE, &Page);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
ASSERT(FALSE);
|
KeBugCheck(MEMORY_MANAGEMENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = MmReadFromSwapPage(SwapEntry, Page);
|
Status = MmReadFromSwapPage(SwapEntry, Page);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
ASSERT(FALSE);
|
KeBugCheck(MEMORY_MANAGEMENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1197,7 +1197,7 @@ MmNotPresentFaultSectionView(PMM_AVL_TABLE AddressSpace,
|
||||||
if (Entry != Entry1)
|
if (Entry != Entry1)
|
||||||
{
|
{
|
||||||
DPRINT1("Someone changed ppte entry while we slept\n");
|
DPRINT1("Someone changed ppte entry while we slept\n");
|
||||||
ASSERT(FALSE);
|
KeBugCheck(MEMORY_MANAGEMENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1220,7 +1220,7 @@ MmNotPresentFaultSectionView(PMM_AVL_TABLE AddressSpace,
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT1("Unable to create virtual mapping\n");
|
DPRINT1("Unable to create virtual mapping\n");
|
||||||
ASSERT(FALSE);
|
KeBugCheck(MEMORY_MANAGEMENT);
|
||||||
}
|
}
|
||||||
MmInsertRmap(Page, Process, (PVOID)PAddress);
|
MmInsertRmap(Page, Process, (PVOID)PAddress);
|
||||||
if (Locked)
|
if (Locked)
|
||||||
|
@ -1252,7 +1252,7 @@ MmNotPresentFaultSectionView(PMM_AVL_TABLE AddressSpace,
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT1("Unable to create virtual mapping\n");
|
DPRINT1("Unable to create virtual mapping\n");
|
||||||
ASSERT(FALSE);
|
KeBugCheck(MEMORY_MANAGEMENT);
|
||||||
}
|
}
|
||||||
MmInsertRmap(Page, Process, (PVOID)PAddress);
|
MmInsertRmap(Page, Process, (PVOID)PAddress);
|
||||||
if (Locked)
|
if (Locked)
|
||||||
|
@ -1346,7 +1346,7 @@ MmAccessFaultSectionView(PMM_AVL_TABLE AddressSpace,
|
||||||
if (PageOp == NULL)
|
if (PageOp == NULL)
|
||||||
{
|
{
|
||||||
DPRINT1("MmGetPageOp failed\n");
|
DPRINT1("MmGetPageOp failed\n");
|
||||||
ASSERT(FALSE);
|
KeBugCheck(MEMORY_MANAGEMENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1362,12 +1362,12 @@ MmAccessFaultSectionView(PMM_AVL_TABLE AddressSpace,
|
||||||
if (Status == STATUS_TIMEOUT)
|
if (Status == STATUS_TIMEOUT)
|
||||||
{
|
{
|
||||||
DPRINT1("Failed to wait for page op, status = %x\n", Status);
|
DPRINT1("Failed to wait for page op, status = %x\n", Status);
|
||||||
ASSERT(FALSE);
|
KeBugCheck(MEMORY_MANAGEMENT);
|
||||||
}
|
}
|
||||||
if (PageOp->Status == STATUS_PENDING)
|
if (PageOp->Status == STATUS_PENDING)
|
||||||
{
|
{
|
||||||
DPRINT1("Woke for page op before completion\n");
|
DPRINT1("Woke for page op before completion\n");
|
||||||
ASSERT(FALSE);
|
KeBugCheck(MEMORY_MANAGEMENT);
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* Restart the operation
|
* Restart the operation
|
||||||
|
@ -1389,7 +1389,7 @@ MmAccessFaultSectionView(PMM_AVL_TABLE AddressSpace,
|
||||||
Status = MmRequestPageMemoryConsumer(MC_USER, TRUE, &NewPage);
|
Status = MmRequestPageMemoryConsumer(MC_USER, TRUE, &NewPage);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
ASSERT(FALSE);
|
KeBugCheck(MEMORY_MANAGEMENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1414,13 +1414,13 @@ MmAccessFaultSectionView(PMM_AVL_TABLE AddressSpace,
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT("MmCreateVirtualMapping failed, not out of memory\n");
|
DPRINT("MmCreateVirtualMapping failed, not out of memory\n");
|
||||||
ASSERT(FALSE);
|
KeBugCheck(MEMORY_MANAGEMENT);
|
||||||
return(Status);
|
return(Status);
|
||||||
}
|
}
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT1("Unable to create virtual mapping\n");
|
DPRINT1("Unable to create virtual mapping\n");
|
||||||
ASSERT(FALSE);
|
KeBugCheck(MEMORY_MANAGEMENT);
|
||||||
}
|
}
|
||||||
if (Locked)
|
if (Locked)
|
||||||
{
|
{
|
||||||
|
@ -1550,7 +1550,7 @@ MmPageOutSectionView(PMM_AVL_TABLE AddressSpace,
|
||||||
DPRINT1("Trying to page out from physical memory section address 0x%X "
|
DPRINT1("Trying to page out from physical memory section address 0x%X "
|
||||||
"process %d\n", Address,
|
"process %d\n", Address,
|
||||||
Process ? Process->UniqueProcessId : 0);
|
Process ? Process->UniqueProcessId : 0);
|
||||||
ASSERT(FALSE);
|
KeBugCheck(MEMORY_MANAGEMENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1561,7 +1561,7 @@ MmPageOutSectionView(PMM_AVL_TABLE AddressSpace,
|
||||||
{
|
{
|
||||||
DPRINT1("Trying to page out not-present page at (%d,0x%.8X).\n",
|
DPRINT1("Trying to page out not-present page at (%d,0x%.8X).\n",
|
||||||
Process ? Process->UniqueProcessId : 0, Address);
|
Process ? Process->UniqueProcessId : 0, Address);
|
||||||
ASSERT(FALSE);
|
KeBugCheck(MEMORY_MANAGEMENT);
|
||||||
}
|
}
|
||||||
Page = MmGetPfnForProcess(Process, Address);
|
Page = MmGetPfnForProcess(Process, Address);
|
||||||
SwapEntry = MmGetSavedSwapEntryPage(Page);
|
SwapEntry = MmGetSavedSwapEntryPage(Page);
|
||||||
|
@ -1589,7 +1589,7 @@ MmPageOutSectionView(PMM_AVL_TABLE AddressSpace,
|
||||||
if(!MiIsPageFromCache(MemoryArea, Context.Offset))
|
if(!MiIsPageFromCache(MemoryArea, Context.Offset))
|
||||||
{
|
{
|
||||||
DPRINT1("Direct mapped non private page is not associated with the cache.\n");
|
DPRINT1("Direct mapped non private page is not associated with the cache.\n");
|
||||||
ASSERT(FALSE);
|
KeBugCheck(MEMORY_MANAGEMENT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1608,7 +1608,7 @@ MmPageOutSectionView(PMM_AVL_TABLE AddressSpace,
|
||||||
if (!(Context.Segment->Flags & MM_PAGEFILE_SEGMENT) &&
|
if (!(Context.Segment->Flags & MM_PAGEFILE_SEGMENT) &&
|
||||||
!(Context.Segment->Characteristics & IMAGE_SCN_MEM_SHARED))
|
!(Context.Segment->Characteristics & IMAGE_SCN_MEM_SHARED))
|
||||||
{
|
{
|
||||||
ASSERT(FALSE);
|
KeBugCheck(MEMORY_MANAGEMENT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1626,7 +1626,7 @@ MmPageOutSectionView(PMM_AVL_TABLE AddressSpace,
|
||||||
{
|
{
|
||||||
DPRINT1("Found a %s private page (address %x) in a pagefile segment.\n",
|
DPRINT1("Found a %s private page (address %x) in a pagefile segment.\n",
|
||||||
Context.WasDirty ? "dirty" : "clean", Address);
|
Context.WasDirty ? "dirty" : "clean", Address);
|
||||||
ASSERT(FALSE);
|
KeBugCheck(MEMORY_MANAGEMENT);
|
||||||
}
|
}
|
||||||
if (!Context.WasDirty && SwapEntry != 0)
|
if (!Context.WasDirty && SwapEntry != 0)
|
||||||
{
|
{
|
||||||
|
@ -1644,7 +1644,7 @@ MmPageOutSectionView(PMM_AVL_TABLE AddressSpace,
|
||||||
{
|
{
|
||||||
DPRINT1("Found a %s private page (address %x) in a shared section segment.\n",
|
DPRINT1("Found a %s private page (address %x) in a shared section segment.\n",
|
||||||
Context.WasDirty ? "dirty" : "clean", Address);
|
Context.WasDirty ? "dirty" : "clean", Address);
|
||||||
ASSERT(FALSE);
|
KeBugCheck(MEMORY_MANAGEMENT);
|
||||||
}
|
}
|
||||||
if (!Context.WasDirty || SwapEntry != 0)
|
if (!Context.WasDirty || SwapEntry != 0)
|
||||||
{
|
{
|
||||||
|
@ -1665,13 +1665,13 @@ MmPageOutSectionView(PMM_AVL_TABLE AddressSpace,
|
||||||
{
|
{
|
||||||
DPRINT1("Found a swapentry for a non private and direct mapped page (address %x)\n",
|
DPRINT1("Found a swapentry for a non private and direct mapped page (address %x)\n",
|
||||||
Address);
|
Address);
|
||||||
ASSERT(FALSE);
|
KeBugCheck(MEMORY_MANAGEMENT);
|
||||||
}
|
}
|
||||||
Status = CcRosUnmapCacheSegment(Bcb, FileOffset, FALSE);
|
Status = CcRosUnmapCacheSegment(Bcb, FileOffset, FALSE);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT1("CCRosUnmapCacheSegment failed, status = %x\n", Status);
|
DPRINT1("CCRosUnmapCacheSegment failed, status = %x\n", Status);
|
||||||
ASSERT(FALSE);
|
KeBugCheck(MEMORY_MANAGEMENT);
|
||||||
}
|
}
|
||||||
PageOp->Status = STATUS_SUCCESS;
|
PageOp->Status = STATUS_SUCCESS;
|
||||||
MmspCompleteAndReleasePageOp(PageOp);
|
MmspCompleteAndReleasePageOp(PageOp);
|
||||||
|
@ -1683,7 +1683,7 @@ MmPageOutSectionView(PMM_AVL_TABLE AddressSpace,
|
||||||
{
|
{
|
||||||
DPRINT1("Found a swap entry for a non dirty, non private and not direct mapped page (address %x)\n",
|
DPRINT1("Found a swap entry for a non dirty, non private and not direct mapped page (address %x)\n",
|
||||||
Address);
|
Address);
|
||||||
ASSERT(FALSE);
|
KeBugCheck(MEMORY_MANAGEMENT);
|
||||||
}
|
}
|
||||||
MmReleasePageMemoryConsumer(MC_USER, Page);
|
MmReleasePageMemoryConsumer(MC_USER, Page);
|
||||||
PageOp->Status = STATUS_SUCCESS;
|
PageOp->Status = STATUS_SUCCESS;
|
||||||
|
@ -1700,7 +1700,7 @@ MmPageOutSectionView(PMM_AVL_TABLE AddressSpace,
|
||||||
MmUnlockAddressSpace(AddressSpace);
|
MmUnlockAddressSpace(AddressSpace);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
ASSERT(FALSE);
|
KeBugCheck(MEMORY_MANAGEMENT);
|
||||||
}
|
}
|
||||||
MmReleasePageMemoryConsumer(MC_USER, Page);
|
MmReleasePageMemoryConsumer(MC_USER, Page);
|
||||||
PageOp->Status = STATUS_SUCCESS;
|
PageOp->Status = STATUS_SUCCESS;
|
||||||
|
@ -1828,7 +1828,7 @@ MmPageOutSectionView(PMM_AVL_TABLE AddressSpace,
|
||||||
MmUnlockAddressSpace(AddressSpace);
|
MmUnlockAddressSpace(AddressSpace);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
ASSERT(FALSE);
|
KeBugCheck(MEMORY_MANAGEMENT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1903,7 +1903,7 @@ MmWritePageSectionView(PMM_AVL_TABLE AddressSpace,
|
||||||
DPRINT1("Trying to write back page from physical memory mapped at %X "
|
DPRINT1("Trying to write back page from physical memory mapped at %X "
|
||||||
"process %d\n", Address,
|
"process %d\n", Address,
|
||||||
Process ? Process->UniqueProcessId : 0);
|
Process ? Process->UniqueProcessId : 0);
|
||||||
ASSERT(FALSE);
|
KeBugCheck(MEMORY_MANAGEMENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1914,7 +1914,7 @@ MmWritePageSectionView(PMM_AVL_TABLE AddressSpace,
|
||||||
{
|
{
|
||||||
DPRINT1("Trying to page out not-present page at (%d,0x%.8X).\n",
|
DPRINT1("Trying to page out not-present page at (%d,0x%.8X).\n",
|
||||||
Process ? Process->UniqueProcessId : 0, Address);
|
Process ? Process->UniqueProcessId : 0, Address);
|
||||||
ASSERT(FALSE);
|
KeBugCheck(MEMORY_MANAGEMENT);
|
||||||
}
|
}
|
||||||
Page = MmGetPfnForProcess(Process, Address);
|
Page = MmGetPfnForProcess(Process, Address);
|
||||||
SwapEntry = MmGetSavedSwapEntryPage(Page);
|
SwapEntry = MmGetSavedSwapEntryPage(Page);
|
||||||
|
@ -2282,7 +2282,7 @@ MmCreatePhysicalMemorySection(VOID)
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT1("Failed to create PhysicalMemory section\n");
|
DPRINT1("Failed to create PhysicalMemory section\n");
|
||||||
ASSERT(FALSE);
|
KeBugCheck(MEMORY_MANAGEMENT);
|
||||||
}
|
}
|
||||||
Status = ObInsertObject(PhysSection,
|
Status = ObInsertObject(PhysSection,
|
||||||
NULL,
|
NULL,
|
||||||
|
@ -2723,7 +2723,7 @@ ExeFmtpReadFile(IN PVOID File,
|
||||||
|
|
||||||
if(Length == 0)
|
if(Length == 0)
|
||||||
{
|
{
|
||||||
ASSERT(FALSE);
|
KeBugCheck(MEMORY_MANAGEMENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
FileOffset = *Offset;
|
FileOffset = *Offset;
|
||||||
|
@ -2731,7 +2731,7 @@ ExeFmtpReadFile(IN PVOID File,
|
||||||
/* Negative/special offset: it cannot be used in this context */
|
/* Negative/special offset: it cannot be used in this context */
|
||||||
if(FileOffset.u.HighPart < 0)
|
if(FileOffset.u.HighPart < 0)
|
||||||
{
|
{
|
||||||
ASSERT(FALSE);
|
KeBugCheck(MEMORY_MANAGEMENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
AdjustOffset = PAGE_ROUND_DOWN(FileOffset.u.LowPart);
|
AdjustOffset = PAGE_ROUND_DOWN(FileOffset.u.LowPart);
|
||||||
|
@ -3134,7 +3134,7 @@ MmspPageAlignSegments
|
||||||
*/
|
*/
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ASSERT(FALSE);
|
KeBugCheck(MEMORY_MANAGEMENT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3903,7 +3903,7 @@ MmFreeSectionPage(PVOID Context, MEMORY_AREA* MemoryArea, PVOID Address,
|
||||||
if (Status != STATUS_SUCCESS)
|
if (Status != STATUS_SUCCESS)
|
||||||
{
|
{
|
||||||
DPRINT1("Failed to wait for page op, status = %x\n", Status);
|
DPRINT1("Failed to wait for page op, status = %x\n", Status);
|
||||||
ASSERT(FALSE);
|
KeBugCheck(MEMORY_MANAGEMENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
MmLockAddressSpace(AddressSpace);
|
MmLockAddressSpace(AddressSpace);
|
||||||
|
@ -3937,7 +3937,7 @@ MmFreeSectionPage(PVOID Context, MEMORY_AREA* MemoryArea, PVOID Address,
|
||||||
if (Segment->Flags & MM_PAGEFILE_SEGMENT)
|
if (Segment->Flags & MM_PAGEFILE_SEGMENT)
|
||||||
{
|
{
|
||||||
DPRINT1("Found a swap entry for a page in a pagefile section.\n");
|
DPRINT1("Found a swap entry for a page in a pagefile section.\n");
|
||||||
ASSERT(FALSE);
|
KeBugCheck(MEMORY_MANAGEMENT);
|
||||||
}
|
}
|
||||||
MmFreeSwapPage(SwapEntry);
|
MmFreeSwapPage(SwapEntry);
|
||||||
}
|
}
|
||||||
|
@ -3952,7 +3952,7 @@ MmFreeSectionPage(PVOID Context, MEMORY_AREA* MemoryArea, PVOID Address,
|
||||||
if (Segment->Flags & MM_PAGEFILE_SEGMENT)
|
if (Segment->Flags & MM_PAGEFILE_SEGMENT)
|
||||||
{
|
{
|
||||||
DPRINT1("Found a private page in a pagefile section.\n");
|
DPRINT1("Found a private page in a pagefile section.\n");
|
||||||
ASSERT(FALSE);
|
KeBugCheck(MEMORY_MANAGEMENT);
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* Just dereference private pages
|
* Just dereference private pages
|
||||||
|
@ -4078,7 +4078,7 @@ MmUnmapViewOfSection(PEPROCESS Process,
|
||||||
if (Status != STATUS_SUCCESS)
|
if (Status != STATUS_SUCCESS)
|
||||||
{
|
{
|
||||||
DPRINT1("Failed to wait for page op, status = %x\n", Status);
|
DPRINT1("Failed to wait for page op, status = %x\n", Status);
|
||||||
ASSERT(FALSE);
|
KeBugCheck(MEMORY_MANAGEMENT);
|
||||||
}
|
}
|
||||||
MmLockAddressSpace(AddressSpace);
|
MmLockAddressSpace(AddressSpace);
|
||||||
MemoryArea = MmLocateMemoryAreaByAddress(AddressSpace,
|
MemoryArea = MmLocateMemoryAreaByAddress(AddressSpace,
|
||||||
|
@ -4124,7 +4124,7 @@ MmUnmapViewOfSection(PEPROCESS Process,
|
||||||
}
|
}
|
||||||
if (i >= NrSegments)
|
if (i >= NrSegments)
|
||||||
{
|
{
|
||||||
ASSERT(FALSE);
|
KeBugCheck(MEMORY_MANAGEMENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < NrSegments; i++)
|
for (i = 0; i < NrSegments; i++)
|
||||||
|
|
|
@ -763,7 +763,7 @@ ObpCloseHandleTableEntry(IN PHANDLE_TABLE HandleTable,
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
NTAPI
|
NTAPI
|
||||||
ObpIncrementHandleCount(IN PVOID Object,
|
ObpIncrementHandleCount(IN PVOID Object,
|
||||||
IN PACCESS_STATE AccessState,
|
IN PACCESS_STATE AccessState OPTIONAL,
|
||||||
IN KPROCESSOR_MODE AccessMode,
|
IN KPROCESSOR_MODE AccessMode,
|
||||||
IN ULONG HandleAttributes,
|
IN ULONG HandleAttributes,
|
||||||
IN PEPROCESS Process,
|
IN PEPROCESS Process,
|
||||||
|
|
|
@ -497,13 +497,8 @@ ObpLookupObjectName(IN HANDLE RootHandle OPTIONAL,
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ParseFromRoot:
|
ParseFromRoot:
|
||||||
/* Check if we have a device map */
|
/* FIXME: Check if we have a device map */
|
||||||
if (DeviceMap)
|
ASSERT(DeviceMap == NULL);
|
||||||
{
|
|
||||||
/* Dereference it */
|
|
||||||
//ObfDereferenceDeviceMap(DeviceMap);
|
|
||||||
DeviceMap = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Check if this is a possible DOS name */
|
/* Check if this is a possible DOS name */
|
||||||
if (!((ULONG_PTR)(ObjectName->Buffer) & 7))
|
if (!((ULONG_PTR)(ObjectName->Buffer) & 7))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue