Changes in v1.8.1 (1/20/2003) (ekohl)

- Fixed the ISO filesystem detection code.
- Removed IsSetupLdr.

svn path=/trunk/; revision=4047
This commit is contained in:
Eric Kohl 2003-01-20 18:39:53 +00:00
parent 3960f23e28
commit e1cf009871
11 changed files with 37 additions and 61 deletions

View file

@ -1,3 +1,8 @@
Changes in v1.8.1 (1/20/2003) (ekohl)
- Fixed the ISO filesystem detection code.
- Removed IsSetupLdr.
Changes in v1.8 (1/18/2003) (brianp) Changes in v1.8 (1/18/2003) (brianp)
- Added F8 options menu - Added F8 options menu

View file

@ -53,7 +53,7 @@ BOOL DiskReadLogicalSectors(U32 DriveNumber, U64 SectorNumber, U32 SectorCount,
// If so then check to see if Int13 extensions work // If so then check to see if Int13 extensions work
// If they do then use them, otherwise default back to BIOS calls // If they do then use them, otherwise default back to BIOS calls
// //
if ((DriveNumber >= 0x80) && (IsSetupLdr || DiskInt13ExtensionsSupported(DriveNumber))) if ((DriveNumber >= 0x80) && DiskInt13ExtensionsSupported(DriveNumber))
{ {
DbgPrint((DPRINT_DISK, "Using Int 13 Extensions for read. DiskInt13ExtensionsSupported(%d) = %s\n", DriveNumber, DiskInt13ExtensionsSupported(DriveNumber) ? "TRUE" : "FALSE")); DbgPrint((DPRINT_DISK, "Using Int 13 Extensions for read. DiskInt13ExtensionsSupported(%d) = %s\n", DriveNumber, DiskInt13ExtensionsSupported(DriveNumber) ? "TRUE" : "FALSE"));
@ -336,11 +336,13 @@ BOOL DiskInt13ExtensionsSupported(U32 DriveNumber)
// CF set on error (extensions not supported) // CF set on error (extensions not supported)
return FALSE; return FALSE;
} }
if (RegsOut.w.bx != 0xAA55) if (RegsOut.w.bx != 0xAA55)
{ {
// BX = AA55h if installed // BX = AA55h if installed
return FALSE; return FALSE;
} }
if (!(RegsOut.w.cx & 0x01)) if (!(RegsOut.w.cx & 0x01))
{ {
// CX = API subset support bitmap // CX = API subset support bitmap

View file

@ -35,7 +35,6 @@
#include <drivemap.h> #include <drivemap.h>
#include <keycodes.h> #include <keycodes.h>
BOOL IsSetupLdr = FALSE;
VOID RunLoader(VOID) VOID RunLoader(VOID)
{ {

View file

@ -95,52 +95,6 @@ BOOL DiskIsDriveRemovable(U32 DriveNumber)
return TRUE; return TRUE;
} }
BOOL DiskIsDriveCdRom(U32 DriveNumber)
{
PUCHAR Sector = (PUCHAR)DISKREADBUFFER;
// FIXME:
// I need to move this code to somewhere else
// probably in the file system code.
// I don't like the fact that the disk code
// reads the on-disk structures to determine
// if it's a CD-ROM drive. Only the file system
// should interpret on-disk data.
// The disk code should use some other method
// to determine if it's a CD-ROM drive.
// Hard disks use drive numbers >= 0x80
// So if the drive number indicates a hard disk
// then return FALSE
//
// We first check if we are running as a SetupLoader
// If so then we are probably booting from a CD-ROM
// So we shouldn't call i386DiskInt13ExtensionsSupported()
// because apparently it screws up some BIOSes
if ((DriveNumber >= 0x80) && (IsSetupLdr || DiskInt13ExtensionsSupported(DriveNumber)))
{
// We are a CD-ROM drive so we should only
// use the extended Int13 disk functions
if (!DiskReadLogicalSectorsLBA(DriveNumber, 16, 1, Sector))
{
DiskError("Disk read error.", 0);
return FALSE;
}
return (Sector[0] == 1 &&
Sector[1] == 'C' &&
Sector[2] == 'D' &&
Sector[3] == '0' &&
Sector[4] == '0' &&
Sector[5] == '1');
}
// Drive is not CdRom so return FALSE
return FALSE;
}
// This function is in arch/i386/i386disk.c // This function is in arch/i386/i386disk.c
//VOID DiskStopFloppyMotor(VOID) //VOID DiskStopFloppyMotor(VOID)

View file

@ -78,9 +78,8 @@ BOOL FsOpenVolume(U32 DriveNumber, U32 PartitionNumber)
return FatOpenVolume(DriveNumber, 0); return FatOpenVolume(DriveNumber, 0);
} }
// Check and see if it is a cdrom drive // Check for ISO9660 file system type
// If so then just assume ISO9660 file system type if (DriveNumber > 0x80 && IsIsoFs(DriveNumber))
if (DiskIsDriveCdRom(DriveNumber))
{ {
DbgPrint((DPRINT_FILESYSTEM, "Drive is a cdrom drive. Assuming ISO-9660 file system.\n")); DbgPrint((DPRINT_FILESYSTEM, "Drive is a cdrom drive. Assuming ISO-9660 file system.\n"));

View file

@ -37,6 +37,25 @@ static U32 IsoRootLength; // Length of the root directory
U32 IsoDriveNumber = 0; U32 IsoDriveNumber = 0;
BOOL IsIsoFs(U32 DriveNumber)
{
PUCHAR Sector = (PUCHAR)DISKREADBUFFER;
if (!DiskReadLogicalSectorsLBA(DriveNumber, 16, 1, Sector))
{
FileSystemError("Failed to read the PVD.");
return FALSE;
}
return (Sector[0] == 1 &&
Sector[1] == 'C' &&
Sector[2] == 'D' &&
Sector[3] == '0' &&
Sector[4] == '0' &&
Sector[5] == '1');
}
BOOL IsoOpenVolume(U32 DriveNumber) BOOL IsoOpenVolume(U32 DriveNumber)
{ {
PPVD Pvd = (PPVD)DISKREADBUFFER; PPVD Pvd = (PPVD)DISKREADBUFFER;
@ -49,7 +68,7 @@ BOOL IsoOpenVolume(U32 DriveNumber)
IsoRootSector = 0; IsoRootSector = 0;
IsoRootLength = 0; IsoRootLength = 0;
if (!DiskReadLogicalSectors(DriveNumber, 16, 1, Pvd)) if (!DiskReadLogicalSectorsLBA(DriveNumber, 16, 1, Pvd))
{ {
FileSystemError("Failed to read the PVD."); FileSystemError("Failed to read the PVD.");
return FALSE; return FALSE;
@ -160,7 +179,7 @@ static PVOID IsoBufferDirectory(U32 DirectoryStartSector, U32 DirectoryLength)
// //
for (i = 0, Ptr = DirectoryBuffer; i < SectorCount; i++, Ptr += SECTORSIZE) for (i = 0, Ptr = DirectoryBuffer; i < SectorCount; i++, Ptr += SECTORSIZE)
{ {
if (!DiskReadLogicalSectors(IsoDriveNumber, DirectoryStartSector + i, 1, (PVOID)DISKREADBUFFER)) if (!DiskReadLogicalSectorsLBA(IsoDriveNumber, DirectoryStartSector + i, 1, (PVOID)DISKREADBUFFER))
{ {
MmFreeMemory(DirectoryBuffer); MmFreeMemory(DirectoryBuffer);
return NULL; return NULL;
@ -372,7 +391,7 @@ BOOL IsoReadFile(FILE *FileHandle, U32 BytesToRead, U32* BytesRead, PVOID Buffer
// //
// Now do the read and update BytesRead, BytesToRead, FilePointer, & Buffer // Now do the read and update BytesRead, BytesToRead, FilePointer, & Buffer
// //
if (!DiskReadLogicalSectors(IsoDriveNumber, SectorNumber, 1, (PVOID)DISKREADBUFFER)) if (!DiskReadLogicalSectorsLBA(IsoDriveNumber, SectorNumber, 1, (PVOID)DISKREADBUFFER))
{ {
return FALSE; return FALSE;
} }
@ -403,7 +422,7 @@ BOOL IsoReadFile(FILE *FileHandle, U32 BytesToRead, U32* BytesRead, PVOID Buffer
// //
// Now do the read and update BytesRead, BytesToRead, FilePointer, & Buffer // Now do the read and update BytesRead, BytesToRead, FilePointer, & Buffer
// //
if (!DiskReadLogicalSectors(IsoDriveNumber, SectorNumber, 1, (PVOID)DISKREADBUFFER)) if (!DiskReadLogicalSectorsLBA(IsoDriveNumber, SectorNumber, 1, (PVOID)DISKREADBUFFER))
{ {
return FALSE; return FALSE;
} }
@ -430,7 +449,7 @@ BOOL IsoReadFile(FILE *FileHandle, U32 BytesToRead, U32* BytesRead, PVOID Buffer
// //
// Now do the read and update BytesRead, BytesToRead, FilePointer, & Buffer // Now do the read and update BytesRead, BytesToRead, FilePointer, & Buffer
// //
if (!DiskReadLogicalSectors(IsoDriveNumber, SectorNumber, 1, (PVOID)DISKREADBUFFER)) if (!DiskReadLogicalSectorsLBA(IsoDriveNumber, SectorNumber, 1, (PVOID)DISKREADBUFFER))
{ {
return FALSE; return FALSE;
} }

View file

@ -105,6 +105,7 @@ typedef struct
} ISO_FILE_INFO, * PISO_FILE_INFO; } ISO_FILE_INFO, * PISO_FILE_INFO;
BOOL IsIsoFs(U32 DriveNumber);
BOOL IsoOpenVolume(U32 DriveNumber); BOOL IsoOpenVolume(U32 DriveNumber);
FILE* IsoOpenFile(PUCHAR FileName); FILE* IsoOpenFile(PUCHAR FileName);
BOOL IsoReadFile(FILE *FileHandle, U32 BytesToRead, U32* BytesRead, PVOID Buffer); BOOL IsoReadFile(FILE *FileHandle, U32 BytesToRead, U32* BytesRead, PVOID Buffer);

View file

@ -109,7 +109,6 @@ PUCHAR DiskGetErrorCodeString(U32 ErrorCode);
BOOL DiskGetDriveGeometry(U32 DriveNumber, PGEOMETRY DriveGeometry); BOOL DiskGetDriveGeometry(U32 DriveNumber, PGEOMETRY DriveGeometry);
BOOL DiskReadLogicalSectors(U32 DriveNumber, U64 SectorNumber, U32 SectorCount, PVOID Buffer); // Implemented in i386disk.c BOOL DiskReadLogicalSectors(U32 DriveNumber, U64 SectorNumber, U32 SectorCount, PVOID Buffer); // Implemented in i386disk.c
BOOL DiskIsDriveRemovable(U32 DriveNumber); BOOL DiskIsDriveRemovable(U32 DriveNumber);
BOOL DiskIsDriveCdRom(U32 DriveNumber);
VOID DiskStopFloppyMotor(VOID); // Implemented in i386disk.c VOID DiskStopFloppyMotor(VOID); // Implemented in i386disk.c
U32 DiskGetCacheableBlockCount(U32 DriveNumber); // Implemented in i386disk.c U32 DiskGetCacheableBlockCount(U32 DriveNumber); // Implemented in i386disk.c

View file

@ -68,7 +68,6 @@ typedef S64 __s64;
extern U32 BootDrive; // BIOS boot drive, 0-A:, 1-B:, 0x80-C:, 0x81-D:, etc. extern U32 BootDrive; // BIOS boot drive, 0-A:, 1-B:, 0x80-C:, 0x81-D:, etc.
extern U32 BootPartition; // Boot Partition, 1-4 extern U32 BootPartition; // Boot Partition, 1-4
extern BOOL UserInterfaceUp; // Tells us if the user interface is displayed extern BOOL UserInterfaceUp; // Tells us if the user interface is displayed
extern BOOL IsSetupLdr;
void BootMain(void); void BootMain(void);
VOID RunLoader(VOID); VOID RunLoader(VOID);

View file

@ -22,7 +22,7 @@
/* just some stuff */ /* just some stuff */
#define VERSION "FreeLoader v1.8" #define VERSION "FreeLoader v1.8.1"
#define COPYRIGHT "Copyright (C) 1998-2003 Brian Palmer <brianp@sginet.com>" #define COPYRIGHT "Copyright (C) 1998-2003 Brian Palmer <brianp@sginet.com>"
#define AUTHOR_EMAIL "<brianp@sginet.com>" #define AUTHOR_EMAIL "<brianp@sginet.com>"
#define BY_AUTHOR "by Brian Palmer" #define BY_AUTHOR "by Brian Palmer"
@ -36,7 +36,7 @@
// //
#define FREELOADER_MAJOR_VERSION 1 #define FREELOADER_MAJOR_VERSION 1
#define FREELOADER_MINOR_VERSION 8 #define FREELOADER_MINOR_VERSION 8
#define FREELOADER_PATCH_VERSION 0 #define FREELOADER_PATCH_VERSION 1
PUCHAR GetFreeLoaderVersionString(VOID); PUCHAR GetFreeLoaderVersionString(VOID);

View file

@ -31,7 +31,6 @@
#include "registry.h" #include "registry.h"
#include "hwdetect.h" #include "hwdetect.h"
BOOL IsSetupLdr = TRUE;
static BOOL static BOOL
LoadKernel(PCHAR szFileName) LoadKernel(PCHAR szFileName)