# HG changeset patch # User Pascal Bellard # Date 1683820729 0 # Node ID 3c71bb4367c3fc73a57ccde9dc681a23b9690315 # Parent 41581d281860e5cf8b930e6525d4b74767f41609 Up memtest (6.20) diff -r 41581d281860 -r 3c71bb4367c3 BootProg/receipt --- a/BootProg/receipt Sat May 06 08:42:03 2023 +0000 +++ b/BootProg/receipt Thu May 11 15:58:49 2023 +0000 @@ -14,16 +14,19 @@ compile_rules() { mkdir -p $src && cd $src - bs="boot16 bootex boot32" + bs="boot12 boot16 bootex boot32" + cp $stuff/boot??.asm . + cp boot16.asm boot12.asm + sed -i 's|^FAT12.*|FAT12 equ 0|' boot16.asm + sed -i 's|^FAT16.*|FAT16 equ 0|' boot12.asm for i in $bs ; do - cp $stuff/$i.asm . nasm $i.asm -f bin -o $i.bin -l $i.lst || return 1 done sed '1,2!d' $stuff/bootprog.sh > bootprog { sed "1,2d;s|FAT32SZ|$(stat -c %s boot32.bin)|" $stuff/bootprog.sh cat ${bs// /.bin }.bin - } | xz -z --format=lzma --lzma1=lc=0,pb=0,nice=33,dict=4k >> bootprog + } | xz -z --format=lzma --lzma1=lc=0,pb=0,nice=100,dict=4k >> bootprog chmod +x bootprog } diff -r 41581d281860 -r 3c71bb4367c3 BootProg/stuff/boot16.asm --- a/BootProg/stuff/boot16.asm Sat May 06 08:42:03 2023 +0000 +++ b/BootProg/stuff/boot16.asm Thu May 11 15:58:49 2023 +0000 @@ -26,6 +26,14 @@ ;; - cpu 8086 is supported ;; ;; ;; ;; ;; +;; Known Limitation: ;; +;; ~~~~~~~~~~~~~~~~~ ;; +;; - Need a up to date field bpbHiddenSectors to work in a partition ; ;; +;; most formatters don't update it correcly in extended partitions. ;; +;; ;; +;; - Partition must fit in the first 8GB disk for CHS reads. ;; +;; ;; +;; ;; ;; Known Bugs: ;; ;; ~~~~~~~~~~~ ;; ;; - All bugs are fixed as far as I know. The boot sector has been tested ;; @@ -85,12 +93,14 @@ %define bx(label) bx+label-boot %define si(label) si+label-boot NullEntryCheck equ 1 ; +2 bytes -ReadRetry equ 1 ; +9 bytes +ReadRetry equ 1 ; +9/+10 bytes LBAsupport equ 1 ; +16 bytes -Over2GB equ 1 ; +5 bytes +CHSsanityCheck equ 1 ; +12/+16 bytes GeometryCheck equ 1 ; +18 bytes +CheckAttrib equ 0 ; +6 bytes +WaitForKey equ 0 ; +5 bytes SectorOf512Bytes equ 0 ; -4/-6 bytes -CheckAttrib equ 0 ; +6 bytes +Always2FATs equ 0 ; -1 bytes [BITS 16] [CPU 8086] @@ -115,10 +125,10 @@ ;; BPB starts here ;; ;;;;;;;;;;;;;;;;;;;;; -bpbBytesPerSector DW 0 ; 0x0B -bpbSectorsPerCluster DB 0 ; 0x0D -bpbReservedSectors DW 0 ; 0x0E -bpbNumberOfFATs DB 0 ; 0x10 +bpbBytesPerSector DW 0 ; 0x0B 512, 1024, 2048 or 4096 +bpbSectorsPerCluster DB 0 ; 0x0D 1, 2, 4, 8, 16, 32 or 64 +bpbReservedSectors DW 0 ; 0x0E 1 +bpbNumberOfFATs DB 0 ; 0x10 2 bpbRootEntries DW 0 ; 0x11 bpbTotalSectors DW 0 ; 0x13 bpbMedia DB 0 ; 0x15 @@ -134,7 +144,7 @@ bsDriveNumber DB 0 ; 0x24 bsUnused DB 0 ; 0x25 -bsExtBootSignature DB 0 ; 0x26 +bsExtBootSignature DB 0 ; 0x26 29 bsSerialNumber DD 0 ; 0x27 bsVolumeLabel times 11 DB " " ; 0x2B "NO NAME " bsFileSystem times 8 DB " " ; 0x36 "FAT12 " or "FAT16 " @@ -199,21 +209,23 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;; %if GeometryCheck != 0 - mov ah, 8 + %if ((main-boot) & 3Fh) != 0 + xchg ax, cx ; ax & 3Fh == 0 + %endif + mov ah, 8 ; update AX,BL,CX,DX,DI, and ES registers int 13h ; may destroy SI,BP, and DS registers %endif - ; update AX,BL,CX,DX,DI, and ES registers push cs pop ds xor bx, bx %if GeometryCheck != 0 and cx, byte 3Fh - cmp [bx(bpbSectorsPerTrack)], cx - jne BadParams ; verify updated and validity - mov al, dh - inc ax - mov [bpbHeadsPerCylinder], ax + je BadParams ; verify updated and validity + mov [bx(bpbSectorsPerTrack)], cx + mov cl, dh + inc cx + mov [bx(bpbHeadsPerCylinder)], cx BadParams: %endif @@ -246,7 +258,11 @@ xchg ax, di ; di = root directory size in sectors, clear ah %endif +%if Always2FATs != 0 + mov al, 2 +%else mov al, [bpbNumberOfFATs] +%endif mul bp ; [bx(bpbSectorsPerFAT)], set by ReadDISectors push es ; read root directory @@ -282,7 +298,7 @@ pop di je FindNameFound %if NullEntryCheck != 0 - scasb ; Z == NC + scasb ; Z == NC cmc lea di, [di+31] dec word [bx(bpbRootEntries)] @@ -327,6 +343,9 @@ push di ; up to 2 * 635K / BytesPerCluster = 2540 bytes %if FAT12 == 1 mov cl, 12 +%else + nop + nop %endif ClusterLoop: mov [di], si @@ -351,6 +370,9 @@ %if FAT12 == 1 add si, [di] shr si, 1 ; si = cluster * 3 / 2 +%else + nop + nop %endif %if FAT16 == 1 ReadClusterFat16: @@ -502,11 +524,11 @@ int 10h cmp al, "." jne PutStr - + %if WaitForKey != 0 cbw int 16h ; wait for a key... int 19h ; bootstrap - + %endif Stop: hlt jmp short Stop @@ -523,7 +545,7 @@ ;; CX = 0 ;; ;; DI = 0 ;; ;; DL = drive number ;; -;; DX:BP = next LBA from FAT ;; +;; 0:BP = next LBA from FAT ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ReadDISectors: @@ -544,6 +566,7 @@ ;; BX = 0 ;; ;; CX or DI = 0 ;; ;; DL = drive number ;; +;; Keep: BP, SI ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ReadSectors: @@ -575,23 +598,25 @@ push di %endif -%if Over2GB != 0 xchg ax, cx ; save low LBA xchg ax, dx ; get high LBA cwd ; clear dx (LBA offset <1TB) idiv word [bx(bpbSectorsPerTrack)] ; up to 8GB disks + %if CHSsanityCheck != 0 + inc ax + cmp ax, [bx(bpbHeadsPerCylinder)] + ja CHSoverflow + dec ax + %endif xchg ax, cx ; restore low LBA, save high LBA / SPT -%else - xor cx, cx ; up to 2GB disks otherwise divide error interrupt ! -%endif idiv word [bx(bpbSectorsPerTrack)] ; ax = LBA / SPT ; dx = LBA % SPT = sector - 1 inc dx xchg cx, dx ; restore high LBA / SPT, save sector no. - idiv word [bx(bpbHeadsPerCylinder)] + idiv word [bx(bpbHeadsPerCylinder)] ; may overflow if SectorsPerTrack * HeadsPerCylinder < 256 or disk > 8GB ; ax = (LBA / SPT) / HPC = cylinder ; dx = (LBA / SPT) % HPC = head @@ -604,21 +629,43 @@ mov dh, dl ; dh = head no. -ReadSectorRetry: +%if CHSsanityCheck != 0 + %if LBAsupport != 0 + or ah, [si+8+3] ; 8GB max, last cylinder 1023 + %else + or ah, [si+2+3] ; 8GB max, last cylinder 1023 + %endif +%endif +CHSoverflow: mov dl, [bx(DriveNumber)] ; dl = drive no. mov si, sp +%if CHSsanityCheck != 0 + %if ReadRetry != 0 || LBAsupport != 0 + pushf + %endif +%endif + +ReadSectorRetry: %if LBAsupport != 0 mov ah, 42h ; ah = 42h = extended read function no. int 13h ; extended read sectors (DL, DS:SI) jnc ReadSectorNextSegment %endif +%if CHSsanityCheck != 0 + %if ReadRetry != 0 || LBAsupport != 0 + popf + pushf + %endif + jne SkipCHS +%endif mov ax, 201h ; al = sector count = 1 ; ah = 2 = read function no. int 13h ; read sectors (AL, CX, DX, ES:BX) jnc ReadSectorNextSegment +SkipCHS: %if ReadRetry != 0 cbw ; ah = 0 = reset function int 13h ; reset drive (DL) @@ -627,29 +674,34 @@ jnz ReadSectorRetry ; up to 15 extra attempt %endif +ReadError: call Error db "Read error." ReadSectorNextSegment: +%if CHSsanityCheck != 0 && (ReadRetry != 0 || LBAsupport != 0) + popf +%endif + +%macro adjust_es 2 + %if SectorOf512Bytes != 0 + add word %1, byte 32 ; adjust segment for next sector + %else + %if %2 != 0 + mov al, %2 + %endif + mul byte [bx(bpbBytesPerSector)+1] ; = (bpbBytesPerSector/256)*16 + add %1, ax ; adjust segment for next sector + %endif +%endmacro %if LBAsupport != 0 pop ax ; al = 16 - %if SectorOf512Bytes != 0 - add word [si+6], byte 32 ; adjust segment for next sector - %else - mul byte [bx(bpbBytesPerSector)+1] ; = (bpbBytesPerSector/256)*16 - add [si+6], ax ; adjust segment for next sector - %endif + adjust_es [si+6], 0 pop cx ; sector count = 1 pop bx %else - %if SectorOf512Bytes != 0 - add word [si], byte 32 ; adjust segment for next sector - %else - mov al, 16 - mul byte [bx(bpbBytesPerSector)+1] ; = (bpbBytesPerSector/256)*16 - add [si], ax ; adjust segment for next sector - %endif + adjust_es [si], 16 %endif pop es ; es:0 updated pop ax diff -r 41581d281860 -r 3c71bb4367c3 BootProg/stuff/boot32.asm --- a/BootProg/stuff/boot32.asm Sat May 06 08:42:03 2023 +0000 +++ b/BootProg/stuff/boot32.asm Thu May 11 15:58:49 2023 +0000 @@ -25,6 +25,14 @@ ;; instruction and lets the BIOS continue bootstrap. ;; ;; ;; ;; ;; +;; Known Limitation: ;; +;; ~~~~~~~~~~~~~~~~~ ;; +;; - Need a up to date field bpbHiddenSectors to work in a partition ; ;; +;; most formatters don't update it correcly in extended partitions. ;; +;; ;; +;; - Requires i80386 or better CPU. ;; +;; ;; +;; ;; ;; Known Bugs: ;; ;; ~~~~~~~~~~~ ;; ;; - All bugs are fixed as far as I know. The boot sector has been tested ;; @@ -86,13 +94,15 @@ NonMirroredFATs equ 1 ; +18 bytes ReadRetry equ 1 ; +7 bytes LBA48bits equ 1 ; +15 bytes -CHSsupport equ 1 ; +27 bytes max 16MB, 32MB or 8GB -CHSupTo32MB equ 1 ; +6 bytes -CHSupTo8GB equ 1 ; +14 bytes +CHSsupport equ 1 ; +27 bytes max 8GB +CHSgeometryCheck equ 1 ; +18 bytes +CHSsanityCheck equ 1 ; +5 bytes SectorOf512Bytes equ 0 ; -5 bytes Always2FATs equ 0 ; -4 bytes +WaitForKey equ 0 ; +5 bytes [BITS 16] +[CPU 386] ImageLoadSeg equ 60h ; <=07Fh because of "push byte ImageLoadSeg" instructions StackSize equ 512 @@ -115,14 +125,14 @@ ;; BPB1 starts here ;; ;;;;;;;;;;;;;;;;;;;;;; -bpbBytesPerSector DW 0 ; 0x0B -bpbSectorsPerCluster DB 0 ; 0x0D -bpbReservedSectors DW 0 ; 0x0E -bpbNumberOfFATs DB 0 ; 0x10 -bpbRootEntries DW 0 ; 0x11 -bpbTotalSectors DW 0 ; 0x13 -bpbMedia DB 0 ; 0x15 -bpbSectorsPerFAT DW 0 ; 0x16 +bpbBytesPerSector DW 0 ; 0x0B 512, 1024, 2048 or 4096 +bpbSectorsPerCluster DB 0 ; 0x0D 1, 2, 4, 8, 16, 32, 64 or 128 +bpbReservedSectors DW 0 ; 0x0E 32 +bpbNumberOfFATs DB 0 ; 0x10 2 +bpbRootEntries DW 0 ; 0x11 0 +bpbTotalSectors DW 0 ; 0x13 0 +bpbMedia DB 0 ; 0x15 F8, F0 +bpbSectorsPerFAT DW 0 ; 0x16 0 bpbSectorsPerTrack DW 0 ; 0x18 bpbHeadsPerCylinder DW 0 ; 0x1A bpbHiddenSectors DD 0 ; 0x1C @@ -145,7 +155,7 @@ bsreserved times 12 DB 0 ; 0x34 bsDriveNumber DB 0 ; 0x40 bsreserved1 DB 0 ; 0x41 -bsExtendedBootSignature DB 0 ; 0x42 +bsExtendedBootSignature DB 0 ; 0x42 29 bsVolumeSerialNumber DD 0 ; 0x43 bsVolumeLabel times 11 DB " " ; 0x47 "NO NAME " bsFileSystemName times 8 DB " " ; 0x52 "FAT32 " @@ -200,23 +210,44 @@ %else push byte main %endif - push es - pop ds retf %if ExtraBootSector != 0 %macro MovedCode 0 %endif main: - xor ebx, ebx %if ExtraBootSector != 0 add al, 32 - mov es, ax - mov eax, [bx(bpbHiddenSectors)] - inc eax - %if LBA48bits != 0 - mov [bx(HiLBA)], bx - %endif + push ax +%endif +;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Get drive parameters ;; +;; Update heads count ;; +;; for current BIOS ;; +;;;;;;;;;;;;;;;;;;;;;;;;;; + +%if CHSgeometryCheck != 0 + mov ah, 8 ; update AX,BL,CX,DX,DI, and ES registers + int 13h ; may destroy SI,BP, and DS registers +%endif + push cs + pop ds + xor ebx, ebx + +%if CHSgeometryCheck != 0 + and cx, byte 3Fh + je BadParams ; verify updated and validity + mov [bx(bpbSectorsPerTrack)], cx + mov cl, dh + inc cx + mov [bx(bpbHeadsPerCylinder)], cx + xor cx, cx +BadParams: +%endif +%if ExtraBootSector != 0 + pop es + mul ebx ; edx:eax = 0 + inc ax call ReadSectorBoot push ds pop ss @@ -258,9 +289,9 @@ mov cl, NameLength mov si, ProgramName ; ds:si -> program name repe cmpsb -%if CheckAttrib != 0 VolumeLabel equ 8 SubDirectory equ 10h +%if CheckAttrib != 0 jnz SkipFindName test byte [es:di], VolumeLabel+SubDirectory SkipFindName: @@ -277,6 +308,10 @@ ErrFind: call Error ; end of root directory (dir end reached) db "File not found." +%if ExtraBootSector != 0 +%endm +%macro BootFileName 0 +%endif FindNameFound: push word [es:di+14h-11] push word [es:di+1Ah-11] @@ -331,7 +366,7 @@ jmp short Run %if ExtraBootSector != 0 %endm -%macro BootFileName 0 +%macro BootCode 0 %endif ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -400,9 +435,11 @@ int 10h cmp al, '.' jne puts +%if WaitForKey != 0 cbw int 16h ; wait for a key... int 19h ; bootstrap +%endif Stop: hlt @@ -428,7 +465,7 @@ mov bp, [bx(bpbBytesPerSector)] shr bp, 4 ; bp = paragraphs per sector %endif - mov dx, 1 ; adjust LBA for next sector + inc eax ; adjust LBA for next sector inc cx loop ReadSectorLBA @@ -444,17 +481,17 @@ imul si, dx, byte 4 ; si=entry # in sector, clear C %if NonMirroredFATs != 0 - cwde + cdq or dl, byte [bx(bsExtendedFlags)] jns MirroredFATs ; Non-mirrored FATs ? and dl, 0Fh imul edx, dword [bx(bsSectorsPerFAT32)] ; we need to read the active one add eax, edx MirroredFATs: - cwde + cdq %else %if LBA48bits != 0 - xor dx, dx + cdq %endif %endif call ReadSectorLBAfromFAT ; read 1 FAT32 sector @@ -475,45 +512,48 @@ movzx ecx, byte [bx(bpbSectorsPerCluster)] ; 8..128 mul ecx ; edx:eax=sector number in data area add eax, edi -%if LBA48bits != 0 - adc dx, bx -%endif ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Reads a sector form the start of FAT ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ReadSectorLBAfromFAT: - add eax, [bx(bpbHiddenSectors)] %if LBA48bits != 0 - adc dx, bx - mov word [bx(HiLBA)], dx + push dx %endif mov dx, [bx(bpbReservedSectors)] + add eax, edx +ReadSectorLBAfromFAT: + pop dx ; 16TB FAT32 max + adc dx, bx +ReadSectorBoot: + mov [bx(HiLBA)], dx +%endif ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Reads a sector using BIOS Int 13h fn 42h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; Input: EAX = LBA ;; -;; CX = sector count ;; +;; Input: EAX+EDX = LBA ;; ;; ES:BX -> buffer address ;; +;; Keep: ESI = next cluster ;; +;; EDI = data cluster ;; +;; BP = paragraphs / sector ;; +;; CX = sector count ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ReadSectorLBA: - add eax, edx %if LBA48bits != 0 - adc word [bx(HiLBA)], bx + mov dx, [bx(HiLBA)] +%else + xor dx, dx ; 2TB FAT32 max +ReadSectorBoot: %endif -ReadSectorBoot: - mov dx, [bx(DriveNumber)] ; restore BIOS boot drive number - pusha + pushad - push bx -%if LBA48bits != 0 - push word [bx(HiLBA)] ; 48-bit LBA -%else - push bx -%endif + add eax, [bx(bpbHiddenSectors)] + adc dx, bx ; 2TB partition offset max + + push edx push eax push es push bx @@ -521,58 +561,56 @@ push byte 16 ; packet size byte = 16, reserved byte = 0 %if CHSsupport != 0 - %if CHSupTo8GB != 0 - push eax - pop cx ; save low LBA - pop ax ; get high LBA - cwd ; clear dx (assume LBA offset <1TB) - idiv word [bx(bpbSectorsPerTrack)] ; up to 8GB disks, avoid divide error - - xchg ax, cx ; restore low LBA, save high LBA / SPT - %else ; Busybox mkdosfs creates fat32 for floppies. ; Floppies may support CHS only. - %if CHSupTo32MB != 0 - xor dx, dx ; clear dx (LBA offset <32MB) - %else - cwd ; clear dx (LBA offset <16MB) - %endif - xor cx, cx ; high LBA / SPT = 0 + %if LBA48bits != 0 +; The following check is only useful with bpbSectorsPerTrack < 8 with disk > 4TB... +; setnz dl ; force cylinder overflow without divide error %endif - idiv word [bx(bpbSectorsPerTrack)] - ; ax = LBA / SPT - ; dx = LBA % SPT = sector - 1 + movzx ecx, word [bx(bpbSectorsPerTrack)] + idiv ecx + ; eax = LBA / SPT + ; edx = LBA % SPT = sector - 1 inc dx - - xchg cx, dx ; restore high LBA / SPT, save sector no. - idiv word [bx(bpbHeadsPerCylinder)] - ; ax = (LBA / SPT) / HPC = cylinder - ; dx = (LBA / SPT) % HPC = head + push dx ; save sector no. + cdq + mov cx, word [bx(bpbHeadsPerCylinder)] + idiv ecx + pop cx + ; eax = (LBA / SPT) / HPC = cylinder + ; dl = (LBA / SPT) % HPC = head xchg ch, al ; clear al ; ch = LSB 0...7 of cylinder no. - %if CHSupTo8GB != 0 || CHSupTo32MB != 0 - shr ax, 2 - or cl, al + %if CHSsanityCheck != 0 + shl eax, 6 + %else + shl ax, 6 + %endif + or cl, ah ; cl = MSB 8...9 of cylinder no. + sector no. - %endif mov dh, dl ; dh = head no. - mov dl, [bx(DriveNumber)] ; restore BIOS boot drive number %endif ReadSectorRetry: + mov dl, [bx(DriveNumber)] ; restore BIOS boot drive number mov si, sp mov ah, 42h ; ah = 42h = extended read function no. int 13h ; extended read sectors (DL, DS:SI) jnc ReadSuccess ; CF = 0 if no error %if CHSsupport != 0 + %if CHSsanityCheck != 0 + cmp eax, 0FFFFh ; max cylinder = 1023 + ja SkipCHS + %endif mov ax, 201h ; al = sector count = 1 ; ah = 2 = read function no. int 13h ; read sectors (AL, CX, DX, ES:BX) jnc ReadSuccess ; CF = 0 if no error +SkipCHS: %endif %if ReadRetry != 0 %if CHSsupport != 0 @@ -592,11 +630,13 @@ ReadSuccess: popa ; sp += 16 - popa + popad + mov dx, [bx(DriveNumber)] ; restore BIOS boot drive number ret %if ExtraBootSector != 0 MovedCode + BootCode %endif ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -616,11 +656,11 @@ ;; End of the sector ID ;; ;;;;;;;;;;;;;;;;;;;;;;;;;; - dw 0AA55h ; BIOS checks for this ID + dw 0AA55h ; BIOS checks for this ID %if ExtraBootSector != 0 - dd 61415252h ; "RRaA" - BootFileName - times (996-($-$$)) db 0 -; dd 41617272h ; "rrAa" + dd 61415252h ; "RRaA" + BootFileName + times (996-($-$$)) db 0 +; dd 41617272h ; "rrAa" %endif diff -r 41581d281860 -r 3c71bb4367c3 BootProg/stuff/bootex.asm --- a/BootProg/stuff/bootex.asm Sat May 06 08:42:03 2023 +0000 +++ b/BootProg/stuff/bootex.asm Thu May 11 15:58:49 2023 +0000 @@ -82,6 +82,9 @@ ReadRetry equ 1 ; +8 bytes SectorOf512Bytes equ 0 ; -11 bytes CheckAttrib equ 0 ; +18 bytes +WaitForKey equ 0 ; +5 bytes +TfatSupport equ 1 ; +10 bytes +CheckLBAsupport equ 0 ; +11/21 bytes [BITS 16] [CPU 386] @@ -117,11 +120,11 @@ bpbVolumeSerial DD 0 ; 0x64 volume serial number bpbFSVersionMinor DB 0 ; 0x68 bpbFSVersionMajor DB 0 ; 0x69 -bpbVolumeStateFlags DW 0 ; 0x6A +bpbVolumeStateFlags DW 0 ; 0x6A bit0 = fat used, bit1 = dirty, bit2 = media error bpbSectorSizeBits DB 0 ; 0x6C sector size as (1 << n) bpbSectorPerClusterBits DB 0 ; 0x6D sector per cluster as (1 << n) -bpbNumberOfFATs DB 0 ; 0x6E always 1 -bpbDriveNumber DB 0 ; 0x6F alaways 0x80 +bpbNumberOfFATs DB 0 ; 0x6E always 1 or 2 (Tfat case) +bpbDriveNumber DB 0 ; 0x6F always 0x80 bpbAllocatedPercent DB 0 ; 0x70 percentage of allocated space ;;;;;;;;;;;;;;;;;;; @@ -170,7 +173,21 @@ push word main retf +%if CheckLBAsupport != 0 +%macro BootFileName 0 main: + mov ah, 41h ; clobbers AX, BX, CX, DH + mov bx, 55AAh + int 13h + jc ReadError +; xor bx, 0AA55h +; jnz ReadError +; shr cx, 1 ; function 42h support ? +; jnc ReadError + xor cx, cx +%else +main: +%endif push cs pop ds @@ -205,46 +222,45 @@ FindNameCycle: pusha +%if NullEntryCheck != 0 + xor ax, ax + or al, [es:di] + je FindNameFailed + %define curtag al + %define chktag al +%else + %define curtag byte [es:di] + %define chktag ax +%endif + cmp curtag, 0c0h ; EXFAT_ENTRY_FILE_INFO ? + jne NotFileInfo + + mov bl, 32 +CopyInfo: + mov [bx], al + dec bx + mov al, [es:di+bx] + jnz CopyInfo ; keep BIOS boot drive number + +NotFileInfo: %if CheckAttrib != 0 Attributes equ 0Bh ; 1 byte - cmp byte [es:di], 85h ; EXFAT_ENTRY_FILE ? + cmp curtag, 85h ; EXFAT_ENTRY_FILE ? jne NotEntryFile mov al, [es:di+Attributes] mov [ProgramName+NameLength+1], al NotEntryFile: %endif -%if NullEntryCheck != 0 - xor ax, ax - or al, [es:di] - je FindNameFailed - cmp al, 0c0h ; EXFAT_ENTRY_FILE_INFO ? -%else - cmp byte [es:di], 0c0h ; EXFAT_ENTRY_FILE_INFO ? -%endif - jne NotFileInfo - - mov bl, 31 -CopyInfo: - mov al, [es:di+bx] - mov [bx], al - dec bx - jnz CopyInfo ; keep BIOS boot drive number - -NotFileInfo: -%if NullEntryCheck != 0 - mov al, 0c1h ; EXFAT_ENTRY_FILE_NAME ? -%else - mov ax, 0c1h ; EXFAT_ENTRY_FILE_NAME ? -%endif + mov chktag, 0c1h ; EXFAT_ENTRY_FILE_NAME ? mov cx, NameLength+1 mov si, ProgramName ; ds:si -> program name CheckName: scasw ; compare UTF-16 lodsb ; with ASCII loope CheckName -%if CheckAttrib != 0 VolumeLabel equ 8 SubDirectory equ 10h +%if CheckAttrib != 0 jnz SkipFindName test byte [si], VolumeLabel+SubDirectory SkipFindName: @@ -370,6 +386,9 @@ ;; All done, transfer control to the program now ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; retf +%if CheckLBAsupport != 0 +%endm +%endif ;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Error Messaging Code ;; @@ -385,11 +404,11 @@ int 10h cmp al, "." jne PutStr - +%if WaitForKey != 0 cbw int 16h ; wait for a key... int 19h ; bootstrap - +%endif Stop: hlt jmp short Stop @@ -398,6 +417,7 @@ ;; Reads a exFAT cluster ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Input: EDX:EAX = LBA ;; +;; EBX = 0 ;; ;; CX = sector cnt ;; ;; ESI = cluster no ;; ;; ES:0 -> buffer adrs ;; @@ -406,7 +426,6 @@ ;; ESI = cluster no ;; ;; EBP = bytes/sector;; ;; Keep: EDI = 0 ;; -;; EBX = 0 ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ReadCluster: @@ -418,9 +437,11 @@ mul ebx ; edx:eax = 0 %if SectorOf512Bytes != 0 mov al, 128 +%define SectorPerClusterBits [bx(bpbSectorPerClusterBits)] %else mov ah, 40h mov cx, [bx(bpbSectorSizeBits)] +%define SectorPerClusterBits ch rol ax, cl ; eax=# of exFAT entries per sector %endif lea edi, [esi-2] ; edi=cluster #-2 @@ -431,15 +452,17 @@ cdq add eax, [bx(bpbFatSectorStart)] ; sector # relative to exFAT +%if TfatSupport + test byte [bx(bpbVolumeStateFlags)], 1 + jz UseFat0 + add eax, [bx(bpbFatSectorCount)] +UseFat0: +%endif call ReadSectorFAT ; read 1 exFAT sector, keep edx=0, set C mov esi, [es:si] ; esi=next cluster # -%if SectorOf512Bytes != 0 - mov dl, [bx(bpbSectorPerClusterBits)] -%else - mov dl, ch -%endif + mov dl, SectorPerClusterBits xor ecx, ecx bts ecx, edx ; 10000h max (32MB cluster) xchg eax, edi ; get cluster #-2 @@ -455,12 +478,12 @@ ;; Reads a sector using BIOS Int 13h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Input: EDX:EAX = LBA ;; +;; EBX = 0 ;; ;; ES:0 -> buffer address ;; ;; Output: EBP = bytes/sector ;; ;; Keep: ESI = cluster ;; ;; EDI = FAT sector or 0 ;; ;; ECX = sector count ;; -;; EBX = 0 ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; %if SectorOf512Bytes != 0 @@ -503,6 +526,7 @@ %endif %endif +ReadError: call Error db "Read error." @@ -515,6 +539,10 @@ popad ; real registers ret +%if CheckLBAsupport != 0 + BootFileName +%endif + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Fill free space with zeroes ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; diff -r 41581d281860 -r 3c71bb4367c3 BootProg/stuff/bootprog.sh --- a/BootProg/stuff/bootprog.sh Sat May 06 08:42:03 2023 +0000 +++ b/BootProg/stuff/bootprog.sh Thu May 11 15:58:49 2023 +0000 @@ -19,15 +19,15 @@ esac | $w=499 count=11 case "$f" in *32) $w=$(($(od -An -j50 -N2 -d $1)<<9)) if=$1 count=$s;; - E*) $r=11 bs=1b | od -vAn -tu1 -w1 - | LANG=C awk 'BEGIN { a=0;i=-1;m=0xFFFFFFFE } -{ if (++i!=106 && i!=107 && i!=112) a=or(and(lshift(a,31),m),and(rshift(a,1),m/2))+$1 } + E*) $r=11 bs=1b | od -vAn -tu1 -w1 - | LANG=C awk ' +{ if (++i!=107 && i!=108 && i!=113) a=or(lshift(and(a,1),31),$1+a/2) } END { b=a/256;c=b/256; for (;i>0;i-=44) printf "%c%c%c%c",a%256,b%256,c%256,(c/256)%256 }' | $w=5632 esac exit 0 done</dev/null 54 59 0 512 FAT12 -54 59 0 512 FAT16 -3 113 512 512 EXFAT -82 87 1024 FAT32SZ FAT32 +54 59 512 512 FAT16 +3 113 1024 512 EXFAT +82 87 1536 FAT32SZ FAT32 S exit 1 diff -r 41581d281860 -r 3c71bb4367c3 libjreen-dev/receipt --- a/libjreen-dev/receipt Sat May 06 08:42:03 2023 +0000 +++ b/libjreen-dev/receipt Thu May 11 15:58:49 2023 +0000 @@ -6,7 +6,7 @@ SHORT_DESC="Qt jabber library, written in C++ - development files." MAINTAINER="devl547@gmail.com" LICENSE="GPL2" -WEB_SITE="http://qutim.org/jreen" +WEB_SITE="https://github.com/euroelessar/jreen" DEPENDS="libjreen pkg-config" WANTED="libjreen" diff -r 41581d281860 -r 3c71bb4367c3 libjreen/receipt --- a/libjreen/receipt Sat May 06 08:42:03 2023 +0000 +++ b/libjreen/receipt Thu May 11 15:58:49 2023 +0000 @@ -6,10 +6,10 @@ SHORT_DESC="Qt jabber library, written in C++." MAINTAINER="devl547@gmail.com" LICENSE="GPL2" -WEB_SITE="http://qutim.org/jreen" +WEB_SITE="https://github.com/euroelessar/jreen" -TARBALL="$PACKAGE-$VERSION.tar.bz2" -WGET_URL="http://qutim.org/dwnl/73/$TARBALL" +TARBALL="$PACKAGE-$VERSION.tar.gz" +WGET_URL="https://github.com/euroelessar/jreen/archive/refs/tags/v$VERSION.tar.gz" DEPENDS="libidn libQtCore libQtNetwork qca" BUILD_DEPENDS="cmake gsasl-dev libidn-dev qca-dev qmake Qt4-dev" @@ -17,8 +17,8 @@ # What is the latest version available today? current_version() { - wget -O - http://qutim.org/jreen 2>/dev/null | \ - sed "/latest/d;/$PACKAGE-[0-9]/!d;/tar/!d;s|.*$PACKAGE-\\(.*\\).tar.*|\\1|" | sort -Vr | sed q + wget -O - $WEB_SITE/tags 2>/dev/null | \ + sed '/archive.*tar/!d;s|.*/v*\(.*\).tar.*|\1|;q' } # Rules to configure and make the package. diff -r 41581d281860 -r 3c71bb4367c3 memtest-efi32/receipt --- a/memtest-efi32/receipt Sat May 06 08:42:03 2023 +0000 +++ b/memtest-efi32/receipt Thu May 11 15:58:49 2023 +0000 @@ -1,7 +1,7 @@ # SliTaz package receipt. PACKAGE="memtest-efi32" -VERSION="6.10" +VERSION="6.20" CATEGORY="base-system" SHORT_DESC="Memory failures detection tool." MAINTAINER="pascal.bellard@slitaz.org" diff -r 41581d281860 -r 3c71bb4367c3 memtest-efi64/receipt --- a/memtest-efi64/receipt Sat May 06 08:42:03 2023 +0000 +++ b/memtest-efi64/receipt Thu May 11 15:58:49 2023 +0000 @@ -1,7 +1,7 @@ # SliTaz package receipt. PACKAGE="memtest-efi64" -VERSION="6.10" +VERSION="6.20" CATEGORY="base-system" SHORT_DESC="Memory failures detection tool." MAINTAINER="pascal.bellard@slitaz.org" diff -r 41581d281860 -r 3c71bb4367c3 memtest/receipt --- a/memtest/receipt Sat May 06 08:42:03 2023 +0000 +++ b/memtest/receipt Thu May 11 15:58:49 2023 +0000 @@ -1,7 +1,7 @@ # SliTaz package receipt. PACKAGE="memtest" -VERSION="6.10" +VERSION="6.20" CATEGORY="base-system" SHORT_DESC="Memory failures detection tool." MAINTAINER="pascal.bellard@slitaz.org" @@ -74,7 +74,7 @@ objdump -t boot/startup.o | \ awk '/patch/ { print "sed -i \"s|" $5 "|0x" $1 "|\" ../boot/setup.S" }' | sh make memtest.bin - tune_lzma memtest.bin 195,mf=bt2 LC 3 PB 2 + tune_lzma memtest.bin 255,mf=bt2 LC 3 PB 2 } diff -r 41581d281860 -r 3c71bb4367c3 memtest/stuff/memtest86+-6-386.patch --- a/memtest/stuff/memtest86+-6-386.patch Sat May 06 08:42:03 2023 +0000 +++ b/memtest/stuff/memtest86+-6-386.patch Thu May 11 15:58:49 2023 +0000 @@ -1,17 +1,17 @@ --- system/cpuinfo.c +++ system/cpuinfo.c -@@ -848,6 +848,12 @@ +@@ -846,6 +846,12 @@ default: // Unknown processor - make a guess at the family. switch (cpuid_info.version.family) { + case 3: -+ cpu_model = "386"; ++ cpu_model = "386-class CPU (unknown)"; + break; + case 4: -+ cpu_model = "486"; ++ cpu_model = "486-class CPU (unknown)"; + break; case 5: - cpu_model = "586"; + cpu_model = "586-class CPU (unknown)"; break; --- system/cpuid.c +++ system/cpuid.c @@ -165,7 +165,7 @@ // Nothing before this should access the boot parameters, in case they are located above 4GB. // This is the first region we map, so it is guaranteed not to fail. boot_params_addr = map_region(boot_params_addr, sizeof(boot_params_t), true); -@@ -282,8 +286,8 @@ +@@ -284,8 +288,8 @@ size_t program_size = (_stacks - _start) + BSP_STACK_SIZE + (num_enabled_cpus - 1) * AP_STACK_SIZE; @@ -176,7 +176,7 @@ trace(0, "program size %ikB", (int)(program_size / 1024)); trace(0, " low_load_addr %0*x", 2*sizeof(uintptr_t), low_load_addr); -@@ -420,7 +424,7 @@ +@@ -422,7 +426,7 @@ // Relocation may disrupt the test. window_num = 1; } @@ -185,7 +185,7 @@ // Avoid unnecessary relocation. window_num = 1; } -@@ -443,10 +447,10 @@ +@@ -445,10 +449,10 @@ switch (window_num) { case 0: window_start = 0; diff -r 41581d281860 -r 3c71bb4367c3 memtest64/receipt --- a/memtest64/receipt Sat May 06 08:42:03 2023 +0000 +++ b/memtest64/receipt Thu May 11 15:58:49 2023 +0000 @@ -1,7 +1,7 @@ # SliTaz package receipt. PACKAGE="memtest64" -VERSION="6.10" +VERSION="6.20" CATEGORY="base-system" SHORT_DESC="Memory failures detection tool." MAINTAINER="pascal.bellard@slitaz.org" @@ -65,7 +65,8 @@ # Rules to configure and make the package. compile_rules() { - tune_lzma memtest64.bin 55,mf=bt2 LC 3 PB 2 + tune_lzma memtest64.bin 144,mf=bt3 LC 3 PB 2 + } # Rules to gen a SliTaz package suitable for Tazpkg. diff -r 41581d281860 -r 3c71bb4367c3 musl-libc-dev/receipt --- a/musl-libc-dev/receipt Sat May 06 08:42:03 2023 +0000 +++ b/musl-libc-dev/receipt Thu May 11 15:58:49 2023 +0000 @@ -6,7 +6,7 @@ SHORT_DESC="A lightweight, fast, simple, free libc - development files." MAINTAINER="pascal.bellard@slitaz.org" LICENSE="MIT" -WEB_SITE="https://www.musl-libc.org/" +WEB_SITE="https://musl.libc.org/" DEPENDS="musl-libc" WANTED="musl-libc" diff -r 41581d281860 -r 3c71bb4367c3 musl-libc/receipt --- a/musl-libc/receipt Sat May 06 08:42:03 2023 +0000 +++ b/musl-libc/receipt Thu May 11 15:58:49 2023 +0000 @@ -6,7 +6,7 @@ SHORT_DESC="A lightweight, fast, simple, free libc." MAINTAINER="pascal.bellard@slitaz.org" LICENSE="MIT" -WEB_SITE="https://www.musl-libc.org/" +WEB_SITE="https://musl.libc.org/" REPOLOGY="musl" SOURCE="musl" diff -r 41581d281860 -r 3c71bb4367c3 urbackup-server/receipt --- a/urbackup-server/receipt Sat May 06 08:42:03 2023 +0000 +++ b/urbackup-server/receipt Thu May 11 15:58:49 2023 +0000 @@ -1,7 +1,7 @@ # SliTaz package receipt. PACKAGE="urbackup-server" -VERSION="2.4.12" +VERSION="2.4.15" CATEGORY="network" TAGS="backup" SHORT_DESC="An easy to setup Open Source client-server backup system." diff -r 41581d281860 -r 3c71bb4367c3 usbutils/receipt --- a/usbutils/receipt Sat May 06 08:42:03 2023 +0000 +++ b/usbutils/receipt Thu May 11 15:58:49 2023 +0000 @@ -8,7 +8,7 @@ LICENSE="GPL2" TARBALL="$PACKAGE-$VERSION.tar.xz" WEB_SITE="https://linux-usb.sourceforge.net/" -WGET_URL="http://deb.debian.org/debian/pool/main/u/usbutils/usbutils_$VERSION.orig.tar.xz" +WGET_URL="https://mirrors.edge.kernel.org/pub/linux/utils/usb/usbutils/$TARBALL" HOST_ARCH="i486 arm" TAGS="usb" diff -r 41581d281860 -r 3c71bb4367c3 warmux/receipt --- a/warmux/receipt Sat May 06 08:42:03 2023 +0000 +++ b/warmux/receipt Thu May 11 15:58:49 2023 +0000 @@ -1,14 +1,15 @@ # SliTaz package receipt. PACKAGE="warmux" +GITHASH="01f2d0071011bae5785d7a8d4502db4370c7de5a" # 20191201 VERSION="11.04.1" CATEGORY="games" SHORT_DESC="Warmux game" MAINTAINER="slaxemulator@gmail.com" LICENSE="GPL2" -WEB_SITE="https://web.archive.org/web/20221203051925/https://www.warmux.org/" -TARBALL="$PACKAGE-$VERSION.tar.bz2" -WGET_URL="$WEB_SITE$TARBALL" +WEB_SITE="https://github.com/fluxer/warmux" +TARBALL="$PACKAGE-$VERSION.zip" +WGET_URL="https://github.com/fluxer/warmux/archive/$GITHASH.zip" PROVIDE="wormux" SUGGESTED="warmux-music" @@ -16,18 +17,20 @@ curl freetype libxml2 libxml++ gcc-lib-base gettext-base" BUILD_DEPENDS="libsdl-dev libsdl-gfx-dev libsdl-image-dev libsdl-mixer-dev \ libsdl-net-dev libsdl-ttf-dev curl-dev freetype-dev libxml2-dev libxml++-dev \ -pkg-config" +automake pkg-config" # What is the latest version available today? current_version() { - wget -O - https://www.warmux.org/ 2>/dev/null | \ - sed "/latest/d;/$PACKAGE-[0-9]/!d;/tar/!d;s|.*$PACKAGE-\\(.*\\).tar.*|\\1|" | sort -Vr | sed q + wget -O - $WEB_SITE/commits/master 2>/dev/null | \ + sed '/Commits on/!d;s|.*on |"|;s|<.*|"|;q' | xargs date +%Y -d } # Rules to configure and make the package. compile_rules() { + ./autogen.sh + sed -i 's/test -z "$(pkgdatadir)"/test -d "$(pkgdatadir)"/' data/Makefile.in sed -i 's|if USE_X11|if SKIP_USE_X11|' src/tool/copynpaste.cpp sed -i "s|test -d \"\\\$(pkgdatadir|test -d \"\\\$(DESTDIR)\\\$(pkgdatadir|" data/Makefile*