mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
Print addresses in stack frames even early in the boot
svn path=/trunk/; revision=1739
This commit is contained in:
parent
634bb6b997
commit
09ad24f08c
6 changed files with 64 additions and 13 deletions
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: ide.c,v 1.38 2001/03/04 00:46:46 ekohl Exp $
|
/* $Id: ide.c,v 1.39 2001/03/27 21:43:43 dwelch Exp $
|
||||||
*
|
*
|
||||||
* IDE.C - IDE Disk driver
|
* IDE.C - IDE Disk driver
|
||||||
* written by Rex Jolliff
|
* written by Rex Jolliff
|
||||||
|
@ -258,6 +258,7 @@ DriverEntry(IN PDRIVER_OBJECT DriverObject,
|
||||||
{
|
{
|
||||||
IDEInitialized = TRUE;
|
IDEInitialized = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
DPRINT( "Returning from DriverEntry\n" );
|
DPRINT( "Returning from DriverEntry\n" );
|
||||||
return WeGotSomeDisks ? STATUS_SUCCESS : STATUS_NO_SUCH_DEVICE;
|
return WeGotSomeDisks ? STATUS_SUCCESS : STATUS_NO_SUCH_DEVICE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,7 +73,8 @@ RtlImageDirectoryEntryToData (
|
||||||
IN BOOLEAN ImageLoaded,
|
IN BOOLEAN ImageLoaded,
|
||||||
IN ULONG Directory,
|
IN ULONG Directory,
|
||||||
OUT PULONG Size);
|
OUT PULONG Size);
|
||||||
|
VOID
|
||||||
|
LdrInit1(VOID);
|
||||||
|
|
||||||
|
|
||||||
#endif /* __INCLUDE_INTERNAL_LDR_H */
|
#endif /* __INCLUDE_INTERNAL_LDR_H */
|
||||||
|
|
|
@ -5,6 +5,14 @@
|
||||||
#include <ddk/ntddk.h>
|
#include <ddk/ntddk.h>
|
||||||
#include <pe.h>
|
#include <pe.h>
|
||||||
|
|
||||||
|
typedef struct _MODULE_TEXT_SECTION
|
||||||
|
{
|
||||||
|
ULONG Base;
|
||||||
|
ULONG Length;
|
||||||
|
LIST_ENTRY ListEntry;
|
||||||
|
PWCH Name;
|
||||||
|
} MODULE_TEXT_SECTION;
|
||||||
|
|
||||||
typedef struct _MODULE_OBJECT
|
typedef struct _MODULE_OBJECT
|
||||||
{
|
{
|
||||||
CSHORT ObjectType;
|
CSHORT ObjectType;
|
||||||
|
|
|
@ -78,20 +78,21 @@ STATIC BOOLEAN
|
||||||
print_address(PVOID address)
|
print_address(PVOID address)
|
||||||
{
|
{
|
||||||
PLIST_ENTRY current_entry;
|
PLIST_ENTRY current_entry;
|
||||||
PMODULE_OBJECT current;
|
MODULE_TEXT_SECTION* current;
|
||||||
extern LIST_ENTRY ModuleListHead;
|
extern LIST_ENTRY ModuleTextListHead;
|
||||||
|
|
||||||
current_entry = ModuleListHead.Flink;
|
current_entry = ModuleTextListHead.Flink;
|
||||||
|
|
||||||
while (current_entry != &ModuleListHead &&
|
while (current_entry != &ModuleTextListHead &&
|
||||||
current_entry != NULL)
|
current_entry != NULL)
|
||||||
{
|
{
|
||||||
current = CONTAINING_RECORD(current_entry, MODULE_OBJECT, ListEntry);
|
current =
|
||||||
|
CONTAINING_RECORD(current_entry, MODULE_TEXT_SECTION, ListEntry);
|
||||||
|
|
||||||
if (address >= current->Base &&
|
if (address >= (PVOID)current->Base &&
|
||||||
address < (current->Base + current->Length))
|
address < (PVOID)(current->Base + current->Length))
|
||||||
{
|
{
|
||||||
DbgPrint("<%wZ: %x>", ¤t->FullName,
|
DbgPrint("<%ws: %x>", current->Name,
|
||||||
address - current->Base);
|
address - current->Base);
|
||||||
return(TRUE);
|
return(TRUE);
|
||||||
}
|
}
|
||||||
|
@ -194,7 +195,7 @@ KiTrapHandler(PKTRAP_FRAME Tf, ULONG ExceptionNr)
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Use the address of the trap frame as approximation to the ring0 esp */
|
/* Use the address of the trap frame as approximation to the ring0 esp */
|
||||||
Esp0 = (ULONG)Tf;
|
Esp0 = (ULONG)&Tf->Eip;
|
||||||
|
|
||||||
/* Get CR2 */
|
/* Get CR2 */
|
||||||
__asm__("movl %%cr2,%0\n\t" : "=d" (cr2));
|
__asm__("movl %%cr2,%0\n\t" : "=d" (cr2));
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: main.c,v 1.84 2001/03/26 20:46:53 dwelch Exp $
|
/* $Id: main.c,v 1.85 2001/03/27 21:43:42 dwelch Exp $
|
||||||
*
|
*
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
* FILE: ntoskrnl/ke/main.c
|
* FILE: ntoskrnl/ke/main.c
|
||||||
|
@ -431,6 +431,7 @@ _main (ULONG MultiBootMagic, PLOADER_PARAMETER_BLOCK _LoaderBlock)
|
||||||
*/
|
*/
|
||||||
HalInitSystem (0, (PLOADER_PARAMETER_BLOCK)&KeLoaderBlock);
|
HalInitSystem (0, (PLOADER_PARAMETER_BLOCK)&KeLoaderBlock);
|
||||||
KeInit1();
|
KeInit1();
|
||||||
|
LdrInit1();
|
||||||
KeLowerIrql(DISPATCH_LEVEL);
|
KeLowerIrql(DISPATCH_LEVEL);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: loader.c,v 1.69 2001/03/16 18:11:23 dwelch Exp $
|
/* $Id: loader.c,v 1.70 2001/03/27 21:43:43 dwelch Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -45,6 +45,9 @@ NTSTATUS IoInitializeDriver(PDRIVER_INITIALIZE DriverEntry);
|
||||||
|
|
||||||
LIST_ENTRY ModuleListHead;
|
LIST_ENTRY ModuleListHead;
|
||||||
POBJECT_TYPE EXPORTED IoDriverObjectType = NULL;
|
POBJECT_TYPE EXPORTED IoDriverObjectType = NULL;
|
||||||
|
LIST_ENTRY ModuleTextListHead;
|
||||||
|
STATIC MODULE_TEXT_SECTION NtoskrnlTextSection;
|
||||||
|
/* STATIC MODULE_TEXT_SECTION HalTextSection; */
|
||||||
|
|
||||||
#define TAG_DRIVER_MEM TAG('D', 'R', 'V', 'M')
|
#define TAG_DRIVER_MEM TAG('D', 'R', 'V', 'M')
|
||||||
#define TAG_SYM_BUF TAG('S', 'Y', 'M', 'B')
|
#define TAG_SYM_BUF TAG('S', 'Y', 'M', 'B')
|
||||||
|
@ -73,6 +76,31 @@ static PVOID LdrPEFixupForward(PCHAR ForwardName);
|
||||||
|
|
||||||
/* FUNCTIONS *****************************************************************/
|
/* FUNCTIONS *****************************************************************/
|
||||||
|
|
||||||
|
VOID
|
||||||
|
LdrInit1(VOID)
|
||||||
|
{
|
||||||
|
PIMAGE_DOS_HEADER DosHeader;
|
||||||
|
PIMAGE_FILE_HEADER FileHeader;
|
||||||
|
PIMAGE_OPTIONAL_HEADER OptionalHeader;
|
||||||
|
PIMAGE_SECTION_HEADER SectionList;
|
||||||
|
|
||||||
|
InitializeListHead(&ModuleTextListHead);
|
||||||
|
|
||||||
|
DosHeader = (PIMAGE_DOS_HEADER) KERNEL_BASE;
|
||||||
|
FileHeader =
|
||||||
|
(PIMAGE_FILE_HEADER) ((DWORD)KERNEL_BASE +
|
||||||
|
DosHeader->e_lfanew + sizeof(ULONG));
|
||||||
|
OptionalHeader = (PIMAGE_OPTIONAL_HEADER)
|
||||||
|
((DWORD)FileHeader + sizeof(IMAGE_FILE_HEADER));
|
||||||
|
SectionList = (PIMAGE_SECTION_HEADER)
|
||||||
|
((DWORD)OptionalHeader + sizeof(IMAGE_OPTIONAL_HEADER));
|
||||||
|
NtoskrnlTextSection.Base = KERNEL_BASE;
|
||||||
|
NtoskrnlTextSection.Length = SectionList[0].Misc.VirtualSize +
|
||||||
|
SectionList[0].VirtualAddress;
|
||||||
|
NtoskrnlTextSection.Name = L"ntoskrnl.exe";
|
||||||
|
InsertTailList(&ModuleTextListHead, &NtoskrnlTextSection.ListEntry);
|
||||||
|
}
|
||||||
|
|
||||||
VOID LdrInitModuleManagement(VOID)
|
VOID LdrInitModuleManagement(VOID)
|
||||||
{
|
{
|
||||||
HANDLE DirHandle, ModuleHandle;
|
HANDLE DirHandle, ModuleHandle;
|
||||||
|
@ -618,6 +646,7 @@ LdrPEProcessModule(PVOID ModuleLoadBase, PUNICODE_STRING FileName)
|
||||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||||
UNICODE_STRING ModuleName;
|
UNICODE_STRING ModuleName;
|
||||||
WCHAR NameBuffer[60];
|
WCHAR NameBuffer[60];
|
||||||
|
MODULE_TEXT_SECTION* ModuleTextSection;
|
||||||
|
|
||||||
DPRINT("Processing PE Module at module base:%08lx\n", ModuleLoadBase);
|
DPRINT("Processing PE Module at module base:%08lx\n", ModuleLoadBase);
|
||||||
|
|
||||||
|
@ -931,6 +960,16 @@ LdrPEProcessModule(PVOID ModuleLoadBase, PUNICODE_STRING FileName)
|
||||||
sizeof(IMAGE_FILE_HEADER) + sizeof(IMAGE_OPTIONAL_HEADER));
|
sizeof(IMAGE_FILE_HEADER) + sizeof(IMAGE_OPTIONAL_HEADER));
|
||||||
DPRINT("SectionList at %x\n", ModuleObject->Image.PE.SectionList);
|
DPRINT("SectionList at %x\n", ModuleObject->Image.PE.SectionList);
|
||||||
|
|
||||||
|
ModuleTextSection = ExAllocatePool(NonPagedPool,
|
||||||
|
sizeof(MODULE_TEXT_SECTION));
|
||||||
|
ModuleTextSection->Base = (ULONG)DriverBase;
|
||||||
|
ModuleTextSection->Length = DriverSize;
|
||||||
|
ModuleTextSection->Name =
|
||||||
|
ExAllocatePool(NonPagedPool,
|
||||||
|
(wcslen(NameBuffer) + 1) * sizeof(WCHAR));
|
||||||
|
wcscpy(ModuleTextSection->Name, NameBuffer);
|
||||||
|
InsertTailList(&ModuleTextListHead, &ModuleTextSection->ListEntry);
|
||||||
|
|
||||||
return ModuleObject;
|
return ModuleObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue