[memdisk] Add drive shift limit logic
authorShao Miller <shao.miller@yrdsb.edu.on.ca>
Sat, 1 Aug 2009 01:45:46 +0000 (21:45 -0400)
committerShao Miller <shao.miller@yrdsb.edu.on.ca>
Tue, 4 Aug 2009 02:09:36 +0000 (22:09 -0400)
We will not shift drives greater than or equal to a maximum BIOS drive
number.  This is hard-coded to drive 0xFF for now.  This addition is in
support of future disk probing logic, which can decide what the drive
shift limit should be.

memdisk/memdisk.inc
memdisk/setup.c

index 3c79b62..7b63c05 100644 (file)
@@ -147,6 +147,12 @@ Int13Start:
                jz our_drive            ; If ZF=1, we have an exact match
                cmp dl,[cs:DriveNo]
                jb .nomatch             ; Drive < Our drive
+               cmp dl,[cs:DriveShiftLimit]
+               jae .nomatch            ; Drive > The maximum drive
+                                       ; number that we will shift for.
+                                       ; This leaves any higher-up BIOS
+                                       ; drives alone, such as an optical
+                                       ; disc drive 0xA0 or 0xE0
                dec dl                  ; Drive > Our drive, adjust drive #
 .nomatch:
                TRACER '!'
@@ -1013,6 +1019,13 @@ DPT_ptr          dw 0                    ; If nonzero, pointer to DPT
 MDI_Len                equ $-MemDisk_Info
 
 ; ---- MDI structure ends here ---
+DriveShiftLimit        db 0ffh                 ; Installer will [soon] probe for
+                                       ; a range of contiguous drives.
+                                       ; Any BIOS drives above this region
+                                       ; shall not be impacted by our
+                                       ; shifting behaviour
+               db 0                    ; pad to a DWORD
+               dw 0                    ; pad to a QWORD
 MemInt1588     dw 0                    ; 1MB-65MB memory amount (1K)
 
 Cylinders      dw 0                    ; Cylinder count
index 7f02663..b2444f6 100644 (file)
@@ -107,6 +107,10 @@ struct patch_area {
 
     uint16_t dpt_ptr;
     /* End of the official MemDisk_Info */
+    uint8_t driveshiftlimit;   /* Do not shift drives above this region */
+    uint8_t _pad2;             /* Pad to DWORD */
+    uint16_t _pad3;            /* Pad to QWORD */
+
     uint16_t memint1588;
 
     uint16_t cylinders;