[ros-diffs] [evb] 45424: - Define memory map structure for Versatile board/QEMU and send to OS Loader. - Many hack removed. - Better efficency use of memory layout. - Region at 0x800000 now available for FreeLDR use to load kernel files. - Implement simple ArmDiskNormalizeSystemPath so boot is allowed to happen. - Use better stack address as defined in memory map. - Now FreeLDR loads all files correctly from disk and is ready to jump to kernel. ARMv5 paging code must be rewritten before that can happen.

evb at svn.reactos.org evb at svn.reactos.org
Thu Feb 4 20:52:13 CET 2010


Author: evb
Date: Thu Feb  4 20:52:13 2010
New Revision: 45424

URL: http://svn.reactos.org/svn/reactos?rev=45424&view=rev
Log:
- Define memory map structure for Versatile board/QEMU and send to OS Loader.
- Many hack removed.
- Better efficency use of memory layout.
- Region at 0x800000 now available for FreeLDR use to load kernel files.
- Implement simple ArmDiskNormalizeSystemPath so boot is allowed to happen.
- Use better stack address as defined in memory map.
- Now FreeLDR loads all files correctly from disk and is ready to jump to kernel. ARMv5 paging code must be rewritten before that can happen.


Modified:
    trunk/reactos/boot/armllb/boot.s
    trunk/reactos/boot/armllb/envir.c
    trunk/reactos/boot/armllb/hw/versatile/hwinfo.c
    trunk/reactos/boot/armllb/hw/versatile/hwinit.c
    trunk/reactos/boot/armllb/os/loader.c
    trunk/reactos/boot/freeldr/freeldr/arcemul/mm.c
    trunk/reactos/boot/freeldr/freeldr/arch/arm/loader.c
    trunk/reactos/boot/freeldr/freeldr/arch/arm/macharm.c
    trunk/reactos/boot/freeldr/freeldr/freeldr.rbuild

Modified: trunk/reactos/boot/armllb/boot.s
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/armllb/boot.s?rev=45424&r1=45423&r2=45424&view=diff
==============================================================================
--- trunk/reactos/boot/armllb/boot.s [iso-8859-1] (original)
+++ trunk/reactos/boot/armllb/boot.s [iso-8859-1] Thu Feb  4 20:52:13 2010
@@ -31,7 +31,7 @@
     ENTRY_END _start
 
 L_BootStackEnd:
-    .long 0x2000000
+    .long 0x00010000
         
 L_LlbStartup:
     .long LlbStartup

Modified: trunk/reactos/boot/armllb/envir.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/armllb/envir.c?rev=45424&r1=45423&r2=45424&view=diff
==============================================================================
--- trunk/reactos/boot/armllb/envir.c [iso-8859-1] (original)
+++ trunk/reactos/boot/armllb/envir.c [iso-8859-1] Thu Feb  4 20:52:13 2010
@@ -47,6 +47,14 @@
                 /* Save RAMDISK start and size */
                 LlbEnvRamDiskStart = Atag->u.InitRd2.Start;
                 LlbEnvRamDiskSize = Atag->u.InitRd2.Size;
+                
+                /* Make sure it's 16MB-aligned */
+                LlbEnvRamDiskSize = (LlbEnvRamDiskSize + (16 * 1024 * 1024) - 1) 
+                                    &~ ((16 * 1024 * 1024) - 1);
+                
+                /* The RAMDISK actually starts 16MB later */
+                LlbEnvRamDiskStart += 16 * 1024 * 1024;
+                LlbEnvRamDiskSize  -= 16 * 1024 * 1024;
                 break;
                 
             case ATAG_CMDLINE:

Modified: trunk/reactos/boot/armllb/hw/versatile/hwinfo.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/armllb/hw/versatile/hwinfo.c?rev=45424&r1=45423&r2=45424&view=diff
==============================================================================
--- trunk/reactos/boot/armllb/hw/versatile/hwinfo.c [iso-8859-1] (original)
+++ trunk/reactos/boot/armllb/hw/versatile/hwinfo.c [iso-8859-1] Thu Feb  4 20:52:13 2010
@@ -37,14 +37,65 @@
 LlbHwGetSerialUart(VOID)
 {
     return 0;
-}     
+}
+
+//
+// Versatile Memory Map
+//
+// 0x00000000 - 0x000000FF ARM Vectors                              [  1 KB]
+// 0x00000100 - 0x000001FF ATAG Structures                          [  1 KB]
+// 0x00000200 - 0x0000FFFF ARM STACK                                [ 62 KB]
+// 0x00010000 - 0x0001FFFF ARM LLB                                  [ 64 KB]
+// 0x00020000 - 0x0009FFFF ARM OS LOADER                            [512 KB]
+// 0x000A0000 - 0x007FFFFF OS LOADER FREE/UNUSED                    [7.3 MB]
+// 0x00800000 - 0x017FFFFF KERNEL, HAL, INITIAL DRIVER LOAD ADDR    [ 16 MB]
+// 0x01800000 - 0x037FFFFF RAM DISK                                 [ 32 MB]
+// 0x03800000 - 0x07FFFFFF FREE RAM                                 [ 72 MB]
+// 0x08000000 - 0x0FFFFFFF FREE RAM IF 256MB DEVICE                 [128 MB]
+// 0x10000000 - 0x1FFFFFFF MMIO DEVICES                             [256 MB]
+BIOS_MEMORY_MAP LlbHwVersaMemoryMap[] =
+{
+    {0x00000000, 0x00000100, BiosMemoryReserved, 0},
+    {0x00000100, 0x00000100, BiosMemoryBootStrap, 0},
+    {0x00000200, 0x0000FE00, BiosMemoryBootStrap, 0},
+    {0x00010000, 0x00010000, BiosMemoryBootStrap, 0},
+    {0x00020000, 0x00080000, BiosMemoryBootLoader, 0},
+    {0x00080000, 0x01000000, BiosMemoryUsable,   0},
+    {0x01800000, 0x02000000, BiosMemoryReserved, 0},
+    {0x10000000, 0x10000000, BiosMemoryReserved, 0},
+    {0, 0, 0, 0}
+};
 
 VOID
 NTAPI
 LlbHwBuildMemoryMap(IN PBIOS_MEMORY_MAP MemoryMap)
 {
-    /* Mark MMIO space as reserved */
-    LlbAllocateMemoryEntry(BiosMemoryReserved, 0x10000000, 128 * 1024 * 1024);
+    PBIOS_MEMORY_MAP MapEntry;
+    ULONG Base, Size, FsBase, FsSize;
+    
+    /* Parse hardware memory map */
+    MapEntry = LlbHwVersaMemoryMap;
+    while (MapEntry->Length)
+    {
+        /* Add this entry */
+        LlbAllocateMemoryEntry(MapEntry->Type, MapEntry->BaseAddress, MapEntry->Length);
+        
+        /* Move to the next one */
+        MapEntry++;
+    }
+    
+    /* Query memory and RAMDISK information */
+    LlbEnvGetMemoryInformation(&Base, &Size);
+    LlbEnvGetRamDiskInformation(&FsBase, &FsSize);
+    
+    /* Add-in the size of the ramdisk */
+    Base = FsBase + FsSize;
+    
+    /* Subtract size of ramdisk and anything else before it */
+    Size -= Base;
+    
+    /* Allocate an entry for it */
+    LlbAllocateMemoryEntry(BiosMemoryUsable, Base, Size);
 }
 
 ULONG

Modified: trunk/reactos/boot/armllb/hw/versatile/hwinit.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/armllb/hw/versatile/hwinit.c?rev=45424&r1=45423&r2=45424&view=diff
==============================================================================
--- trunk/reactos/boot/armllb/hw/versatile/hwinit.c [iso-8859-1] (original)
+++ trunk/reactos/boot/armllb/hw/versatile/hwinit.c [iso-8859-1] Thu Feb  4 20:52:13 2010
@@ -33,14 +33,11 @@
     PCHAR Offset;
     CHAR CommandLine[64];
     
-    /* On versatile, the NAND image is loaded as the RAMDISK */
-    LlbEnvGetRamDiskInformation(&Base, &Size);
+    /* On versatile we load the RAMDISK with initrd */
+    LlbEnvGetRamDiskInformation(&RootFs, &Size);
     
-    /* The LLB is first, which we already have, so skip it */
-    Base += 0x10000; // 64 KB (see nandflash)
-    
-    /* The OS loader is next, followed by the root file system */
-    RootFs = Base + 0x80000; // 512 KB (see nandflash)
+    /* The OS Loader is at 0x20000, always */
+    Base = 0x20000;
     
     /* Read image offset */
     Offset = LlbEnvRead("rdoffset");

Modified: trunk/reactos/boot/armllb/os/loader.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/armllb/os/loader.c?rev=45424&r1=45423&r2=45424&view=diff
==============================================================================
--- trunk/reactos/boot/armllb/os/loader.c [iso-8859-1] (original)
+++ trunk/reactos/boot/armllb/os/loader.c [iso-8859-1] Thu Feb  4 20:52:13 2010
@@ -93,21 +93,8 @@
 NTAPI
 LlbBuildMemoryMap(VOID)
 {
-    ULONG Base, Size;
-    
     /* Zero out the memory map */
     memset(MemoryMap, 0, sizeof(MemoryMap));
-        
-    /* Query memory information */
-    LlbEnvGetMemoryInformation(&Base, &Size);
-    
-    /* Don't use memory that the RAMDISK is using */
-    /* HACK HACK */
-    Base += 32 * 1024 * 1024;
-    Size -= 32 * 1024 * 1024;
-    
-    /* Allocate an entry for it */
-    LlbAllocateMemoryEntry(BiosMemoryUsable, Base, Size);
 
     /* Call the hardware-specific function for hardware-defined regions */
     LlbHwBuildMemoryMap(MemoryMap);

Modified: trunk/reactos/boot/freeldr/freeldr/arcemul/mm.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arcemul/mm.c?rev=45424&r1=45423&r2=45424&view=diff
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/arcemul/mm.c [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/arcemul/mm.c [iso-8859-1] Thu Feb  4 20:52:13 2010
@@ -32,9 +32,7 @@
     { { MemoryFirmwarePermanent, 0xA0, 0x60 }, 6, }, // ROM / Video
     { { MemorySpecialMemory, 0xFFF, 1 }, 7, }, // unusable memory
 #elif __arm__ // This needs to be done per-platform specific way
-    { { MemoryLoadedProgram, 0x80000, 32 }, 0, }, // X-Loader + OmapLdr
-    { { MemoryLoadedProgram, 0x81000, 128 }, 1, }, // FreeLDR
-    { { MemoryFirmwareTemporary, 0x80500, 4096 }, 2, }, // Video Buffer
+
 #endif
 };
 MEMORY_DESCRIPTOR*

Modified: trunk/reactos/boot/freeldr/freeldr/arch/arm/loader.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/arm/loader.c?rev=45424&r1=45423&r2=45424&view=diff
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/arch/arm/loader.c [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/arch/arm/loader.c [iso-8859-1] Thu Feb  4 20:52:13 2010
@@ -1036,6 +1036,9 @@
     PULONG Buffer;
     PWCHAR ArmModuleName;
 
+    TuiPrintf("About to prepare for kernel boot\n");
+    while (TRUE);
+
     //
     // Allocate the ARM Shared Heap
     //
@@ -1607,6 +1610,7 @@
     //
     // Initialize the page directory
     //
+    TuiPrintf("About to jump into kernel\n");
     while (TRUE);
     ArmSetupPageDirectory();
 

Modified: trunk/reactos/boot/freeldr/freeldr/arch/arm/macharm.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/arm/macharm.c?rev=45424&r1=45423&r2=45424&view=diff
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/arch/arm/macharm.c [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/arch/arm/macharm.c [iso-8859-1] Thu Feb  4 20:52:13 2010
@@ -73,8 +73,8 @@
 ArmDiskNormalizeSystemPath(IN OUT PCHAR SystemPath,
                            IN unsigned Size)
 {
-    TuiPrintf("Called: %s\n", SystemPath);
-    while (TRUE);
+    /* Only RAMDISK supported for now */
+    if (!strstr(SystemPath, "ramdisk(0)")) return FALSE;
     return TRUE;
 }
 

Modified: trunk/reactos/boot/freeldr/freeldr/freeldr.rbuild
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/freeldr.rbuild?rev=45424&r1=45423&r2=45424&view=diff
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/freeldr.rbuild [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/freeldr.rbuild [iso-8859-1] Thu Feb  4 20:52:13 2010
@@ -38,7 +38,7 @@
 			        <linkerflag>-Wl,--image-base=0x80FFF000</linkerflag>
 			    </if>
                 <if property="SARCH" value="versatile">
-			        <linkerflag>-Wl,--image-base=0x0080F000</linkerflag>
+			        <linkerflag>-Wl,--image-base=0x0001F000</linkerflag>
 			    </if>				
 			</group>
 		</module>




More information about the Ros-diffs mailing list