mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
- Update two pde's if the kernel stack crosses a 4MB boundary.
svn path=/trunk/; revision=4821
This commit is contained in:
parent
d4ce775b60
commit
210252c422
3 changed files with 15 additions and 14 deletions
|
@ -235,7 +235,7 @@ MmDeleteVirtualMapping(struct _EPROCESS* Process,
|
|||
BOOL FreePage,
|
||||
BOOL* WasDirty,
|
||||
PHYSICAL_ADDRESS* PhysicalPage);
|
||||
VOID MmUpdatePageDir(PULONG LocalPageDir, PVOID Address);
|
||||
VOID MmUpdateStackPageDir(PULONG LocalPageDir, struct _KTHREAD* KThread);
|
||||
|
||||
#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.13 2003/05/08 05:26:36 gvg Exp $
|
||||
/* $Id: process.c,v 1.14 2003/06/01 19:50:04 hbirr Exp $
|
||||
*
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: ntoskrnl/ke/process.c
|
||||
|
@ -44,7 +44,6 @@ KeAttachProcess (PEPROCESS Process)
|
|||
{
|
||||
KIRQL oldlvl;
|
||||
PETHREAD CurrentThread;
|
||||
PVOID ESP;
|
||||
PULONG AttachedProcessPageDir;
|
||||
ULONG PageDir;
|
||||
|
||||
|
@ -69,11 +68,8 @@ 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, ESP);
|
||||
MmUpdateStackPageDir(AttachedProcessPageDir, &CurrentThread->Tcb);
|
||||
ExUnmapPage(AttachedProcessPageDir);
|
||||
|
||||
CurrentThread->OldProcess = PsGetCurrentProcess();
|
||||
|
|
|
@ -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.50 2003/05/17 13:45:04 hbirr Exp $
|
||||
/* $Id: page.c,v 1.51 2003/06/01 19:50:04 hbirr Exp $
|
||||
*
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: ntoskrnl/mm/i386/page.c
|
||||
|
@ -115,10 +115,10 @@ ProtectToPTE(ULONG flProtect)
|
|||
#define ADDR_TO_PAGE_TABLE(v) (((ULONG)(v)) / (4 * 1024 * 1024))
|
||||
|
||||
#define ADDR_TO_PDE(v) (PULONG)(PAGEDIRECTORY_MAP + \
|
||||
(((ULONG)v / (1024 * 1024))&(~0x3)))
|
||||
((((ULONG)(v)) / (1024 * 1024))&(~0x3)))
|
||||
#define ADDR_TO_PTE(v) (PULONG)(PAGETABLE_MAP + ((((ULONG)v / 1024))&(~0x3)))
|
||||
|
||||
#define ADDR_TO_PDE_OFFSET(v) (((ULONG)v / (4 * 1024 * 1024)))
|
||||
#define ADDR_TO_PDE_OFFSET(v) ((((ULONG)(v)) / (4 * 1024 * 1024)))
|
||||
|
||||
NTSTATUS Mmi386ReleaseMmInfo(PEPROCESS Process)
|
||||
{
|
||||
|
@ -1247,13 +1247,18 @@ MmGetPhysicalAddress(PVOID vaddr)
|
|||
|
||||
|
||||
VOID
|
||||
MmUpdatePageDir(PULONG LocalPageDir, PVOID Address)
|
||||
MmUpdateStackPageDir(PULONG LocalPageDir, PKTHREAD PThread)
|
||||
{
|
||||
unsigned Entry = ADDR_TO_PDE_OFFSET(Address);
|
||||
unsigned EntryBase = ADDR_TO_PDE_OFFSET(PThread->StackLimit);
|
||||
unsigned EntryTop = ADDR_TO_PDE_OFFSET(PThread->InitialStack - PAGE_SIZE);
|
||||
|
||||
if (0 == LocalPageDir[Entry])
|
||||
if (0 == LocalPageDir[EntryBase])
|
||||
{
|
||||
LocalPageDir[Entry] = MmGlobalKernelPageDirectory[Entry];
|
||||
LocalPageDir[EntryBase] = MmGlobalKernelPageDirectory[EntryBase];
|
||||
}
|
||||
if (EntryBase != EntryTop && 0 == LocalPageDir[EntryTop])
|
||||
{
|
||||
LocalPageDir[EntryTop] = MmGlobalKernelPageDirectory[EntryTop];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue