Changeset 49 for trunk/BOOTCODE/REGULAR


Ignore:
Timestamp:
Apr 12, 2014, 12:13:57 PM (12 years ago)
Author:
Ben Rietbroek
Message:

Fixed a nasty bug when eCS phase1 is active [2012-05-13]

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 THESE COMMITS!!

Fixes

o Bug Description

When creating a partition in a free space between partitions for
eCS installation, the phase1 boot-through code would calculate the
wrong index for the new partition. As a result the next partition
would be auto-booted instead of the newly installed system.
This bug is also present in v1.07.

o Quick Fix

Run PARTSCAN_ScanForPartitions for a second time when eCS phase1
is active. This resyncs the PartitionXref table.

Location:
trunk/BOOTCODE/REGULAR
Files:
5 edited

Legend:

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

    r47 r49  
    164164DEBUG_DumpGeo   Endp
    165165
     166
     167
     168DEBUG_DumpIPT   Proc
     169        pushf
     170        pusha
     171
     172        call    AuxIO_TeletypeNL
     173
     174        mov     si,offset [PartitionTable]
     175        call    AuxIO_DumpSector
     176
     177        popa
     178        popf
     179        ret
     180DEBUG_DumpIPT   EndP
     181
     182DEBUG_DumpNewPartTable  Proc
     183        pushf
     184        pusha
     185
     186        call    AuxIO_TeletypeNL
     187
     188        mov     si,offset [NewPartTable]
     189        call    AuxIO_DumpSector
     190
     191        popa
     192        popf
     193        ret
     194DEBUG_DumpNewPartTable  EndP
     195
     196DEBUG_DumpPartitionPointers     Proc
     197        pushf
     198        pusha
     199
     200        call    AuxIO_TeletypeNL
     201
     202        mov     si,offset [PartitionPointers]
     203        mov     cx,7
     204
     205    DEBUG_DumpPartitionPointers_next:
     206        call    AuxIO_DumpParagraph
     207        add     si,16
     208        call    AuxIO_TeletypeNL
     209        loop    DEBUG_DumpPartitionPointers_next
     210
     211        popa
     212        popf
     213        ret
     214DEBUG_DumpPartitionPointers     EndP
     215
     216
     217DEBUG_DumpPartitionXref     Proc
     218        pushf
     219        pusha
     220
     221        call    AuxIO_TeletypeNL
     222
     223        mov     si,offset [PartitionXref]
     224        mov     cx,3
     225
     226    DEBUG_DumpPartitionXref_next:
     227        call    AuxIO_DumpParagraph
     228        add     si,16
     229        call    AuxIO_TeletypeNL
     230        loop    DEBUG_DumpPartitionXref_next
     231
     232        popa
     233        popf
     234        ret
     235DEBUG_DumpPartitionXref     EndP
     236
    166237;
    167238; Dump information before the menu is displayed.
     
    230301
    231302DEBUG_DumpHidePartTables    Proc    Near
    232         pushf
    233         pusha
    234 
    235         mov     cx,3
    236         mov     si, offset [HidePartitionTable]
    237     again1:
    238         call    AuxIO_DumpSector
    239         add     si,512
    240         loop    again1
    241         call    AuxIO_TeletypeNL
    242 
    243         mov     cx,3
    244         mov     si, offset [PartitionXref]
    245     again2:
    246         call    AuxIO_DumpParagraph
    247         call    AuxIO_TeletypeNL
    248         add     si,16
    249         loop    again2
    250         call    AuxIO_TeletypeNL
    251 
    252         mov     cx,3
    253         mov     si, offset [NewHidePartTable]
    254     again3:
    255         call    AuxIO_DumpSector
    256         add     si,512
    257         loop    again3
    258         call    AuxIO_TeletypeNL
    259 
    260         popa
    261         popf
     303        ;~ pushf
     304        ;~ pusha
     305;~
     306        ;~ mov     cx,3
     307        ;~ mov     si, offset [HidePartitionTable]
     308    ;~ again1:
     309        ;~ call    AuxIO_DumpSector
     310        ;~ add     si,512
     311        ;~ loop    again1
     312        ;~ call    AuxIO_TeletypeNL
     313;~
     314        ;~ mov     cx,3
     315        ;~ mov     si, offset [PartitionXref]
     316    ;~ again2:
     317        ;~ call    AuxIO_DumpParagraph
     318        ;~ call    AuxIO_TeletypeNL
     319        ;~ add     si,16
     320        ;~ loop    again2
     321        ;~ call    AuxIO_TeletypeNL
     322;~
     323        ;~ mov     cx,3
     324        ;~ mov     si, offset [NewHidePartTable]
     325    ;~ again3:
     326        ;~ call    AuxIO_DumpSector
     327        ;~ add     si,512
     328        ;~ loop    again3
     329        ;~ call    AuxIO_TeletypeNL
     330;~
     331        ;~ popa
     332        ;~ popf
    262333        ret
    263334DEBUG_DumpHidePartTables    EndP
  • trunk/BOOTCODE/REGULAR/DRIVEIO.ASM

    r47 r49  
    107107        mov     es, ax
    108108
    109         mov     ah, 00h                        ; Function 2 - Reset Drive
     109        mov     ah, 00h                        ; Function 0 - Reset Drive
    110110        xor     dl, dl
    111111        int     13h
     
    569569    IFDEF AUX_DEBUG
    570570        ; show current partition location
    571         pushf
    572         pusha
     571        ;~ pushf
     572        ;~ pusha
    573573        ;~ call    AuxIO_TeletypeNL
    574574        ;~ mov     si,offset db_curlvmsec
    575575        ;~ call    AuxIO_Print
    576         mov     dx,bx
     576        ;~ mov     dx,bx
    577577        ;~ call    AuxIO_TeletypeHexDWord
    578578        ;~ call    AuxIO_TeletypeNL
    579         mov     si,offset LVMSector
     579        ;~ mov     si,offset LVMSector
    580580        ;~ call    AuxIO_DumpSector
    581581        ;~ call    AuxIO_TeletypeNL
    582         popa
    583         popf
     582        ;~ popa
     583        ;~ popf
    584584    ENDIF
    585585
  • trunk/BOOTCODE/REGULAR/PARTMAIN.ASM

    r46 r49  
    745745
    746746
     747; Setup Phase1
     748; If found CY=1, AL=partnum, else CY=0, AL=0FFH
     749PART_SetupPhase1    Proc    Uses bx cx dx si di
     750
     751                ;
     752                ; Enumberate Bootable Systems by name
     753                ; and prepare Phase 1 if active.
     754                ;
     755                ; This can also be implemented using the
     756                ; Installable LVM-flag I think.
     757                ; But at the time I had lesser knowledge about LVM...
     758                ; So this algorithm may change in the future.
     759                ;
     760                mov     byte ptr [Phase1Active],0   ; Clear phase1 indicator
     761                mov     si, offset PartitionTable   ; Pointer to IPT
     762                xor     cx,cx
     763                mov     cl,[CFG_Partitions]         ; Partitions in IPT
     764
     765    ; Process next entry in IPT
     766    MBR_Parts:
     767                add     si, 4
     768                ;push    si
     769                ;push    si
     770                ;call    MBR_TeletypeVolName
     771                ;pop     si
     772                call    PART_IsInstallVolume        ; Check if this is install-volume
     773                jnc     MBR_Parts_NI
     774
     775                ;
     776                ; Install Volume found
     777                ;
     778                mov     byte ptr [Phase1Active],1   ; Set phase1 indicator
     779
     780                mov     al,' '
     781                mov     bl,7
     782                mov     ah, 0eh
     783                int     10h
     784
     785                mov     al,'('
     786                mov     bl,7
     787                mov     ah, 0eh
     788                int     10h
     789
     790
     791
     792                mov     al,[CFG_Partitions]
     793                sub     al,cl
     794
     795                mov     dh,al
     796
     797
     798                mov     [CFG_PartAutomatic],al  ; Setup entry for install-volume
     799                mov     [CFG_PartLast],al
     800
     801                add     al,'1'
     802                mov     bl,7
     803                mov     ah, 0eh
     804                int     10h
     805
     806                mov     al,')'
     807                mov     bl,7
     808                mov     ah, 0eh
     809                int     10h
     810
     811                ;mov     bx,cx       ; ????
     812
     813                mov     al,dh
     814                stc
     815                jmp     PART_SetupPhase1_found
     816
     817    MBR_Parts_NI:
     818                ;xor     si,si
     819                ;call    MBR_TeletypeNL
     820                ;pop     si
     821                add     si, 30      ; Add remainder of IPT entry
     822                loop    MBR_Parts
     823
     824                mov     al,0ffh
     825                clc
     826
     827    PART_SetupPhase1_found:
     828
     829                ret
     830
     831PART_SetupPhase1    EndP
     832
     833
     834
     835
     836;~ PART_GetOldPartitionCount   Proc    Uses    cx dx di
     837                ;~ mov     di,offset [PartitionXref]
     838                ;~ mov     dx,partition_count
     839                ;~ mov     cx,dx
     840                ;~ mov     al,0ffh
     841                ;~ cld
     842                ;~ repne   scasb
     843                ;~ inc     cx
     844                ;~ sub     dx,cx
     845                ;~ mov     ax,dx
     846                ;~ ret
     847;~ PART_GetOldPartitionCount   EndP
     848
     849
    747850
    748851; ###################
     
    12941397        popa
    12951398
     1399
     1400
     1401
     1402
    12961403        ; Debug display physdisk, ptype and physdisk offset in BPB
    1297         pusha
    1298         mov     ah,[si+LocIPT_Drive]
    1299         mov     al,[si+LocIPT_SystemID]
    1300         call    VideoIO_PrintHexWord
    1301         mov     ax,bx
    1302         call    VideoIO_PrintHexWord
    1303         mov     ax,[si+LocIPT_AbsolutePartTable+02]
    1304         call    VideoIO_PrintHexWord
    1305         mov     ax,[si+LocIPT_AbsolutePartTable+00]
    1306         call    VideoIO_PrintHexWord
    1307         mov     al,[ExtendedAbsPosSet]
    1308         call    VideoIO_PrintHexByte
    1309         popa
     1404        ;~ pusha
     1405        ;~ mov     ah,[si+LocIPT_Drive]
     1406        ;~ mov     al,[si+LocIPT_SystemID]
     1407        ;~ call    VideoIO_PrintHexWord
     1408        ;~ mov     ax,bx
     1409        ;~ call    VideoIO_PrintHexWord
     1410        ;~ mov     ax,[si+LocIPT_AbsolutePartTable+02]
     1411        ;~ call    VideoIO_PrintHexWord
     1412        ;~ mov     ax,[si+LocIPT_AbsolutePartTable+00]
     1413        ;~ call    VideoIO_PrintHexWord
     1414        ;~ mov     al,[ExtendedAbsPosSet]
     1415        ;~ call    VideoIO_PrintHexByte
     1416        ;~ mov     al,'-'
     1417        ;~ call    VideoIO_PrintSingleChar
     1418        ;~ mov     al,byte ptr [Menu_EntrySelected]
     1419        ;~ call    VideoIO_PrintHexByte
     1420        ;~ mov     al,byte ptr [CFG_PartAutomatic]
     1421        ;~ call    VideoIO_PrintHexByte
     1422        ;~ mov     al,byte ptr [Phase1Active]
     1423        ;~ call    VideoIO_PrintHexByte
     1424        ;~ mov     al,byte ptr [NewPartitions]
     1425        ;~ call    VideoIO_PrintHexByte
     1426        ;~ mov     al, byte ptr [OldPartitionCount]
     1427        ;~ call    VideoIO_PrintHexByte
     1428        ;~ popa
     1429
     1430
     1431
     1432
    13101433
    13111434
  • trunk/BOOTCODE/REGULAR/PARTSCAN.ASM

    r46 r49  
    894894
    895895    IFDEF   AUX_DEBUG
    896         pusha
    897         mov     al,dl
    898         call    AuxIO_TeletypeHexByte
    899         call    AuxIO_TeletypeNL
    900         popa
     896        ;~ pusha
     897        ;~ mov     al,dl
     898        ;~ call    AuxIO_TeletypeHexByte
     899        ;~ call    AuxIO_TeletypeNL
     900        ;~ popa
    901901    ENDIF
    902902
     
    914914    IFDEF   AUX_DEBUG
    915915        ; debug code
    916         mov     ax,di
    917         call    AuxIO_TeletypeHexWord
    918         call    AuxIO_TeletypeNL
     916        ;~ mov     ax,di
     917        ;~ call    AuxIO_TeletypeHexWord
     918        ;~ call    AuxIO_TeletypeNL
    919919    ENDIF
    920920
  • trunk/BOOTCODE/REGULAR/STD_TEXT.ASM

    r48 r49  
    5555             db BLDLVL_MINOR_VERSION,' - (c) '
    5656             db BLDLVL_YEAR
    57              ;~ db ' M. Kiewitz  <<Internal Release 2q>> (bld: '
    58              db ' M. Kiewitz  <<Release Candidate 2>> (bld: '
     57             db ' M. Kiewitz  <<Internal Release 3b>> (bld: '
     58             ;~ db ' M. Kiewitz  <<Release Candidate 2>> (bld: '
    5959             db BLDLVL_YEAR
    6060             db BLDLVL_MONTH
Note: See TracChangeset for help on using the changeset viewer.