PULONG stack;
NTSTATUS Status;
ULONG Esp0;
+ ULONG StackLimit;
static char *TypeStrings[] =
{
"Divide Error",
stack = (PULONG)(((ULONG)stack) & (~0x3));
DbgPrint("stack<%p>: ", stack);
+
+ if (PsGetCurrentThread() != NULL)
+ {
+ StackLimit = (ULONG)PsGetCurrentThread()->Tcb.StackBase;
+ }
+ else
+ {
+ StackLimit = (ULONG)&init_stack_top;
+ }
for (i = 0; i < 18; i = i + 6)
{
stack[i+4], stack[i+5]);
}
DbgPrint("Frames:\n");
- for (i = 0; i < 32; i++)
+ for (i = 0; i < 32 && ((ULONG)&stack[i] < StackLimit); i++)
{
if (stack[i] > ((unsigned int) &_text_start__) &&
!(stack[i] >= ((ULONG)&init_stack) &&
for(;;);
}
-VOID KeDumpStackFrames(PVOID _Stack, ULONG NrFrames)
+VOID
+KeDumpStackFrames(PVOID _Stack, ULONG NrFrames)
{
PULONG Stack = (PULONG)_Stack;
ULONG i;
+ ULONG StackLimit;
Stack = (PVOID)(((ULONG)Stack) & (~0x3));
DbgPrint("Stack: %x\n", Stack);
DbgPrint("kernel stack base %x\n",
PsGetCurrentThread()->Tcb.StackLimit);
}
+
+ if (PsGetCurrentThread() != NULL)
+ {
+ StackLimit = (ULONG)PsGetCurrentThread()->Tcb.StackBase;
+ }
+ else
+ {
+ StackLimit = (ULONG)&init_stack_top;
+ }
DbgPrint("Frames:\n");
- for (i=0; i<NrFrames; i++)
+ for (i=0; i<NrFrames && ((ULONG)&Stack[i] < StackLimit); i++)
{
-// if (Stack[i] > KERNEL_BASE && Stack[i] < ((ULONG)&etext))
if (Stack[i] > KERNEL_BASE)
{
-// DbgPrint("%.8x ",Stack[i]);
print_address((PVOID)Stack[i]);
DbgPrint(" ");
}
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-/* $Id: section.c,v 1.53 2001/03/29 17:24:43 dwelch Exp $
+/* $Id: section.c,v 1.54 2001/03/30 15:14:53 dwelch Exp $
*
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/mm/section.c
FALSE);
if (!NT_SUCCESS(Status))
{
- MmUnlockAddressSpace(AddressSpace);
return(Status);
}
{
PVOID SBaseAddress;
- SBaseAddress = (PVOID)
- ((ULONG)Section->ImageBase +
- (ULONG)Section->Segments[i].VirtualAddress);
-
- MmLockSectionSegment(&Section->Segments[i]);
- Status = MmMapViewOfSegment(Process,
- &Process->AddressSpace,
- Section,
- &Section->Segments[i],
- &SBaseAddress,
- Section->Segments[i].Length,
- Section->Segments[i].Protection,
- Section->Segments[i].FileOffset);
- MmUnlockSectionSegment(&Section->Segments[i]);
- if (!NT_SUCCESS(Status))
+ if (!(Section->Segments[i].Characteristics & IMAGE_SECTION_NOLOAD))
{
- MmUnlockSection(Section);
- MmUnlockAddressSpace(AddressSpace);
- ObDereferenceObject(Section);
- ObDereferenceObject(Process);
- return(Status);
+ SBaseAddress = (PVOID)
+ ((ULONG)Section->ImageBase +
+ (ULONG)Section->Segments[i].VirtualAddress);
+
+ MmLockSectionSegment(&Section->Segments[i]);
+ Status = MmMapViewOfSegment(Process,
+ &Process->AddressSpace,
+ Section,
+ &Section->Segments[i],
+ &SBaseAddress,
+ Section->Segments[i].Length,
+ Section->Segments[i].Protection,
+ Section->Segments[i].FileOffset);
+ MmUnlockSectionSegment(&Section->Segments[i]);
+ if (!NT_SUCCESS(Status))
+ {
+ MmUnlockSection(Section);
+ MmUnlockAddressSpace(AddressSpace);
+ ObDereferenceObject(Section);
+ ObDereferenceObject(Process);
+ return(Status);
+ }
}
}
*BaseAddress = Section->ImageBase;