Author: tkreuzer
Date: Tue Sep 11 12:17:38 2012
New Revision: 57275
URL:
http://svn.reactos.org/svn/reactos?rev=57275&view=rev
Log:
revert r57274. Looks like testbot doesn't like it.
Modified:
trunk/reactos/boot/freeldr/freeldr/arch/i386/hwdisk.c
trunk/reactos/boot/freeldr/freeldr/arch/i386/pcmem.c
trunk/reactos/boot/freeldr/freeldr/include/arch/pc/x86common.h
Modified: trunk/reactos/boot/freeldr/freeldr/arch/i386/hwdisk.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/arch/i386/hwdisk.c [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/arch/i386/hwdisk.c [iso-8859-1] Tue Sep 11 12:17:38
2012
@@ -113,47 +113,32 @@
static LONG DiskRead(ULONG FileId, VOID* Buffer, ULONG N, ULONG* Count)
{
DISKCONTEXT* Context = FsGetDeviceSpecific(FileId);
- UCHAR * Ptr = (UCHAR*)Buffer;
- ULONG Length, TotalSectors, MaxSectors, ReadSectors;
- BOOLEAN ret;
- ULONGLONG SectorOffset;
-
- TotalSectors = (N + Context->SectorSize - 1) / Context->SectorSize;
- MaxSectors = DISKREADBUFFER_SIZE / Context->SectorSize;
- SectorOffset = Context->SectorNumber + Context->SectorOffset;
-
- ret = 0;
-
- while (TotalSectors)
- {
- ReadSectors = TotalSectors;
- if (ReadSectors > MaxSectors)
- ReadSectors = MaxSectors;
-
+ UCHAR* Ptr = (UCHAR*)Buffer;
+ ULONG i, Length;
+ BOOLEAN ret;
+
+ *Count = 0;
+ i = 0;
+ while (N > 0)
+ {
+ Length = N;
+ if (Length > Context->SectorSize)
+ Length = Context->SectorSize;
ret = MachDiskReadLogicalSectors(
Context->DriveNumber,
- SectorOffset,
- ReadSectors,
+ Context->SectorNumber + Context->SectorOffset + i,
+ 1,
(PVOID)DISKREADBUFFER);
if (!ret)
- break;
-
- Length = ReadSectors * Context->SectorSize;
- if (Length > N)
- Length = N;
-
+ return EIO;
RtlCopyMemory(Ptr, (PVOID)DISKREADBUFFER, Length);
-
Ptr += Length;
- N -= Length;
-
- SectorOffset += ReadSectors;
- TotalSectors -= ReadSectors;
- }
-
- *Count = Ptr - (UCHAR *)Buffer;
-
- return (!ret) ? EIO : ESUCCESS;
+ *Count += Length;
+ N -= Length;
+ i++;
+ }
+
+ return ESUCCESS;
}
static LONG DiskSeek(ULONG FileId, LARGE_INTEGER* Position, SEEKMODE SeekMode)
Modified: trunk/reactos/boot/freeldr/freeldr/arch/i386/pcmem.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/arch/i386/pcmem.c [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/arch/i386/pcmem.c [iso-8859-1] Tue Sep 11 12:17:38
2012
@@ -29,13 +29,15 @@
#define MAX_BIOS_DESCRIPTORS 32
#define FREELDR_BASE_PAGE (FREELDR_BASE / PAGE_SIZE)
+#define FILEBUF_BASE_PAGE (FILESYSBUFFER / PAGE_SIZE)
#define DISKBUF_BASE_PAGE (DISKREADBUFFER / PAGE_SIZE)
-#define STACK_BASE_PAGE (STACKLOWLIMIT / PAGE_SIZE)
+#define STACK_BASE_PAGE (DISKBUF_BASE_PAGE + 1)
#define STACK_END_PAGE (STACK32ADDR / PAGE_SIZE)
#define BIOSBUF_BASE_PAGE (BIOSCALLBUFFER / PAGE_SIZE)
-#define FREELDR_PAGE_COUNT (DISKBUF_BASE_PAGE - FREELDR_BASE_PAGE)
-#define DISKBUF_PAGE_COUNT (STACK_BASE_PAGE - DISKBUF_BASE_PAGE)
+#define FREELDR_PAGE_COUNT (FILEBUF_BASE_PAGE - FREELDR_BASE_PAGE)
+#define FILEBUF_PAGE_COUNT (DISKBUF_BASE_PAGE - FILEBUF_BASE_PAGE)
+#define DISKBUF_PAGE_COUNT (1)
#define STACK_PAGE_COUNT (STACK_END_PAGE - STACK_BASE_PAGE)
#define BIOSBUF_PAGE_COUNT (1)
@@ -47,6 +49,7 @@
{ LoaderFirmwarePermanent, 0x00, 1 }, // realmode int vectors
{ LoaderFirmwareTemporary, 0x01, FREELDR_BASE_PAGE - 1 }, // freeldr stack
+ cmdline
{ LoaderLoadedProgram, FREELDR_BASE_PAGE, FREELDR_PAGE_COUNT }, // freeldr image
+ { LoaderFirmwareTemporary, FILEBUF_BASE_PAGE, FILEBUF_PAGE_COUNT }, // File system read
buffer. FILESYSBUFFER
{ LoaderFirmwareTemporary, DISKBUF_BASE_PAGE, DISKBUF_PAGE_COUNT }, // Disk read buffer
for int 13h. DISKREADBUFFER
{ LoaderOsloaderStack, STACK_BASE_PAGE, STACK_PAGE_COUNT }, // prot mode stack.
{ LoaderFirmwareTemporary, BIOSBUF_BASE_PAGE, BIOSBUF_PAGE_COUNT }, // BIOSCALLBUFFER
Modified: trunk/reactos/boot/freeldr/freeldr/include/arch/pc/x86common.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/inclu…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/include/arch/pc/x86common.h [iso-8859-1]
(original)
+++ trunk/reactos/boot/freeldr/freeldr/include/arch/pc/x86common.h [iso-8859-1] Tue Sep 11
12:17:38 2012
@@ -13,12 +13,12 @@
#define BSS_START HEX(6F00)
#define FREELDR_BASE HEX(F800)
#define FREELDR_PE_BASE HEX(10000)
-#define DISKREADBUFFER HEX(80000) /* Buffer to store data read in from the disk via
the BIOS */
-#define STACKLOWLIMIT HEX(90000)
+#define FILESYSBUFFER HEX(80000) /* Buffer to store file system data (e.g. cluster
buffer for FAT) */
+#define DISKREADBUFFER HEX(90000) /* Buffer to store data read in from the disk via
the BIOS */
#define STACK32ADDR HEX(98000) /* The 32-bit stack top will be at 9000:8000, or
0xA8000 */
#define STACK64ADDR HEX(98000) /* The 64-bit stack top will be at 98000 */
#define BIOSCALLBUFFER HEX(98000) /* Buffer to store temporary data for any Int386()
call */
-#define DISKREADBUFFER_SIZE HEX(10000)
+#define DISKREADBUFFER_SIZE 512
#define BIOSCALLBUFSEGMENT (BIOSCALLBUFFER/16) /* Buffer to store temporary data for any
Int386() call */
#define BIOSCALLBUFOFFSET HEX(0000) /* Buffer to store temporary data for any Int386()
call */