Author: sginsberg
Date: Mon Aug 25 13:42:40 2008
New Revision: 35635
URL:
http://svn.reactos.org/svn/reactos?rev=35635&view=rev
Log:
- Use MiSyncForProcessAttach and MiSyncForContextSwitch instead of
MiSyncThreadProcessViews to avoid some unneeded mm hack-syncing
Modified:
trunk/reactos/ntoskrnl/include/internal/mm.h
trunk/reactos/ntoskrnl/ke/i386/ctxswitch.S
trunk/reactos/ntoskrnl/ke/procobj.c
trunk/reactos/ntoskrnl/ke/thrdobj.c
trunk/reactos/ntoskrnl/ke/thrdschd.c
trunk/reactos/ntoskrnl/mm/mm.c
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 [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/include/internal/mm.h [iso-8859-1] Mon Aug 25 13:42:40 2008
@@ -1554,12 +1554,18 @@
IN PLIST_ENTRY ListHead
);
-/* ReactOS Mm Hack */
+/* ReactOS Mm Hacks */
VOID
FASTCALL
-MiSyncThreadProcessViews(
+MiSyncForProcessAttach(
IN PKTHREAD NextThread,
IN PEPROCESS Process
+);
+
+VOID
+FASTCALL
+MiSyncForContextSwitch(
+ IN PKTHREAD Thread
);
extern PMM_AVL_TABLE MmKernelAddressSpace;
Modified: trunk/reactos/ntoskrnl/ke/i386/ctxswitch.S
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/i386/ctxswitch…
==============================================================================
--- trunk/reactos/ntoskrnl/ke/i386/ctxswitch.S [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ke/i386/ctxswitch.S [iso-8859-1] Mon Aug 25 13:42:40 2008
@@ -738,8 +738,7 @@
SwapContext:
/* ReactOS Mm Hack */
mov ecx, esi
- mov edx, [edi+KTHREAD_APCSTATE_PROCESS]
- call @MiSyncThreadProcessViews@8
+ call @MiSyncForContextSwitch@4
/* Swap context at APC_LEVEL */
mov ecx, APC_LEVEL
Modified: trunk/reactos/ntoskrnl/ke/procobj.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/procobj.c?rev=…
==============================================================================
--- trunk/reactos/ntoskrnl/ke/procobj.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ke/procobj.c [iso-8859-1] Mon Aug 25 13:42:40 2008
@@ -448,7 +448,7 @@
ASSERT_IRQL_LESS_OR_EQUAL(DISPATCH_LEVEL);
/* Make sure that we are in the right page directory (ReactOS Mm Hack) */
- MiSyncThreadProcessViews(Thread, (PEPROCESS)Process);
+ MiSyncForProcessAttach(Thread, (PEPROCESS)Process);
/* Check if we're already in that process */
if (Thread->ApcState.Process == Process) return;
@@ -574,7 +574,7 @@
ASSERT_IRQL_LESS_OR_EQUAL(DISPATCH_LEVEL);
/* Make sure that we are in the right page directory (ReactOS Mm Hack) */
- MiSyncThreadProcessViews(Thread, (PEPROCESS)Process);
+ MiSyncForProcessAttach(Thread, (PEPROCESS)Process);
/* Crash system if DPC is being executed! */
if (KeIsExecutingDpc())
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 [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ke/thrdobj.c [iso-8859-1] Mon Aug 25 13:42:40 2008
@@ -811,7 +811,7 @@
Thread->KernelStackResident = TRUE;
/* Make sure that we are in the right page directory (ReactOS Mm Hack) */
- MiSyncThreadProcessViews(Thread, (PEPROCESS)Process);
+ MiSyncForProcessAttach(Thread, (PEPROCESS)Process);
/* Enter SEH to avoid crashes due to user mode */
Status = STATUS_SUCCESS;
Modified: trunk/reactos/ntoskrnl/ke/thrdschd.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/thrdschd.c?rev…
==============================================================================
--- trunk/reactos/ntoskrnl/ke/thrdschd.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ke/thrdschd.c [iso-8859-1] Mon Aug 25 13:42:40 2008
@@ -344,7 +344,7 @@
WaitIrql = CurrentThread->WaitIrql;
/* REACTOS Mm Hack of Doom */
- MiSyncThreadProcessViews(NextThread, PsGetCurrentProcess());
+ MiSyncForContextSwitch(NextThread);
/* Swap contexts */
ApcState = KiSwapContext(CurrentThread, NextThread);
@@ -714,7 +714,7 @@
ASSERT(OldIrql <= DISPATCH_LEVEL);
/* REACTOS Mm Hack of Doom */
- MiSyncThreadProcessViews(NextThread, PsGetCurrentProcess());
+ MiSyncForContextSwitch(NextThread);
/* Swap to new thread */
KiSwapContext(Thread, NextThread);
Modified: trunk/reactos/ntoskrnl/mm/mm.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/mm.c?rev=35635…
==============================================================================
--- trunk/reactos/ntoskrnl/mm/mm.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/mm.c [iso-8859-1] Mon Aug 25 13:42:40 2008
@@ -26,17 +26,31 @@
VOID
FASTCALL
-MiSyncThreadProcessViews(IN PKTHREAD NextThread,
- IN PEPROCESS Process)
-{
- PETHREAD Thread = CONTAINING_RECORD(NextThread, ETHREAD, Tcb);
+MiSyncForProcessAttach(IN PKTHREAD Thread,
+ IN PEPROCESS Process)
+{
+ PETHREAD Ethread = CONTAINING_RECORD(Thread, ETHREAD, Tcb);
/* Hack Sync because Mm is broken */
- MmUpdatePageDir(Process, Thread, sizeof(ETHREAD));
- MmUpdatePageDir(Process, Thread->ThreadsProcess, sizeof(EPROCESS));
+ MmUpdatePageDir(Process, Ethread->ThreadsProcess, sizeof(EPROCESS));
MmUpdatePageDir(Process,
- (PVOID)Thread->Tcb.StackLimit,
- NextThread->LargeStack ?
+ (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);
}