From 9a5b681194520b579650ad7f70220b0c367c0df8 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Herm=C3=A8s=20B=C3=A9lusca-Ma=C3=AFto?= Date: Fri, 5 Feb 2016 23:47:35 +0000 Subject: [PATCH] [FREELDR] - Whitespace fixes only in the disk code. - Fix the name of the EXT2 FS driver. - Move I/O initialization after Mm init so that we can properly read disk data into the correct buffers if needed (and I will need that). svn path=/trunk/; revision=70695 --- reactos/boot/freeldr/freeldr/arch/i386/pcdisk.c | 11 +++++------ reactos/boot/freeldr/freeldr/disk/partition.c | 10 +++++----- reactos/boot/freeldr/freeldr/freeldr.c | 10 +++++++--- reactos/boot/freeldr/freeldr/lib/fs/ext2.c | 2 +- 4 files changed, 18 insertions(+), 15 deletions(-) diff --git a/reactos/boot/freeldr/freeldr/arch/i386/pcdisk.c b/reactos/boot/freeldr/freeldr/arch/i386/pcdisk.c index a1c3f9eb9a0..d73f9e7d857 100644 --- a/reactos/boot/freeldr/freeldr/arch/i386/pcdisk.c +++ b/reactos/boot/freeldr/freeldr/arch/i386/pcdisk.c @@ -69,16 +69,16 @@ static BOOLEAN PcDiskReadLogicalSectorsLBA(UCHAR DriveNumber, ULONGLONG SectorNu { REGS RegsIn; REGS RegsOut; - ULONG RetryCount; + ULONG RetryCount; PI386_DISK_ADDRESS_PACKET Packet = (PI386_DISK_ADDRESS_PACKET)(BIOSCALLBUFFER); TRACE("PcDiskReadLogicalSectorsLBA() DriveNumber: 0x%x SectorNumber: %I64d SectorCount: %d Buffer: 0x%x\n", DriveNumber, SectorNumber, SectorCount, Buffer); ASSERT(((ULONG_PTR)Buffer) <= 0xFFFFF); // BIOS int 0x13, function 42h - IBM/MS INT 13 Extensions - EXTENDED READ - RegsIn.b.ah = 0x42; // Subfunction 42h - RegsIn.b.dl = DriveNumber; // Drive number in DL (0 - floppy, 0x80 - harddisk) - RegsIn.x.ds = BIOSCALLBUFSEGMENT; // DS:SI -> disk address packet + RegsIn.b.ah = 0x42; // Subfunction 42h + RegsIn.b.dl = DriveNumber; // Drive number in DL (0 - floppy, 0x80 - harddisk) + RegsIn.x.ds = BIOSCALLBUFSEGMENT; // DS:SI -> disk address packet RegsIn.w.si = BIOSCALLBUFOFFSET; // Setup disk address packet @@ -115,11 +115,10 @@ static BOOLEAN PcDiskReadLogicalSectorsLBA(UCHAR DriveNumber, ULONGLONG SectorNu { return TRUE; } - // If it failed the do the next retry + // If it failed then do the next retry else { PcDiskResetController(DriveNumber); - continue; } } diff --git a/reactos/boot/freeldr/freeldr/disk/partition.c b/reactos/boot/freeldr/freeldr/disk/partition.c index 78c317312af..46c515e2ae2 100644 --- a/reactos/boot/freeldr/freeldr/disk/partition.c +++ b/reactos/boot/freeldr/freeldr/disk/partition.c @@ -27,10 +27,11 @@ BOOLEAN DiskGetActivePartitionEntry(UCHAR DriveNumber, PPARTITION_TABLE_ENTRY PartitionTableEntry, ULONG *ActivePartition) { - ULONG BootablePartitionCount = 0; - MASTER_BOOT_RECORD MasterBootRecord; + ULONG BootablePartitionCount = 0; + MASTER_BOOT_RECORD MasterBootRecord; *ActivePartition = 0; + // Read master boot record if (!DiskReadBootRecord(DriveNumber, 0, &MasterBootRecord)) { @@ -134,7 +135,7 @@ BOOLEAN DiskGetPartitionEntry(UCHAR DriveNumber, ULONG PartitionNumber, PPARTITI ExtendedPartitionOffset = ExtendedPartitionTableEntry.SectorCountBeforePartition; } // Read the partition boot record - if (!DiskReadBootRecord(DriveNumber, ExtendedPartitionTableEntry.SectorCountBeforePartition, &MasterBootRecord)) + if (!DiskReadBootRecord(DriveNumber, ExtendedPartitionTableEntry.SectorCountBeforePartition, &MasterBootRecord)) { return FALSE; } @@ -199,7 +200,7 @@ BOOLEAN DiskGetFirstExtendedPartitionEntry(PMASTER_BOOT_RECORD MasterBootRecord, BOOLEAN DiskReadBootRecord(UCHAR DriveNumber, ULONGLONG LogicalSectorNumber, PMASTER_BOOT_RECORD BootRecord) { - ULONG Index; + ULONG Index; // Read master boot record if (!MachDiskReadLogicalSectors(DriveNumber, LogicalSectorNumber, 1, DiskReadBuffer)) @@ -208,7 +209,6 @@ BOOLEAN DiskReadBootRecord(UCHAR DriveNumber, ULONGLONG LogicalSectorNumber, PMA } RtlCopyMemory(BootRecord, DiskReadBuffer, sizeof(MASTER_BOOT_RECORD)); - TRACE("Dumping partition table for drive 0x%x:\n", DriveNumber); TRACE("Boot record logical start sector = %d\n", LogicalSectorNumber); TRACE("sizeof(MASTER_BOOT_RECORD) = 0x%x.\n", sizeof(MASTER_BOOT_RECORD)); diff --git a/reactos/boot/freeldr/freeldr/freeldr.c b/reactos/boot/freeldr/freeldr/freeldr.c index a797f980ba0..cc68d4183dd 100644 --- a/reactos/boot/freeldr/freeldr/freeldr.c +++ b/reactos/boot/freeldr/freeldr/freeldr.c @@ -29,16 +29,16 @@ DBG_DEFAULT_CHANNEL(WARNING); VOID __cdecl BootMain(IN PCCH CmdLine) { CmdLineParse(CmdLine); - MachInit(CmdLine); - FsInit(); /* Debugger pre-initialization */ DebugInit(FALSE); TRACE("BootMain() called.\n"); + MachInit(CmdLine); + /* Check if the CPU is new enough */ - FrLdrCheckCpuCompatiblity(); + FrLdrCheckCpuCompatiblity(); // FIXME: Should be done inside MachInit! /* UI pre-initialization */ if (!UiInitialize(FALSE)) @@ -47,12 +47,16 @@ VOID __cdecl BootMain(IN PCCH CmdLine) goto Quit; } + /* Initialize memory manager */ if (!MmInitializeMemoryManager()) { UiMessageBoxCritical("Unable to initialize memory manager."); goto Quit; } + /* Initialize I/O subsystem */ + FsInit(); + RunLoader(); Quit: diff --git a/reactos/boot/freeldr/freeldr/lib/fs/ext2.c b/reactos/boot/freeldr/freeldr/lib/fs/ext2.c index aa38c868d43..3428bd42d97 100644 --- a/reactos/boot/freeldr/freeldr/lib/fs/ext2.c +++ b/reactos/boot/freeldr/freeldr/lib/fs/ext2.c @@ -1294,7 +1294,7 @@ const DEVVTBL Ext2FuncTable = Ext2Open, Ext2Read, Ext2Seek, - L"ext2", + L"ext2fs", }; const DEVVTBL* Ext2Mount(ULONG DeviceId) -- 2.17.1