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

Added more debug hooks [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

    r116 r117  
    3535        mov     dl, [BIOS_BootDisk]     ; We check using the boot-disk
    3636        int     13h
     37
     38IFDEF   AUX_DEBUG
     39        IF 0
     40        pushf
     41        pusha
     42            push    si
     43            mov     si, offset $+5
     44            jmp     @F
     45            db      10,'DriveIO_CheckFor13extensions:',10,0
     46            @@:
     47            call    AuxIO_Print
     48            pop     si
     49            call    DEBUG_DumpRegisters
     50            ;~ call    AuxIO_DumpParagraph
     51            ;~ call    AuxIO_TeletypeNL
     52
     53            mov     si, offset [INT13X_DiskParams]
     54            mov     word ptr [si], 50h
     55            mov     ah, 48h
     56            int     13h
     57            call    DEBUG_DumpRegisters
     58            ;~ call    AuxIO_DumpSector
     59
     60
     61        popa
     62        popf
     63        ENDIF
     64ENDIF
     65
    3766        jc      PCCF13E_NotFound        ; Error occured
    3867        cmp     bx, 0AA55h
     
    351380; #########################################################################
    352381DriveIO_LoadPartition   Proc Near  Uses si
     382
     383IFDEF   AUX_DEBUG
     384        IF 0
     385        pushf
     386        pusha
     387            push    si
     388            mov     si, offset $+5
     389            jmp     @F
     390            db      10,'DriveIO_LoadPartition:',10,0
     391            @@:
     392            call    AuxIO_Print
     393            pop     si
     394            call    DEBUG_DumpRegisters
     395            ;~ call    AuxIO_DumpParagraph
     396            ;~ call    AuxIO_TeletypeNL
     397        popa
     398        popf
     399        ENDIF
     400ENDIF
     401
    353402        mov     wptr cs:[CurPartition_Location+0], ax
    354403        mov     wptr cs:[CurPartition_Location+2], bx
     
    369418    DIOLP_Success:
    370419
    371     IFDEF   AUX_DEBUG
    372         ; show current partition location
    373         ;~ pushf
    374         ;~ pusha
    375         ;~ call     AuxIO_TeletypeNL
    376         ;~ mov      si,offset db_curpartloc
    377         ;~ call     AuxIO_Print
    378         ;~ mov      dx,word ptr [CurPartition_Location+02]
    379         ;~ mov      ax,word ptr [CurPartition_Location+00]
    380         ;~ call     AuxIO_TeletypeHexDWord
    381         ;~ call     AuxIO_TeletypeNL
    382         ;~ mov      si,offset PartitionSector
    383         ;~ call     AuxIO_DumpSector
    384         ;~ call     AuxIO_TeletypeNL
    385         ;~ popa
    386         ;~ popf
    387     ENDIF
     420
    388421
    389422        ret
     
    462495            call    AuxIO_Print
    463496            pop     si
    464             ;~ call    DEBUG_DumpRegisters
     497            call    DEBUG_DumpRegisters
     498            call    AuxIO_DumpSector
    465499            ;~ call    AuxIO_DumpParagraph
    466500            ;~ call    AuxIO_TeletypeNL
     
    479513        call    DriveIO_LVMAdjustToInfoSector
    480514
    481         mov     si, offset LVMSector
     515        mov     si, offset [LVMSector]
    482516        call    DriveIO_LoadSector
    483517
    484     IFDEF   AUX_DEBUG
    485         ; show current partition location
    486         ;~ pushf
    487         ;~ pusha
    488         ;~ call    AuxIO_TeletypeNL
    489         ;~ mov     si,offset db_curlvmsec
    490         ;~ call    AuxIO_Print
    491         ;~ mov     dx,bx
    492         ;~ call    AuxIO_TeletypeHexDWord
    493         ;~ call    AuxIO_TeletypeNL
    494         ;~ mov     si,offset LVMSector
    495         ;~ call    AuxIO_DumpSector
    496         ;~ call    AuxIO_TeletypeNL
    497         ;~ popa
    498         ;~ popf
    499     ENDIF
     518IFDEF   AUX_DEBUG
     519        IF 0
     520        pushf
     521        pusha
     522            push    si
     523            mov     si, offset $+5
     524            jmp     @F
     525            db      10,'lvm record ex',10,0
     526            @@:
     527            call    AuxIO_Print
     528            pop     si
     529            ;~ call    AuxIO_TeletypeHexWord
     530            ;~ call    AuxIO_TeletypeNL
     531            call    DEBUG_DumpRegisters
     532            ;~ call    AuxIO_DumpSector
     533            ;~ mov     cx, 7
     534            mov     cx, 32
     535        @@:
     536            call    AuxIO_DumpParagraph
     537            call    AuxIO_TeletypeNL
     538            add     si, 16
     539            loop @B
     540        popa
     541        popf
     542        ENDIF
     543ENDIF
     544
    500545
    501546        call    LVM_CheckSectorSignature
     
    545590        jnc     DIOSLVMS_SevereError                  ; LVM Signature must be there
    546591
    547     IFDEF   AUX_DEBUG
    548 ;~ dioatlvm    db 'DriveIO_LVMAdjustToInfoSector',10,0
    549         ;~ pushf
    550         ;~ pusha
    551         ;~ mov     si,offset dioatlvm
    552         ;~ call    AuxIO_Print
    553         ;~ popa
    554         ;~ popf
    555         call    DEBUG_DumpRegisters
    556         call    DEBUG_DumpCHS
    557     ENDIF
     592IFDEF   AUX_DEBUG
     593        IF 0
     594        pushf
     595        pusha
     596            ;~ dioatlvm    db 'DriveIO_LVMAdjustToInfoSector',10,0
     597            ;~ pushf
     598            ;~ pusha
     599            ;~ mov     si,offset dioatlvm
     600            ;~ call    AuxIO_Print
     601            ;~ popa
     602            ;~ popf
     603            call    DEBUG_DumpRegisters
     604            call    DEBUG_DumpCHS
     605        popa
     606        popf
     607        ENDIF
     608ENDIF
    558609
    559610        call    DriveIO_LVMAdjustToInfoSector
    560611
    561     IFDEF   AUX_DEBUG
    562         call    DEBUG_DumpRegisters
    563         call    DEBUG_DumpCHS
    564     ENDIF
     612IFDEF   AUX_DEBUG
     613        IF 0
     614        pushf
     615        pusha
     616            call    DEBUG_DumpRegisters
     617            call    DEBUG_DumpCHS
     618        popa
     619        popf
     620        ENDIF
     621ENDIF
    565622
    566623        mov     si, offset LVMSector
     
    621678            call    AuxIO_Print
    622679            pop     si
    623             ;~ call    DEBUG_DumpRegisters
     680            call    DEBUG_DumpRegisters
    624681            ;~ call    AuxIO_DumpParagraph
    625682            ;~ call    AuxIO_TeletypeNL
     
    707764
    708765    DIOLS_Success:
     766
     767IFDEF   AUX_DEBUG
     768        IF 0
     769        pusha
     770            push    si
     771            mov     si, offset $+5
     772            jmp     @F
     773            db      10,'sector loaded',10,0
     774            @@:
     775            call    AuxIO_Print
     776            pop     si
     777            ;~ call    DEBUG_DumpRegisters
     778            call    AuxIO_DumpSector
     779            ;~ call    AuxIO_DumpParagraph
     780            ;~ call    AuxIO_TeletypeNL
     781        popa
     782        ENDIF
     783ENDIF
    709784        ret
    710785DriveIO_LoadSector      EndP
     
    714789;##############################################################################
    715790;# ACTION   : Reads a sector from disk using INT13 extensions
     791;# ----------------------------------------------------------------------------
     792;# EFFECTS  : Modifies DAP structure and fills transfer buffer
    716793;# ----------------------------------------------------------------------------
    717794;# IN       : BX:CX - LBA address of sector
     
    719796;# ----------------------------------------------------------------------------
    720797;# OUT      : CF=1  - failure, AH failure code
    721 ;# ----------------------------------------------------------------------------
    722 ;# EFFECTS  : Modifies DAP structure and fills transfer buffer
    723798;##############################################################################
    724799DriveIO_ReadSectorLBA       Proc Near  Uses bx cx dx si di ds es
     
    783858;##############################################################################
    784859;# ACTION   : Writes a sector to disk using INT13 extensions
     860;# ----------------------------------------------------------------------------
     861;# EFFECTS  : Modifies DAP structure and mofifies the disk
    785862;# ----------------------------------------------------------------------------
    786863;# IN       : AL    - write flags, AL.0 verify (1.0,2.0), AL.1 verify (2.1+)
     
    789866;# ----------------------------------------------------------------------------
    790867;# OUT      : CF=1  - failure, AH failure code
    791 ;# ----------------------------------------------------------------------------
    792 ;# EFFECTS  : Modifies DAP structure and mofifies the disk
    793868;##############################################################################
    794869DriveIO_WriteSectorLBA      Proc Near  Uses bx cx dx si di ds es
     
    11601235ENDIF
    11611236
    1162     ;!
    1163     ;! DEBUG_BLOCK
    1164     ;! Force write to LBA0 to test interception routine.
    1165     ;! Do *NOT* enable unless you are debugging, will overwrite MBR !
    1166     ;!
    1167     ;~ __DIO_FORCE_LBA0_WRITE__    EQU
    1168     IFDEF   AUX_DEBUG
    1169         IFDEF   __DIO_FORCE_LBA0_WRITE__
     1237
     1238;!
     1239;! DEBUG_BLOCK
     1240;! Force write to LBA0 to test interception routine.
     1241;! Do *NOT* enable unless you are debugging, will overwrite MBR !
     1242;!
     1243IFDEF   AUX_DEBUG
     1244    IF 0
     1245    pushf
     1246    pusha
    11701247        xor ax,ax
    11711248        xor bx,bx
     
    11731250        inc cx
    11741251        xor dh,dh
    1175         ENDIF
     1252    popa
     1253    popf
    11761254    ENDIF
     1255ENDIF
    11771256
    11781257        ;
     
    12101289
    12111290
    1212     IFDEF   AUX_DEBUG
    1213         pusha
    1214         mov     si, offset NonMBRwrite
     1291IFDEF   AUX_DEBUG
     1292    IF 0
     1293    pushf
     1294    pusha
     1295        mov     si, offset [NonMBRwrite]
    12151296        call    AuxIO_TeletypeNL
    12161297        call    AuxIO_Print
    12171298        call    AuxIO_TeletypeNL
    1218         popa
     1299    popa
     1300    popf
    12191301    ENDIF
     1302ENDIF
    12201303
    12211304        ; Show popup and halt the system.
     
    14421525        call    LVM_ValidateSector
    14431526
     1527
     1528
    14441529IFDEF   AUX_DEBUG
    14451530        IF 0
     
    14541539            pop     si
    14551540            call    DEBUG_DumpRegisters
     1541            ;~ call    AuxIO_DumpSector
     1542            mov     cx, 7
     1543        @@:
    14561544            call    AuxIO_DumpParagraph
    14571545            call    AuxIO_TeletypeNL
     1546            add     si, 16
     1547            loop @B
    14581548        popa
    14591549        popf
     
    15901680            call    AuxIO_Print
    15911681            pop     si
    1592             ;~ call    DEBUG_DumpRegisters
     1682            call    DEBUG_DumpRegisters
    15931683            ;~ call    AuxIO_DumpParagraph
    15941684            ;~ call    AuxIO_TeletypeNL
     
    16151705        ; so we clear the whole buffer to be sure.
    16161706        mov     cx, i13xbuf_size        ; Dynamically calculated by assembler.
    1617         mov     di, offset i13xbuf      ; Points to size field.
     1707        mov     di, offset [i13xbuf]    ; Points to size field.
    16181708        mov     [di],cx                 ; Setup buffer-size.
    16191709        inc     di
     
    16261716        mov     ah, 48h                 ; Get Drive Parameters (extended version)
    16271717        ;mov     dl, 80h                ; Drive number
    1628         mov     si, offset i13xbuf      ; Buffer for result-info
     1718        mov     si, offset [i13xbuf]    ; Buffer for result-info
    16291719        push    dx
    16301720        int     13h                     ; Call the BIOS-function
     
    16891779
    16901780        ; Store total secs
    1691         mov      bx, offset BIOS_TotalSecs
     1781        mov      bx, offset [BIOS_TotalSecs]
    16921782        add      bx,dx
    16931783        add      bx,dx
     
    17031793
    17041794        ; Store number of bytes per sector
    1705         mov      bx, offset BIOS_Bytes
     1795        mov      bx, offset [BIOS_Bytes]
    17061796        add      bx,dx
    17071797        mov      ax,[si+18h]
Note: See TracChangeset for help on using the changeset viewer.