Changeset 100


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

Redone LVM sector validation [v1.1.1-testing]

AL.0 is 1 when a valid signature is found..
AH.0 is 1 when the CRC was OK.
ZF is 0 when LVM sector is valid.

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

Location:
trunk/bootcode
Files:
2 edited

Legend:

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

    r98 r100  
    11761176
    11771177        ; See if this is a valid LVM-sector
    1178         ; CY=1 if valid
    1179         call    DriveIO_LVMSectorValid
     1178        ; ZF=0 if valid
     1179        call    LVM_ValidateSector
    11801180
    11811181;        pushf
     
    11921192
    11931193        ; Yep, we found the master LVM-sector
    1194         jc      DriveIO_LoadMasterLVMSector_Found
     1194        jnz     DriveIO_LoadMasterLVMSector_Found
    11951195        ; Try next location
    11961196        loop    DriveIO_LoadMasterLVMSector_NextTry
  • trunk/bootcode/special/lvm.asm

    r99 r100  
    125125LVM_CheckSectorCRC              EndP
    126126
    127 ; See if a LVM-sector is valid.
    128 ; In  : si, pointer to sector
    129 ; Out : CY if valid LVM sector, NC if not
    130 DriveIO_LVMSectorValid           Proc  Near
    131         pusha
    132 
    133         call    LVM_CheckSectorSignature
    134         ; NC if no signature found
    135         jnc     DriveIO_LVMSectorValid_End
    136 
    137         call    LVM_CheckSectorCRC
    138         ; Force valid !!!
    139         ;~ stc
    140 
    141     DriveIO_LVMSectorValid_End:
    142         popa
    143         ret
    144 DriveIO_LVMSectorValid           EndP
     127; Checks if a sector is a valid LVM-sector
     128;  Sector is considered valid LVM-sector if both signature and CRC are correct.
     129;        In: DS:SI - Sector that needs to get checked...
     130;       Out: AL = 1 -> LVM Signature found
     131;            AH = 1 -> CRC OK
     132;            ZF = 0 -> Signature found and CRC OK, ZF = 1 -> Invalid LVM sector
     133;      Note: AL thus indicates a valid signature and AH a valid CRC
     134; Destroyed: None
     135LVM_ValidateSector              Proc Near
     136        xor     ax, ax                      ; Start with all zero bits
     137        call    LVM_CheckSectorSignature    ; CF=1 -> Signature OK
     138        rcl     al, 1                       ; Store CF in AL
     139        call    LVM_CheckSectorCRC          ; CF=1 -> Checksum OK
     140        rcl     ah, 1                       ; Store CF in AH
     141        test    al, ah                      ; ZF=0 if both AL and AH are 1
     142        ret
     143LVM_ValidateSector              EndP
    145144
    146145; Updates Sector with valid LVM CRC
Note: See TracChangeset for help on using the changeset viewer.