mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
Only update page dir for page containing stack
svn path=/trunk/; revision=4657
This commit is contained in:
parent
5966a211e9
commit
77d0973eaa
3 changed files with 13 additions and 17 deletions
|
@ -218,7 +218,7 @@ MmDeleteVirtualMapping(struct _EPROCESS* Process,
|
|||
BOOL FreePage,
|
||||
BOOL* WasDirty,
|
||||
PHYSICAL_ADDRESS* PhysicalPage);
|
||||
VOID MmUpdatePageDir(PULONG LocalPageDir);
|
||||
VOID MmUpdatePageDir(PULONG LocalPageDir, PVOID Address);
|
||||
|
||||
#define MM_PAGE_CLEAN (0)
|
||||
#define MM_PAGE_DIRTY (1)
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id: process.c,v 1.12 2003/05/07 21:41:03 gvg Exp $
|
||||
/* $Id: process.c,v 1.13 2003/05/08 05:26:36 gvg Exp $
|
||||
*
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: ntoskrnl/ke/process.c
|
||||
|
@ -44,6 +44,7 @@ KeAttachProcess (PEPROCESS Process)
|
|||
{
|
||||
KIRQL oldlvl;
|
||||
PETHREAD CurrentThread;
|
||||
PVOID ESP;
|
||||
PULONG AttachedProcessPageDir;
|
||||
ULONG PageDir;
|
||||
|
||||
|
@ -68,8 +69,11 @@ KeAttachProcess (PEPROCESS Process)
|
|||
To prevent this, make sure the page directory of the process we're
|
||||
attaching to is up-to-date. */
|
||||
|
||||
__asm__("mov %%esp,%0\n\t"
|
||||
: "=r" (ESP));
|
||||
|
||||
AttachedProcessPageDir = ExAllocatePageWithPhysPage(Process->Pcb.DirectoryTableBase);
|
||||
MmUpdatePageDir(AttachedProcessPageDir);
|
||||
MmUpdatePageDir(AttachedProcessPageDir, ESP);
|
||||
ExUnmapPage(AttachedProcessPageDir);
|
||||
|
||||
CurrentThread->OldProcess = PsGetCurrentProcess();
|
||||
|
@ -77,7 +81,7 @@ KeAttachProcess (PEPROCESS Process)
|
|||
PageDir = Process->Pcb.DirectoryTableBase.u.LowPart;
|
||||
DPRINT("Switching process context to %x\n",PageDir)
|
||||
__asm__("movl %0,%%cr3\n\t"
|
||||
: /* no inputs */
|
||||
: /* no outputs */
|
||||
: "r" (PageDir));
|
||||
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id: page.c,v 1.48 2003/05/07 21:41:03 gvg Exp $
|
||||
/* $Id: page.c,v 1.49 2003/05/08 05:26:36 gvg Exp $
|
||||
*
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: ntoskrnl/mm/i386/page.c
|
||||
|
@ -1214,21 +1214,13 @@ MmGetPhysicalAddress(PVOID vaddr)
|
|||
|
||||
|
||||
VOID
|
||||
MmUpdatePageDir(PULONG LocalPageDir)
|
||||
MmUpdatePageDir(PULONG LocalPageDir, PVOID Address)
|
||||
{
|
||||
unsigned Entry;
|
||||
unsigned Entry = ADDR_TO_PDE_OFFSET(Address);
|
||||
|
||||
for (Entry = ADDR_TO_PDE_OFFSET(KERNEL_BASE);
|
||||
Entry < PAGE_SIZE / sizeof(LONG);
|
||||
Entry++)
|
||||
if (0 == LocalPageDir[Entry])
|
||||
{
|
||||
/* Skip the page directory */
|
||||
if (ADDR_TO_PDE_OFFSET(PAGETABLE_MAP) != Entry &&
|
||||
0 == LocalPageDir[Entry] &&
|
||||
0 != MmGlobalKernelPageDirectory[Entry])
|
||||
{
|
||||
LocalPageDir[Entry] = MmGlobalKernelPageDirectory[Entry];
|
||||
}
|
||||
LocalPageDir[Entry] = MmGlobalKernelPageDirectory[Entry];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue