Ignore:
Timestamp:
Apr 8, 2017, 12:27:09 AM (8 years ago)
Author:
Ben Rietbroek
Message:

Updated debug hooks (debugging) [v1.1.1-testing]

CAUTION:
This is a testbuild !
AirBoot uses the BIOS to access disks and a small coding error can trash
partition tables or other vital disk structures. You are advised to make
backups of TRACK0 and EBRs before using this testbuild. More info at:
https://rousseaux.github.io/netlabs.air-boot/pdf/AirBoot-v1.1.0-manual.pdf

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bootcode/regular/driveio.asm

    r110 r111  
    5858;  Those are originally loaded on startup and will NOT get reloaded.
    5959DriveIO_LoadConfiguration   Proc Near   Uses ax bx cx dx es
     60
     61IFDEF   AUX_DEBUG
     62        IF 0
     63        pushf
     64        pusha
     65            push    si
     66            mov     si, offset $+5
     67            jmp     @F
     68            db      10,'DriveIO_LoadConfiguration:',10,0
     69            @@:
     70            call    AuxIO_Print
     71            pop     si
     72            ;~ call    DEBUG_DumpRegisters
     73            ;~ call    AuxIO_DumpParagraph
     74            ;~ call    AuxIO_TeletypeNL
     75        popa
     76        popf
     77        ENDIF
     78ENDIF
     79
    6080        mov     ax, cs
    6181        mov     es, ax
     
    7393
    7494DriveIO_SaveConfiguration   Proc Near   Uses ax bx cx dx ds es si
     95
     96IFDEF   AUX_DEBUG
     97        IF 0
     98        pushf
     99        pusha
     100            push    si
     101            mov     si, offset $+5
     102            jmp     @F
     103            db      10,'DriveIO_SaveConfiguration:',10,0
     104            @@:
     105            call    AuxIO_Print
     106            pop     si
     107            ;~ call    DEBUG_DumpRegisters
     108            ;~ call    AuxIO_DumpParagraph
     109            ;~ call    AuxIO_TeletypeNL
     110        popa
     111        popf
     112        ENDIF
     113ENDIF
     114
    75115        mov     ax, cs
    76116        mov     ds, ax
     
    238278;           Ugly, need to cleanup.
    239279DriveIO_LVMAdjustToInfoSector   Proc Near
     280
     281IFDEF   AUX_DEBUG
     282        IF 0
     283        pusha
     284            push    si
     285            mov     si, offset $+5
     286            jmp     @F
     287            db      10,'DriveIO_LVMAdjustToInfoSector:',10,0
     288            @@:
     289            call    AuxIO_Print
     290            pop     si
     291            call    DEBUG_DumpRegisters
     292            ;~ call    AuxIO_DumpParagraph
     293            ;~ call    AuxIO_TeletypeNL
     294        popa
     295        ENDIF
     296ENDIF
     297
    240298        push    cx                      ; Save Cyl/Sec part
    241299        xor     ch,ch                   ; Clear low Cyl part
     
    258316        or      cl,63                   ; Adjust CHS part   !FIX ME for > 63!   !! FIX HUGE DRIVE !!
    259317
     318IFDEF   AUX_DEBUG
     319        IF 0
     320        pusha
     321            push    si
     322            mov     si, offset $+5
     323            jmp     @F
     324            db      10,'adjusted',10,0
     325            @@:
     326            call    AuxIO_Print
     327            pop     si
     328            call    DEBUG_DumpRegisters
     329            ;~ call    AuxIO_DumpParagraph
     330            ;~ call    AuxIO_TeletypeNL
     331        popa
     332        ENDIF
     333ENDIF
    260334
    261335        ret
     
    326400; #########################################################################
    327401DriveIO_SavePartition   Proc Near  Uses ax bx cx dx si
     402
     403IFDEF   AUX_DEBUG
     404        IF 0
     405        pushf
     406        pusha
     407            push    si
     408            mov     si, offset $+5
     409            jmp     @F
     410            db      10,'DriveIO_SavePartition:',10,0
     411            @@:
     412            call    AuxIO_Print
     413            pop     si
     414            ;~ call    DEBUG_DumpRegisters
     415            ;~ call    AuxIO_DumpParagraph
     416            ;~ call    AuxIO_TeletypeNL
     417        popa
     418        popf
     419        ENDIF
     420ENDIF
     421
    328422        mov     ax, wptr cs:[CurPartition_Location+0]
    329423        mov     bx, wptr cs:[CurPartition_Location+2]
     
    356450; Keeps DS:SI for caller, sets carry if valid LVM sector encountered
    357451DriveIO_LoadLVMSector   Proc Near  Uses ax bx cx dx
     452
     453IFDEF   AUX_DEBUG
     454        IF 0
     455        pushf
     456        pusha
     457            push    si
     458            mov     si, offset $+5
     459            jmp     @F
     460            db      10,'DriveIO_LoadLVMSector:',10,0
     461            @@:
     462            call    AuxIO_Print
     463            pop     si
     464            ;~ call    DEBUG_DumpRegisters
     465            ;~ call    AuxIO_DumpParagraph
     466            ;~ call    AuxIO_TeletypeNL
     467        popa
     468        popf
     469        ENDIF
     470ENDIF
     471
    358472        test    byte ptr [CFG_IgnoreLVM], 1            ; We are supposed to ignore LVM, so
    359473        jnz     DIOLLVMS_NoLVMSector          ;  don't load but declare as bad!
     
    402516; Keeps DS:SI for caller, saves at anytime w/o checks (!)
    403517DriveIO_SaveLVMSector   Proc Near  Uses ax bx cx dx
     518
     519IFDEF   AUX_DEBUG
     520        IF 0
     521        pushf
     522        pusha
     523            push    si
     524            mov     si, offset $+5
     525            jmp     @F
     526            db      10,'DriveIO_SaveLVMSector:',10,0
     527            @@:
     528            call    AuxIO_Print
     529            pop     si
     530            ;~ call    DEBUG_DumpRegisters
     531            ;~ call    AuxIO_DumpParagraph
     532            ;~ call    AuxIO_TeletypeNL
     533        popa
     534        popf
     535        ENDIF
     536ENDIF
     537
    404538        test    byte ptr [CFG_IgnoreLVM], 1            ; We are supposed to ignore LVM, so
    405539        jnz     DIOSLVMS_SevereError          ;  don't save at anytime (security!)
     
    476610DriveIO_LoadSector      Proc Near  Uses ax bx cx dx ds si es di
    477611
     612IFDEF   AUX_DEBUG
     613        IF 0
     614        pushf
     615        pusha
     616            push    si
     617            mov     si, offset $+5
     618            jmp     @F
     619            db      10,'DriveIO_LoadSector:',10,0
     620            @@:
     621            call    AuxIO_Print
     622            pop     si
     623            ;~ call    DEBUG_DumpRegisters
     624            ;~ call    AuxIO_DumpParagraph
     625            ;~ call    AuxIO_TeletypeNL
     626        popa
     627        popf
     628        ENDIF
     629ENDIF
     630
    478631        ; Is the drive not a harddrive?
    479632        cmp     dl, 80h
     
    494647        cmp     bptr cs:[LBASwitchTable+di], bl
    495648        jbe     DIOLS_UseExtension
     649
    496650    DIOLS_UseNormal:
    497         mov     di, 3
     651
     652IFDEF   AUX_DEBUG
     653        IF 0
     654        pusha
     655            push    si
     656            mov     si, offset $+5
     657            jmp     @F
     658            db      10,'DriveIO_ReadSectorCHS:',10,0
     659            @@:
     660            call    AuxIO_Print
     661            pop     si
     662            call    DEBUG_DumpRegisters
     663            call    AuxIO_DumpParagraph
     664            call    AuxIO_TeletypeNL
     665        popa
     666        ENDIF
     667ENDIF
     668
     669        mov     di, 3                      ; retry count
    498670    DIOLS_ErrorLoop:
    499671        push    ds
     
    503675        int     13h
    504676        jnc     DIOLS_Success
    505         dec     di
     677        dec     di                         ; decrement retry count
    506678        jnz     DIOLS_ErrorLoop
    507679
     
    552724DriveIO_ReadSectorLBA       Proc Near  Uses bx cx dx si di ds es
    553725
     726IFDEF   AUX_DEBUG
     727        IF 0
     728        pushf
     729        pusha
     730            push    si
     731            mov     si, offset $+5
     732            jmp     @F
     733            db      10,'DriveIO_ReadSectorLBA:',10,0
     734            @@:
     735            call    AuxIO_Print
     736            pop     si
     737            call    DEBUG_DumpRegisters
     738            call    AuxIO_DumpParagraph
     739            call    AuxIO_TeletypeNL
     740        popa
     741        popf
     742        ENDIF
     743ENDIF
     744
    554745        ; One sector to read
    555746        mov     cs:[INT13X_DAP_NumBlocks], 1
     
    602793;##############################################################################
    603794DriveIO_WriteSectorLBA      Proc Near  Uses bx cx dx si di ds es
     795
     796IFDEF   AUX_DEBUG
     797        IF 0
     798        pusha
     799            push    si
     800            mov     si, offset $+5
     801            jmp     @F
     802            db      10,'DriveIO_WriteSectorLBA:',10,0
     803            @@:
     804            call    AuxIO_Print
     805            pop     si
     806            call    DEBUG_DumpRegisters
     807            call    AuxIO_DumpParagraph
     808            call    AuxIO_TeletypeNL
     809        popa
     810        ENDIF
     811ENDIF
    604812
    605813        ; Mask reserved bits for wrte flags -- should check version here
     
    7941002DriveIO_SaveSector              Proc Near  Uses ax bx cx dx ds si es di
    7951003
     1004IFDEF   AUX_DEBUG
     1005        IF 0
     1006        pushf
     1007        pusha
     1008            push    si
     1009            mov     si, offset $+5
     1010            jmp     @F
     1011            db      10,'DriveIO_SaveSector:',10,0
     1012            @@:
     1013            call    AuxIO_Print
     1014            pop     si
     1015            ;~ call    DEBUG_DumpRegisters
     1016            ;~ call    AuxIO_DumpParagraph
     1017            ;~ call    AuxIO_TeletypeNL
     1018        popa
     1019        popf
     1020        ENDIF
     1021ENDIF
    7961022
    7971023    ;!
     
    8081034        inc cx
    8091035        xor dh,dh
    810         ENDIF
    811     ENDIF
    812 
    813 
    814     ;!
    815     ;! DEBUG_BLOCK
    816     ;! Check what is being written to disk.
    817     ;! Uncomment below to activate.
    818     ;!
    819     __DIO_SS_DMP__  EQU
    820     IFDEF   AUX_DEBUG
    821         IFDEF   __DIO_SS_DMP__
    822         pusha
    823         push    si
    824         mov     si,offset [dioss]
    825         call    AuxIO_Print
    826         pop     si
    827         call    DEBUG_DumpRegisters
    828         call    AuxIO_DumpSector
    829         call    AuxIO_TeletypeNL
    830         popa
    8311036        ENDIF
    8321037    ENDIF
     
    9041109
    9051110    DIOSS_UseNormal:
    906         mov     di, 3
     1111
     1112IFDEF   AUX_DEBUG
     1113        IF 0
     1114        pusha
     1115            push    si
     1116            mov     si, offset $+5
     1117            jmp     @F
     1118            db      10,'DriveIO_WriteSectorCHS:',10,0
     1119            @@:
     1120            call    AuxIO_Print
     1121            pop     si
     1122            call    DEBUG_DumpRegisters
     1123            call    AuxIO_DumpParagraph
     1124            call    AuxIO_TeletypeNL
     1125        popa
     1126        ENDIF
     1127ENDIF
     1128
     1129        mov     di, 3                      ; retry count
    9071130    DIOSS_ErrorLoop:
    9081131        push    ds
     
    9121135        int     13h
    9131136        jnc     DIOSS_Success
    914         dec     di
     1137        dec     di                         ; decrement retry count
    9151138        jnz     DIOSS_ErrorLoop
    9161139        call    MBR_SaveError
     
    9671190; Loads sector at [LVMSector] !
    9681191DriveIO_LoadMasterLVMSector     Proc  Near
    969         pusha
    970 
    971         ;~ mov      si,offset db_lmlvm
    972         ;~ call     AuxIO_Print
    973 
    974         ;~ ; Physical disk
    975         ;~ mov     al,'<'
    976         ;~ call    VideoIO_PrintSingleChar
    977         ;~ mov     al,dl
    978         ;~ call    VideoIO_PrintHexByte
    979         ;~ mov     al,'>'
    980         ;~ call    VideoIO_PrintSingleChar
    981 ;~
    982         ;~ call    AuxIO_TeletypeHexByte
    983         ;~ call    AuxIO_TeletypeNL
    984 
     1192
     1193IFDEF   AUX_DEBUG
     1194        IF 0
     1195        pushf
     1196        pusha
     1197            push    si
     1198            mov     si, offset $+5
     1199            jmp     @F
     1200            db      10,'DriveIO_LoadMasterLVMSector:',10,0
     1201            @@:
     1202            call    AuxIO_Print
     1203            pop     si
     1204            ;~ call    DEBUG_DumpRegisters
     1205            ;~ call    AuxIO_DumpParagraph
     1206            ;~ call    AuxIO_TeletypeNL
     1207        popa
     1208        popf
     1209        ENDIF
     1210ENDIF
     1211
     1212        pusha
    9851213
    9861214        ; Loop over the sector-translation table,
     
    10001228        ; Get the sector-number of the next possible LVM sector (255,127,63)
    10011229        ; using the translation table and the counter as the index
    1002         mov     bx,offset secs_per_track_table
    1003         mov     ax,cx
    1004         dec     ax
    1005         xlatb
    1006         dec     al
     1230        mov     bx,offset [secs_per_track_table]
     1231        mov     ax,cx   ; 1-based index to sec_per_track_table
     1232        dec     ax      ; Adjust to 0-based
     1233        xlatb           ; Get the (well known) SPT
     1234        dec     al      ; Minus 1 for LVM-record
    10071235
    10081236        ;
     
    10121240        ;
    10131241
    1014         ;~ push    ax
    1015         ;~ push    ax
    1016         ;~ mov     al,'$'
    1017         ;~ call    VideoIO_PrintSingleChar
    1018         ;~ pop     ax
    1019         ;~ call    VideoIO_PrintHexByte
    1020         ;~ mov     al,'$'
    1021         ;~ call    VideoIO_PrintSingleChar
    1022         ;~ pop     ax
    1023 
    1024     IFDEF   AUX_DEBUG
    1025         ; Dump the value
    1026         ;~ call     AuxIO_TeletypeHexByte
    1027         ;~ call     AuxIO_TeletypeNL
    1028     ENDIF
     1242
     1243IFDEF   AUX_DEBUG
     1244        IF 0
     1245        pushf
     1246        pusha
     1247            push    si
     1248            mov     si, offset $+5
     1249            jmp     @F
     1250            db      10,'geo',10,0
     1251            @@:
     1252            call    AuxIO_Print
     1253            pop     si
     1254            call    DEBUG_DumpRegisters
     1255            call    AuxIO_DumpParagraph
     1256            call    AuxIO_TeletypeNL
     1257        popa
     1258        popf
     1259        ENDIF
     1260ENDIF
     1261
    10291262
    10301263        ; Setup the requested LBA sector number
     
    10361269
    10371270IFDEF   AUX_DEBUG
    1038                 pushf
    1039                 pusha
    1040                 pushf
    1041                 xor     ax, ax
    1042                 mov     al, dl
    1043                 call    AuxIO_TeletypeHexWord
    1044                 mov     al, '#'
    1045                 call    AuxIO_Teletype
    1046                 popf
    1047                 mov     ax,0000h
    1048                 rcl     al, 1
    1049                 call    AuxIO_TeletypeHexWord
    1050                 mov     al, '#'
    1051                 call    AuxIO_Teletype
    1052                 mov     ax,word ptr [INT13X_DAP_Absolute+0]
    1053                 call    AuxIO_TeletypeHexWord
    1054                 mov     al, '#'
    1055                 call    AuxIO_Teletype
    1056                 popa
    1057                 popf
     1271        IF 0
     1272        pushf
     1273        pusha
     1274            pushf
     1275            xor     ax, ax
     1276            mov     al, dl
     1277            call    AuxIO_TeletypeHexWord
     1278            mov     al, '#'
     1279            call    AuxIO_Teletype
     1280            popf
     1281            mov     ax,0000h
     1282            rcl     al, 1
     1283            call    AuxIO_TeletypeHexWord
     1284            mov     al, '#'
     1285            call    AuxIO_Teletype
     1286            mov     ax,word ptr [INT13X_DAP_Absolute+0]
     1287            call    AuxIO_TeletypeHexWord
     1288            mov     al, '#'
     1289            call    AuxIO_Teletype
     1290        popa
     1291        popf
     1292        ENDIF
    10581293ENDIF
    10591294
     
    10681303        call    LVM_ValidateSector
    10691304
    1070 ;        pushf
    1071 ;        mov     ah,0
    1072 ;        rcl     ah,1
    1073 ;        mov     al,'|'
    1074 ;        call    VideoIO_PrintSingleChar
    1075 ;        mov     al,ah
    1076 ;        call    VideoIO_PrintHexByte
    1077 ;        mov     al,'|'
    1078 ;        call    VideoIO_PrintSingleChar
    1079 ;        popf
     1305IFDEF   AUX_DEBUG
     1306        IF 0
     1307        pushf
     1308        pusha
     1309            push    si
     1310            mov     si, offset $+5
     1311            jmp     @F
     1312            db      10,'lvm record',10,0
     1313            @@:
     1314            call    AuxIO_Print
     1315            pop     si
     1316            call    DEBUG_DumpRegisters
     1317            call    AuxIO_DumpParagraph
     1318            call    AuxIO_TeletypeNL
     1319        popa
     1320        popf
     1321        ENDIF
     1322ENDIF
    10801323
    10811324
     
    11951438; DL contains BIOS disk-number; 80h for first, 81h for second, etc.
    11961439DriveIO_GatherDiskInfo  Proc Near
     1440
     1441IFDEF   AUX_DEBUG
     1442        IF 0
     1443        pushf
     1444        pusha
     1445            push    si
     1446            mov     si, offset $+5
     1447            jmp     @F
     1448            db      10,'DriveIO_GatherDiskInfo:',10,0
     1449            @@:
     1450            call    AuxIO_Print
     1451            pop     si
     1452            ;~ call    DEBUG_DumpRegisters
     1453            ;~ call    AuxIO_DumpParagraph
     1454            ;~ call    AuxIO_TeletypeNL
     1455        popa
     1456        popf
     1457        ENDIF
     1458ENDIF
     1459
    11971460        pushf
    11981461        push    bx
     
    13601623secs_per_track_table    db    63,127,255,255,255,255
    13611624
    1362 ;db_lmlvm:   db 'Load Master LVM -- disk: ',0
     1625db_lmlvm    db 'Load Master LVM -- disk: ',0
Note: See TracChangeset for help on using the changeset viewer.