Changeset 538 in xtideuniversalbios for trunk


Ignore:
Timestamp:
Apr 11, 2013, 8:05:27 PM (12 years ago)
Author:
aitotat@…
google:author:
aitotat@gmail.com
Message:

Changes to XTIDE Universal BIOS:

  • Segment overflow is now checked when transfer buffer pointer is normalized (AT builds only).
Location:
trunk/XTIDE_Universal_BIOS/Src/Device
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/XTIDE_Universal_BIOS/Src/Device/IDE/IdeTransfer.asm

    r526 r538  
    7878    mov     bx, g_rgfnPioRead
    7979    call    InitializePiovarsInSSBPwithSectorCountInAH
     80%ifdef USE_AT
     81    jc      SHORT ReturnWithTransferErrorInAH
     82%endif
    8083
    8184    ; Wait until drive is ready to transfer
     
    154157    mov     bx, g_rgfnPioWrite
    155158    call    InitializePiovarsInSSBPwithSectorCountInAH
     159%ifdef USE_AT
     160    jc      SHORT ReturnWithTransferErrorInAH
     161%endif
    156162
    157163    ; Always poll when writing first block (IRQs are generated for following blocks)
     
    201207;       SS:BP:  Ptr to PIOVARS
    202208;   Returns:
    203 ;       Nothing
    204 ;   Corrupts registers:
    205 ;       AX, BX, DX
     209;       ES:SI:  Normalized pointer
     210;       AH:     INT 13h Error Code (only when CF set)
     211;       CF:     Set of failed to normalize pointer (segment overflow)
     212;               Cleared if success
     213;   Corrupts registers:
     214;       AL, BX, DX
    206215;--------------------------------------------------------------------
    207216ALIGN JUMP_ALIGN
     
    209218    ; Store sizes and Data Port
    210219    mov     [bp+PIOVARS.bSectorsLeft], ah
     220%ifdef USE_AT
     221    xchg    dx, ax
     222%endif
    211223    mov     ax, [di+DPT.wBasePort]
    212224    mov     [bp+PIOVARS.wDataPort], ax
     
    280292    ;------------------------------------
    281293%endif                  ; 26    29/26
     294    clc
    282295    ret
    283296%endif ; MODULE_8BIT_IDE_ADVANCED
     
    288301; IdeTransfer_NormalizePointerInESSI
    289302;   Parameters:
     303;       DH:     Number of sectors to transfer (when USE_AT defined)
    290304;       ES:SI:  Ptr to be normalized
    291305;   Returns:
    292306;       ES:SI:  Normalized pointer (SI = 0...15)
     307;       AH:     INT 13h Error Code (only when CF set)
     308;       CF:     Set of failed to normalize pointer (segment overflow)
     309;               Cleared if success
    293310;   Corrupts registers:
    294311;       AX, DX
    295312;--------------------------------------------------------------------
    296313IdeTransfer_NormalizePointerInESSI:
     314; Normalization can cause segment overflow if it is done when not needed
     315; (I don't know if any software calls with such seg:off address).
     316; This does not apply to XT systems since nothing will write to main BIOS ROM.
     317; On AT systems things are quite different, even in protected mode the address
     318; is passed in seg:offset form and HMA is accessible in real mode.
     319%ifdef USE_AT
     320    xor     dl, dl
     321    shl     dx, 1
     322    dec     dx      ; Prevents normalization when bytes + offset will be zero
     323    add     dx, si
     324    jc      SHORT .NormalizationRequired
     325    ret
     326.NormalizationRequired:
     327%endif ; USE_AT
     328
    297329    NORMALIZE_FAR_POINTER   es, si, ax, dx
    298     ret
     330%ifdef USE_AT       ; CF is always clear for XT builds
     331    mov     ah, 0   ; Clear AH and preserve CF
     332    rcl     ah, 1   ; RET_HD_INVALID
     333%endif
     334    ret
     335
    299336
    300337
  • trunk/XTIDE_Universal_BIOS/Src/Device/IDE/JrIdeTransfer.asm

    r536 r538  
    5353    xor     ax, ax
    5454    mov     [bp+MEMPIOVARS.bSectorsDone], al
    55     mov     al, [bp+IDEPACK.bSectorCount]
    56     mov     [bp+MEMPIOVARS.bSectorsLeft], al
     55    mov     dh, [bp+IDEPACK.bSectorCount]
     56    mov     [bp+MEMPIOVARS.bSectorsLeft], dh
    5757    mov     al, [di+DPT_ATA.bBlockSize]
    5858    mov     [bp+MEMPIOVARS.wSectorsInBlock], ax
     
    6262    ; Normalize pointer
    6363    call    IdeTransfer_NormalizePointerInESSI
     64%ifdef USE_AT
     65    jc      SHORT ReturnWithMemoryIOtransferErrorInAH
     66%endif
    6467
    6568    ; Get far pointer to Sector Access Window
  • trunk/XTIDE_Universal_BIOS/Src/Device/Serial/SerialCommand.asm

    r526 r538  
    6262.readOrWrite:
    6363        mov     [bp+IDEPACK.bFeatures],ah       ; store protocol command
     64%ifdef USE_AT
     65        mov     dh, [bp+IDEPACK.bSectorCount]
     66%endif
    6467        call    IdeTransfer_NormalizePointerInESSI
     68%ifdef USE_AT
     69        jnc     SHORT .PointerNormalizationWasSuccessfull
     70        xor     cx, cx          ; Nothing transferred
     71        jmp     SerialCommand_ReturnError
     72.PointerNormalizationWasSuccessfull:
     73%endif
    6574
    6675        mov     dx, [di+DPT_SERIAL.wSerialPortAndBaud]
Note: See TracChangeset for help on using the changeset viewer.