Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

X64 boot fixes #115

Closed
wants to merge 21 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 12 additions & 4 deletions ntoskrnl/mm/ARM3/pagfault.c
Expand Up @@ -576,6 +576,7 @@ MiResolveDemandZeroFault(IN PVOID Address,
BOOLEAN NeedZero = FALSE, HaveLock = FALSE;
ULONG Color;
PMMPFN Pfn1;
PMMPTE PtePte;
DPRINT("ARM3 Demand Zero Page Fault Handler for address: %p in process: %p\n",
Address,
Process);
Expand Down Expand Up @@ -705,6 +706,9 @@ MiResolveDemandZeroFault(IN PVOID Address,
if (MI_IS_PAGE_WRITEABLE(&TempPte)) MI_MAKE_DIRTY_PAGE(&TempPte);

/* Write it */
/* HACK: mark it as writeable before wiring to it */
PtePte = MiAddressToPte(PointerPte);
PtePte->u.Hard.Write = 1;
MI_WRITE_VALID_PTE(PointerPte, TempPte);

/* Did we manually acquire the lock */
Expand Down Expand Up @@ -1640,6 +1644,7 @@ MmArmAccessFault(IN BOOLEAN StoreInstruction,
ULONG Color;
BOOLEAN IsSessionAddress;
PMMPFN Pfn1;
PMMPTE PtePte;
DPRINT("ARM3 FAULT AT: %p\n", Address);

/* Check for page fault on high IRQL */
Expand Down Expand Up @@ -2029,10 +2034,10 @@ _WARN("Session space stuff is not implemented yet!")
{
/* Right now, we only handle scenarios where the PXE is totally empty */
ASSERT(PointerPxe->u.Long == 0);
#if 0
#if 1
/* Resolve a demand zero fault */
Status = MiResolveDemandZeroFault(PointerPpe,
MM_READWRITE,
MiAddressToPte(PointerPpe),
CurrentProcess,
MM_NOIRQL);
#endif
Expand All @@ -2049,10 +2054,10 @@ _WARN("Session space stuff is not implemented yet!")
{
/* Right now, we only handle scenarios where the PPE is totally empty */
ASSERT(PointerPpe->u.Long == 0);
#if 0
#if 1
/* Resolve a demand zero fault */
Status = MiResolveDemandZeroFault(PointerPde,
MM_READWRITE,
MiAddressToPte(PointerPde),
CurrentProcess,
MM_NOIRQL);
#endif
Expand Down Expand Up @@ -2087,6 +2092,9 @@ _WARN("Session space stuff is not implemented yet!")
}

/* Write a demand-zero PDE */
/* HACK: make it writeable before writing */
PtePte = MiAddressToPte(PointerPde);
PtePte->u.Hard.Write = 1;
MI_WRITE_INVALID_PDE(PointerPde, DemandZeroPde);

/* Dispatch the fault */
Expand Down
8 changes: 4 additions & 4 deletions ntoskrnl/ps/debug.c
Expand Up @@ -61,18 +61,18 @@ PspDumpThreads(BOOLEAN IncludeSystem)
{
#ifdef _M_IX86
ULONG i = 0;
PULONG Esp = (PULONG)Thread->Tcb.KernelStack;
PULONG Ebp = (PULONG)Esp[4];
PULONG_PTR Esp = (PULONG_PTR)Thread->Tcb.KernelStack;
PULONG_PTR Ebp = (PULONG_PTR)Esp[4];

/* Print EBP */
DbgPrint("Ebp %p\n", Ebp);

/* Walk it */
while(Ebp != 0 && Ebp >= (PULONG)Thread->Tcb.StackLimit)
while(Ebp != 0 && Ebp >= (PULONG_PTR)Thread->Tcb.StackLimit)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is x86 specific code. A proper fix would be using KeRosDumpStackFrames() or something similar. Alternatively use #ifdef _M_IX86 ... #else DbgPrint("FIXME: Backtrace skipped on non-x86\n") #endif

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, made it conditional. Didn't know that these is x86-specific.

{
/* Print what's on the stack */
DbgPrint("%.8X %.8X%s", Ebp[0], Ebp[1], (i % 8) == 7 ? "\n" : " ");
Ebp = (PULONG)Ebp[0];
Ebp = (PULONG_PTR)Ebp[0];
i++;
}

Expand Down