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

Changed the layout of the BSS to make space [v1.1.1-testing]

We are going to store the complete disk information data from the
INT13 and INT13X BIOS calls (08h and 48h). INT13X v3+ can return 42h
of disk information. A total of 64 disks are supported, so some more
space in the BSS was needed. This was done by moving the BSS downwards
by 2000h (8K) bytes. While function 48h only returns 42h bytes, we
allocate 80h bytes per disk, so the size of the block is a multiple
of 2, so indexing can be done using bit shifts.

Data blocks containing related information are clustered and aligned
on 16 byte boundaries. That gives us neat offsets with the lower 4 bits
zero.

Supporting 64 disks might seem a bit overblown, especially since
AirBoot only supports a maximum of 45 partitions across all disks.
It is mainly done with regard to UEFI and future enhancements in mind.

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/airboot.asm

    r109 r112  
    20932093
    20942094sobss:
     2095sobss_abs = offset sobss + image_size
    20952096;------------------------------------------------------------------------------
    20962097
    2097                             ;
    2098                             ; Removed ORG for BSS data to be more compatible
    2099                             ; with segment-concatenated layout.
    2100                             ;
    2101                             ; What happens before this space ??
    2102                             ; If org 0 corruption occurs.
    2103                             ;
    2104 
    2105                             ;
    2106                             ; Filling hiddenparttable goes out-of-bounds !
    2107                             ; Fixed with 6-bit packing.
    2108                             ;
     2098
     2099        ;
     2100        ; This is the actual start of the BSS.
     2101        ; In the past however, we have had a code-loop that went out of bounds,
     2102        ; overwriting the start of the BSS.
     2103        ;
     2104        ; Because important runtime data is stored in the BSS, we offset it
     2105        ; by 400h bytes. Since the loader-image is always 62 sectors, which
     2106        ; makes it 7c00h in size, the runtime data starts at 8000h.
     2107        ; This is the 'BeginOfVariables' location.
     2108        ;
     2109
    21092110
    21102111;
     
    21142115;
    21152116IFDEF   SEGMENTED
    2116                             ORG 02400h
     2117                            ORG 00400h      ; 7c00h + 400h = 8000h
    21172118ELSE
    2118                             ORG 0A000h
     2119                            ORG 08000h      ; 8000h
    21192120ENDIF
    21202121
     
    21262127; This space actually gets initialized in PreCrap to NUL (till EndOfVariables)
    21272128BeginOfVariables:
     2129BeginOfVariablesAbs = offset BeginOfVariables + image_size
    21282130
    21292131
     
    21372139TmpSector           db  512 dup (?) ; Temporary Sector
    21382140Scratch             db  512 dup (?) ; Scratch buffer
     2141                    ALIGN   16
     2142
    21392143
    21402144; -----------------------------------------------------------------------------
     
    21442148; BOOKMARK: New Partition Table
    21452149NewPartTable                db  1536 dup (?)    ; New Partition Table
     2150                            ALIGN   16
    21462151
    21472152
     
    21512156; BOOKMARK: New Hide-Partition Table
    21522157NewHidePartTable            db  LocIPT_MaxPartitions * LocHPT_LenOfHPT dup (?)
    2153 
    2154     ;~ even
     2158                            ALIGN   16
     2159
    21552160
    21562161; -----------------------------------------------------------------------------
     
    21592164; BOOKMARK: Logical Drive-Letters
    21602165NewDriveLetters             db  LocIPT_MaxPartitions dup (?)
    2161 
    2162     ;~ even
     2166                            ALIGN   16
     2167
    21632168
    21642169; -----------------------------------------------------------------------------
     
    21682173; BOOKMARK: Partition Size Table
    21692174PartitionSizeTable          db  LocIPT_MaxPartitions * 6 dup (?)
     2175                            ALIGN   16
    21702176
    21712177
     
    21762182; BOOKMARK: Partition Pointers
    21772183PartitionPointers           dw  52 dup (?)
     2184                            ALIGN   16
    21782185
    21792186; Count of total Partition Pointers
    21802187PartitionPointerCount       db  ?
     2188                            ALIGN   16
     2189
    21812190
    21822191; -----------------------------------------------------------------------------
     
    21872196; BOOKMARK: Xref Table
    21882197PartitionXref               db  LocIPT_MaxPartitions dup (?)
     2198                            ALIGN   16
     2199
    21892200
    21902201; -----------------------------------------------------------------------------
     
    21982209; BOOKMARK: Volume Drive Letters
    21992210PartitionVolumeLetters      db  LocIPT_MaxPartitions dup (?)
    2200 
     2211                            ALIGN   16
    22012212
    22022213
     
    22212232CurIO_Scanning          db  ?           ; 1-AiR-BOOT is scanning partitions
    22222233                                            ; (for detailed error message)
    2223 
    2224 ; [Linux support removed since v1.02]
    2225 ;GotLinux                     db     ?    ; 1-Linux found
     2234                        ALIGN   16
    22262235
    22272236
     
    22382247Menu_EntryAutomatic db  ?   ; Automatic Entry in filtered View
    22392248                                         ;  - All adjusted to menu locations
     2249                    ALIGN   16
     2250
    22402251
    22412252; -----------------------------------------------------------------------------
     
    22472258PartSetup_HiddenX       db  ?   ; Pos for Hidden-Setup
    22482259PartSetup_HiddenAdd     db  ?   ; Adjust for Hidden-Setup
     2260                        ALIGN   16
     2261
    22492262
    22502263; -----------------------------------------------------------------------------
     
    22662279ChangePartNameSave  db  ?   ; Save label after user-edit ?
    22672280SyncLvmLabels       db  ?   ; Sync LVM labels after user-edit ?
     2281                    ALIGN   16
    22682282
    22692283
     
    22812295FX_WideScrollerBounceSpeed  db  ?
    22822296FX_CooperBarsTimer          dw  ?
     2297                            ALIGN   16
    22832298
    22842299; Dynamically Generated Tables - do not need to get initialized with NUL
     
    22872302FX_SinusPos         db     7 dup (?)
    22882303FX_CooperPos        dw     7 dup (?)
     2304                    ALIGN   16
    22892305
    22902306
     
    22932309; -----------------------------------------------------------------------------
    22942310CharsetTempBuffer   db  4096 dup (?) ; Uninitialized Charset buffer
     2311                    ALIGN   16
     2312
    22952313
    22962314; -----------------------------------------------------------------------------
     
    22982316; -----------------------------------------------------------------------------
    22992317LVM_CRCTable        dd   256 dup (?) ; LVM-CRC (->SPECiAL\LVM.asm)
    2300 
    2301 
    2302 
    2303 ;
    2304 ; Rousseau: added some stuff.
    2305 ;
     2318                    ALIGN   16
     2319
     2320
    23062321; -----------------------------------------------------------------------------
    23072322;                                                           ECS PHASE1 RELATED
     
    23092324Phase1Active                db      ?
    23102325OldPartitionCount           db      ?
     2326                            ALIGN   16
    23112327
    23122328
     
    23142330;                                                              DISK PARAMETERS
    23152331; -----------------------------------------------------------------------------
    2316                               ;EVEN
    23172332HugeDisk                    db      MaxDisks  dup(?)
    23182333TrueSecs                    dd      MaxDisks  dup(?)
     2334                            ALIGN   16
    23192335
    23202336; BIOS geometry of the boot-drive
     
    23262342BIOS_Bytes                  dw      MaxDisks  dup(?)
    23272343BIOS_TotalSecs              dq      MaxDisks  dup(?)
     2344                            ALIGN   16
    23282345
    23292346; LBA geometry of the boot-drive
     
    23342351LVM_Bytes                   dw      MaxDisks  dup(?)
    23352352LVM_TotalSecs               dq      MaxDisks  dup(?)
     2353                            ALIGN   16
    23362354
    23372355; OS/2 geometry of the boot-drive
     
    23422360LOG_Bytes                   dw      MaxDisks  dup(?)
    23432361LOG_TotalSecs               dq      MaxDisks  dup(?)
     2362                            ALIGN   16
     2363
     2364; Storage for INT13 disk parameters
     2365INT13_DiskParams            db      MaxDisks  dup(10h dup(?))
     2366                            ALIGN   16
     2367
     2368; Storage for INT13X disk parameters
     2369INT13X_DiskParams           db      MaxDisks  dup(80h dup(?))
     2370                            ALIGN   16
    23442371
    23452372; Get's initialized at startup to: 00000011111111111111111111111100b
     
    23472374; Each partition with an assigned drive-letter clears a bit in this map.
    23482375FreeDriveletterMap          dd      ?
     2376                            ALIGN   16
    23492377
    23502378; LBA address of master LVM sector, zero if non-existant
    2351 MasterLVMLBA                dd      ?
     2379MasterLVMLBA                dd      MaxDisks  dup(?)
     2380                            ALIGN   16
    23522381
    23532382
     
    23642393                            dd      ?       ; Second Part of QWORD
    23652394INT13X_DAP_Size = $-offset [INT13X_DAP]     ; Calculated size
     2395                            ALIGN   16
    23662396
    23672397;
     
    23802410            ; (excluding the size word at the start).
    23812411            i13xbuf_size = $-offset i13xbuf-2
     2412            ALIGN   16
    23822413
    23832414            ; Some debug area.
    23842415dbg_scratch db  512 dup(?)
     2416            ALIGN   16
    23852417
    23862418
    23872419; End of transient variables.
    23882420EndOfVariables:
    2389 
     2421EndOfVariablesAbs = offset EndOfVariables + image_size
    23902422
    23912423
     
    24052437; to be partly overwritten by the clearing routine.
    24062438                            dd      ?
     2439                            ALIGN   16
    24072440
    24082441; SS:SP from before our relocation.
     
    24182451CurrentSP                   dw      ?
    24192452CurrentSS                   dw      ?
    2420 
     2453                            ALIGN   16
    24212454;
    24222455; End of BSS segment.
    24232456;
    24242457eobss:
    2425 
     2458eobss_abs = offset eobss + image_size
    24262459;
    24272460; Total RAM occupied, including BSS.
     
    24292462; Note that the LDRIMAGE is of constant size, 7C00h = 62 sectors of 512 bytes.
    24302463;
    2431 resident_size = (offset eobss + image_size)
     2464resident_size = offset eobss + image_size
    24322465
    24332466;
Note: See TracChangeset for help on using the changeset viewer.