Changeset 154


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

Reimplemented 'LVM_GetDriveLetter' [v1.1.1-testing]

The new method uses SI which points to the IPT entry for the partition.
The IPT entry contains all info needed to load the corresponding LVM
sector. This does away with distinguishing between primary and logical
partitions and also removes ugly and possibly faulty LBA adjustments.

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/special/lvm.asm

    r153 r154  
    220220
    221221
    222 
    223 LVM_GetDriveLetter      Proc Near   Uses bx cx dx si di ds es
    224         xor     al, al
     222;------------------------------------------------------------------------------
     223; Get the LVM drive-letter for a partition (if available)
     224;------------------------------------------------------------------------------
     225; IN    : SI    - Pointer to IPT entry for partition
     226; OUT   : AL    - LVM drive-letter
     227;       : SI    - Pointer to LVM entry in loaded LVM record
     228;       : CF=1  - No valid LVM sector found, AL not valid
     229; NOTE  : Besides the drive-letter, AL can be 0 (LVM hidden) or '*' (LVM auto)
     230;------------------------------------------------------------------------------
     231LVM_GetDriveLetter      Proc Near   Uses bx cx dx di
     232
     233IFDEF   AUX_DEBUG
     234        IF 0
     235        DBG_TEXT_OUT_AUX    'LVM_GetDriveLetter:'
     236        PUSHRF
     237            call    DEBUG_DumpRegisters
     238            ;~ call    AuxIO_DumpParagraph
     239            ;~ call    AuxIO_TeletypeNL
     240        POPRF
     241        ENDIF
     242ENDIF
     243
     244        ; Save IPT pointer
     245        mov     di, si
     246
     247        ; Get the LBA addresses of the MBR or EBR from the IPT entry
     248        mov     dl, [si+LocIPT_Drive]                   ; BIOS disk number
     249        mov     ax, [si+LocIPT_AbsolutePartTable+00h]   ; LBA lo MBR/EBR
     250        mov     bx, [si+LocIPT_AbsolutePartTable+02h]   ; LBA hi MBR/EBR
     251
     252        ; Try to load the corresponding LVM sector
     253        mov     si, offset [LVMSector]                  ; Pointer to buffer
     254        call    DriveIO_LoadLVMSectorXBR                ; Try to load LVM sector
     255        jc      LVM_GetDriveLetter_no_lvm               ; No success
     256
     257        ; Recall IPT pointer
     258        mov     si, di
     259
     260        ; Locate the LVM entry for the partition
     261        mov     ax, [si+LocIPT_AbsoluteBegin+00h]       ; LBA lo of partition
     262        mov     dx, [si+LocIPT_AbsoluteBegin+02h]       ; LBA hi of partition
     263        mov     si, offset [LVMSector]                  ; Loaded LVM sector
     264        call    LVM_SearchForPartition                  ; Locate entry
     265        jnc     LVM_GetDriveLetter_no_lvm               ; Entry not found
     266
     267        ; Get the LVM drive-letter
     268        mov     al, [si+LocLVM_VolumeLetter]            ; Can be 0,'*',letter
     269
     270        ; We're done, indicate success and return
    225271        clc
     272        jmp     LVM_GetDriveLetter_done
     273
     274    LVM_GetDriveLetter_no_lvm:
     275        ; Indicate no LVM drive-letter found
     276        xor     ax, ax
     277        mov     si, ax
     278        stc
     279
     280    LVM_GetDriveLetter_done:
     281
     282IFDEF   AUX_DEBUG
     283        IF 0
     284        DBG_TEXT_OUT_AUX    'lgdl_lvmsec'
     285        PUSHRF
     286            call    DEBUG_DumpRegisters
     287            mov     si, offset [LVMSector]
     288            call    AuxIO_DumpSector
     289            ;~ call    AuxIO_DumpParagraph
     290            ;~ call    AuxIO_TeletypeNL
     291        POPRF
     292        ENDIF
     293ENDIF
     294
    226295        ret
    227296LVM_GetDriveLetter      EndP
Note: See TracChangeset for help on using the changeset viewer.