Changeset 78


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

More hard-coded '80h' corrections [v1.1.1-testing]

Code in 'partmain.asm' around line 1350 needs some more attention.
Possibly the whole 'boot-flag' stuff is not needed with modern BIOSses.
Updating them is disabled for now, which should only affect very old
BIOSses that don't leave this checking to the MBR code.

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

Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/bootcode/airboot.asm

    r77 r78  
    120120BIOS_AUXPARMS_DEFAULT   EQU     (AUX_INIT_PARMS SHL 8) OR BIOS_COM_PORT
    121121
    122 ; Default byte value for BIOS_BootDisk variabls
     122; Default byte value for BIOS_BootDisk variable
    123123BIOS_BOOTDISK_DEFAULT   EQU     80h
    124124
  • trunk/bootcode/regular/driveio.asm

    r67 r78  
    3939        mov     es, ax
    4040        mov     bx, offset Configuration
    41         mov     dx, 0080h                     ; First harddrive, Sector 55...
    42         mov     cx, 0037h
     41        xor     dh, dh
     42        mov     dl, [BIOS_BootDisk]           ; Disk we booted from
     43        mov     cx, 0037h                     ; Sector 55 (CHS)
    4344        mov     ax, 0201h                     ; Function 02, read 1 sector...
    4445        int     13h
     
    8687        ; ES == CS
    8788        mov     bx, offset Configuration
    88         mov     dx, 0080h                     ; First harddrive, Sector 55...
    89         mov     cx, 0037h
     89        xor     dh, dh
     90        mov     dl, [BIOS_BootDisk]           ; Disk we booted from
     91        mov     cx, 0037h                     ; Sector 55 (CHS)
    9092
    9193        ; Changed from 5 to calculated value
     
    173175        mov     di, offset LBASwitchTable
    174176        mov     dh, [TotalHarddiscs]
    175         mov     dl, 80h
     177        mov     dl, 80h        ; First disk to process
    176178    DIOILUT_DriveLoop:
    177179        push    dx
     
    197199        mov     bptr ds:[di], ah  ; Save that value
    198200        inc     di                ; Go to next BYTE
    199         inc     dl
    200         dec     dh
    201         jnz     DIOILUT_DriveLoop
     201        inc     dl                ; Next disk
     202        dec     dh                ; Decrease disks to process
     203        jnz     DIOILUT_DriveLoop ; Next disk if DH != 0
    202204        ret
    203205DriveIO_InitLBASwitchTable  EndP
     
    800802        ; checking the AiR-BOOT MBR.
    801803        ;
    802         cmp     dl,80h
    803         ja      DriveIO_ProtectMBR_is_not_bootdisk
     804        cmp     dl, [BIOS_BootDisk]
     805        jne     DriveIO_ProtectMBR_is_not_bootdisk
    804806
    805807        ;
  • trunk/bootcode/regular/other.asm

    r76 r78  
    166166        call    MBR_TeletypeNL
    167167
     168        ;
     169        ; Write MBR back to disk to sync MBR variables.
     170        ; Otherwise subsequent MBR loads will differ from the RAM stored one,
     171        ; which is used by MBR protection to validate parts of the MBR.
     172        ;
     173        xor     bx, bx
     174        mov     cx, 1
     175        xor     dh, dh
     176        mov     dl, [BIOS_BootDisk]
     177        mov     al, 1
     178        mov     ah, 03h
     179        int     13h
     180
     181
     182        ; Start with disk at index 0
    168183        xor     cx,cx
     184
    169185    PRECRAP_Main_next_disk:
    170186
     187        ; Get next disk and convert to BIOS disk-number
    171188        mov     dl,cl
    172189        or      dl,80h
     
    431448        mov     ah, 41h
    432449        mov     bx, 55AAh
    433         mov     dl, 80h
     450        mov     dl, [BIOS_BootDisk]     ; We check using the boot-disk
    434451        int     13h
    435452        cmp     bx, 0AA55h
  • trunk/bootcode/regular/partmain.asm

    r76 r78  
    13181318        ; --- HIDE COMPLETED ---
    13191319        ; So something got hidden and we have to remark a primary partition,
    1320         ;  if we are booting something non-primary from 1st hdd.
    1321         cmp     bptr [si+LocIPT_Drive], 80h
    1322         ja      PSP_HideAdjustPrimaryMark  ; When booting any hdd, but 1st
     1320        ;  if we are booting something non-primary from the boot-disk.
     1321        mov     al, [BIOS_BootDisk]
     1322        cmp     bptr [si+LocIPT_Drive], al
     1323        jne     PSP_HideAdjustPrimaryMark  ; When booting any hdd, but boot-disk
    13231324        mov     ax, wptr [si+LocIPT_AbsolutePartTable]
    13241325        mov     bx, wptr [si+LocIPT_AbsolutePartTable+2]
    13251326        or      ax, ax
    13261327        jnz     PSP_HideAdjustPrimaryMark  ; or booting non-primary partition
    1327         or      bx, bx                     ;  on 1st harddrive.
     1328        or      bx, bx                     ;  on boot-disk.
    13281329        jz      PSP_NoHideAdjustPrimaryMark
    13291330
     
    13331334        xor     bx, bx
    13341335        mov     cx, 0001h                  ; Cylinder 0, Sector 1
    1335         mov     dx, 0080h                  ; First HD, Head 0
    1336                                                                      ; Load MBR
     1336        xor     dh, dh                     ; Head 0
     1337        mov     dl, [BIOS_BootDisk]        ; Boot Disk
     1338
     1339        ; This uses the boot-disk and alters 'CurPartition_Location'.
     1340        ; CHECKME: How does 81h being the boot-disk influences this ?
    13371341        call    DriveIO_LoadPartition      ; Load Primary Partition Table
     1342
     1343        ; This would only be needed for very old BIOSses
    13381344        call    PART_MarkFirstGoodPrimary
    1339         call    DriveIO_SavePartition       ; Saves the Partition-Table
     1345
     1346        ; CHECKME: Disabled writing back MBR with modified boot flags
     1347        ; This is a safety measure now that booting AirBoot from other disks
     1348        ; than 80h can occur.
     1349        ;~ call    DriveIO_SavePartition       ; Saves the Partition-Table
    13401350
    13411351
  • trunk/bootcode/regular/partscan.asm

    r76 r78  
    305305        ; Clearing the boot-flags on other disks would prevent booting them
    306306        ; from the BIOS. (TRAC ticket #6)
    307         cmp     dl, 080h                            ; See if this is boot-disk
     307        cmp     dl, [BIOS_BootDisk]                 ; See if this is boot-disk
    308308        jne     PSSP_Skip_Clear_BootFlag            ; Nope, skip clear flag
    309309        and     byte ptr [si+LocBRPT_Flags], 7Fh    ; Reset the Active-Flag
     
    313313        jb      PSSP_ScanLoop
    314314        ; If we are on first HDD and in primary partition table -> mark primary
    315         cmp     bptr [CurPartition_Location+4], 80h ; Drive
     315        mov     al, [BIOS_BootDisk]
     316        cmp     bptr [CurPartition_Location+4], al  ; Drive
    316317        jne     PSSP_NoMarkPrimary
    317318        cmp     wptr [CurPartition_Location+0], 0
    318319        jne     PSSP_NoMarkPrimary
    319         cmp     wptr [CurPartition_Location+2], 0 ; Absolute Location
     320        cmp     wptr [CurPartition_Location+2], 0   ; Absolute Location
    320321        jne     PSSP_NoMarkPrimary
    321322        call    PART_MarkFirstGoodPrimary
  • trunk/include/version.h

    r76 r78  
    3232#define     BLDLVL_YEAR             "2017"
    3333#define     BLDLVL_MONTH            "03"
    34 #define     BLDLVL_DAY              "18"
     34#define     BLDLVL_DAY              "19"
    3535// Build time
    3636//~ #define     BLDLVL_HOURS            "01"
  • trunk/include/version.inc

    r76 r78  
    7070AB_YEAR             EQU     2017h
    7171AB_MONTH            EQU     03h
    72 AB_DAY              EQU     18h
     72AB_DAY              EQU     19h
    7373
    7474; The Hours, Minutes and Seconds, again in BCD for easy manipulation.
Note: See TracChangeset for help on using the changeset viewer.