Changeset 33


Ignore:
Timestamp:
Jan 13, 2013, 8:58:15 AM (13 years ago)
Author:
Ben Rietbroek
Message:

Fixed Partition <-> LVM-info correlation [2011-11-20]

Fixes

o Start of partition now used to find LVM drive-letter for PRI part

Previously, the index of a primary partition in the partition-table
was used to find it's corresponding LVM-record. However, this does
not work when partition-pointers are cross-linked, i.e. a pointer
with a lower index pointing to a partition located above the one(s)
of subsequent pointers. The start of the partition is now used to
identify the corresponding LVM-info.

Note

This commit and all following commits upto and including the RC3
commit [2012-09-09] are delayed commits from a local repository.
Also, the RC (Release Candidate) naming of the corresponding commits
is a bit misleading. One would label a revision with RC when near to
a final release. Since many things have changed between RC1,RC2 & RC3,
these RC's should be interpreted as mile-stones.

WARNING!!

All commits upto and including the commit of [2012-05-13] contain
a severe bug!! Building from these sources and then disabling
the 'force LBA' feature while also using the drive-letter feature or
editing the label can destroy the MBR on all attached disks!!
DO NOT DISABLE 'FORCE LBA USAGE' WHEN BUILT FROM THE ABOVE COMMITS!!

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/BOOTCODE/REGULAR/PARTMAIN.ASM

    r32 r33  
    13481348        mov     dh,al       ; Save PRI or LOG
    13491349
    1350         ; Save for later use
     1350        ; Save PRI/LOG indicator for later use
    13511351        push    dx
    13521352
     
    13751375        pop     si
    13761376
    1377         ; Point BX to LVM 1st drive-letter
    1378         mov     bx,offset [LVMSector]
    1379         add     bx,LocLVM_VolumeLetter2
    1380 
    13811377
    13821378        ; Restore PRI/LOG partition indicator and index
     
    13951391        popa
    13961392
    1397         ; Calculate index for driveletter of PRI partition
    1398         mov     ax,03ch     ; Length of LVM record ?
    1399         mul     dl          ; Multiply by index
    1400         add     bx,ax       ; Point to LVM-driveletter
    1401 
    14021393
    14031394    is_not_pri:
    14041395
    1405         ;
    1406         ; At this point BX points to the drive-letter related to the
     1396
     1397        ;
     1398        ; At this stage the LVM-info sector has been loaded at [LVMSector].
     1399        ; From here we look for an LVM entry for the partition.
     1400        ; If one is found, based on it's LBA-start, it's driveletter is used
     1401        ; in case byte 25h is zero.
     1402        ;
     1403
     1404
     1405        ; Search for the partition in the LVM info.
     1406        ; If found, CY is set and SI points to LVM entry.
     1407        push    si
     1408        mov     dl,bptr [si+LocIPT_Drive]
     1409        mov     ax,[si+LocIPT_AbsoluteBegin+00h]
     1410        mov     dx,[si+LocIPT_AbsoluteBegin+02h]
     1411        mov     si,offset [LVMSector]
     1412        call    LVM_SearchForPartition
     1413        mov     bx,si   ; BX now points to LVM entry
     1414        mov     dx,0    ; Setup null driveletter
     1415        pop     si
     1416
     1417        ; Oops, no valid LVM record was used so we have a null driveletter.
     1418        jnc     null_lvm_dl
     1419
     1420        ;
     1421        ; At this point BX points to the LVM-entry related to the
    14071422        ; partition, whether it was a logical or a primary one.
    1408         ; We convert it ('C'=80h etc) and put it in DH for later use.
    1409         mov     dh,[bx]
     1423        ; We get the drive-letter and convert it ('C'=80h etc)
     1424        ; and put it in DH for later use.
     1425        ;
     1426        mov     dh,[bx+LocLVM_VolumeLetter]
    14101427        ; Don't convert if zero
    14111428        test    dh,dh
Note: See TracChangeset for help on using the changeset viewer.