lotus



previous page: 13.01.  Details on OnTrack Disk Manager
  
page up: Enhanced IDE/Fast-ATA/ATA-2 FAQ
  
next page: 14.01.  The hacker's documentation guide

13.02. How does Windows' 32-bit disk access work?




Description

This item is from the Yet Another Enhanced IDE/Fast-ATA/ATA-2 FAQ, by John Wehman and Peter den Haan with numerous contributions by others. (v1.92).

13.02. How does Windows' 32-bit disk access work?

32-bit disk access (32BDA), also known as FastDisk, is a set of protected-mode drivers that direct int13 calls to the hard disk controller through a protected mode interface. For the latter the hard disk controller has to supply an appropriate virtual device driver (VxD).

Windows ships with one such driver built in: *wdctrl. Unfortunately, this device only supports controllers that are strictly compatible with the WD1003 standard; this excludes SCSI, ATA-2, LBA or CHS translation, disks with more than 1024 cylinders and even some commonplace features of ATA such as block mode. If it detects one of these during the initialization phase it will refuse to load. In today's computers, this means that *wdctrl will rarely do the job and an external VxD must be used.

32BDA has two advantages over disk access through the BIOS. First, since the FastDisk VxD is re-entrant, it enables Windows to use virtual memory for DOS sessions. Using virtual memory without 32BDA could create a deadlock situation if a page fault is generated during the execution of BIOS routines. Since the BIOS is not re-entrant, it is not possible to use a BIOS call to read the page from disk until the first BIOS call has terminated; on the other hand, this BIOS thread must remain suspended until the swapped out page has been read.

So 32BDA enables Windows to manage memory much more efficiently with one or more DOS sessions open.

The second advantage of 32-bit disk access is that it saves two (relatively slow) switches between virtual and protected mode per disk I/O call. Take, for instance, a disk read performed by a DOS application. In the absence of 32BDA, each such call causes the following sequence of events:

 1     Application     calls INT21 to read from disk
 2     Windows         traps the call, switches to protected mode
 3     Windows         switches to real mode, returns to DOS
 4     DOS             makes int13 call to BIOS disk routines
 5     Windows         traps the call, switches to protected mode
 6     Windows         switches to real mode, returns to BIOS
 7     BIOS            acts upon int13 call and does the read
 8     Windows         traps the return from int13, switches to PM
 9     Windows         switches to RM, returns the result to DOS
10     DOS             receives the result, passes on to application
11     Windows         traps the return from DOS, switches to PM
12     Windows         switches to RM, returns result to application
13     Application     receives the result from the INT21 call

Using 32-bit disk access replaces steps 6 to 8 by a single call to the FastDisk VxD. This removes two mode switches, resulting in a usually small disk performance improvement. (Steps 3-11 also apply to native Windows applications).

 

Continue to:













TOP
previous page: 13.01.  Details on OnTrack Disk Manager
  
page up: Enhanced IDE/Fast-ATA/ATA-2 FAQ
  
next page: 14.01.  The hacker's documentation guide