Changeset 107


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

Optimized routine for dumping registers (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/debug.asm

    r94 r107  
    435435
    436436DEBUG_DumpRegisters     Proc
    437         pushf
    438         pusha
    439 
    440         ; Safe flags so they can be printed later
    441         pushf
    442 
    443         ; Save value in SI so it can be printed later
     437
     438        ; Save state of caller
     439        pushf
     440        pusha
     441
     442        ; Save flags so they can be printed later
     443        pushf
     444
     445        ; Push the registers to print on the stack (SP is bogus)
     446.386
     447        push    gs
     448        push    fs
     449.286
     450        push    bp
     451        push    sp
     452        push    ss
     453        push    es
     454        push    ds
     455        push    cs
     456        push    di
    444457        push    si
     458        push    dx
     459        push    cx
     460        push    bx
     461        push    ax
    445462
    446463        ; Base of registers string
    447464        mov     si, offset [regAX]
    448465
    449         ; AX
     466        ; Print AX BX CX DX SI DI
     467        mov     cx, 6
     468    @@:
     469        pop     ax
    450470        call    AuxIO_Print
    451471        call    AuxIO_TeletypeHexWord
    452 
    453         ; BX
    454         call    AuxIO_Print
    455         mov     ax,bx
     472        loop    @B
     473
     474        ; 1st row printed
     475        call    AuxIO_TeletypeNL
     476
     477        ; Print CS DS ES SS SP BP
     478        mov     cx, 6
     479    @@:
     480        pop     ax
     481        call    AuxIO_Print
    456482        call    AuxIO_TeletypeHexWord
    457 
    458         ; CX
    459         call    AuxIO_Print
    460         mov     ax,cx
     483        loop    @B
     484
     485        ; 2nd row printed
     486        call    AuxIO_TeletypeNL
     487
     488        ; Print FS GS
     489        mov     cx, 2
     490    @@:
     491        pop     ax
     492        call    AuxIO_Print
    461493        call    AuxIO_TeletypeHexWord
    462 
    463         ; DX
    464         call    AuxIO_Print
    465         mov     ax,dx
    466         call    AuxIO_TeletypeHexWord
    467 
    468         ; SI
    469         call    AuxIO_Print
    470         pop     ax
    471         call    AuxIO_TeletypeHexWord
    472 
    473         ; DI
    474         call    AuxIO_Print
    475         mov     ax,di
    476         call    AuxIO_TeletypeHexWord
    477 
    478         ; 1st row printed
    479         call    AuxIO_TeletypeNL
    480 
    481         ; CS
    482         call    AuxIO_Print
    483         mov     ax,cs
    484         call    AuxIO_TeletypeHexWord
    485 
    486         ; DS
    487         call    AuxIO_Print
    488         mov     ax,ds
    489         call    AuxIO_TeletypeHexWord
    490 
    491         ; ES
    492         call    AuxIO_Print
    493         mov     ax,es
    494         call    AuxIO_TeletypeHexWord
    495 
    496         ; SS
    497         call    AuxIO_Print
    498         mov     ax,ss
    499         call    AuxIO_TeletypeHexWord
    500 
    501         ; SP
    502         call    AuxIO_Print
    503         mov     ax,sp
    504         call    AuxIO_TeletypeHexWord
    505 
    506         ; BP
    507         call    AuxIO_Print
    508         mov     ax,bp
    509         call    AuxIO_TeletypeHexWord
    510 
    511         ; 2nd row printed
    512         call    AuxIO_TeletypeNL
    513 .386
    514         ; FS
    515         call    AuxIO_Print
    516         mov     ax,fs
    517         call    AuxIO_TeletypeHexWord
    518 
    519         ; GS
    520         call    AuxIO_Print
    521         mov     ax,gs
    522         call    AuxIO_TeletypeHexWord
    523         ;~ call    AuxIO_TeletypeNL
    524 .286
     494        loop    @B
     495
    525496        ; Restore the flags
    526497        popf
     
    532503        ;~ mov     si, offset [flagsSF]
    533504
    534         ; SF
     505        ; Print SF
    535506        call    AuxIO_Print
    536507        mov     al, ah
     
    540511        call    AuxIO_Teletype
    541512
    542         ; ZF
     513        ; Print ZF
    543514        call    AuxIO_Print
    544515        mov     al, ah
     
    548519        call    AuxIO_Teletype
    549520
    550         ; AF
     521        ; Print AF
    551522        call    AuxIO_Print
    552523        mov     al, ah
     
    556527        call    AuxIO_Teletype
    557528
    558         ; PF
     529        ; Print PF
    559530        call    AuxIO_Print
    560531        mov     al, ah
     
    564535        call    AuxIO_Teletype
    565536
    566         ; CF
     537        ; Print CF
    567538        call    AuxIO_Print
    568539        mov     al, ah
     
    574545        call    AuxIO_TeletypeNL
    575546
    576         popa
    577         popf
     547        ; Restore caller state
     548        popa
     549        popf
     550
    578551        ret
    579552DEBUG_DumpRegisters     EndP
Note: See TracChangeset for help on using the changeset viewer.