- 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.


svn path=/trunk/; revision=45424
This commit is contained in:
evb 2010-02-04 19:52:13 +00:00
parent 724f076f8a
commit 466a1c65ee
9 changed files with 75 additions and 30 deletions

View file

@ -31,7 +31,7 @@
ENTRY_END _start
L_BootStackEnd:
.long 0x2000000
.long 0x00010000
L_LlbStartup:
.long LlbStartup

View file

@ -47,6 +47,14 @@ LlbEnvParseArguments(IN PATAG Arguments)
/* 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:

View file

@ -37,14 +37,65 @@ NTAPI
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

View file

@ -33,14 +33,11 @@ LlbHwLoadOsLoaderFromRam(VOID)
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");

View file

@ -93,21 +93,8 @@ VOID
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);

View file

@ -32,9 +32,7 @@ static const MEMORY_DESCRIPTOR_INT MemoryDescriptors[] =
{ { 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*

View file

@ -1036,6 +1036,9 @@ ArmPrepareForReactOS(IN BOOLEAN Setup)
PULONG Buffer;
PWCHAR ArmModuleName;
TuiPrintf("About to prepare for kernel boot\n");
while (TRUE);
//
// Allocate the ARM Shared Heap
//
@ -1607,6 +1610,7 @@ FrLdrStartup(IN ULONG Magic)
//
// Initialize the page directory
//
TuiPrintf("About to jump into kernel\n");
while (TRUE);
ArmSetupPageDirectory();

View file

@ -73,8 +73,8 @@ BOOLEAN
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;
}

View file

@ -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>