[ros-diffs] [arty] 26776: Process all boot drivers as elf. This makes things much easier and more regular in kernel land.

arty at svn.reactos.org arty at svn.reactos.org
Mon May 14 08:00:32 CEST 2007


Author: arty
Date: Mon May 14 10:00:32 2007
New Revision: 26776

URL: http://svn.reactos.org/svn/reactos?rev=26776&view=rev
Log:
Process all boot drivers as elf.  This makes things much easier and more 
regular in kernel land.

Modified:
    branches/powerpc/reactos/boot/freeldr/freeldr/arch/powerpc/mboot.c
    branches/powerpc/reactos/boot/freeldr/freeldr/include/reactos.h
    branches/powerpc/reactos/boot/freeldr/freeldr/reactos/reactos.c

Modified: branches/powerpc/reactos/boot/freeldr/freeldr/arch/powerpc/mboot.c
URL: http://svn.reactos.org/svn/reactos/branches/powerpc/reactos/boot/freeldr/freeldr/arch/powerpc/mboot.c?rev=26776&r1=26775&r2=26776&view=diff
==============================================================================
--- branches/powerpc/reactos/boot/freeldr/freeldr/arch/powerpc/mboot.c (original)
+++ branches/powerpc/reactos/boot/freeldr/freeldr/arch/powerpc/mboot.c Mon May 14 10:00:32 2007
@@ -357,6 +357,12 @@
     Elf32_Ehdr ehdr;
     Elf32_Shdr *shdr;
 
+    if(!KernelAddr)
+	KernelAddr = (ULONG)NextModuleBase - (ULONG)KernelMemory + KernelBase;
+    if(!MemLoadAddr)
+	MemLoadAddr = (PCHAR)NextModuleBase;
+
+    ModuleData = &reactos_modules[LoaderBlock.ModsCount];
     printf("Loading file (elf at %x)\n", KernelAddr);
 
     /* Load the first 1024 bytes of the kernel image so we can read the PE header */
@@ -438,6 +444,8 @@
 	printf("Section %d (NT Header) is elf section %d\n",
 	       i, SWAPD(Section->PointerToRawData));
 	
+	Section->PointerToRawData = SWAPD((Section->VirtualAddress - KernelAddr));
+
 	if (shdr->sh_type != SHT_NOBITS)
 	{
 	    /* Content area */
@@ -560,7 +568,6 @@
 
     MmFreeMemory(sptr);
 
-    ModuleData = &reactos_modules[LoaderBlock.ModsCount];
     ModuleData->ModStart = (ULONG)KernelMemory;
     /* Increase the next Load Base */
     NextModuleBase = ROUND_UP((ULONG)KernelMemory + ImageSize, PAGE_SIZE);

Modified: branches/powerpc/reactos/boot/freeldr/freeldr/include/reactos.h
URL: http://svn.reactos.org/svn/reactos/branches/powerpc/reactos/boot/freeldr/freeldr/include/reactos.h?rev=26776&r1=26775&r2=26776&view=diff
==============================================================================
--- branches/powerpc/reactos/boot/freeldr/freeldr/include/reactos.h (original)
+++ branches/powerpc/reactos/boot/freeldr/freeldr/include/reactos.h Mon May 14 10:00:32 2007
@@ -62,6 +62,7 @@
 BOOLEAN NTAPI FrLdrMapKernel(FILE *KernelImage);
 ULONG_PTR NTAPI FrLdrCreateModule(LPCSTR ModuleName);
 ULONG_PTR NTAPI FrLdrLoadModule(FILE *ModuleImage, LPCSTR ModuleName, PULONG ModuleSize);
+BOOLEAN NTAPI FrLdrMapModule(FILE *ModuleImage, PCHAR ModuleName, PCHAR MemLoadAddr, ULONG KernelAddr);
 BOOLEAN NTAPI FrLdrCloseModule(ULONG_PTR ModuleBase, ULONG dwModuleSize);
 VOID NTAPI FrLdrStartup(ULONG Magic);
 typedef VOID (FASTCALL *ASMCODE)(ULONG Magic, PROS_LOADER_PARAMETER_BLOCK LoaderBlock);

Modified: branches/powerpc/reactos/boot/freeldr/freeldr/reactos/reactos.c
URL: http://svn.reactos.org/svn/reactos/branches/powerpc/reactos/boot/freeldr/freeldr/reactos/reactos.c?rev=26776&r1=26775&r2=26776&view=diff
==============================================================================
--- branches/powerpc/reactos/boot/freeldr/freeldr/reactos/reactos.c (original)
+++ branches/powerpc/reactos/boot/freeldr/freeldr/reactos/reactos.c Mon May 14 10:00:32 2007
@@ -308,6 +308,8 @@
     CHAR value[256];
     LPSTR p;
 
+    printf("Loading driver %s\n", szFileName);
+
     /* Open the Driver */
     FilePointer = FsOpenFile(szFileName);
 
@@ -336,7 +338,7 @@
     UiDrawStatusText(value);
 
     /* Load the driver */
-    FrLdrLoadModule(FilePointer, szFileName, NULL);
+    FrLdrMapModule(FilePointer, szFileName, 0, 0);
 
     /* Update status and return */
     UiDrawProgressBarCenter(nPos, 100, szLoadingMsg);




More information about the Ros-diffs mailing list