Index: trunk/bootcode/airboot.asm
===================================================================
--- trunk/bootcode/airboot.asm	(revision 111)
+++ trunk/bootcode/airboot.asm	(revision 112)
@@ -2093,18 +2093,19 @@
 
 sobss:
+sobss_abs = offset sobss + image_size
 ;------------------------------------------------------------------------------
 
-                            ;
-                            ; Removed ORG for BSS data to be more compatible
-                            ; with segment-concatenated layout.
-                            ;
-                            ; What happens before this space ??
-                            ; If org 0 corruption occurs.
-                            ;
-
-                            ;
-                            ; Filling hiddenparttable goes out-of-bounds !
-                            ; Fixed with 6-bit packing.
-                            ;
+
+        ;
+        ; This is the actual start of the BSS.
+        ; In the past however, we have had a code-loop that went out of bounds,
+        ; overwriting the start of the BSS.
+        ;
+        ; Because important runtime data is stored in the BSS, we offset it
+        ; by 400h bytes. Since the loader-image is always 62 sectors, which
+        ; makes it 7c00h in size, the runtime data starts at 8000h.
+        ; This is the 'BeginOfVariables' location.
+        ;
+
 
 ;
@@ -2114,7 +2115,7 @@
 ;
 IFDEF   SEGMENTED
-                            ORG 02400h
+                            ORG 00400h      ; 7c00h + 400h = 8000h
 ELSE
-                            ORG 0A000h
+                            ORG 08000h      ; 8000h
 ENDIF
 
@@ -2126,4 +2127,5 @@
 ; This space actually gets initialized in PreCrap to NUL (till EndOfVariables)
 BeginOfVariables:
+BeginOfVariablesAbs = offset BeginOfVariables + image_size
 
 
@@ -2137,4 +2139,6 @@
 TmpSector           db  512 dup (?) ; Temporary Sector
 Scratch             db  512 dup (?) ; Scratch buffer
+                    ALIGN   16
+
 
 ; -----------------------------------------------------------------------------
@@ -2144,4 +2148,5 @@
 ; BOOKMARK: New Partition Table
 NewPartTable                db  1536 dup (?)    ; New Partition Table
+                            ALIGN   16
 
 
@@ -2151,6 +2156,6 @@
 ; BOOKMARK: New Hide-Partition Table
 NewHidePartTable            db  LocIPT_MaxPartitions * LocHPT_LenOfHPT dup (?)
-
-    ;~ even
+                            ALIGN   16
+
 
 ; -----------------------------------------------------------------------------
@@ -2159,6 +2164,6 @@
 ; BOOKMARK: Logical Drive-Letters
 NewDriveLetters             db  LocIPT_MaxPartitions dup (?)
-
-    ;~ even
+                            ALIGN   16
+
 
 ; -----------------------------------------------------------------------------
@@ -2168,4 +2173,5 @@
 ; BOOKMARK: Partition Size Table
 PartitionSizeTable          db  LocIPT_MaxPartitions * 6 dup (?)
+                            ALIGN   16
 
 
@@ -2176,7 +2182,10 @@
 ; BOOKMARK: Partition Pointers
 PartitionPointers           dw  52 dup (?)
+                            ALIGN   16
 
 ; Count of total Partition Pointers
 PartitionPointerCount       db  ?
+                            ALIGN   16
+
 
 ; -----------------------------------------------------------------------------
@@ -2187,4 +2196,6 @@
 ; BOOKMARK: Xref Table
 PartitionXref               db  LocIPT_MaxPartitions dup (?)
+                            ALIGN   16
+
 
 ; -----------------------------------------------------------------------------
@@ -2198,5 +2209,5 @@
 ; BOOKMARK: Volume Drive Letters
 PartitionVolumeLetters      db  LocIPT_MaxPartitions dup (?)
-
+                            ALIGN   16
 
 
@@ -2221,7 +2232,5 @@
 CurIO_Scanning          db  ?           ; 1-AiR-BOOT is scanning partitions
                                             ; (for detailed error message)
-
-; [Linux support removed since v1.02]
-;GotLinux                     db     ?    ; 1-Linux found
+                        ALIGN   16
 
 
@@ -2238,4 +2247,6 @@
 Menu_EntryAutomatic db  ?   ; Automatic Entry in filtered View
                                          ;  - All adjusted to menu locations
+                    ALIGN   16
+
 
 ; -----------------------------------------------------------------------------
@@ -2247,4 +2258,6 @@
 PartSetup_HiddenX       db  ?   ; Pos for Hidden-Setup
 PartSetup_HiddenAdd     db  ?   ; Adjust for Hidden-Setup
+                        ALIGN   16
+
 
 ; -----------------------------------------------------------------------------
@@ -2266,4 +2279,5 @@
 ChangePartNameSave  db  ?   ; Save label after user-edit ?
 SyncLvmLabels       db  ?   ; Sync LVM labels after user-edit ?
+                    ALIGN   16
 
 
@@ -2281,4 +2295,5 @@
 FX_WideScrollerBounceSpeed  db  ?
 FX_CooperBarsTimer          dw  ?
+                            ALIGN   16
 
 ; Dynamically Generated Tables - do not need to get initialized with NUL
@@ -2287,4 +2302,5 @@
 FX_SinusPos         db     7 dup (?)
 FX_CooperPos        dw     7 dup (?)
+                    ALIGN   16
 
 
@@ -2293,4 +2309,6 @@
 ; -----------------------------------------------------------------------------
 CharsetTempBuffer   db  4096 dup (?) ; Uninitialized Charset buffer
+                    ALIGN   16
+
 
 ; -----------------------------------------------------------------------------
@@ -2298,10 +2316,7 @@
 ; -----------------------------------------------------------------------------
 LVM_CRCTable        dd   256 dup (?) ; LVM-CRC (->SPECiAL\LVM.asm)
-
-
-
-;
-; Rousseau: added some stuff.
-;
+                    ALIGN   16
+
+
 ; -----------------------------------------------------------------------------
 ;                                                           ECS PHASE1 RELATED
@@ -2309,4 +2324,5 @@
 Phase1Active                db      ?
 OldPartitionCount           db      ?
+                            ALIGN   16
 
 
@@ -2314,7 +2330,7 @@
 ;                                                              DISK PARAMETERS
 ; -----------------------------------------------------------------------------
-                              ;EVEN
 HugeDisk                    db      MaxDisks  dup(?)
 TrueSecs                    dd      MaxDisks  dup(?)
+                            ALIGN   16
 
 ; BIOS geometry of the boot-drive
@@ -2326,4 +2342,5 @@
 BIOS_Bytes                  dw      MaxDisks  dup(?)
 BIOS_TotalSecs              dq      MaxDisks  dup(?)
+                            ALIGN   16
 
 ; LBA geometry of the boot-drive
@@ -2334,4 +2351,5 @@
 LVM_Bytes                   dw      MaxDisks  dup(?)
 LVM_TotalSecs               dq      MaxDisks  dup(?)
+                            ALIGN   16
 
 ; OS/2 geometry of the boot-drive
@@ -2342,4 +2360,13 @@
 LOG_Bytes                   dw      MaxDisks  dup(?)
 LOG_TotalSecs               dq      MaxDisks  dup(?)
+                            ALIGN   16
+
+; Storage for INT13 disk parameters
+INT13_DiskParams            db      MaxDisks  dup(10h dup(?))
+                            ALIGN   16
+
+; Storage for INT13X disk parameters
+INT13X_DiskParams           db      MaxDisks  dup(80h dup(?))
+                            ALIGN   16
 
 ; Get's initialized at startup to: 00000011111111111111111111111100b
@@ -2347,7 +2374,9 @@
 ; Each partition with an assigned drive-letter clears a bit in this map.
 FreeDriveletterMap          dd      ?
+                            ALIGN   16
 
 ; LBA address of master LVM sector, zero if non-existant
-MasterLVMLBA                dd      ?
+MasterLVMLBA                dd      MaxDisks  dup(?)
+                            ALIGN   16
 
 
@@ -2364,4 +2393,5 @@
                             dd      ?       ; Second Part of QWORD
 INT13X_DAP_Size = $-offset [INT13X_DAP]     ; Calculated size
+                            ALIGN   16
 
 ;
@@ -2380,12 +2410,14 @@
             ; (excluding the size word at the start).
             i13xbuf_size = $-offset i13xbuf-2
+            ALIGN   16
 
             ; Some debug area.
 dbg_scratch db  512 dup(?)
+            ALIGN   16
 
 
 ; End of transient variables.
 EndOfVariables:
-
+EndOfVariablesAbs = offset EndOfVariables + image_size
 
 
@@ -2405,4 +2437,5 @@
 ; to be partly overwritten by the clearing routine.
                             dd      ?
+                            ALIGN   16
 
 ; SS:SP from before our relocation.
@@ -2418,10 +2451,10 @@
 CurrentSP                   dw      ?
 CurrentSS                   dw      ?
-
+                            ALIGN   16
 ;
 ; End of BSS segment.
 ;
 eobss:
-
+eobss_abs = offset eobss + image_size
 ;
 ; Total RAM occupied, including BSS.
@@ -2429,5 +2462,5 @@
 ; Note that the LDRIMAGE is of constant size, 7C00h = 62 sectors of 512 bytes.
 ;
-resident_size = (offset eobss + image_size)
+resident_size = offset eobss + image_size
 
 ;
