[ros-dev] Freeldr changes

Ge van Geldorp gvg at reactos.com
Tue Apr 19 12:22:30 CEST 2005


Art,

The freeldr changes I just checked in more or less formalize the concepts of
a boot volume/partition (containing freeldr.sys and freeldr.ini) and a
system volume/partition (containing \ReactOS). Most of the time, the boot
volume and system volume will be the same, but it's not required. The main
freeldr code no longer knows anything about partitions, this is handled in
the architecture-dependent functions now. The main code is given an opaque
drive number and the sector number at which a partition/slice/volume starts.

There are a number of new Mach functions:

BOOL
MachDiskGetBootVolume(PULONG DriveNumber, PULONGLONG StartSector, PULONGLONG
SectorCount, int *FsType)

which should return the boot DriveNumber (the main freeldr code just hands
it back to MachDiskReadLogicalSectors when needed), the StartSector of the
boot partition/slice/whatever, the SectorCount of the boot
partition/slice/whatever and the FsType (FS_FAT, FS_EXT2 etc.). The i386
MachDiskGetBootVolume() uses the boot drive and boot partition passed in by
the BIOS/boot sector to set the values, but the ppc implementation is
ofcourse free to handle it in its own way.

BOOL
MachDiskGetSystemVolume(char *SystemPath,
                        char *RemainingPath,
                        PULONG Device,
                        PULONG DriveNumber,
                        PULONGLONG StartSector,
                        PULONGLONG SectorCount,
                        int *FsType)

This routine takes a SystemPath, which for i386 is something like
multi(0)disk(0)rdisk(0)partition(1)\ReactOS and finds the DriveNumber,
StartSector, SectorCount and FsType from that. If RemainingPath is non-NULL,
in this example it will return \ReactOS in it. Device can be NULL, if it's
not the value appropriate for LoaderBlock.BootDevice will be returned there.
The format of the SystemPath passed in is architecture-dependent. It's taken
from freeldr.ini and passed on to MachDiskGetSystemVolume() by the main
freeldr code without any attempt to interpret it.

BOOL
MachDiskGetBootPath(char *BootPath, unsigned Size)

This constructs a system path for the boot volume. The i386 routine does
this by referencing its internal i386BootDrive and i386BootPartition
variables.

VOID
MachDiskGetBootDevice(PULONG BootDevice)

Returns a suitable value for LoaderBlock.BootDevice for the boot volume.

BOOL
MachDiskBootingFromFloppy()

Returns TRUE when booting from a low-capacity device.

Gé van Geldorp.





More information about the Ros-dev mailing list