Changeset 52 for trunk/BOOTCODE/SETUP


Ignore:
Timestamp:
Apr 13, 2014, 4:45:41 PM (12 years ago)
Author:
Ben Rietbroek
Message:

Added BOOKMARK Comments [2013-02-27]

I recently added the 'addons' plugin to Geany, the editor I use on
Linux, and it contains a very handy feature to scan sources for tags
like FIXME:, BOOKMARK: and the like. Custom tags can also be defined.

So I added some major bookmark locations to easily navigate around
multiple sources. What's also nice is that of course these tags can be
listed with grep. For instance, grep -r -n 'BOOKMARK:' *.ASM will
display a list of all bookmark comments with line-numbers in the
assembler sources in the current and underlying directories.

Changes:

o Started fixing the CRC issue

Since AiR-BOOT now updates the PBR on HPFS and JFS, the CRC needs to
be recalculated and stored in the IPT. Otherwise AB will think the
PBR is infected and a virus message will appear.

o Changed PART_UpdateBootRecordCRC

Only PartitionSector could be CRC'd because it was hard coded.
Also, SI got immediately overwritten and that might have been an
unsurfaced bug, even in v.106. Have to investigate this further.
Changed to use BX as a pointer to the sector to be CRC'd.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/BOOTCODE/SETUP/PART_SET.ASM

    r51 r52  
    620620   je      PSCPN_NotLVMSupported
    621621
    622    ; ------------------------------------------------------------[LVM CHECK]---
    623    ; Load LVM-Sector here and seek to PartitionName
    624    ; Set CurPartition_Location information of destination partition
    625    mov     ax, [si+LocIPT_AbsolutePartTable]
    626    mov     [CurPartition_Location+0], ax
    627    mov     ax, [si+LocIPT_AbsolutePartTable+2]
    628    mov     [CurPartition_Location+2], ax
    629    mov     ah, byte ptr [si+LocIPT_LocationPartTable+0]
    630    mov     al, byte ptr [si+LocIPT_Drive]
    631    mov     [CurPartition_Location+4], ax
    632    mov     ax, [si+LocIPT_LocationPartTable+1]
    633    mov     [CurPartition_Location+6], ax
    634    mov     di, si                        ; Put SI into DI
    635    call    DriveIO_LoadLVMSector
    636    jnc     PSCPN_LVMGotError             ; Security again, if problem -> halt
    637    push    dx
     622    ;
     623    ; BOOKMARK: LVM Label Manipulations
     624    ;
     625   
     626    ; ------------------------------------------------------------[LVM CHECK]---
     627    ; Load LVM-Sector here and seek to PartitionName
     628    ; Set CurPartition_Location information of destination partition
     629    mov     ax, [si+LocIPT_AbsolutePartTable]
     630    mov     [CurPartition_Location+0], ax
     631    mov     ax, [si+LocIPT_AbsolutePartTable+2]
     632    mov     [CurPartition_Location+2], ax
     633    mov     ah, byte ptr [si+LocIPT_LocationPartTable+0]
     634    mov     al, byte ptr [si+LocIPT_Drive]
     635    mov     [CurPartition_Location+4], ax
     636    mov     ax, [si+LocIPT_LocationPartTable+1]
     637    mov     [CurPartition_Location+6], ax
     638    mov     di, si                        ; Put SI into DI
     639    call    DriveIO_LoadLVMSector
     640    jnc     PSCPN_LVMGotError             ; Security again, if problem -> halt
     641    push    dx
    638642      mov     ax, [di+LocIPT_AbsoluteBegin]
    639643      mov     dx, [di+LocIPT_AbsoluteBegin+2]
    640644      call    LVM_SearchForPartition
    641    pop     dx
    642    jnc     PSCPN_LVMGotError             ; Not Found? -> display error and halt
     645    pop     dx
     646    jnc     PSCPN_LVMGotError             ; Not Found? -> display error and halt
    643647
    644648
    645649    ; Point to LVM VolumeName
    646    add     si, LocLVM_VolumeName
    647 
    648 
    649    xchg    si, di                        ; SI-IPTEntry, DI-LVM PartName
    650    jmp     PSCPN_CheckPartName           ; Check, if match...
    651 
    652 
    653 
    654   PSCPN_LVMGotError:
    655    jmp     MBR_LoadError
    656 
    657 
    658 
    659 ;   mov     si, di                        ; Restore SI and bootrecord fall-back
    660   PSCPN_NotLVMSupported:
    661    ; ----------------------------------------------------[BOOT-RECORD CHECK]---
    662    ; Load Boot-Record...
    663    push    dx
     650    add     si, LocLVM_VolumeName
     651
     652
     653    xchg    si, di                        ; SI-IPTEntry, DI-LVM PartName
     654    jmp     PSCPN_CheckPartName           ; Check, if match...
     655
     656
     657
     658    PSCPN_LVMGotError:
     659    jmp     MBR_LoadError
     660
     661
     662
     663    ;   mov     si, di                        ; Restore SI and bootrecord fall-back
     664    PSCPN_NotLVMSupported:
     665    ; ----------------------------------------------------[BOOT-RECORD CHECK]---
     666    ; Load Boot-Record...
     667    ; BOOKMARK: Load Boot Record
     668    push    dx
    664669      mov     ax, [si+LocIPT_AbsoluteBegin+0]
    665670      mov     bx, [si+LocIPT_AbsoluteBegin+2]
     
    668673      mov     dl, [si+LocIPT_Drive]
    669674      call    DriveIO_LoadPartition
    670    pop     dx
    671 
    672    ; We seek to Partition Label within boot-record here
    673    mov     di, offset PartitionSector
    674 
    675    push    si
     675    pop     dx
     676
     677    ; We seek to Partition Label within boot-record here
     678    mov     di, offset PartitionSector
     679
     680    push    si
    676681      mov     al, [si+LocIPT_SystemID]
    677682      call    PART_SearchFileSysName
    678683      ; Replies AH - FileSysFlags, AL - UnhiddenID, SI - FileSysNamePtr
    679    pop     si
    680 
    681    test    ah, FileSysFlags_NoName       ; If NoName by FileSysFlag
    682    jnz     PSCPN_LetUserEditPartName     ;  -> don't put it into BR at anytime
    683    test    ah, FileSysFlags_FAT32        ; FAT32 specific name getting
    684    jz      PSCPN_ResumeNormal
    685    add     di, 1Ch                       ; Fix for FAT 32, shit
    686   PSCPN_ResumeNormal:
    687    add     di, 2Bh                       ; ES:DI - Name of Partition
    688 
    689 
    690 
    691 
    692 
    693    ; This code is used for BR and LVM checking
    694    ; Rousseau: Because AiR-BOOT v1.0.8 uses the LVM_VolumeName, which is copied
    695    ; to the IPT, this compare fails when the LVM_PartitionName is not
    696    ; the same as the LVM_VolumeName. In that case, only the LVM_VolumeName
    697    ; is updated. If they are the same, both are upated so they are the same
    698    ; again after the edit.
    699 
    700   PSCPN_CheckPartName:
     684    pop     si
     685
     686    test    ah, FileSysFlags_NoName       ; If NoName by FileSysFlag
     687    jnz     PSCPN_LetUserEditPartName     ;  -> don't put it into BR at anytime
     688    test    ah, FileSysFlags_FAT32        ; FAT32 specific name getting
     689    jz      PSCPN_ResumeNormal
     690    add     di, 1Ch                       ; Fix for FAT 32, shit
     691    PSCPN_ResumeNormal:
     692    add     di, 2Bh                       ; ES:DI - Name of Partition
     693
     694
     695
     696
     697
     698    ; This code is used for BR and LVM checking
     699    ; Rousseau: Because AiR-BOOT v1.0.8 uses the LVM_VolumeName, which is copied
     700    ; to the IPT, this compare fails when the LVM_PartitionName is not
     701    ; the same as the LVM_VolumeName. In that case, only the LVM_VolumeName
     702    ; is updated. If they are the same, both are upated so they are the same
     703    ; again after the edit.
     704
     705    PSCPN_CheckPartName:
    701706
    702707    ; Do no synchronization initially.
    703708    mov     byte ptr [SyncLvmLabels],0
    704709
    705   ; SI = IPT_Enty, DI points to LVM VolumeName.
     710    ; SI = IPT_Enty, DI points to LVM VolumeName.
    706711
    707712        ; If the partition is an LVM partition then disable editing completely.
     
    709714        jnz     no_type_35h
    710715
    711    ; Cannot boot LVM-Data partitions
    712    pusha
    713    mov     cx, 0C04h
    714    mov     si, offset TXT_SETUP_NoEditType35
    715    call    SETUP_ShowErrorBox
    716    popa
     716    ; Cannot boot LVM-Data partitions
     717    pusha
     718    mov     cx, 0C04h
     719    mov     si, offset TXT_SETUP_NoEditType35
     720    call    SETUP_ShowErrorBox
     721    popa
    717722
    718723
     
    740745
    741746
    742    mov     cx, 11                        ; Partition-Name-Length = 11 Bytes
    743    push    si
    744    push    di
     747    mov     cx, 11                        ; Partition-Name-Length = 11 Bytes
     748    push    si
     749    push    di
    745750      add     si, LocIPT_Name            ; DS:SI -> Partition-Name
    746751      repz    cmpsb
    747    pop     di
    748    pop     si
    749    jne     PSCPN_LetUserEditPartName     ; -> No BR/LVM Changing/Saving
    750 
    751    mov     byte ptr [ChangePartNameSave], 1         ; Remember, so we will save to BR
    752 
    753   ; SI = IPT_Enty, DI points to LVM PartitionName.
    754   PSCPN_LetUserEditPartName:
    755    ; User will now edit the volume label...
    756    mov     cx, 11
    757    add     si, LocIPT_Name               ; DS:SI -> Partition-Name
    758    call    VideoIO_LetUserEditString     ; -> does actual editing
    759    jnc     PSCPN_AllDone                 ; Did user abort ?
    760 
    761    test    byte ptr [ChangePartNameSave], 1
    762    jz      PSCPN_AllDone                 ; Actually we just skip BR/LVM-Save
    763 
    764    ; Check, where to save 2nd destination to...
    765 
    766    ;movzx   bx, dl
    767    mov   bl,dl
    768    mov   bh,0
    769 
    770    cmp     byte ptr [PartitionVolumeLetters+bx], 0 ; ==0 means not supported by LVM
    771    je      PSCPN_SaveBootRecord
    772 
    773 
    774    ; Make DI point to LVM VolumeName in LVM-entry
    775    ;~ sub     di,20
     752    pop     di
     753    pop     si
     754    jne     PSCPN_LetUserEditPartName     ; -> No BR/LVM Changing/Saving
     755
     756    mov     byte ptr [ChangePartNameSave], 1         ; Remember, so we will save to BR
     757
     758    ; SI = IPT_Enty, DI points to LVM PartitionName.
     759    PSCPN_LetUserEditPartName:
     760    ; User will now edit the volume label...
     761    mov     cx, 11
     762    add     si, LocIPT_Name               ; DS:SI -> Partition-Name
     763    call    VideoIO_LetUserEditString     ; -> does actual editing
     764    jnc     PSCPN_AllDone                 ; Did user abort ?
     765
     766    test    byte ptr [ChangePartNameSave], 1
     767    jz      PSCPN_AllDone                 ; Actually we just skip BR/LVM-Save
     768
     769    ; Check, where to save 2nd destination to...
     770
     771    ;movzx   bx, dl
     772    mov   bl,dl
     773    mov   bh,0
     774
     775    cmp     byte ptr [PartitionVolumeLetters+bx], 0 ; ==0 means not supported by LVM
     776    je      PSCPN_SaveBootRecord
     777
     778
     779    ; Make DI point to LVM VolumeName in LVM-entry
     780    ;~ sub     di,20
    776781
    777782        ; Points to LVM VolumeName.
     
    831836
    832837    LVM_no_sync_labels:
    833 
    834    ; Update LVM-CRC now...
    835    mov     si, offset LVMSector
    836    call    LVM_UpdateSectorCRC
    837    IFDEF ReleaseCode
    838       call    DriveIO_SaveLVMSector      ; Save sector
    839    ENDIF
    840    jmp     PSCPN_AllDone
    841 
    842    ; -----------------------------------------------------[BOOT-RECORD SAVE]---
    843   PSCPN_SaveBootRecord:
    844    ; Copy 11 bytes from IPT to Boot-Record
    845    mov     cx, 11
    846    push    si
    847       rep     movsb                      ; Copy IPT-name to Boot-Record
    848    pop     si
    849    IFDEF ReleaseCode
    850       call    DriveIO_SavePartition      ; Saves Boot-Record
    851    ENDIF
    852 
    853    ; And reset VIBR-CRC, otherwise virus-warning and system-halt
    854    sub     si, LocIPT_Name               ; Now pointer points to base again...
    855    call    PART_UpdateBootRecordCRC
    856 
    857   PSCPN_AllDone:
    858    ; This here is done for safety, because we misused CurPartition_Location
    859    xor     ax, ax
    860    mov     di, offset CurPartition_Location
    861    mov     cx, 4
    862    rep     stosw                         ; NUL out CurPartition_Location
    863    ret
     838        ; Update LVM-CRC now...
     839        mov     si, offset LVMSector
     840        call    LVM_UpdateSectorCRC
     841        IFDEF ReleaseCode
     842          call    DriveIO_SaveLVMSector      ; Save sector
     843        ENDIF
     844        jmp     PSCPN_AllDone
     845
     846    ; -----------------------------------------------------[BOOT-RECORD SAVE]---
     847    ; BOOKMARK: Save Boot Record (After change from Setup Menu)
     848    PSCPN_SaveBootRecord:
     849        ; Copy 11 bytes from IPT to Boot-Record
     850        mov     cx, 11
     851        push    si
     852          rep     movsb                      ; Copy IPT-name to Boot-Record
     853        pop     si
     854        IFDEF ReleaseCode
     855          call    DriveIO_SavePartition      ; Saves Boot-Record
     856        ENDIF
     857
     858    ; And reset VIBR-CRC, otherwise virus-warning and system-halt
     859    ; BOOKMARK: Update CRC on Partition Sector
     860    sub     si, LocIPT_Name               ; Now pointer points to base again...
     861    mov     bx, offset [PartitionSector]
     862    call    PART_UpdateBootRecordCRC
     863
     864    PSCPN_AllDone:
     865        ; This here is done for safety, because we misused CurPartition_Location
     866        xor     ax, ax
     867        mov     di, offset CurPartition_Location
     868        mov     cx, 4
     869        rep     stosw                         ; NUL out CurPartition_Location
     870    ret
    864871PARTSETUP_ChangePartitionName   EndP
    865872
Note: See TracChangeset for help on using the changeset viewer.