#define NDEBUG
#include <debug.h>
+/* non-standard specifier from windef.h -- please deprecate */
+#undef PACKED
+#ifdef __GNUC__
+#define PACKED __attribute__((packed))
+#endif
+
typedef struct
{
UCHAR PacketSize; // 00h - Size of packet (10h or 18h)
REGS RegsIn;
REGS RegsOut;
- DbgPrint((DPRINT_DISK, "PcDiskResetController(0x%x) DISK OPERATION FAILED -- RESETTING CONTROLLER\n", DriveNumber));
+ DPRINTM(DPRINT_DISK, "PcDiskResetController(0x%x) DISK OPERATION FAILED -- RESETTING CONTROLLER\n", DriveNumber);
// BIOS Int 13h, function 0 - Reset disk system
// AH = 00h
ULONG RetryCount;
PI386_DISK_ADDRESS_PACKET Packet = (PI386_DISK_ADDRESS_PACKET)(BIOSCALLBUFFER);
- DbgPrint((DPRINT_DISK, "PcDiskReadLogicalSectorsLBA() DriveNumber: 0x%x SectorNumber: %I64d SectorCount: %d Buffer: 0x%x\n", DriveNumber, SectorNumber, SectorCount, Buffer));
+ DPRINTM(DPRINT_DISK, "PcDiskReadLogicalSectorsLBA() DriveNumber: 0x%x SectorNumber: %I64d SectorCount: %d Buffer: 0x%x\n", DriveNumber, SectorNumber, SectorCount, Buffer);
// BIOS int 0x13, function 42h - IBM/MS INT 13 Extensions - EXTENDED READ
RegsIn.b.ah = 0x42; // Subfunction 42h
Packet->PacketSize = sizeof(I386_DISK_ADDRESS_PACKET);
Packet->Reserved = 0;
Packet->LBABlockCount = SectorCount;
- Packet->TransferBufferOffset = ((ULONG)Buffer) & 0x0F;
- Packet->TransferBufferSegment = ((ULONG)Buffer) >> 4;
+ Packet->TransferBufferOffset = ((ULONG_PTR)Buffer) & 0x0F;
+ Packet->TransferBufferSegment = ((ULONG_PTR)Buffer) >> 4;
Packet->LBAStartBlock = SectorNumber;
// BIOS int 0x13, function 42h - IBM/MS INT 13 Extensions - EXTENDED READ
REGS RegsOut;
ULONG RetryCount;
- DbgPrint((DPRINT_DISK, "PcDiskReadLogicalSectorsCHS()\n"));
+ DPRINTM(DPRINT_DISK, "PcDiskReadLogicalSectorsCHS()\n");
//
// Get the drive geometry
RegsIn.b.cl = (PhysicalSector + ((PhysicalTrack & 0x300) >> 2));
RegsIn.b.dh = PhysicalHead;
RegsIn.b.dl = DriveNumber;
- RegsIn.w.es = ((ULONG)Buffer) >> 4;
- RegsIn.w.bx = ((ULONG)Buffer) & 0x0F;
+ RegsIn.w.es = ((ULONG_PTR)Buffer) >> 4;
+ RegsIn.w.bx = ((ULONG_PTR)Buffer) & 0x0F;
//
// Perform the read
REGS RegsIn;
REGS RegsOut;
- DbgPrint((DPRINT_DISK, "PcDiskInt13ExtensionsSupported()\n"));
+ DPRINTM(DPRINT_DISK, "PcDiskInt13ExtensionsSupported()\n");
if (DriveNumber == LastDriveNumber)
{
- DbgPrint((DPRINT_DISK, "Using cached value %s for drive 0x%x\n", LastSupported ? "TRUE" : "FALSE", DriveNumber));
+ DPRINTM(DPRINT_DISK, "Using cached value %s for drive 0x%x\n", LastSupported ? "TRUE" : "FALSE", DriveNumber);
return LastSupported;
}
BOOLEAN PcDiskReadLogicalSectors(ULONG DriveNumber, ULONGLONG SectorNumber, ULONG SectorCount, PVOID Buffer)
{
- DbgPrint((DPRINT_DISK, "PcDiskReadLogicalSectors() DriveNumber: 0x%x SectorNumber: %I64d SectorCount: %d Buffer: 0x%x\n", DriveNumber, SectorNumber, SectorCount, Buffer));
+ DPRINTM(DPRINT_DISK, "PcDiskReadLogicalSectors() DriveNumber: 0x%x SectorNumber: %I64d SectorCount: %d Buffer: 0x%x\n", DriveNumber, SectorNumber, SectorCount, Buffer);
//
// Check to see if it is a fixed disk drive
//
if ((DriveNumber >= 0x80) && PcDiskInt13ExtensionsSupported(DriveNumber))
{
- DbgPrint((DPRINT_DISK, "Using Int 13 Extensions for read. PcDiskInt13ExtensionsSupported(%d) = %s\n", DriveNumber, PcDiskInt13ExtensionsSupported(DriveNumber) ? "TRUE" : "FALSE"));
+ DPRINTM(DPRINT_DISK, "Using Int 13 Extensions for read. PcDiskInt13ExtensionsSupported(%d) = %s\n", DriveNumber, PcDiskInt13ExtensionsSupported(DriveNumber) ? "TRUE" : "FALSE");
//
// LBA is easy, nothing to calculate
REGS RegsOut;
ULONG Cylinders;
- DbgPrint((DPRINT_DISK, "DiskGetDriveGeometry()\n"));
+ DPRINTM(DPRINT_DISK, "DiskGetDriveGeometry()\n");
/* BIOS Int 13h, function 08h - Get drive parameters
* AH = 08h