VirtualBox

Ignore:
Timestamp:
Mar 15, 2024 12:07:48 PM (11 months ago)
Author:
vboxsync
Message:

ValidationKit/bootsectors: clean up bs3-bootsector a little, bugref:9898

  • fix non-display of error code
  • add code to dodge around 64kB DMA boundaries
  • remove never-working code to handle wrong fd geometry
  • simplify 'HLT_ON_FAILURE' ifdefs
  • squeeze out a few bytes
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-bootsector.asm

    r102270 r103866  
    5757;; Enables support for fake 63.5 MB floppies with 255 sectors, 2 heads and 255 tracks.
    5858%define BS3KIT_BOOTSECTOR_SUPPORT_63_5MB_FLOPPIES
     59;; Enables code to avoid trying to read across 64kB DMA boundaries.
     60%define BS3KIT_BOOTSECTOR_DODGE_BOUNDARIES
    5961
    6062;; Halts on failure location. For debugging.
     
    499501        mov     ax, si
    500502.do_read:
     503
     504 %ifdef BS3KIT_BOOTSECTOR_DODGE_BOUNDARIES
     505                                        ; Dodge around 64kB DMA boundaries
     506        push    di                      ; di is 'paragraph' address of buffer
     507        push    ax                      ; Example: di = 1f60h, al = 12h = 18-sector request;
     508        shr     di, 5                   ; 0fbh   addr = 1f600h (can fit 5x 200h below 128kB)
     509        and     di, 7fh                 ;  7bh
     510        add     di, ax                  ;  8dh
     511        sub     di, 80h                 ;  0dh
     512        pop     ax                      ;  12h
     513        js      .non_boundary
     514        sub     ax, di                  ;  05h
     515.non_boundary:
     516        pop     di
     517 %endif
     518
    501519 %if 0 ; DEBUG
    502520        push    ax
     
    511529        mov     es, di                  ; es:bx -> buffer
    512530        int     13h
     531 %ifdef BS3KIT_BOOTSECTOR_DODGE_BOUNDARIES
     532        jc      .failure
     533 %else
    513534        jnc     .advance_sector
    514535
    515536        cmp     ah, 9                   ; DMA 64KB crossing error
    516  %if 0 ; This hack doesn't work. If the FDC is in single sided mode we end up with a garbled image. Probably "missing" sides.
    517         je      .read_one
    518 
    519         cmp     ah, 20h                 ; Controller error, probably because we're reading side 1 on a single sided floppy
    520537        jne     .failure
    521         cmp     bMaxHead, 0
    522         je      .failure
    523         cmp     dh, 1
    524         jne     .failure
    525         xor     dh, dh
    526         mov     bMaxHead, dh
    527         inc     ch
    528         jmp     .the_load_loop
    529 .read_one:
    530  %elifdef HLT_ON_FAILURE
    531         je      .read_one_ok
    532         cli
    533         hlt
    534 .read_one_ok:
    535  %else
    536         jne     .failure
    537  %endif
    538538        mov     ax, 1                   ; Retry reading a single sector.
    539539        jmp     .read_again
     540 %endif ; !BS3KIT_BOOTSECTOR_DODGE_BOUNDARIES
    540541
    541542        ; advance to the next sector/head/cylinder and address.
     
    592593        ; Something went wrong, display a message.
    593594        ;
     595.str_sErrMsgBang:
     596        db ' rd err!'
     597
    594598.failure:
    595599 %if 1 ; Disable to save space for debugging.
    596   %if 1
    597         push    ax
    598   %endif
    599 
     600        mov     al, ah
     601        call    bs3PrintHexInAl
    600602        ; print message
    601         mov     si, .s_szErrMsg
     603        mov     si, .str_sErrMsgBang
    602604.failure_next_char:
    603605        lodsb
    604606        call    bs3PrintChrInAl
    605         cmp     si, .s_szErrMsgEnd
    606         jb      .failure_next_char
    607 
    608         ; panic
    609   %if 1
    610         pop     ax
    611         mov     al, ah
    612         push    bs3PrintHexInAl
    613   %endif
    614         call    Bs3Panic
    615 .s_szErrMsg:
    616         db 13, 10, 'rd err! '
    617  %else
    618         hlt
    619         jmp .failure
     607        cmp     byte [si], '!'          ; Don't trust that int 10h/0eh preserves al
     608        jne     .failure_next_char
    620609 %endif
    621610%else
    622611.failure:
    623         hlt
    624 %endif
    625 .s_szErrMsgEnd:
     612%endif
     613        jmp     Bs3Panic
    626614;ENDPROC bs3InitLoadImage - don't want the padding.
    627615
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette