Changeset 114


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

Make checking for valid LVM-sector use CF instead of ZF [v1.1.1-testing]

Both the checks for LVM Signature and CRC already use CF on return.
Doing the same for complete LVM-sector validation is more consistent.

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

    r113 r114  
    13031303
    13041304        ; See if this is a valid LVM-sector
    1305         ; ZF=0 if valid
     1305        ; CY if valid
    13061306        call    LVM_ValidateSector
    13071307
     
    13271327
    13281328        ; Yep, we found the master LVM-sector
    1329         jnz     DriveIO_LoadMasterLVMSector_Found
     1329        jc      DriveIO_LoadMasterLVMSector_Found
     1330
    13301331        ; Try next location
    13311332        loop    DriveIO_LoadMasterLVMSector_NextTry
  • trunk/bootcode/special/lvm.asm

    r111 r114  
    149149
    150150; Checks if a sector is a valid LVM-sector
    151 ;  Sector is considered valid LVM-sector if both signature and CRC are correct.
    152 ;        In: DS:SI - Sector that needs to get checked...
    153 ;       Out: AL = 1 -> LVM Signature found
    154 ;            AH = 1 -> CRC OK
    155 ;            ZF = 0 -> Signature found and CRC OK, ZF = 1 -> Invalid LVM sector
    156 ;      Note: AL thus indicates a valid signature and AH a valid CRC
     151; Sector is considered valid LVM-sector if both signature and CRC are correct.
     152; IN  : DS:SI - Buffer with LVM-sector that needs to be checked...
     153; OUT : AL.0  - 1 -> LVM Signature found
     154;       AL.1  - 1 -> CRC OK
     155;       CY    - Signature and CRC OK, otherwise none or invalid LVM sector
    157156; Destroyed: None
    158157LVM_ValidateSector              Proc Near
    159         xor     ax, ax                      ; Start with all zero bits
     158        xor     ax, ax                      ; Assume no Signature or valid CRC
    160159        call    LVM_CheckSectorSignature    ; CF=1 -> Signature OK
    161         rcl     al, 1                       ; Store CF in AL
    162         call    LVM_CheckSectorCRC          ; CF=1 -> Checksum OK
    163         rcl     ah, 1                       ; Store CF in AH
    164         test    al, ah                      ; ZF=0 if both AL and AH are 1
     160        rcl     al, 1                       ; Store CF in AL.0
     161        call    LVM_CheckSectorCRC          ; CF=1 -> CRC OK
     162        rcl     ah, 1                       ; Store CF in AH.0
     163        shl     ah, 1                       ; Move it to AH.1
     164        or      al, ah                      ; Merge CY results to AL
     165        cmp     al, 3                       ; AH=3 -> Signature and CRC OK
     166        clc                                 ; Assume invalid LVM-sector
     167        jne     @F
     168        stc                                 ; AH=3 -> Indicate valid LVM-sector
     169    @@:
     170        mov     ah, 0                       ; Don't leave garbage in AH
    165171        ret
    166172LVM_ValidateSector              EndP
Note: See TracChangeset for help on using the changeset viewer.