Exemple #1
0
//
// Should go to hwdev.c
//
POSLOADER_INIT
NTAPI
LlbHwLoadOsLoaderFromRam(VOID)
{
    ULONG Base, RootFs, Size;
    PCHAR Offset;
    CHAR CommandLine[64];
    
    /* On versatile we load the RAMDISK with initrd */
    LlbEnvGetRamDiskInformation(&RootFs, &Size);
    DbgPrint("Root fs: %lx, size: %lx\n", RootFs, Size);
    
    /* The OS Loader is at 0x20000, always */
    Base = 0x20000;
    
    /* Read image offset */
    Offset = LlbEnvRead("rdoffset");
    
    /* Set parameters for the OS loader */
    snprintf(CommandLine,
             sizeof(CommandLine),
             "rdbase=0x%x rdsize=0x%x rdoffset=%s",
             RootFs, Size, Offset);
    LlbSetCommandLine(CommandLine);
    
    /* Return the OS loader base address */
    return (POSLOADER_INIT)Base;
}
Exemple #2
0
VOID
NTAPI
LlbHwBuildMemoryMap(IN PBIOS_MEMORY_MAP MemoryMap)
{
    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);
}