Ignore:
Timestamp:
Apr 11, 2014, 11:48:01 PM (11 years ago)
Author:
Ben Rietbroek
Message:

BSS Corruption Problem located (auxdebug on) [2012-02-21]

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

Problem

o Function with Xrefs goes out-of-bounds because hideparttable is too small

Has only 30 entries and should be 45.
Lost partition checker initializes out-of-bounds.

Info

o About the hideparttable

For each partition it can be specified which other partitions need to
be hidden when that partition is booted. This is useful for legacy DOS
but also braindead Windows that presents HPFS/JFS partitions as
unformatted and tries to persuade the user to format them.
With v1.07 the numer of partitions that can be handled was expanded from
30 to 45, but the size of the hideparttable was overseen.

o The need to compress the hideparttable

The old size was 30x30=900 bytes while the required size is 45x45=2045 bytes.
This amount of space is not available in the image.
Since 6 bits are enough to identify the partition number to be hidden,
the solution is to devide the table into bitfields. This will result
in a table of (45*45*6)/8=1519 bytes, which can be fitted.

Changes

Revamped the sources quite a bit and moved the history to a separate
file. (AIR-BOOT.HIS)

New

o FIXCODE script for Linux

Just until the C version is ready...

File:
1 edited

Legend:

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

    r30 r43  
    3636ENDIF
    3737
    38 
    39 
    40 ; Initialize the com-port
    41 ; In:          AL - com-port, 0=disable com-port logging, 1=com1 etc. (max 4)
    42 ;              AH - initialization parameters (see below)
    43 ; Out:         AX - line status
    44 DEBUG_Dump1             Proc  Near
    45       pushf
    46       pusha
    47 
    48       ; Hello message
    49       mov      si, offset AuxIOHello
    50       call     AuxIO_Print
    51 
    52       ; Build Date
    53       mov      si, offset BUILD_DATE
    54       call     AuxIO_Print
    55 
    56       ; Start new line
    57       call     AuxIO_TeletypeNL
    58       Call     AuxIO_TeletypeNL
    59 
    60       ; Msg check math-module
    61       mov      si,offset db_checkmath
    62       call     AuxIO_Print
    63 
    64       ; Output hex-word
    65       mov      ax,0BABEh
    66       call     AuxIO_TeletypeHexWord
    67 
    68       mov      al,' '
    69       call     AuxIO_Teletype
    70       mov      al,'*'
    71       call     AuxIO_Teletype
    72       mov      al,' '
    73       call     AuxIO_Teletype
    74 
    75       ; Output hex-word
    76       mov      ax,0BABEh
    77       call     AuxIO_TeletypeHexWord
    78 
    79       mov      al,' '
    80       call     AuxIO_Teletype
    81       mov      al,'='
    82       call     AuxIO_Teletype
    83       mov      al,' '
    84       call     AuxIO_Teletype
    85 
    86       mov      ax,0BABEh
    87       mul      ax
    88       call     AuxIO_TeletypeHexDWord
    89 
    90       ; Start new line
    91       call     AuxIO_TeletypeNL
    92 
    93 
    94       ; Output hex-dword
    95       mov      dx,0DEADh
    96       mov      ax,0FACEh
    97       call     AuxIO_TeletypeHexDWord
    98 
    99       mov      al,' '
    100       call     AuxIO_Teletype
    101       mov      al,'*'
    102       call     AuxIO_Teletype
    103       mov      al,' '
    104       call     AuxIO_Teletype
    105 
    106       ; Output hex-dword
    107       mov      dx,0DEADh
    108       mov      ax,0FACEh
    109       call     AuxIO_TeletypeHexDWord
    110 
    111       mov      al,' '
    112       call     AuxIO_Teletype
    113       mov      al,'='
    114       call     AuxIO_Teletype
    115       mov      al,' '
    116       call     AuxIO_Teletype
    117 
    118 
    119 
    120       mov      bx,0DEADh
    121       mov      cx,0FACEh
    122       mov      dx,0DEADh
    123       mov      ax,0FACEh
    124       call     MATH_Mul32
    125       call     AuxIO_TeletypeHexQWord
    126 
    127 
    128       ; Start new line
    129       call     AuxIO_TeletypeNL
    130 
    131 
    132       ; Start new line
    133       call     AuxIO_TeletypeNL
    134 
    135 
    136       ; BIOS cyls
    137 ;      mov      dx,word ptr [BIOS_Cyls+02]
    138 ;      mov      ax,word ptr [BIOS_Cyls+00]
    139 ;      call     AuxIO_TeletypeHexDWord
    140 ;      call     AuxIO_TeletypeNL
    141 
    142       ; BIOS heads
    143 ;      mov      dx,word ptr [BIOS_Heads+02]
    144 ;      mov      ax,word ptr [BIOS_Heads+00]
    145 ;      call     AuxIO_TeletypeHexDWord
    146 ;      call     AuxIO_TeletypeNL
    147 
    148       ; BIOS secs
    149 ;      mov      dx,word ptr [BIOS_Secs+02]
    150 ;      mov      ax,word ptr [BIOS_Secs+00]
    151 ;      call     AuxIO_TeletypeHexDWord
    152 ;      call     AuxIO_TeletypeNL
    153 
    154       ; Bytes per sector
    155 ;      mov      ax,[BIOS_Bytes]
    156 ;      call     AuxIO_TeletypeHexWord
    157 ;      call     AuxIO_TeletypeNL
    158 
    159       ; Total secs
    160 ;      mov      bx, word ptr [BIOS_TotalSecs+06]
    161 ;      mov      cx, word ptr [BIOS_TotalSecs+04]
    162 ;      mov      dx, word ptr [BIOS_TotalSecs+02]
    163 ;      mov      ax, word ptr [BIOS_TotalSecs+00]
    164 ;      call     AuxIO_TeletypeHexDWord
    165 ;      call     AuxIO_TeletypeNL
    166 
    167       ; CHS to LBA
    168 ;      mov      dx,1
    169 ;      mov      ax,29e5h
    170 ;      mov      bx,23h
    171 ;      mov      cx,9h
    172 ;      call     CONV_CHS2LBA
    173 ;      call     AuxIO_TeletypeHexDWord
    174 ;      call     AuxIO_TeletypeNL
    175 
    176 
    177       popa
    178       popf
    179       ret
    180 DEBUG_Dump1             EndP
    181 
    182 
    183 
    184 ;DEBUG_Dump2             Proc  Near
    185 ;      pushf
    186 ;      pusha
    187 
    188 
    189 ;      call     AuxIO_TeletypeNL
    190 ;      call     AuxIO_TeletypeNL
    191 
    192 
    193 ;      mov      si,offset db_config
    194 ;      call     AuxIO_Print
    195 
    196 ;      mov      si,offset db_cfgparts
    197 ;      call     AuxIO_Print
    198 ;      mov      al,[CFG_Partitions]
    199 ;      call     AuxIO_TeletypeHexByte
    200 ;      call     AuxIO_TeletypeNL
    201 
    202 ;      mov      si,offset db_cfgpartdef
    203 ;      call     AuxIO_Print
    204 ;      mov      al,[CFG_PartDefault]
    205 ;      call     AuxIO_TeletypeHexByte
    206 ;      call     AuxIO_TeletypeNL
    207 
    208 ;      mov      si,offset db_cfgpartlast
    209 ;      call     AuxIO_Print
    210 ;      mov      al,[CFG_PartLast]
    211 ;      call     AuxIO_TeletypeHexByte
    212 ;      call     AuxIO_TeletypeNL
    213 ;      call     AuxIO_TeletypeNL
    214 
    215 
    216 
    217 ;      mov      si,offset db_vars
    218 ;      call     AuxIO_Print
    219 
    220 ;      mov      si,offset db_newpart
    221 ;      call     AuxIO_Print
    222 ;      mov      si,offset NewPartTable
    223 ;      call     AuxIO_DumpSector
    224 ;      call     AuxIO_TeletypeNL
    225 ;      add      si,512
    226 ;      call     AuxIO_DumpSector
    227 ;      call     AuxIO_TeletypeNL
    228 ;      call     AuxIO_TeletypeNL
    229 
    230 ;      mov      si,offset db_newhide
    231 ;      call     AuxIO_Print
    232 ;      mov      si,offset NewHidePartTable
    233 ;      call     AuxIO_DumpSector
    234 ;      call     AuxIO_TeletypeNL
    235 ;      add      si,512
    236 ;      call     AuxIO_DumpSector
    237 ;      call     AuxIO_TeletypeNL
    238 ;      call     AuxIO_TeletypeNL
    239 
    240 ;      mov      si,offset db_dletters
    241 ;      call     AuxIO_Print
    242 ;      mov      si,offset NewDriveLetters
    243 ;      call     AuxIO_DumpParagraph
    244 ;      call     AuxIO_TeletypeNL
    245 ;      add      si,16
    246 ;      call     AuxIO_DumpParagraph
    247 ;      call     AuxIO_TeletypeNL
    248 ;      call     AuxIO_TeletypeNL
    249 
    250 ;      mov      si,offset db_tmpec
    251 ;      call     AuxIO_Print
    252 ;      mov      si,offset TmpSector
    253 ;      call     AuxIO_DumpSector
    254 ;      call     AuxIO_TeletypeNL
    255 ;      call     AuxIO_TeletypeNL
    256 
    257 ;      mov      si,offset db_partsec
    258 ;      call     AuxIO_Print
    259 ;      mov      si,offset PartitionSector
    260 ;      call     AuxIO_DumpSector
    261 ;      call     AuxIO_TeletypeNL
    262 ;      call     AuxIO_TeletypeNL
    263 
    264 ;      popa
    265 ;      popf
    266 ;      ret
    267 ;DEBUG_Dump2             EndP
    268 
    269 
    270 
    271 db_mbr:           db "## MBR ##",10,0
    272 db_masterlvm:     db "## MLVMR ##",10,0
    273 
    274 db_checkmath:     db "## CHK MATH ##",10,0
    275 
    276 
    277 db_config:        db '## CFG (DMP2) ##',10,0
    278 db_cfgparts:      db 'CFG_Partitions:',0
    279 db_cfgpartdef:    db 'CFG_PartDefault:',0
    280 db_cfgpartlast:   db 'CFG_PartLast:',0
    281 
    282 
    283 db_vars:          db '## VARS ##',10,0
    284 db_partsec:       db 'PartitionSector:',10,0
    285 ;db_lvmsec:        db 'LVMSector :',10,0
    286 db_tmpec:         db 'TmpSector :',10,0
    287 
    288 db_newpart:       db 'NewPartTable :',10,0
    289 db_newhide:       db 'NewHideTable:',10,0
    290 db_dletters:      db 'NewDriveLetters:',10,0
    291 
    292 ;db_partsize:      db 'PartitionSizeTable:',10,0
    293 ;db_partpoint:     db 'PartitionPointers:',10,0
    294 ;db_partpointcnt:  db 'PartitionPointerCount:',0
    295 ;db_partxref:      db 'PartitionXref:',10,0
    296 ;db_partvoldl:     db 'PartitionVolumeLetters:',10,0
    297 
    298 ;db_totaldisks:    db 'TotalHarddiscs:',0
    299 ;db_lbaswitchtab:  db 'LBASwitchTable:',10,0
    300 ;db_newparts:      db 'NewPartitions:',0
    301 
    302 ;db_exabspos:      db 'ExtendedAbsPos:',0
    303 ;db_exabsposset:   db 'ExtendedAbsPosSet:',0
    304 
    305 db_curpartloc:    db 'CurPartition_Location:',0
    306 ;db_curiox:        db 'CurIO_UseExtension:',0
    307 
    308 db_curlvmsec:     db 'Current LVM Sector:',0
     38DEBUG_CheckMath Proc    Near
     39        pushf
     40        pusha
     41
     42        ; Msg check math-module
     43        mov     si,offset db_checkmath
     44        call    AuxIO_Print
     45
     46        ; Output hex-word
     47        mov     ax,0BABEh
     48        call    AuxIO_TeletypeHexWord
     49
     50        mov     al,' '
     51        call    AuxIO_Teletype
     52        mov     al,'*'
     53        call    AuxIO_Teletype
     54        mov     al,' '
     55        call    AuxIO_Teletype
     56
     57        ; Output hex-word
     58        mov     ax,0BABEh
     59        call    AuxIO_TeletypeHexWord
     60
     61        mov     al,' '
     62        call    AuxIO_Teletype
     63        mov     al,'='
     64        call    AuxIO_Teletype
     65        mov     al,' '
     66        call    AuxIO_Teletype
     67
     68        mov     ax,0BABEh
     69        mul     ax
     70        call    AuxIO_TeletypeHexDWord
     71
     72        ; Start new line
     73        call    AuxIO_TeletypeNL
     74
     75        ; Output hex-dword
     76        mov     dx,0DEADh
     77        mov     ax,0FACEh
     78        call    AuxIO_TeletypeHexDWord
     79
     80        mov     al,' '
     81        call    AuxIO_Teletype
     82        mov     al,'*'
     83        call    AuxIO_Teletype
     84        mov     al,' '
     85        call     AuxIO_Teletype
     86
     87        ; Output hex-dword
     88        mov     dx,0DEADh
     89        mov     ax,0FACEh
     90        call    AuxIO_TeletypeHexDWord
     91
     92        mov     al,' '
     93        call    AuxIO_Teletype
     94        mov     al,'='
     95        call    AuxIO_Teletype
     96        mov     al,' '
     97        call    AuxIO_Teletype
     98
     99        mov     bx,0DEADh
     100        mov     cx,0FACEh
     101        mov     dx,0DEADh
     102        mov     ax,0FACEh
     103        call    MATH_Mul32
     104        call    AuxIO_TeletypeHexQWord
     105
     106        ; Start new line
     107        call    AuxIO_TeletypeNL
     108
     109        ;~ ; Start new line
     110        call    AuxIO_TeletypeNL
     111
     112        popa
     113        popf
     114
     115        ret
     116DEBUG_CheckMath EndP
     117
     118
     119DEBUG_DumpGeo   Proc
     120        pushf
     121        pusha
     122
     123        ; BIOS cyls
     124        mov     dx,word ptr [BIOS_Cyls+02]
     125        mov     ax,word ptr [BIOS_Cyls+00]
     126        call    AuxIO_TeletypeHexDWord
     127        call    AuxIO_TeletypeNL
     128
     129        ; BIOS heads
     130        mov     dx,word ptr [BIOS_Heads+02]
     131        mov     ax,word ptr [BIOS_Heads+00]
     132        call    AuxIO_TeletypeHexDWord
     133        call    AuxIO_TeletypeNL
     134
     135        ; BIOS secs
     136        mov     dx,word ptr [BIOS_Secs+02]
     137        mov     ax,word ptr [BIOS_Secs+00]
     138        call    AuxIO_TeletypeHexDWord
     139        call    AuxIO_TeletypeNL
     140
     141        ; Bytes per sector
     142        mov     ax,[BIOS_Bytes]
     143        call    AuxIO_TeletypeHexWord
     144        call    AuxIO_TeletypeNL
     145
     146        ; Total secs
     147        mov     bx, word ptr [BIOS_TotalSecs+06]
     148        mov     cx, word ptr [BIOS_TotalSecs+04]
     149        mov     dx, word ptr [BIOS_TotalSecs+02]
     150        mov     ax, word ptr [BIOS_TotalSecs+00]
     151        call    AuxIO_TeletypeHexDWord
     152        call    AuxIO_TeletypeNL
     153
     154        ; CHS to LBA
     155        mov     dx,1
     156        mov     ax,29e5h
     157        mov     bx,23h
     158        mov     cx,9h
     159        call    CONV_CHS2LBA
     160        call     AuxIO_TeletypeHexDWord
     161        call     AuxIO_TeletypeNL
     162
     163        popa
     164        popf
     165
     166        ret
     167DEBUG_DumpGeo   Endp
     168
     169;
     170; Dump information before the menu is displayed.
     171;
     172DEBUG_Dump1     Proc  Near
     173        pushf
     174        pusha
     175
     176        ; Hello message
     177        mov     si, offset AuxIOHello
     178        call    AuxIO_Print
     179
     180        ; Build Date
     181        mov     si, offset BUILD_DATE
     182        call    AuxIO_Print
     183
     184        ; Start new line
     185        call    AuxIO_TeletypeNL
     186        call    AuxIO_TeletypeNL
     187
     188        ;~ call    DEBUG_CheckMath
     189
     190        ;~ call    DEBUG_DumpGeo
     191
     192
     193
     194        popa
     195        popf
     196        ret
     197DEBUG_Dump1     EndP
     198
     199
     200DEBUG_DumpBSSSectors    Proc    Near
     201        pushf
     202        pusha
     203
     204        mov     si, offset [PartitionSector]
     205        call    AuxIO_DumpSector
     206        call    AuxIO_TeletypeNL
     207
     208        mov     si, offset [JfsPBR]
     209        call    AuxIO_DumpSector
     210        call    AuxIO_TeletypeNL
     211
     212        mov     si, offset [LVMSector]
     213        call    AuxIO_DumpSector
     214        call    AuxIO_TeletypeNL
     215
     216        mov     si, offset [TmpSector]
     217        call    AuxIO_DumpSector
     218        call    AuxIO_TeletypeNL
     219
     220        mov     si, offset [NewPartTable]
     221        call    AuxIO_DumpSector
     222        call    AuxIO_TeletypeNL
     223        call    AuxIO_TeletypeNL
     224
     225        popa
     226        popf
     227        ret
     228
     229
     230DEBUG_DumpBSSSectors    EndP
     231
     232
     233
     234
     235;
     236; Dump information before the partition is booted.
     237;
     238DEBUG_Dump2     Proc  Near
     239        pushf
     240        pusha
     241
     242
     243        call    AuxIO_TeletypeNL
     244        call    AuxIO_TeletypeNL
     245
     246
     247        mov     si,offset db_config
     248        call    AuxIO_Print
     249
     250        mov     si,offset db_cfgparts
     251        call    AuxIO_Print
     252        mov     al,[CFG_Partitions]
     253        call    AuxIO_TeletypeHexByte
     254        call    AuxIO_TeletypeNL
     255
     256        mov     si,offset db_cfgpartdef
     257        call    AuxIO_Print
     258        mov     al,[CFG_PartDefault]
     259        call    AuxIO_TeletypeHexByte
     260        call    AuxIO_TeletypeNL
     261
     262        mov     si,offset db_cfgpartlast
     263        call    AuxIO_Print
     264        mov     al,[CFG_PartLast]
     265        call    AuxIO_TeletypeHexByte
     266        call    AuxIO_TeletypeNL
     267        call    AuxIO_TeletypeNL
     268
     269
     270
     271        mov     si,offset db_vars
     272        call    AuxIO_Print
     273
     274        mov     si,offset db_newpart
     275        call    AuxIO_Print
     276        mov     si,offset NewPartTable
     277        call    AuxIO_DumpSector
     278        call    AuxIO_TeletypeNL
     279        add     si,512
     280        call    AuxIO_DumpSector
     281        call    AuxIO_TeletypeNL
     282        call    AuxIO_TeletypeNL
     283
     284        mov     si,offset db_newhide
     285        call    AuxIO_Print
     286        mov     si,offset NewHidePartTable
     287        call    AuxIO_DumpSector
     288        call    AuxIO_TeletypeNL
     289        add     si,512
     290        call    AuxIO_DumpSector
     291        call    AuxIO_TeletypeNL
     292        call    AuxIO_TeletypeNL
     293
     294        mov     si,offset db_dletters
     295        call    AuxIO_Print
     296        mov     si,offset NewDriveLetters
     297        call    AuxIO_DumpParagraph
     298        call    AuxIO_TeletypeNL
     299        add     si,16
     300        call    AuxIO_DumpParagraph
     301        call    AuxIO_TeletypeNL
     302        call    AuxIO_TeletypeNL
     303
     304        mov     si,offset db_tmpec
     305        call    AuxIO_Print
     306        mov     si,offset TmpSector
     307        call    AuxIO_DumpSector
     308        call    AuxIO_TeletypeNL
     309        call    AuxIO_TeletypeNL
     310
     311        mov     si,offset db_partsec
     312        call    AuxIO_Print
     313        mov     si,offset PartitionSector
     314        call    AuxIO_DumpSector
     315        call    AuxIO_TeletypeNL
     316        call    AuxIO_TeletypeNL
     317
     318        popa
     319        popf
     320        ret
     321DEBUG_Dump2     EndP
     322
     323
     324
     325db_mbr              db "## MBR ##",10,0
     326db_masterlvm        db "## MLVMR ##",10,0
     327
     328db_checkmath        db "## CHK MATH ##",10,0
     329
     330
     331db_config           db '## CFG (DMP2) ##',10,0
     332db_cfgparts         db 'CFG_Partitions:',0
     333db_cfgpartdef       db 'CFG_PartDefault:',0
     334db_cfgpartlast      db 'CFG_PartLast:',0
     335
     336
     337db_vars             db '## VARS ##',10,0
     338db_partsec          db 'PartitionSector:',10,0
     339;db_lvmsec           db 'LVMSector :',10,0
     340db_tmpec            db 'TmpSector :',10,0
     341
     342db_newpart          db 'NewPartTable :',10,0
     343db_newhide          db 'NewHideTable:',10,0
     344db_dletters         db 'NewDriveLetters:',10,0
     345
     346;db_partsize         db 'PartitionSizeTable:',10,0
     347;db_partpoint        db 'PartitionPointers:',10,0
     348;db_partpointcnt     db 'PartitionPointerCount:',0
     349;db_partxref         db 'PartitionXref:',10,0
     350;db_partvoldl        db 'PartitionVolumeLetters:',10,0
     351
     352;db_totaldisks       db 'TotalHarddiscs:',0
     353;db_lbaswitchtab     db 'LBASwitchTable:',10,0
     354;db_newparts         db 'NewPartitions:',0
     355
     356;db_exabspos         db 'ExtendedAbsPos:',0
     357;db_exabsposset      db 'ExtendedAbsPosSet:',0
     358
     359db_curpartloc       db 'CurPartition_Location:',0
     360;db_curiox           db 'CurIO_UseExtension:',0
     361
     362db_curlvmsec        db 'Current LVM Sector:',0
     363
Note: See TracChangeset for help on using the changeset viewer.