[ros-diffs] [tkreuzer] 34989: Fix macros that didn't have brackets around the argument. Add FrLdrDbgPrint for debugprints. Use ULONG_PTR instead of ULONG for memory offsets and pointer values. Use RosLoaderBlock->KernelBase instead of hardcoded value for the beginning of the kernel. Now we reach KiSystemStartupReal.

tkreuzer at svn.reactos.org tkreuzer at svn.reactos.org
Fri Aug 1 03:08:53 CEST 2008


Author: tkreuzer
Date: Thu Jul 31 20:08:53 2008
New Revision: 34989

URL: http://svn.reactos.org/svn/reactos?rev=34989&view=rev
Log:
Fix macros that didn't have brackets around the argument. Add FrLdrDbgPrint for debugprints. Use ULONG_PTR instead of ULONG for memory offsets and pointer values. Use RosLoaderBlock->KernelBase instead of hardcoded value for the beginning of the kernel. Now we reach KiSystemStartupReal.


Modified:
    branches/ros-amd64-bringup/reactos/ntoskrnl/ke/freeldr.c

Modified: branches/ros-amd64-bringup/reactos/ntoskrnl/ke/freeldr.c
URL: http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/ntoskrnl/ke/freeldr.c?rev=34989&r1=34988&r2=34989&view=diff
==============================================================================
--- branches/ros-amd64-bringup/reactos/ntoskrnl/ke/freeldr.c [iso-8859-1] (original)
+++ branches/ros-amd64-bringup/reactos/ntoskrnl/ke/freeldr.c [iso-8859-1] Thu Jul 31 20:08:53 2008
@@ -15,10 +15,10 @@
 #ifdef _M_PPC
 #include <ppcmmu/mmu.h>
 #define KERNEL_RVA(x) RVA(x,0x80800000)
-#define KERNEL_DESCRIPTOR_PAGE(x) (((ULONG_PTR)x + KernelBase) >> PAGE_SHIFT)
+#define KERNEL_DESCRIPTOR_PAGE(x) (((ULONG_PTR)(x) + KernelBase) >> PAGE_SHIFT)
 #else
 #define KERNEL_RVA(x) RVA(x,KSEG0_BASE)
-#define KERNEL_DESCRIPTOR_PAGE(x) (((ULONG_PTR)x &~ KSEG0_BASE) >> PAGE_SHIFT)
+#define KERNEL_DESCRIPTOR_PAGE(x) (((ULONG_PTR)(x) & ~KSEG0_BASE) >> PAGE_SHIFT)
 #endif
 
 typedef struct _BIOS_MEMORY_DESCRIPTOR
@@ -28,6 +28,9 @@
 } BIOS_MEMORY_DESCRIPTOR, *PBIOS_MEMORY_DESCRIPTOR;
 
 /* GLOBALS *******************************************************************/
+
+/* Function pointer for early debug prints */
+ULONG (*FrLdrDbgPrint)(const char *Format, ...);
 
 /* FreeLDR Loader Data */
 PROS_LOADER_PARAMETER_BLOCK KeRosLoaderBlock;
@@ -869,7 +872,7 @@
 VOID
 NTAPI
 KiRosFixupComponentTree(IN PCONFIGURATION_COMPONENT_DATA p,
-                        IN ULONG i)
+                        IN ULONG_PTR i)
 {
     PCONFIGURATION_COMPONENT pp;
 
@@ -1144,7 +1147,7 @@
     /* Now mark the remainder of the FreeLDR 6MB area as "in use" */
     KiRosAllocateNtDescriptor(LoaderMemoryData,
                               KERNEL_DESCRIPTOR_PAGE(RosEntry->ModEnd),
-                              KERNEL_DESCRIPTOR_PAGE((0x80800000 + 0x600000)) -
+                              KERNEL_DESCRIPTOR_PAGE((RosLoaderBlock->KernelBase + 0x600000)) -
                               KERNEL_DESCRIPTOR_PAGE(RosEntry->ModEnd),
                               0,
                               &Base);
@@ -1297,12 +1300,15 @@
     /* Save pointer to ROS Block */
     KeRosLoaderBlock = LoaderBlock;
 
+    /* Get debugging function */
+    FrLdrDbgPrint = LoaderBlock->FrLdrDbgPrint;
+
     /* Save memory manager data */
     KeMemoryMapRangeCount = 0;
     if (LoaderBlock->Flags & MB_FLAGS_MMAP_INFO)
     {
         /* We have a memory map from the nice BIOS */
-        ent = ((PULONG)(LoaderBlock->MmapAddr - sizeof(ULONG)));
+        ent = ((PULONG)(LoaderBlock->MmapAddr - sizeof(ULONG))); // FIXME: this is ugly
         size = *ent;
         i = 0;
 
@@ -1323,13 +1329,13 @@
 
         /* Save data */
         LoaderBlock->MmapLength = KeMemoryMapRangeCount * sizeof(ADDRESS_RANGE);
-        LoaderBlock->MmapAddr = (ULONG)KeMemoryMap;
+        LoaderBlock->MmapAddr = (ULONG_PTR)KeMemoryMap;
     }
     else
     {
         /* Nothing from BIOS */
         LoaderBlock->MmapLength = 0;
-        LoaderBlock->MmapAddr = (ULONG)KeMemoryMap;
+        LoaderBlock->MmapAddr = (ULONG_PTR)KeMemoryMap;
     }
 
 #if defined(_M_IX86)



More information about the Ros-diffs mailing list