mirror of
https://github.com/reactos/reactos.git
synced 2024-06-30 18:01:07 +00:00
[NTOS]: Remove the "35314 sginsberg /* REACTOS Mm Hack of Doom */". Apocalypse averted?
svn path=/trunk/; revision=49196
This commit is contained in:
parent
ba0bd37078
commit
32ccfc25bf
|
@ -1670,20 +1670,6 @@ MmCallDllInitialize(
|
|||
IN PLIST_ENTRY ListHead
|
||||
);
|
||||
|
||||
/* ReactOS Mm Hacks */
|
||||
VOID
|
||||
FASTCALL
|
||||
MiSyncForProcessAttach(
|
||||
IN PKTHREAD NextThread,
|
||||
IN PEPROCESS Process
|
||||
);
|
||||
|
||||
VOID
|
||||
FASTCALL
|
||||
MiSyncForContextSwitch(
|
||||
IN PKTHREAD Thread
|
||||
);
|
||||
|
||||
extern PMMSUPPORT MmKernelAddressSpace;
|
||||
|
||||
FORCEINLINE
|
||||
|
|
|
@ -584,10 +584,6 @@ CheckNext:
|
|||
#endif
|
||||
|
||||
SwapContext:
|
||||
/* ReactOS Mm Hack */
|
||||
mov ecx, esi
|
||||
call @MiSyncForContextSwitch@4
|
||||
|
||||
/* Swap context at APC_LEVEL */
|
||||
mov ecx, APC_LEVEL
|
||||
call @KiSwapContextInternal@0
|
||||
|
|
|
@ -96,9 +96,6 @@ KiAttachProcess(IN PKTHREAD Thread,
|
|||
|
||||
/* Release lock */
|
||||
KiReleaseApcLockFromDpcLevel(ApcLock);
|
||||
|
||||
/* Make sure that we are in the right page directory (ReactOS Mm Hack) */
|
||||
MiSyncForProcessAttach(Thread, (PEPROCESS)Process);
|
||||
|
||||
/* Swap Processes */
|
||||
KiSwapProcess(Process, SavedApcState->Process);
|
||||
|
@ -450,9 +447,6 @@ KeAttachProcess(IN PKPROCESS Process)
|
|||
ASSERT_PROCESS(Process);
|
||||
ASSERT_IRQL_LESS_OR_EQUAL(DISPATCH_LEVEL);
|
||||
|
||||
/* Make sure that we are in the right page directory (ReactOS Mm Hack) */
|
||||
MiSyncForProcessAttach(Thread, (PEPROCESS)Process);
|
||||
|
||||
/* Check if we're already in that process */
|
||||
if (Thread->ApcState.Process == Process) return;
|
||||
|
||||
|
|
|
@ -810,9 +810,6 @@ KeInitThread(IN OUT PKTHREAD Thread,
|
|||
Thread->StackLimit = (ULONG_PTR)KernelStack - KERNEL_STACK_SIZE;
|
||||
Thread->KernelStackResident = TRUE;
|
||||
|
||||
/* Make sure that we are in the right page directory (ReactOS Mm Hack) */
|
||||
MiSyncForProcessAttach(Thread, (PEPROCESS)Process);
|
||||
|
||||
/* Enter SEH to avoid crashes due to user mode */
|
||||
Status = STATUS_SUCCESS;
|
||||
_SEH2_TRY
|
||||
|
|
|
@ -386,9 +386,6 @@ KiSwapThread(IN PKTHREAD CurrentThread,
|
|||
/* Save the wait IRQL */
|
||||
WaitIrql = CurrentThread->WaitIrql;
|
||||
|
||||
/* REACTOS Mm Hack of Doom */
|
||||
MiSyncForContextSwitch(NextThread);
|
||||
|
||||
/* Swap contexts */
|
||||
ApcState = KiSwapContext(CurrentThread, NextThread);
|
||||
|
||||
|
@ -756,9 +753,6 @@ NtYieldExecution(VOID)
|
|||
/* Sanity check */
|
||||
ASSERT(OldIrql <= DISPATCH_LEVEL);
|
||||
|
||||
/* REACTOS Mm Hack of Doom */
|
||||
MiSyncForContextSwitch(NextThread);
|
||||
|
||||
/* Swap to new thread */
|
||||
KiSwapContext(Thread, NextThread);
|
||||
Status = STATUS_SUCCESS;
|
||||
|
|
|
@ -909,54 +909,6 @@ MmGetPhysicalAddress(PVOID vaddr)
|
|||
return p;
|
||||
}
|
||||
|
||||
VOID
|
||||
NTAPI
|
||||
MmUpdatePageDir(PEPROCESS Process, PVOID Address, ULONG Size)
|
||||
{
|
||||
ULONG StartOffset, EndOffset, Offset;
|
||||
PULONG Pde;
|
||||
|
||||
//
|
||||
// Check if the process isn't there anymore
|
||||
// This is probably a bad sign, since it means the caller is setting cr3 to
|
||||
// 0 or something...
|
||||
//
|
||||
if ((PTE_TO_PFN(Process->Pcb.DirectoryTableBase[0]) == 0) && (Process != PsGetCurrentProcess()))
|
||||
{
|
||||
DPRINT1("Process: %16s is dead: %p\n", Process->ImageFileName, Process->Pcb.DirectoryTableBase[0]);
|
||||
ASSERT(FALSE);
|
||||
return;
|
||||
}
|
||||
|
||||
if (Address < MmSystemRangeStart)
|
||||
{
|
||||
KeBugCheck(MEMORY_MANAGEMENT);
|
||||
}
|
||||
|
||||
StartOffset = ADDR_TO_PDE_OFFSET(Address);
|
||||
EndOffset = ADDR_TO_PDE_OFFSET((PVOID)((ULONG_PTR)Address + Size));
|
||||
|
||||
if (Process != NULL && Process != PsGetCurrentProcess())
|
||||
{
|
||||
Pde = MmCreateHyperspaceMapping(PTE_TO_PFN(Process->Pcb.DirectoryTableBase[0]));
|
||||
}
|
||||
else
|
||||
{
|
||||
Pde = (PULONG)PAGEDIRECTORY_MAP;
|
||||
}
|
||||
for (Offset = StartOffset; Offset <= EndOffset; Offset++)
|
||||
{
|
||||
if (Offset != ADDR_TO_PDE_OFFSET(PAGETABLE_MAP))
|
||||
{
|
||||
InterlockedCompareExchangePte(&Pde[Offset], MmGlobalKernelPageDirectory[Offset], 0);
|
||||
}
|
||||
}
|
||||
if (Pde != (PULONG)PAGEDIRECTORY_MAP)
|
||||
{
|
||||
MmDeleteHyperspaceMapping(Pde);
|
||||
}
|
||||
}
|
||||
|
||||
VOID
|
||||
INIT_FUNCTION
|
||||
NTAPI
|
||||
|
|
|
@ -17,37 +17,6 @@
|
|||
|
||||
/* PRIVATE FUNCTIONS **********************************************************/
|
||||
|
||||
VOID
|
||||
FASTCALL
|
||||
MiSyncForProcessAttach(IN PKTHREAD Thread,
|
||||
IN PEPROCESS Process)
|
||||
{
|
||||
PETHREAD Ethread = CONTAINING_RECORD(Thread, ETHREAD, Tcb);
|
||||
|
||||
/* Hack Sync because Mm is broken */
|
||||
MmUpdatePageDir(Process, Ethread, sizeof(ETHREAD));
|
||||
MmUpdatePageDir(Process, Ethread->ThreadsProcess, sizeof(EPROCESS));
|
||||
MmUpdatePageDir(Process,
|
||||
(PVOID)Thread->StackLimit,
|
||||
Thread->LargeStack ?
|
||||
KERNEL_LARGE_STACK_SIZE : KERNEL_STACK_SIZE);
|
||||
}
|
||||
|
||||
VOID
|
||||
FASTCALL
|
||||
MiSyncForContextSwitch(IN PKTHREAD Thread)
|
||||
{
|
||||
PVOID Process = PsGetCurrentProcess();
|
||||
PETHREAD Ethread = CONTAINING_RECORD(Thread, ETHREAD, Tcb);
|
||||
|
||||
/* Hack Sync because Mm is broken */
|
||||
MmUpdatePageDir(Process, Ethread->ThreadsProcess, sizeof(EPROCESS));
|
||||
MmUpdatePageDir(Process,
|
||||
(PVOID)Thread->StackLimit,
|
||||
Thread->LargeStack ?
|
||||
KERNEL_LARGE_STACK_SIZE : KERNEL_STACK_SIZE);
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
MmpAccessFault(KPROCESSOR_MODE Mode,
|
||||
|
|
Loading…
Reference in a new issue