mirror of
https://github.com/reactos/reactos.git
synced 2025-02-21 16:04:57 +00:00
[freeldr/i386] Read up to 128 sectors at once
svn path=/trunk/; revision=43565
This commit is contained in:
parent
125296305f
commit
9c62b2152a
3 changed files with 13 additions and 10 deletions
|
@ -467,7 +467,7 @@ static LONG DiskRead(ULONG FileId, VOID* Buffer, ULONG N, ULONG* Count)
|
|||
{
|
||||
DISKCONTEXT* Context = FsGetDeviceSpecific(FileId);
|
||||
UCHAR* Ptr = (UCHAR*)Buffer;
|
||||
ULONG i, Length;
|
||||
ULONG i, Length, Sectors;
|
||||
BOOLEAN ret;
|
||||
|
||||
*Count = 0;
|
||||
|
@ -475,12 +475,13 @@ static LONG DiskRead(ULONG FileId, VOID* Buffer, ULONG N, ULONG* Count)
|
|||
while (N > 0)
|
||||
{
|
||||
Length = N;
|
||||
if (Length > Context->SectorSize)
|
||||
Length = Context->SectorSize;
|
||||
if (Length > DISKREADBUFFER_SIZE)
|
||||
Length = DISKREADBUFFER_SIZE;
|
||||
Sectors = (Length + Context->SectorSize - 1) / Context->SectorSize;
|
||||
ret = MachDiskReadLogicalSectors(
|
||||
Context->DriveNumber,
|
||||
Context->SectorNumber + Context->SectorOffset + i,
|
||||
1,
|
||||
Sectors,
|
||||
(PVOID)DISKREADBUFFER);
|
||||
if (!ret)
|
||||
return EIO;
|
||||
|
@ -488,7 +489,7 @@ static LONG DiskRead(ULONG FileId, VOID* Buffer, ULONG N, ULONG* Count)
|
|||
Ptr += Length;
|
||||
*Count += Length;
|
||||
N -= Length;
|
||||
i++;
|
||||
i += Sectors;
|
||||
}
|
||||
|
||||
return ESUCCESS;
|
||||
|
|
|
@ -168,7 +168,7 @@ static LONG DiskRead(ULONG FileId, VOID* Buffer, ULONG N, ULONG* Count)
|
|||
{
|
||||
DISKCONTEXT* Context = FsGetDeviceSpecific(FileId);
|
||||
UCHAR* Ptr = (UCHAR*)Buffer;
|
||||
ULONG i, Length;
|
||||
ULONG i, Length, Sectors;
|
||||
BOOLEAN ret;
|
||||
|
||||
*Count = 0;
|
||||
|
@ -176,12 +176,13 @@ static LONG DiskRead(ULONG FileId, VOID* Buffer, ULONG N, ULONG* Count)
|
|||
while (N > 0)
|
||||
{
|
||||
Length = N;
|
||||
if (Length > Context->SectorSize)
|
||||
Length = Context->SectorSize;
|
||||
if (Length > DISKREADBUFFER_SIZE)
|
||||
Length = DISKREADBUFFER_SIZE;
|
||||
Sectors = (Length + Context->SectorSize - 1) / Context->SectorSize;
|
||||
ret = MachDiskReadLogicalSectors(
|
||||
Context->DriveNumber,
|
||||
Context->SectorNumber + Context->SectorOffset + i,
|
||||
1,
|
||||
Sectors,
|
||||
(PVOID)DISKREADBUFFER);
|
||||
if (!ret)
|
||||
return EIO;
|
||||
|
@ -189,7 +190,7 @@ static LONG DiskRead(ULONG FileId, VOID* Buffer, ULONG N, ULONG* Count)
|
|||
Ptr += Length;
|
||||
*Count += Length;
|
||||
N -= Length;
|
||||
i++;
|
||||
i += Sectors;
|
||||
}
|
||||
|
||||
return ESUCCESS;
|
||||
|
|
|
@ -46,6 +46,7 @@
|
|||
#define BIOSCALLBUFOFFSET 0x0000 /* Buffer to store temporary data for any Int386() call */
|
||||
#define FILESYSBUFFER 0x80000 /* Buffer to store file system data (e.g. cluster buffer for FAT) */
|
||||
#define DISKREADBUFFER 0x90000 /* Buffer to store data read in from the disk via the BIOS */
|
||||
#define DISKREADBUFFER_SIZE 0x10000
|
||||
#elif defined(_M_PPC) || defined(_M_MIPS) || defined(_M_ARM)
|
||||
#define DISKREADBUFFER 0x80000000
|
||||
#define FILESYSBUFFER 0x80000000
|
||||
|
|
Loading…
Reference in a new issue