Changeset 34 for trunk/BOOTCODE/SPECIAL/LVM.ASM
- Timestamp:
- Jan 13, 2013, 9:07:21 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BOOTCODE/SPECIAL/LVM.ASM
r30 r34 166 166 ret 167 167 LVM_SearchForPartition EndP 168 169 170 ; Gets a drive-letter from the LVM-info of a partition. (if it exists) 171 ; In: BX:CX - LBA starting sector of partition to be searched 172 ; DL = Physical Disk in BIOS notation. (80h+) 173 ; Out: Carry set, if LVM-info found 174 ; AL - drive-letter from LVM-info 175 176 LVM_GetDriveLetter Proc Near Uses bx cx dx si di ds es 177 ; For primary partitions this information is stored in the last 178 ; sector of track0; for all four partition entries should they 179 ; all be primary ones. 180 ; 181 ; LVM DLAT info for logical partitions is stored in the sector 182 ; preceding the start of the partition. 183 ; 184 ; Because the LVM info of a logical partition is the easiest to find, 185 ; we do that first. The LVM info for primary partitions is located 186 ; dependent on the geometry in use, so we use a special locater 187 ; call for that. Also, since the LVM info for primaries contains 188 ; info on all 4 entries, we need the partition index to obtain the 189 ; correct drive-letter. 190 ; 191 192 ; See if this is a primary partition 193 ; CY will be set if it is and AL will contain the 0-based 194 ; index in the P-table. 195 ; If it's a logical partition, CY will be clear and AL 196 ; will be set to 0ffh indicating an invalid index. 197 call PART_IsPrimaryPartition 198 mov al,0 199 rcl al,1 ; CY if primary 200 mov dh,al ; Save PRI or LOG 201 202 ; Save PRI/LOG indicator for later use 203 push dx 204 205 ; Load *possible* LVM sector 206 ; This load is only valid if the partition is logical, in which case 207 ; the LVM sector is below the start of the partition. 208 ; If primary, the LVM sector is at a location that 209 ; DriveIO_LoadMasterLVMSector will find out. 210 211 ; Push LBA address 212 push bx 213 push cx 214 215 ; Adjust for logical LVM-sector 216 sub cx,1 217 sbb bx,0 218 219 ; Load the LVM sector 220 push si 221 push di 222 mov si,offset [LVMSector] 223 mov di,ds 224 call DriveIO_LoadSectorLBA 225 pop di 226 pop si 227 228 ; Restore LBA address 229 pop cx 230 pop bx 231 232 ; Restore PRI/LOG partition indicator in DH 233 pop dx 234 235 ; Test PRI or not 236 test dh,dh 237 ; It's not a PRI so we can use the previously loaded LVM sector 238 jz LVM_GetDriveLetter_is_not_pri 239 240 ; It's a PRI so we use the special locator function. 241 ; This locator takes care of extended eCS geometry should that be used 242 call DriveIO_LoadMasterLVMSector 243 244 LVM_GetDriveLetter_is_not_pri: 245 246 247 ; 248 ; At this stage the LVM-info sector has been loaded at [LVMSector]. 249 ; From here we look for an LVM entry for the partition. 250 ; If one is found, based on it's LBA-start, it's driveletter is used 251 ; in case byte 25h is zero. 252 ; 253 254 255 ; Search for the partition in the LVM info. 256 ; If found, CY is set and SI points to LVM entry. 257 push si 258 mov ax,cx 259 mov dx,bx 260 mov si,offset [LVMSector] 261 call LVM_SearchForPartition 262 mov bx,si ; BX now points to LVM entry 263 mov dx,0 ; Setup null driveletter 264 pop si 265 266 mov al,0 267 ; Oops, no valid LVM record was used so we have a null driveletter. 268 jnc LVM_GetDriveLetter_null_lvm_dl 269 270 ; 271 ; At this point BX points to the LVM-entry related to the 272 ; partition, whether it was a logical or a primary one. 273 ; 274 mov al,[bx+LocLVM_VolumeLetter] 275 ; Clear CY if 0 276 test al,al 277 clc 278 jz LVM_GetDriveLetter_null_lvm_dl 279 stc 280 281 LVM_GetDriveLetter_null_lvm_dl: 282 ret 283 LVM_GetDriveLetter EndP 284 168 285 169 286 ; Removes a given drive-letter from the whole LVM information sector
Note:
See TracChangeset
for help on using the changeset viewer.