# HG changeset patch # User Pascal Bellard # Date 1617873686 0 # Node ID 6b6d14c9f7e94b2569b05ea9936f0fc117901218 # Parent 2984cf98c782343fd8412a65c0726bcb4d235c31 Openssh (8.5p1) diff -r 2984cf98c782 -r 6b6d14c9f7e9 codec2/receipt --- a/codec2/receipt Wed Apr 07 15:56:56 2021 +0100 +++ b/codec2/receipt Thu Apr 08 09:21:26 2021 +0000 @@ -15,7 +15,7 @@ current_version() { wget -O - ${WGET_URL%/arch*}/releases 2>/dev/null | \ - sed '/archive.*tar/!d;s|.*archive/v\(.*\).tar.*|\1|;q' + sed '/archive.*tar/!d;s|.*/v\(.*\).tar.*|\1|;q' } # Rules to configure and make the package. diff -r 2984cf98c782 -r 6b6d14c9f7e9 linld/stuff/src/A20.ASM --- a/linld/stuff/src/A20.ASM Wed Apr 07 15:56:56 2021 +0100 +++ b/linld/stuff/src/A20.ASM Thu Apr 08 09:21:26 2021 +0000 @@ -2,7 +2,7 @@ ;****** This file is distributed under GPL ;*************************************************************** ideal - %PAGESIZE 1000 + %PAGESIZE 255 %crefref %noincl %nomacs diff -r 2984cf98c782 -r 6b6d14c9f7e9 linld/stuff/src/COMMON.H --- a/linld/stuff/src/COMMON.H Wed Apr 07 15:56:56 2021 +0100 +++ b/linld/stuff/src/COMMON.H Thu Apr 08 09:21:26 2021 +0000 @@ -1,7 +1,7 @@ //#define WITH_XMM_ALLOC add himem.sys driver +//#define INT15_E820 add int15/eax=E820 driver //#define LARGE_ZIMAGE may load system in high memory temporarily -//#define INT15_E820 add int15/eax=E820 driver -//#define RAW_ISO9660 raw filename support with ';1' or '.' trailers +#define CLEAN_ISO9660 remove ';1' or '.' trailers for non rockridge name #define BASIC_ISO9660 non rockridge support #define ROCKRIDGE iso 9660 posix name support #define ISO9660 iso= support @@ -26,7 +26,7 @@ #define CPU64 #endif #endif -#if defined(ROCKRIDGE) || defined(BASIC_ISO9660) || defined(RAW_ISO9660) +#if defined(ROCKRIDGE) || defined(BASIC_ISO9660) || defined(CLEAN_ISO9660) #ifndef ISO9660 #define ISO9660 #endif diff -r 2984cf98c782 -r 6b6d14c9f7e9 linld/stuff/src/CRTL.ASM --- a/linld/stuff/src/CRTL.ASM Wed Apr 07 15:56:56 2021 +0100 +++ b/linld/stuff/src/CRTL.ASM Thu Apr 08 09:21:26 2021 +0000 @@ -2,7 +2,7 @@ ;****** This file is distributed under GPL ;*************************************************************** ideal - %PAGESIZE 1000 + %PAGESIZE 255 %crefref %noincl %nomacs @@ -47,6 +47,258 @@ segment _TEXT byte public use16 'CODE' + ifdef VCPI + p386 +;*************************************************************** + +struc data_himem ;struct data_himem { +first dd ? ; 0 u32 first; *must* be the first one assume zero'd in bss +cacheidx dw ? ; 4 int cacheidx; quad * assume zero'd in bss +pageidx dw ? ; 6 int pageidx; byte * assume zero'd in bss +cache dd 1024 dup(?) ; 8 int cache; +page dd 1024 dup(?) ;4104 int page; +ends data_himem ;}; + + include "himem.inc" + +;*************************************************************** +;_fastcall u32* malloc_bufv_or_die(si:struct image_himem *m); +;*************************************************************** + global @malloc_bufv_or_die$qp11image_himem:near + proc @malloc_bufv_or_die$qp11image_himem near + + p386 + ;mov ecx,[(image_himem si).size] + ;shr ecx,20 ; pages index size = size >> 20 + ;mov ax,cx + ;add ax,size data_himem-4096 + mov ax,size data_himem + call malloc_or_die + ;mov cx,4096+4095 ; cnt = 1+(m->size+PAGE_MASK)/PAGE_SIZE; + mov ecx,4096+4095 ; cnt = 1+(m->size+PAGE_MASK)/PAGE_SIZE; + add ecx,[(image_himem si).size] + shr ecx,12 + mov [(image_himem si).bufv],ax ; update m->bufv + xchg ax,di +@@vcpi_alloc: + mov ax,0DE04h ; allocate a 4K page => EDX + int 67h + or ah,ah + mov bx,offset vcpi_alloc_err + jnz jmpdie +; for (i = cnt-1; i >= 0; i--) +; if (edx < pm.fallback+pm.size) again + mov bx,offset _imgs.fallback+size image_himem + mov eax,[bx-2+6-size image_himem] ; pm.size + add eax,[bx-2+2-size image_himem] + cmp eax,edx ; pm.fallback+pm.size <= edx ? + ja @@vcpi_alloc + mov eax,ecx + dec eax + shl eax,12 ; i*_4k +; if (edx >= initrd.fallback+i*_4k && edx < initrd.fallback+initrd.size) again + add eax,[bx-2+2] ; +initrd.fallback + cmp eax,edx ; initrd.fallback+i*_4k > edx ? + ja @@initrdok + mov eax,[bx-2+6] ; initrd.size + add eax,[bx-2+2] ; +initrd.fallback + cmp eax,edx ; initrd.fallback+initrd.size > edx ? +@@ja_vcpi_alloc: + ja @@vcpi_alloc +@@initrdok: + cmp [(data_himem di).first],0 ; zero'd in bss + jne @@notfirst + mov [(data_himem di).first],edx +@@notfirst: + mov bx,[(data_himem di).cacheidx] ; zero'd in bss + cmp bh,4 + jae @@nextpage + shl bx,2 + inc [(data_himem di).cacheidx] + mov [(data_himem bx+di).cache],edx ; cache[cacheidx++] = edx + loopd @@vcpi_alloc + mov [(data_himem bx+di).cache],ecx ; last is 0 +@@nextpage: + and [(data_himem di).cacheidx],0 + mov bx,[(data_himem di).pageidx] ; zero'd in bss + mov [(data_himem bx+di).page],edx + add [(data_himem di).pageidx],4 + push cx + lea cx,[(data_himem di).cache] + ifdef NO386 + push edx + pop ax ; to es:ax + pop es + endif + call storepage ; storepage(edx/es:ax,cx) + pop cx + or ecx,ecx ; clear C + jnz @@ja_vcpi_alloc + + endp @malloc_bufv_or_die$qp11image_himem + +;*************************************************************** +;_fastcall void reset_bufv(di:u32 *p); +;*************************************************************** + global @reset_bufv$qpul:near + proc @reset_bufv$qpul near + + mov [curdata],di + and [dword (data_himem di).cacheidx],0 ; and pageidx=0 + ret + + endp @reset_bufv$qpul + +;*************************************************************** +;u32* di=prev_bufv(); +;u32* di=prev_bufv(); +;*************************************************************** + global _prev_bufv:near + global _next_bufv:near + proc _prev_bufv near + + stc + db 73h ; jnc +_next_bufv: + clc + push si + mov bx,0 + org $-2 +curdata dw ? + sbb ax,ax + cmc + adc ax,[(data_himem bx).cacheidx] ; -1/+1 + mov si,3ffh + and si,ax + mov [(data_himem bx).cacheidx],si + shl si,2 + xor ecx,ecx + test ax,0fc00h + jz @@gotpage ; FFFF / 0400 + xchg al,ah ; FFFC / 0004 + and al,0fch + add [(data_himem bx).pageidx],ax + mov di,[(data_himem bx).pageidx] + lea di,[(data_himem bx+di).page] + mov edx,ds + shl edx,4 + lea cx,[(data_himem bx).cache] + add edx,ecx + mov eax,[di] + or eax,eax + jz @@ret + mov cx,4096 ; get page + call memcpy_imagez ; memcpy_imagez(edx,eax,ecx) +@@gotpage: + lea ax,[(data_himem bx+si).cache] + or si,[(data_himem bx).pageidx] ; !pageidx && !cacheidx + jnz @@notfirst2 + xchg ax,bx ; &first +@@notfirst2: + xchg ax,di +@@ret: + pop si + ret + + endp _prev_bufv + endif + + ifdef NO386 + p8086 + endif + +;*************************************************************** +;_fastcall void memcpy_image_initrd(si:struct image_himem *m); +;_fastcall void memcpy_image_kernel(si:struct image_himem *m); +;_fastcall void memcpy_image(bx:struct image_himem *m); +;*************************************************************** + global @memcpy_image_initrd$qv:near +@memcpy_image_initrd$qv: + lea bx,[si+size image_himem] + db 0A9h ; test ax,imm + global @memcpy_image_kernel$qv:near +@memcpy_image_kernel$qv: + mov bx,si + proc @memcpy_image$qp11image_himem near + + ifndef NO386 + mov edx,[(image_himem bx).fallback] + mov eax,[(image_himem bx).buf] + cmp eax,edx ; if (m->fallback != m->buf) + jz @@skip ; memcpy32(m->fallback,0,m->buf,m->size) + mov ecx,[(image_himem bx).size] + else + les cx,[((image_himem bx).buf)] + mov dx,es + les ax,[((image_himem bx).fallback)] + cmp ax,cx ; if (m->fallback != m->buf) + jnz @@do + cmp dx,[word ((image_himem bx).fallback)+2] + jz @@skip ; memcpy32(m->fallback,0,m->buf,m->size) +@@do: + push [((image_himem bx).size)] + xor bx,bx +call_memcpy32: ; call_memcpy32(to=es:ax,fromseg=bx,fromofs=dx:cx,size) + push dx ; [word ((image_himem bx).buf)+2] + push cx ; [word ((image_himem bx).buf)] + push bx + push es ; push es:ax + push ax + jmp @@memcpy + endif +memcpy_imagez: ; memcpy_imagez(edx,eax,ecx) + p386 + push ecx + push eax + push 0 + ifndef NO386 +call_memcpy32: ; call_memcpy32(to=edx,fromseg,fromofs,size) + endif + push edx + ifdef NO386 + p8086 + endif +@@memcpy: + extrn memcpy32:near + call near memcpy32 +@@skip: + ret + + global movedend:near +movedend: + + endp @memcpy_image$qp11image_himem + +;*************************************************************** +;_fastcall void storepage(di:u32 *dst); +;*************************************************************** + global @storepage$qpul:near + proc @storepage$qpul near + + ifndef NO386 + mov edx,[di] + else + les ax,[dword di] + endif + mov cx,offset _buf4k +storepage: ; storepage(edx,cx) + ifndef NO386 + push 0 + push 4096 + push 0 + push cx + push ds ; call_memcpy32(to=edx,fromseg,fromofs,size) + else + xor dx,dx + push dx ; 0 + mov bx,4096 + push bx ; 4096 + mov bx,ds ; call_memcpy32(to=es:ax,fromseg=bx,fromofs=dx:cx,size) + endif + jmp call_memcpy32 + + endp @storepage$qpul + ;*************************************************************** ;_fastcall void strcatb(bx:const char* a, ax:const char* b); ;*************************************************************** @@ -347,37 +599,37 @@ ifdef ISO9660 ifdef ISOHOOK ;*************************************************************** -;_fastcall int strhead(bx:const char* a, ax:const char* b); +;_fastcall int strhead(ax:const char* a, bx:const char* b); ;*************************************************************** global @strhead$qpxzct1:near proc @strhead$qpxzct1 near @@loop: - xchg ax,bx - mov dl,[bx] ; dl = *b++ + mov dh,[bx] ; dh = *b++ inc bx xchg ax,bx - or dl,dl ; clear C - jz failifc ; return 0, bx=a tail - xor dl,[bx] ; dl -= *a++ + or dh,dh ; clear C + jz failifc ; return 0, bx=a tail, dh=0 + xor dh,[bx] ; dh -= *a++ jne fail ; return -1 inc bx + xchg ax,bx jmp @@loop endp @strhead$qpxzct1 ;*************************************************************** -;_fastcall int strcmp(bx:const char* a, ax:const char* b); +;_fastcall int strcmp(ax:const char* a, bx:const char* b); ;*************************************************************** global @strcmp$qpxzct1:near proc @strcmp$qpxzct1 near call @strhead$qpxzct1 jne fail ; return -1 - xor dl,[bx] ; clear C + xor dh,[bx] ; clear C jne fail ; return -1 - jmp failifc ; return 0 + jmp failifc ; return 0, dh=0 endp @strcmp$qpxzct1 @@ -411,6 +663,274 @@ endif ;*************************************************************** +;_fastcall void puts(bx:const char* s): +;*************************************************************** + global @puts$qpxzc:near + +; global puts:near ; puts(bx) +@putsz: + call @putc +@puts$qpxzc: +puts: + mov dl,[bx] + inc bx + or dl,dl + jne @putsz + mov dl,10 +@putc: + cmp dl,10 + jne @putcz + call @putcz2 +@putcz2: + xor dl,7 ; 10^13 1010^1101 +@putcz: + mov ah,2 +do_int21h: + int 21h + ret + + +;*************************************************************** +;_fastcall char* malloc_or_die(ax:unsigned size); +;*************************************************************** +xchg_heap_top: + xchg ax,[bx] + ret + + proc @malloc_or_die$qui near + +malloc_or_die: ; ax = malloc_or_die(ax) + extrn _heap_top + mov bx,offset _heap_top + add ax,[bx] + jnc xchg_heap_top + mov bx,offset msg_malloc + + endp @malloc_or_die$qui + + +;*************************************************************** +;_fastcall int die(bx:const char* msg); +;int exit(ax:int status); +;int abort(void); +;*************************************************************** + global @die$qpxzc:near + proc @die$qpxzc near +@die$qpxzc: + global die:near ; die(bx) +die: + call puts + global @exit$qv:near +@exit$qv: +_exit: + extrn _imgs:image_himem + mov cx,[(word _imgs.buf)+2] ; no_exit ? + mov ah,4Ch + jcxz do_int21h + mov bx, offset msg_hang + call puts +; global _abort:near +_abort: + cli + hlt + jmp _abort + + endp @die$qpxzc + +;*************************************************************** +;_fastcall void open_image(si:struct image_himem *m, ax:const char *name); +;*************************************************************** + + global @open_image$qp11image_himempxzc:near + proc @open_image$qp11image_himempxzc near + + mov [(image_himem si).state],ax + push ax +@@next: + call next_chunk + ifndef NO386 + add eax,3 + and al,0FCh + add [(image_himem si).size],eax ; m->size += m->chunk_size size zero'd in bss + or eax,eax + else + add ax,3 + adc dx,0 + and al,0FCh + add [word (image_himem si).size],ax ; m->size += m->chunk_size size zero'd in bss + adc [word ((image_himem si).size)+2],dx + or ax,dx + endif + jnz @@next + pop [(image_himem si).state] + + endp @open_image$qp11image_himempxzc + + +;*************************************************************** +;static long next_chunk(struct image_himem *si); +;*************************************************************** + proc next_chunk near + + ifndef NO_CLOSE + mov ax,[(image_himem si).fd] + call close + endif + ifndef NO386 + xor eax,eax + else + xor ax,ax + cwd + endif + mov [(image_himem si).fd],ax + mov bx,[(image_himem si).state] + cmp al,[bx] ; "" + jz @@end + dec bx + push di +@@scan: + inc bx + mov al,[bx] + mov di,bx + or al,al + jz @@eos + sub al,',' + jnz @@scan + inc bx +@@eos: + xchg [(image_himem si).state],bx ; set start of string + mov [current_file],bx + xchg [di],ax ; set temp eos (ax == 0) + push ax + call @open$qpxzc + pop [word di] ; restore string + pop di + jnc @@opened +loadfailure: +;*************************************************************** +;_fastcall void loadfailure(void); +;*************************************************************** + global @loadfailure$qv:near +@loadfailure$qv: + mov bx,0 + org $-2 +current_file dw ? + call puts + mov bx,offset loaderr +jmpdie: + jmp die +@@opened: + mov [(image_himem si).fd],ax + ifndef NO_CLOSE + mov [(image_himem si).fd2close],ax + endif + ifdef ISO9660 + ifndef NO386 + mov eax,[_isostate.filesize] + else + les ax,[_isostate.filesize] + mov dx,es + endif + else + mov bl,02h ; SEEK_END + call lseek0 + ifndef NO386 + push eax + mov ax,[(image_himem si).fd] + call rewind + pop eax + else + push ax + push dx + mov ax,[(image_himem si).fd] + call rewind + pop dx + pop ax + endif + endif +@@end: + ifndef NO386 + mov [(image_himem si).chunk_size],eax + else + mov [word (image_himem si).chunk_size],ax + mov [word ((image_himem si).chunk_size)+2],dx + endif + ret + + endp next_chunk + + +;*************************************************************** +;_fastcall int read_image(si:struct image_himem *m); +;*************************************************************** + global @read_image$qp11image_himem:near + proc @read_image$qp11image_himem near + + push di + xor di,di +@@loop: + ifndef NO386 + xor ecx,ecx + mov ch,4096/256 + sub cx,di + mov eax,[(image_himem si).chunk_size] + cmp ecx,eax + jb @@szok + else + mov cx,4096 + sub cx,di + mov ax,[word (image_himem si).chunk_size] + cmp cx,ax + jb @@szok + cmp [word ((image_himem si).chunk_size)+2],0 ; hi m->chunk_size + jne @@szok + endif + xchg ax,cx +@@szok: + jcxz image_done + lea dx,[di+_buf4k] + mov bx,[(image_himem si).fd] + call @read$cxdxbx + jb image_done + add di,ax + ifndef NO386 + cwde ; ax < 8000h + cdq + sub [(image_himem si).chunk_size],eax + else + cwd ; ax < 8000h + sub [word (image_himem si).chunk_size],ax + sbb [word ((image_himem si).chunk_size)+2],dx + endif +@@fill: + test al,3 + je @@filled + mov [di+_buf4k],dl + inc di + inc ax + jmp @@fill +@@filled: + ifndef NO386 + sub [(image_himem si).remaining],eax + or edx,[word (image_himem si).chunk_size] + else + sub [word (image_himem si).remaining],ax + sbb [word ((image_himem si).remaining)+2],dx + mov ax,[word (image_himem si).chunk_size] + or ax,[word ((image_himem si).chunk_size)+2] + endif + jnz @@same_chunk + call next_chunk +@@same_chunk: + jmp @@loop +image_done: + xchg ax,di + pop di + ret + + endp @read_image$qp11image_himem + +;*************************************************************** ;_fastcall const char **argstr(bx:const char *s, ax:const char keywords[], dx:const char **var); ;_fastcall unsigned long *argnum(bx:char *s, ax:const char keywords[], dx:unsigned long *var); ;*************************************************************** @@ -583,534 +1103,6 @@ endp @argstr$qpxzcxt1ppxzc -;*************************************************************** -;_fastcall void puts(bx:const char* s): -;*************************************************************** - global @puts$qpxzc:near - -; global puts:near ; puts(bx) -@putsz: - call @putc -@puts$qpxzc: -puts: - mov dl,[bx] - inc bx - or dl,dl - jne @putsz - mov dl,10 -@putc: - cmp dl,10 - jne @putcz - call @putcz2 -@putcz2: - xor dl,7 ; 10^13 1010^1101 -@putcz: - mov ah,2 -do_int21h: - int 21h - ret - - - include "himem.inc" - -;*************************************************************** -;_fastcall char* malloc_or_die(ax:unsigned size); -;*************************************************************** -xchg_heap_top: - xchg ax,[bx] - ret - - proc @malloc_or_die$qui near - -malloc_or_die: ; ax = malloc_or_die(ax) - extrn _heap_top - mov bx,offset _heap_top - add ax,[bx] - jnc xchg_heap_top - mov bx,offset msg_malloc - - endp @malloc_or_die$qui - - -;*************************************************************** -;_fastcall int die(bx:const char* msg); -;int exit(ax:int status); -;int abort(void); -;*************************************************************** - global @die$qpxzc:near - proc @die$qpxzc near -@die$qpxzc: - global die:near ; die(bx) -die: - call puts - global @exit$qv:near -@exit$qv: -_exit: - extrn _imgs:image_himem - mov cx,[(word _imgs.buf)+2] ; no_exit ? - mov ah,4Ch - jcxz do_int21h - mov bx, offset msg_hang - call puts -; global _abort:near -_abort: - cli - hlt - jmp _abort - - endp @die$qpxzc - -;*************************************************************** -;_fastcall void open_image(si:struct image_himem *m, ax:const char *name); -;*************************************************************** - - global @open_image$qp11image_himempxzc:near - proc @open_image$qp11image_himempxzc near - - mov [(image_himem si).state],ax - push ax -@@next: - call next_chunk - ifndef NO386 - add eax,3 - and al,0FCh - add [(image_himem si).size],eax ; m->size += m->chunk_size - or eax,eax - else - add ax,3 - adc dx,0 - and al,0FCh - add [word (image_himem si).size],ax ; m->size += m->chunk_size - adc [word ((image_himem si).size)+2],dx - or ax,dx - endif - jnz @@next - pop [(image_himem si).state] - - endp @open_image$qp11image_himempxzc - - -;*************************************************************** -;static long next_chunk(struct image_himem *si); -;*************************************************************** - proc next_chunk near - - ifndef NO_CLOSE - mov ax,[(image_himem si).fd] - call close - endif - ifndef NO386 - xor eax,eax - else - xor ax,ax - cwd - endif - mov [(image_himem si).fd],ax - mov bx,[(image_himem si).state] - cmp al,[bx] ; "" - jz @@end - dec bx - push di -@@scan: - inc bx - mov al,[bx] - mov di,bx - or al,al - jz @@eos - sub al,',' - jnz @@scan - inc bx -@@eos: - xchg [(image_himem si).state],bx ; set start of string - mov [current_file],bx - xchg [di],ax ; set temp eos (ax == 0) - push ax - call @open$qpxzc - pop [word di] ; restore string - pop di - jnc @@opened -loadfailure: -;*************************************************************** -;_fastcall void loadfailure(void); -;*************************************************************** - global @loadfailure$qv:near -@loadfailure$qv: - mov bx,0 - org $-2 -current_file dw ? - call puts - mov bx,offset loaderr -jmpdie: - jmp die -@@opened: - mov [(image_himem si).fd],ax - ifndef NO_CLOSE - mov [(image_himem si).fd2close],ax - endif - ifdef ISO9660 - ifndef NO386 - mov eax,[_isostate.filesize] - else - mov ax,[word _isostate.filesize] - mov dx,[(word _isostate.filesize)+2] - endif - else - mov bl,02h ; SEEK_END - call lseek0 - ifndef NO386 - push eax - mov ax,[(image_himem si).fd] - call rewind - pop eax - else - push ax - push dx - mov ax,[(image_himem si).fd] - call rewind - pop dx - pop ax - endif - endif -@@end: - ifndef NO386 - mov [(image_himem si).chunk_size],eax - else - mov [word (image_himem si).chunk_size],ax - mov [word ((image_himem si).chunk_size)+2],dx - endif - ret - - endp next_chunk - - ifdef VCPI -;*************************************************************** - -struc data_himem ;struct data_himem { -first dd ? ; 0 u32 first; *must* be the first one -cacheidx dw ? ; 4 int cacheidx; quad * -pageidx dw ? ; 6 int pageidx; byte * -cache dd 1024 dup(?) ; 8 int cache; -page dd 1024 dup(?) ;4104 int page; -ends data_himem ;}; - -;*************************************************************** -;_fastcall u32* malloc_bufv_or_die(si:struct image_himem *m); -;*************************************************************** - global @malloc_bufv_or_die$qp11image_himem:near - proc @malloc_bufv_or_die$qp11image_himem near - - p386 - push si - ;mov ecx,[(image_himem si).size] - ;shr ecx,20 ; pages index size = size >> 20 - ;mov ax,cx - ;add ax,size data_himem-4096 - mov ax,size data_himem - call malloc_or_die - ;mov cx,4096+4095 ; cnt = 1+(m->size+PAGE_MASK)/PAGE_SIZE; - mov ecx,4096+4095 ; cnt = 1+(m->size+PAGE_MASK)/PAGE_SIZE; - add ecx,[(image_himem si).size] - shr ecx,12 - mov [curdata],ax - mov [(image_himem si).bufv],ax ; update m->bufv - xchg ax,si -@@vcpi_alloc: - mov ax,0DE04h ; allocate a 4K page => EDX - int 67h - or ah,ah - mov bx,offset vcpi_alloc_err - jnz jmpdie -; for (i = cnt-1; i >= 0; i--) -; if (edx < pm.fallback+pm.size) again - mov bx,offset _imgs.fallback+size image_himem - mov eax,[bx-2+6-size image_himem] ; pm.size - add eax,[bx-2+2-size image_himem] - cmp eax,edx ; pm.fallback+pm.size <= edx ? - ja @@vcpi_alloc - mov eax,ecx - dec eax - shl eax,12 ; i*_4k -; if (edx >= initrd.fallback+i*_4k && edx < initrd.fallback+initrd.size) again - add eax,[bx-2+2] ; +initrd.fallback - cmp eax,edx ; initrd.fallback+i*_4k > edx ? - ja @@initrdok - mov eax,[bx-2+6] ; initrd.size - add eax,[bx-2+2] ; +initrd.fallback - cmp eax,edx ; initrd.fallback+initrd.size > edx ? -@@ja_vcpi_alloc: - ja @@vcpi_alloc -@@initrdok: - cmp [(data_himem si).first],0 - jne @@notfirst - mov [(data_himem si).first],edx -@@notfirst: - mov bx,[(data_himem si).cacheidx] - cmp bh,4 - jae @@nextpage - shl bx,2 - inc [(data_himem si).cacheidx] - mov [(data_himem bx+si).cache],edx ; cache[cacheidx++] = edx - loopd @@vcpi_alloc - mov [(data_himem bx+si).cache],ecx ; last is 0 -@@nextpage: - and [(data_himem si).cacheidx],0 - mov bx,[(data_himem si).pageidx] - mov [(data_himem bx+si).page],edx - add [(data_himem si).pageidx],4 - push cx - lea cx,[(data_himem si).cache] - ifdef NO386 - push edx - pop ax ; to es:ax - pop es - endif - call storepage ; storepage(edx/es:ax,cx) - pop cx - or ecx,ecx ; clear C - jnz @@ja_vcpi_alloc - mov [dword (data_himem si).cacheidx],ecx - xchg ax,si - pop si - ret - ifdef NO386 - p8086 - endif - - endp @malloc_bufv_or_die$qp11image_himem - endif - - -;*************************************************************** -;_fastcall void memcpy_image_initrd(si:struct image_himem *m); -;_fastcall void memcpy_image_kernel(si:struct image_himem *m); -;_fastcall void memcpy_image(bx:struct image_himem *m); -;*************************************************************** - global @memcpy_image_initrd$qv:near -@memcpy_image_initrd$qv: - lea bx,[si+size image_himem] - db 0A9h ; test ax,imm - global @memcpy_image_kernel$qv:near -@memcpy_image_kernel$qv: - mov bx,si - proc @memcpy_image$qp11image_himem near - - ifndef NO386 - mov edx,[(image_himem bx).fallback] - mov eax,[(image_himem bx).buf] - cmp eax,edx ; if (m->fallback != m->buf) - jz @@skip ; memcpy32(m->fallback,0,m->buf,m->size) - mov ecx,[(image_himem bx).size] - else - les cx,[((image_himem bx).buf)] - mov dx,es - les ax,[((image_himem bx).fallback)] - cmp ax,cx ; if (m->fallback != m->buf) - jnz @@do - cmp dx,[word ((image_himem bx).fallback)+2] - jz @@skip ; memcpy32(m->fallback,0,m->buf,m->size) -@@do: - push [((image_himem bx).size)] - xor bx,bx -call_memcpy32: ; call_memcpy32(to=es:ax,fromseg=bx,fromofs=dx:cx,size) - push dx ; [word ((image_himem bx).buf)+2] - push cx ; [word ((image_himem bx).buf)] - push bx - push es ; push es:ax - push ax - jmp @@memcpy - endif -memcpy_imagez: ; memcpy_imagez(edx,eax,ecx) - p386 - push ecx - push eax - push 0 - ifndef NO386 -call_memcpy32: ; call_memcpy32(to=edx,fromseg,fromofs,size) - endif - push edx - ifdef NO386 - p8086 - endif -@@memcpy: - extrn memcpy32:near - call near memcpy32 -@@skip: - ret - - endp @memcpy_image$qp11image_himem - -;*************************************************************** -;_fastcall void storepage(di:u32 *dst); -;*************************************************************** - global @storepage$qpul:near - proc @storepage$qpul near - - ifndef NO386 - mov edx,[di] - else - les ax,[dword di] - endif - mov cx,offset _buf4k -storepage: ; storepage(edx,cx) - ifndef NO386 - push 0 - push 4096 - push 0 - push cx - push ds ; call_memcpy32(to=edx,fromseg,fromofs,size) - else - xor dx,dx - push dx ; 0 - mov bx,4096 - push bx ; 4096 - mov bx,ds ; call_memcpy32(to=es:ax,fromseg=bx,fromofs=dx:cx,size) - endif - jmp call_memcpy32 - - endp @storepage$qpul - - ifdef VCPI - p386 -;*************************************************************** -;_fastcall void reset_bufv(di:u32 *p); -;*************************************************************** - global @reset_bufv$qpul:near - proc @reset_bufv$qpul near - - mov [curdata],di - and [dword (data_himem di).cacheidx],0 ; and pageidx=0 - ret - - endp @reset_bufv$qpul - -;*************************************************************** -;u32* di=prev_bufv(); -;u32* di=prev_bufv(); -;*************************************************************** - global _prev_bufv:near - global _next_bufv:near - proc _prev_bufv near - - stc - db 73h ; jnc -_next_bufv: - clc - push si - mov bx,0 - org $-2 -curdata dw ? - sbb ax,ax - cmc - adc ax,[(data_himem bx).cacheidx] ; -1/+1 - mov si,3ffh - and si,ax - mov [(data_himem bx).cacheidx],si - shl si,2 - xor ecx,ecx - test ax,0fc00h - jz @@gotpage ; FFFF / 0400 - xchg al,ah ; FFFC / 0004 - and al,0fch - add [(data_himem bx).pageidx],ax - mov di,[(data_himem bx).pageidx] - lea di,[(data_himem bx+di).page] - mov edx,ds - shl edx,4 - lea cx,[(data_himem bx).cache] - add edx,ecx - mov eax,[di] - or eax,eax - jz @@ret - mov cx,4096 ; get page - call memcpy_imagez ; memcpy_imagez(edx,eax,ecx) -@@gotpage: - lea ax,[(data_himem bx+si).cache] - or si,[(data_himem bx).pageidx] ; !pageidx && !cacheidx - jnz @@notfirst2 - xchg ax,bx ; &first -@@notfirst2: - xchg ax,di -@@ret: - pop si - ret - - endp _prev_bufv - endif - - ifdef NO386 - p8086 - endif - -;*************************************************************** -;_fastcall int read_image(si:struct image_himem *m); -;*************************************************************** - global @read_image$qp11image_himem:near - proc @read_image$qp11image_himem near - - push di - xor di,di -@@loop: - ifndef NO386 - xor ecx,ecx - mov ch,4096/256 - sub cx,di - mov eax,[(image_himem si).chunk_size] - cmp ecx,eax - jb @@szok - else - mov cx,4096 - sub cx,di - mov ax,[word (image_himem si).chunk_size] - cmp cx,ax - jb @@szok - cmp [word ((image_himem si).chunk_size)+2],0 ; hi m->chunk_size - jne @@szok - endif - xchg ax,cx -@@szok: - jcxz image_done - lea dx,[di+_buf4k] - mov bx,[(image_himem si).fd] - call @read$cxdxbx - jb image_done - add di,ax - ifndef NO386 - cwde ; ax < 8000h - cdq - sub [(image_himem si).chunk_size],eax - else - cwd ; ax < 8000h - sub [word (image_himem si).chunk_size],ax - sbb [word ((image_himem si).chunk_size)+2],dx - endif -@@fill: - test al,3 - je @@filled - mov [di+_buf4k],dl - inc di - inc ax - jmp @@fill -@@filled: - ifndef NO386 - sub [(image_himem si).remaining],eax - or edx,[word (image_himem si).chunk_size] - else - sub [word (image_himem si).remaining],ax - sbb [word ((image_himem si).remaining)+2],dx - mov ax,[word (image_himem si).chunk_size] - or ax,[word ((image_himem si).chunk_size)+2] - endif - jnz @@same_chunk - call next_chunk -@@same_chunk: - jmp @@loop -image_done: - xchg ax,di - pop di - ret - - endp @read_image$qp11image_himem - ends _TEXT diff -r 2984cf98c782 -r 6b6d14c9f7e9 linld/stuff/src/HIMEM.CPP --- a/linld/stuff/src/HIMEM.CPP Wed Apr 07 15:56:56 2021 +0100 +++ b/linld/stuff/src/HIMEM.CPP Thu Apr 08 09:21:26 2021 +0000 @@ -59,6 +59,7 @@ pushf ;cli push ds + push es push cs pop ds # ifdef NO386 @@ -88,11 +89,12 @@ // Move initrd memcpy_image_initrd(); #ifdef VCPI - } else { //vcpi + } else { //vcpi FIXME: LARGE_ZIMAGE case #if defined(__BORLANDC__) && defined(NO386) #pragma option -3 asm{ .386p + pushad } #endif // Move kernel @@ -125,6 +127,9 @@ memcpy_image_initrd(); } while(q != m[INITRD].bufv); } + asm{ + popad + } } #endif asm { @@ -136,6 +141,7 @@ # else popa # endif + pop es pop ds popf } diff -r 2984cf98c782 -r 6b6d14c9f7e9 linld/stuff/src/HIMEM.INC --- a/linld/stuff/src/HIMEM.INC Wed Apr 07 15:56:56 2021 +0100 +++ b/linld/stuff/src/HIMEM.INC Thu Apr 08 09:21:26 2021 +0000 @@ -1,11 +1,11 @@ -struc image_himem ;struct image_himem { -fd dw ? ; 0 int fd; -fallback dd ? ; 2 u32 fallback; -size dd ? ; 6 u32 size; -remaining dd ? ;10 u32 remaining; -buf dd ? ;14 u32 buf; -bufv dw ? ;18 u32 *bufv; -chunk_size dd ? ;20 u32 chunk_size; -state dw ? ;24 u16 state; -fd2close dw ? ;26 u16 fd2close; -ends image_himem ;}; +struc image_himem ;struct image_himem { +fd dw ? ; 0 int fd; +fallback dd ? ; 2 u32 fallback; +size dd ? ; 6 u32 size; // assume zero'd in bss +remaining dd ? ;10 u32 remaining; +buf dd ? ;14 u32 buf; +bufv dw ? ;18 u32 *bufv; +chunk_size dd ? ;20 u32 chunk_size; +state dw ? ;24 u16 state; +fd2close dw ? ;26 u16 fd2close; +ends image_himem ;}; diff -r 2984cf98c782 -r 6b6d14c9f7e9 linld/stuff/src/ISO9660.CPP --- a/linld/stuff/src/ISO9660.CPP Wed Apr 07 15:56:56 2021 +0100 +++ b/linld/stuff/src/ISO9660.CPP Thu Apr 08 09:21:26 2021 +0000 @@ -15,7 +15,7 @@ x->dirsize = filesize2dirsize(* (unsigned long *) (buf2k + 0xA6)); \ } -#ifdef RAW_ISO9660 +#if !defined(BASIC_ISO9660) && defined(CLEAN_ISO9660) #define BASIC_ISO9660 #endif #if !defined(BASIC_ISO9660) && !defined(ROCKRIDGE) @@ -68,7 +68,7 @@ # endif if (((* (short *) p) & 0xFEFF) -1 != 0) { s = p + 1; p += *p; -# ifndef RAW_ISO9660 +# ifdef CLEAN_ISO9660 if (* (short *) (p-1) == 0x313B) p-=2; // remove ;1 if (*p != '.') p++; # endif diff -r 2984cf98c782 -r 6b6d14c9f7e9 linld/stuff/src/ISO9660.H --- a/linld/stuff/src/ISO9660.H Wed Apr 07 15:56:56 2021 +0100 +++ b/linld/stuff/src/ISO9660.H Thu Apr 08 09:21:26 2021 +0000 @@ -13,11 +13,12 @@ unsigned long fileofs; unsigned long filesize; unsigned long filepos; - char *filename; - dirsizetype curdirsize, dirsize; + dirsizetype dirsize; typedef unsigned dirpagetype; dirpagetype dirpage; + dirsizetype curdirsize; unsigned long curdirofs; + char *filename; char _64bits; char c; int entrysize; diff -r 2984cf98c782 -r 6b6d14c9f7e9 linld/stuff/src/ISOSTATE.INC --- a/linld/stuff/src/ISOSTATE.INC Wed Apr 07 15:56:56 2021 +0100 +++ b/linld/stuff/src/ISOSTATE.INC Thu Apr 08 09:21:26 2021 +0000 @@ -1,22 +1,22 @@ ;typedef unsigned dirsizetype; struc isostate ; struct isostate { -curpos dw ? ; 0 unsigned curpos; -filename2open dw ? ; 2 char *filename2open; -fd dw ? ; 4 int fd; -fileofs dd ? ; 6 unsigned long fileofs; -filesize dd ? ;10 unsigned long filesize; -filepos dd ? ;14 unsigned long filepos; -filename dw ? ;18 char *filename; -curdirsize dw ? ;20 dirsizetype curdirsize; -dirsize dw ? ;22 dirsizetype dirsize; -dirpape dw ? ;24 unsigned short dirpage; -curdirofs dd ? ;26 unsigned long curdirofs; -_64bits db ? ;30 char _64bits; +curpos dw ? ; 0L unsigned curpos; // assume zero'd in bss +filename2open dw ? ; 2I char *filename2open; +fd dw ? ; 4X int fd; // assume zero'd in bss +fileofs dd ? ; 6O unsigned long fileofs; +filesize dd ? ;10O unsigned long filesize; +filepos dd ? ;14O unsigned long filepos; +dirsize dw ? ;18S dirsizetype dirsize; //\ +dirpage dw ? ;20S unsigned short dirpage; /// +curdirsize dw ? ;22L dirsizetype curdirsize; +curdirofs dd ? ;24L unsigned long curdirofs; // assume zero'd in bss ;overlap -c db ? ;31 char c; -entrysize dw ? ;32 int entrysize; -tmp dw ? ;34 const char *tmp; +filename dw ? ;28U char *filename; +_64bits db ? ;30U char _64bits; +c db ? ;31U char c; +entrysize dw ? ;32U int entrysize; +tmp dw ? ;34U const char *tmp; ends isostate ; } isostate; -ISOSTATE_OVERLAP = 5 +ISOSTATE_OVERLAP = 8 diff -r 2984cf98c782 -r 6b6d14c9f7e9 linld/stuff/src/JUMP.ASM --- a/linld/stuff/src/JUMP.ASM Wed Apr 07 15:56:56 2021 +0100 +++ b/linld/stuff/src/JUMP.ASM Thu Apr 08 09:21:26 2021 +0000 @@ -2,7 +2,7 @@ ;****** This file is distributed under GPL ;*************************************************************** ideal - %PAGESIZE 1000 + %PAGESIZE 255 %crefref %noincl %nomacs @@ -87,7 +87,6 @@ ;void boot_kernel(); ;****** Never returns ;*************************************************************** - global _boot_kernel:near proc _boot_kernel near ifdef NO386 @@ -165,7 +164,13 @@ include "himem.inc" extrn _imgs:image_himem + ifdef NO386 + les ax,[_imgs.fallback] ; src ofs = pm.fallback + push es + push ax + else push [_imgs.fallback] ; src ofs = pm.fallback + endif ;in al,70h ;or al,80h ; disable NMI @@ -183,7 +188,7 @@ ifdef NO386 mov ax,ss - add ax,900h + add ax,800h+(4096/16) push ax ; topseg()+0x0900 else push 9800h+(4096/16) ; 4096 bytes for cmdline @@ -199,9 +204,12 @@ xor di,di rep movsb - call near @@isbzimage ; movsb; pop cs ; ds=es=ss + call near @@isbzimage ; pop cs ; ds=es=ss endif + ;mov es,cx + ;mov [es:15*4+2],cs ; update int15/88h hook + extrn memcpy32:near call memcpy32 diff -r 2984cf98c782 -r 6b6d14c9f7e9 linld/stuff/src/LINK.CMD --- a/linld/stuff/src/LINK.CMD Wed Apr 07 15:56:56 2021 +0100 +++ b/linld/stuff/src/LINK.CMD Thu Apr 08 09:21:26 2021 +0000 @@ -1,1 +1,1 @@ -_beg.obj linld.obj jump.obj memtop.obj memcpy32.obj vcpi.obj xmm.obj a20.obj crtl.obj load.obj himem.obj iso9660.obj _end.obj, linld +_beg.obj linld.obj jump.obj memtop.obj memcpy32.obj vcpi.obj a20.obj crtl.obj xmm.obj load.obj himem.obj iso9660.obj _end.obj, linld diff -r 2984cf98c782 -r 6b6d14c9f7e9 linld/stuff/src/MEMCPY32.ASM --- a/linld/stuff/src/MEMCPY32.ASM Wed Apr 07 15:56:56 2021 +0100 +++ b/linld/stuff/src/MEMCPY32.ASM Thu Apr 08 09:21:26 2021 +0000 @@ -2,7 +2,7 @@ ;****** This file is distributed under GPL ;*************************************************************** ideal - %PAGESIZE 1000 + %PAGESIZE 255 %crefref %noincl %nomacs @@ -24,6 +24,12 @@ ;3+ NOPs also work fine (chkd on 386) endm +macro addzx_e rm,i + db 66h + add rm,i + dw 0 +endm + segment _TEXT byte public use16 'CODE' ;*************************************************************** @@ -41,18 +47,19 @@ ;****** Init *************************************************** + push bp + mov bp,sp + ;cld + pushf + push ds + ifndef NO386 - enter 0,0 - ;cld - pushf - push ds es pushad ; struct declared in VCPI.ASM mov cl,4 movzx esi,[srcseg] shl esi,cl add esi,[srcofs] - mov [srcofs],esi ; for memcpy_vcpi mov edi,[dstofs] ifndef pm_only @@ -60,9 +67,8 @@ shr eax,cl mov edx,edi shr edx,cl - mov ecx,esi - or ecx,edi - shr ecx,20 ; >1mb ? + lea ecx,[eax+edx] + shr ecx,16 ; >1mb ? jnz @@pmcopy @@movlp: mov ds,ax @@ -84,13 +90,8 @@ @@pmcopy: else - push bp - mov bp,sp - ;cld - pushf - push ds es push si - xor bx,bx + push di xor si,si mov ax,[srcseg] extrn N_LXLSH@4:near @@ -98,32 +99,31 @@ add [word srcofs],ax adc [word srcofs+2],dx @@2flat: - les ax,[dword si+srcofs] ; srcofs, dstofs - mov dx,es + les dx,[dword si+srcofs] ; srcofs, dstofs + mov di,dx ; dstofs + mov ax,es mov cl,4 @@loop: - shr dx,1 - rcr ax,1 + shr ax,1 ; high + rcr dx,1 ; low loop @@loop - or bx,dx ; >=1mb flag - push ax ; srcseg, dstseg + push dx ; srcseg, dstseg + xchg ax,bx ; save/restore high srcreg xor si,-6 jnz @@2flat + or bx,ax ; srcseg & dstseg < 1mb ? clear C pop dx ; dstseg pop ax ; srcseg - cmp bx,si ; <1mb ? - jne @@pmcopy - push di -@@movlp: + jnz @@pmcopy +@@movlp: ; bx=cx=0 mov ds,ax mov es,dx inc ax inc dx mov cl,0Fh mov si,cx - mov di,cx + and di,cx and si,[word srcofs] - and di,[word dstofs] inc cx sub [word sz],cx ;jae @@movpara @@ -134,9 +134,10 @@ @@movpara: rep movsb jae @@movlp +@@pmcopy: pop di - jmp @@done16 -@@pmcopy: + pop si + jc @@done16 p386 pushad ; struct declared in VCPI.ASM mov esi,[srcofs] @@ -146,6 +147,7 @@ mov ecx,[sz] jecxz @@done + cli ifdef VCPI smsw ax @@ -158,11 +160,22 @@ jmp @@done endif @@real_mode: - cli oldGDTR = (pword srcseg) ; don't need src seg/ofs anymore sgdt [oldGDTR] ;****** Load gdtr ********************************************** + ifdef LARGE_ZIMAGE + local rflags: word, rds: word, \ + reax: dword, recx: dword, redx: dword, rebx: dword, \ + resp: dword, rebp: dword, resi: dword, redi: dword, \ + GDTR: pword = LOCAL_SIZE + mov eax,cs + shl eax,4 + addzx_e ax, + push eax ; gdt_base_memcpy + push -1 ; gdt_limit + endif + lgdt [GDTR] ;****** Go into pm ********************************************* @@ -192,21 +205,16 @@ lcr0 eax ;****** Return ************************************************* lgdt [oldGDTR] + ifdef LARGE_ZIMAGE + add sp,6 + endif @@done: popad p8086 @@done16: - ifdef NO386 - pop si - endif - pop es ds + pop ds popf ; restore I & D - ifndef NO386 - p386 - leave - else pop bp - endif ret 14 ;****** Const data ********************************************* @@ -224,16 +232,15 @@ ; base_med P S D A G ??l_hi base_hi ; Pl E W D endif + ifndef LARGE_ZIMAGE label GDTR pword gdt_limit dw 0ffffh global gdt_base_memcpy:word gdt_base_memcpy dw offset gdt_memcpy,0 + endif endp memcpy32 - global movedend:near -movedend: - ends _TEXT end diff -r 2984cf98c782 -r 6b6d14c9f7e9 linld/stuff/src/MEMTOP.ASM --- a/linld/stuff/src/MEMTOP.ASM Wed Apr 07 15:56:56 2021 +0100 +++ b/linld/stuff/src/MEMTOP.ASM Thu Apr 08 09:21:26 2021 +0000 @@ -2,7 +2,7 @@ ;****** This file is distributed under GPL ;*************************************************************** ideal - %PAGESIZE 1000 + %PAGESIZE 255 %crefref %noincl %nomacs diff -r 2984cf98c782 -r 6b6d14c9f7e9 linld/stuff/src/VCPI.ASM --- a/linld/stuff/src/VCPI.ASM Wed Apr 07 15:56:56 2021 +0100 +++ b/linld/stuff/src/VCPI.ASM Thu Apr 08 09:21:26 2021 +0000 @@ -24,7 +24,7 @@ ideal - %PAGESIZE 1000 + %PAGESIZE 255 %crefref %noincl %nomacs diff -r 2984cf98c782 -r 6b6d14c9f7e9 linld/stuff/src/XMM.ASM --- a/linld/stuff/src/XMM.ASM Wed Apr 07 15:56:56 2021 +0100 +++ b/linld/stuff/src/XMM.ASM Thu Apr 08 09:21:26 2021 +0000 @@ -2,7 +2,7 @@ ;****** This file is distributed under GPL ;*************************************************************** ideal - %PAGESIZE 1000 + %PAGESIZE 255 %crefref %noincl %nomacs diff -r 2984cf98c782 -r 6b6d14c9f7e9 linld/stuff/src/_BEG.ASM --- a/linld/stuff/src/_BEG.ASM Wed Apr 07 15:56:56 2021 +0100 +++ b/linld/stuff/src/_BEG.ASM Thu Apr 08 09:21:26 2021 +0000 @@ -2,7 +2,7 @@ ;****** This file is distributed under GPL ;*************************************************************** ideal - %PAGESIZE 1000 + %PAGESIZE 255 %crefref %noincl %nomacs @@ -89,6 +89,8 @@ alloc_image endif +;BSS_OVERLAP_BOOT = 1 + ifndef BSS_OVERLAP_BOOT ifdef room_for_isostate @@ -143,10 +145,20 @@ js endcpu86 ;it is not a 386+, try ELKS & co endif p386 + ifdef VCPI mov edx,cs shl edx,4 ; edx for prepare_vcpi + else + ifndef LARGE_ZIMAGE + mov edx,cs + shl edx,4 ; edx for memcpy32 + endif + endif + ifndef LARGE_ZIMAGE extrn gdt_base_memcpy:word ; gdt_base for memcpy32 add [dword gdt_base_memcpy],edx + endif + ; Check for vm smsw ax ;SMSW cannot be trapped! :-) and al,1 ;MSW_PE @@ -260,12 +272,8 @@ ;*************************************************************** - org $-4 ; _himem_buf - ifdef BSS_OVERLAP_BOOT - mov al,0 - mov di,100h - mov cx,offset clean-100h + mov di,offset clean-100h org $-(CMDNUMCNT*4) ; alloc_cmdnum @@ -283,17 +291,16 @@ endif alloc_cmdnum +clean: + mov [di+0FFh],bh + dec di + jnz clean endif + org $-4 ; _himem_buf global _himem_buf:dword _himem_buf dd ? - ifdef BSS_OVERLAP_BOOT -clean: - rep - stosb - endif - ;*************************************************************** extrn _bss_end:word mov di,offset _bss_end diff -r 2984cf98c782 -r 6b6d14c9f7e9 linld/stuff/src/pipehole.awk --- a/linld/stuff/src/pipehole.awk Wed Apr 07 15:56:56 2021 +0100 +++ b/linld/stuff/src/pipehole.awk Thu Apr 08 09:21:26 2021 +0000 @@ -7,7 +7,10 @@ if (/^@.*:$/ || / endp$/) afterjmp=0 if (/^ \.386p$/) is386=1 if (file == "" && /debug S/) { file=$3; gsub(/\"/,"",file) } - if (/debug S/) print " %PAGESIZE 1000" + if (/debug S/) { + print " %PAGESIZE 255" + print " include common.inc" + } if (file == "linld.cpp") { if (/\[si/ || /si,/ || /,si/) sub(/si/,"di") else if (/\[di/ || /di,/ || /,di/) sub(/di/,"si") @@ -67,7 +70,7 @@ } if (ishimem == 1) { if (/do \{/) ishimem=2 - if (/bx,si/ || /push bp/ || /bp,sp/ || /push di/ || /push si/) next + if (/bx,si/ || /di,ax/ || /push bp/ || /bp,sp/ || /push di/ || /push si/) next if (/sp,2/ || /bp\+4/) next } if (ishimem == 2) { @@ -252,6 +255,16 @@ } } # file == "load.cpp" if (file == "iso9660.cpp") { + if (swapsidi == 1) { + if (/\[si/) sub(/\[si/,"[di") + else (/\[di/) sub(/\[di/,"[si") + if (/\+si/) sub(/\+si/,"+di") + else (/\+di/) sub(/\+di/,"+si") + if (/,si/) sub(/,si/,",di") + else if (/,di/) sub(/,di/,",si") + if (/si,/) sub(/si,/,"di,") + else if (/di,/) sub(/di,/,"si,") + } if (/di,offset DGROUP:_buf2k/) { si="si"; di="di" } if (/si,offset DGROUP:_buf2k/) { si="di"; di="si" } if (/leave/ || /enter/ || /bp/ || /sub sp,/) next @@ -260,22 +273,32 @@ if (/ptr \[.i\+6\],eax/) next if (/x,word ptr \[.i\+32\]/) next if (/add word ptr \[.i\],ax/) sub(/ax/,"cx") - if (/ax,word ptr \[si\+22\]/) sub(/mov ax,/,"les ax,d") - if (/ax,word ptr \[si\+24\]/) next - if (/word ptr \[si\+27\],ax/) sub(/ax/,"es") + if (/ax,word ptr \[si\+18\]/) sub(/mov ax,/,"les ax,d") + if (/ax,word ptr \[si\+20\]/) next + if (/word ptr \[si\+25\],ax/) sub(/ax/,"es") sub(/di,word ptr DGROUP:_isostate\+2/,"di,word ptr [si+2]") + if (/-257/) isiso=22 + if (isiso == 22) { + sub(/-257/,"-257 ; clear C") + if (/je/) { + print " cbw" + print " xchg ax,bx" + print " xchg ax,dx ; .. or ." + $0=" je returnC" + } + } if (/p = buf2k \+ 32 \+ x->curpos/) isiso=21 - sub(/-257/,"-257 ; clear C") if (isiso == 21) { # ISO9660.LST if (/ax,/) next - if (/si,ax/) { - print " add ax,32" - $0=" xchg ax,si" - } + if (/.i,ax/) sub(/mov/,"xchg") if (/# else/) isiso=0 } - if (/cx,si/) { - if (isiso == 0) print " inc " di + if (/cx,.i/) { + if (isiso == 0) { + print " ifndef CLEAN_ISO9660" + print " inc " di + print " mov cx," di + } isiso=20 } if (isiso == 20) { # ISO9660.LST @@ -283,13 +306,33 @@ isiso=12 next } + if (/add .i,ax/ || /cbw/) next + if (/cmp/) sub(/\[/,"[bx+") if (/inc cx/) next - if (/al,byte ptr/) $0=" ;inc ax" + if (/sub/) sub(/.i/,"bx") + sub(/inc .i/,"inc bx") + if (/al,byte ptr/) { + next + } + sub(/i-1\],12603/,"i],12603") + if (/bx\+.i\],46/) { + print " inc " di + print " mov cx," di + } if (/i],0/) { - sub(/,0/,",ah ; clear C") - sub(/mov/,"and") + print " ifndef CLEAN_ISO9660" + print " inc " di + print " mov cx," di + print " endif" + print "seteos:" + sub(/,0/,",bh ; clear C") + sub(/mov byte ptr \[/,"and byte ptr [bx+") } - sub(/cx/,"dx") + if (/cx,.i/) next + if (/\}/) { + print " xchg ax,cx" + } + if (/cx,5/) $0=" lea dx,[" di "+5]" if (/filename = s;/) { isiso=0 } @@ -297,15 +340,16 @@ if (isiso == 19) { # ISO9660.LST if (/short @2@310/) $0=" jc restoreC" if (/si\+32/ || /ax,dx/ || /ax,di/ || /cmp ax,-1/ || /sub ax,/) next - sub(/dx,/,"ax,") - if (/ax,word ptr \[si\+18\]/) sub(/ax/,"bx") + if (/ax,word ptr \[si\+28\]/) next if (/bx,offset/) sub(/bx/,"ax") + sub(/dx,/,"bx,") if (/short @2@282/) sub(/je/,"jnc") - if (/\[si\+35\],0/) sub(/,0/,",ch") + if (/\[si\+30\],0/) $0=" ;or cl,cl" + if (/short @2@478/) sub(/je/,"jcxz") if (/@strcmp\$qpxzct1/) { print print "restoreC:" - $0=" mov byte ptr [di],cl ; c" + $0=" mov byte ptr [di],dl ; c" isiso=1 } } @@ -313,9 +357,9 @@ if (/endif/) isiso=1 } if (isiso == 17) { # ISO9660.LST - if (/si\+22/) { + if (/si\+18/) { print "next:" - print " mov word ptr [si+24],bx" + print " mov word ptr [si+20],bx" print isiso=0 } @@ -339,7 +383,7 @@ if (/cmp/) { print " mov bx,word ptr [si+7]" print " mov ax,word ptr [si+11]" - print " dec cx" + print " dec dx" print " jns next" } if (/isolseek/) isiso=1 @@ -350,11 +394,16 @@ if (isiso == 15) { # ISO9660.LST if (/xor/) { print "returnC:" - print " sbb ax,ax" + print " sbb dx,dx" print "return:" next } - if (/i\+18\],cx/) sub(/cx/,"dx") + if (/i\+28\],cx/) { + print " ifndef BASIC_ISO9660" + print " xchg ax,dx" + print " endif" + next + } if (/@1@422:/) next if (/\[di\],47/) isiso=17 } @@ -371,10 +420,10 @@ } if (/p = buf2k \+ 34/) isiso=13 if (isiso == 13) { # ISO9660.LST - if (/cbw/) $0=" ;cbw" + #if (/cbw/) $0=" ;cbw" if (/i,.i/) $0=" xchg ax,bx" if (/i,ax/) $0=" xchg ax," di - if (/i,70/ || /word ptr \[.i\+32\]/) next + if (/i,70/ || /ptr \[.i\+32\]/) next if (/register len/) { isiso=12 } @@ -382,16 +431,28 @@ if (isiso == 12) { # ISO9660.LST if (/.i\+2/) sub(/al/,"bl") if (/cbw/) next - sub(/dx,ax/,"bh,0") + if (/dx,ax/) next if (/bx,dx/) next sub(/i,dx/,"i,bx") sub(/cx,/,"dx,") - if (/bx\+.i\],0/) sub(/,0/,",bh") + if (/bx\+.i\],0/) { + sub(/,0/,",bh") + } + if (/jmp/) { + print + $0=" endif" + } + if (/jne/) { + print " ifdef BASIC_ISO9660" + print " lea cx,[" di "+5]" + print " je seteos" + print " else" + } if (/while/) isiso=120 } if (isiso == 120) { # ISO9660.LST - sub(/ax/,"bx") - if (/cmp bx,/) $0=" cmp " di ",bx" + sub(/ax/,"cx") + if (/cmp cx,/) $0=" cmp " di ",cx" sub(/jae/,"jb") if (/endif/) isiso=0 } @@ -421,11 +482,37 @@ } if (/filesize =/) isiso=8 if (isiso == 8) { # ISO9660.LST - if (/ax,/) next + if (/ax,/ || /cbw/) next sub(/mov dx,/,"les dx,d") sub(/\],ax/,"],es") sub(/cx,/,"dx,") - if (/sub/) isiso=0 + if (/DGROUP:s@\+/) { + print + next + } + if (/i\+33]/) { + print " ifdef ROCKRIDGE" + print " ifdef BASIC_ISO9660" + print " add " di ",32" + print " mov ax,[" di "]" + print " else" + print " mov ax,[" di "+32]" + print " endif" + print " mov bl,ah" + print " mov bh,0" + print " else" + print " mov al,[" di "+33]" + print " cbw" + $0=" endif" + } + if (/sub/) { + print " ifdef ROCKRIDGE" + print " sub dx,bx" + print " else" + print + $0=" endif" + isiso=0 + } } if (/entrysize =/) isiso=5 if (isiso == 5) { # ISO9660.LST @@ -454,17 +541,31 @@ sub(/cmp byte ptr \[.i\]/,"sub al") if (/inc /) { r=$2; print; next } if (/al,0/) print " mov al,[" r "]" + if (/word ptr \[si\],-1/) $0=" not word ptr [si] ; zero'd in BSS" + sub(/al,32/,"ax,32") + if (/byte ptr \[si\+30\],al/) $0=" xchg ax,cx" if (/al,byte ptr \[/) next if (/byte ptr \[.*\],0/) next if (/byte ptr \[si\+31\],al/) next } - if (/ptr .isoreaddir/) isiso=1 + if (/ptr .isoreaddir/) { + print " ifdef ISOHOOK" + print " push cx" + print + print " pop cx" + print " else" + print + $0=" endif" + isiso=1 + } if (isiso == 1) { # ISO9660.LST - if (/xor/) isiso=18 + if (/xor/) { + $0=" xor cl,32" + isiso=18 + } if (/n = name;/) { isiso=19 - print " xchg ax,cx" - print " xchg cl,byte ptr [di] ; c" + print " xchg dl,byte ptr [di] ; c" } sub(/jne/,"jnc") if (/short @2@450/) $0=" jc returnC" @@ -479,7 +580,12 @@ if (/@2@142$/) print " inc di" } if (/i\+34\]/) next - sub(/di,offset DGROUP:_isostate/,"di,si") + if (/di,offset DGROUP:_isostate/) { + sub(/mov/,";mov") + sub(/di,/,"si,") + swapsidi=1 + } + if (/^ ret/) swapsidi=0 } # file == "iso9660.cpp" if (wascall) { if (rcall != "") { diff -r 2984cf98c782 -r 6b6d14c9f7e9 lz4/receipt --- a/lz4/receipt Wed Apr 07 15:56:56 2021 +0100 +++ b/lz4/receipt Thu Apr 08 09:21:26 2021 +0000 @@ -16,7 +16,7 @@ current_version() { wget -O - ${WGET_URL%/arch*}/releases 2>/dev/null | \ - sed '/archive.*tar/!d;s|.*archive/v\(.*\).tar.*|\1|;q' + sed '/archive.*tar/!d;s|.*/v\(.*\).tar.*|\1|;q' } # Rules to configure and make the package. diff -r 2984cf98c782 -r 6b6d14c9f7e9 lzham_codec/receipt --- a/lzham_codec/receipt Wed Apr 07 15:56:56 2021 +0100 +++ b/lzham_codec/receipt Thu Apr 08 09:21:26 2021 +0000 @@ -17,7 +17,7 @@ current_version() { wget -O - ${WGET_URL%/arch*}/releases 2>/dev/null | \ - sed '/archive.*tar/!d;s|.*archive/v\(.*\).tar.*|\1|;q' + sed '/archive.*tar/!d;s|.*/v\(.*\).tar.*|\1|;q' } # Rules to configure and make the package. diff -r 2984cf98c782 -r 6b6d14c9f7e9 nwipe/receipt --- a/nwipe/receipt Wed Apr 07 15:56:56 2021 +0100 +++ b/nwipe/receipt Thu Apr 08 09:21:26 2021 +0000 @@ -16,7 +16,7 @@ current_version() { wget -O - $WEB_SITE/releases 2>/dev/null | \ - sed '/archive.*tar/!d;s|.*archive/v\(.*\).tar.*|\1|;q' + sed '/archive.*tar/!d;s|.*/v\(.*\).tar.*|\1|;q' } # Rules to configure and make the package. diff -r 2984cf98c782 -r 6b6d14c9f7e9 openssh-pam/receipt --- a/openssh-pam/receipt Wed Apr 07 15:56:56 2021 +0100 +++ b/openssh-pam/receipt Thu Apr 08 09:21:26 2021 +0000 @@ -1,7 +1,7 @@ # SliTaz package receipt. PACKAGE="openssh-pam" -VERSION="8.4p1" +VERSION="8.5p1" CATEGORY="security" SHORT_DESC="Openbsd Secure Shell using PAM." MAINTAINER="pascal.bellard@slitaz.org" diff -r 2984cf98c782 -r 6b6d14c9f7e9 openssh/receipt --- a/openssh/receipt Wed Apr 07 15:56:56 2021 +0100 +++ b/openssh/receipt Thu Apr 08 09:21:26 2021 +0000 @@ -1,7 +1,7 @@ # SliTaz package receipt. PACKAGE="openssh" -VERSION="8.4p1" +VERSION="8.5p1" CATEGORY="security" SHORT_DESC="Openbsd Secure Shell." MAINTAINER="pascal.bellard@slitaz.org" diff -r 2984cf98c782 -r 6b6d14c9f7e9 radare2/receipt --- a/radare2/receipt Wed Apr 07 15:56:56 2021 +0100 +++ b/radare2/receipt Thu Apr 08 09:21:26 2021 +0000 @@ -13,7 +13,7 @@ current_version() { wget -O - ${WGET_URL%/arch*}/releases 2>/dev/null | \ - sed '/archive.[0-9].*tar/!d;s|.*archive/\(.*\).tar.*|\1|;q' + sed '/archive.*tar/!d;s|.*/\(.*\).tar.*|\1|;q' } # Rules to configure and make the package. diff -r 2984cf98c782 -r 6b6d14c9f7e9 sftp-server/receipt --- a/sftp-server/receipt Wed Apr 07 15:56:56 2021 +0100 +++ b/sftp-server/receipt Thu Apr 08 09:21:26 2021 +0000 @@ -1,7 +1,7 @@ # SliTaz package receipt. PACKAGE="sftp-server" -VERSION="8.4p1" +VERSION="8.5p1" CATEGORY="security" TAGS="ssh" SHORT_DESC="Openbsd Secure FTP server." diff -r 2984cf98c782 -r 6b6d14c9f7e9 sslh/receipt --- a/sslh/receipt Wed Apr 07 15:56:56 2021 +0100 +++ b/sslh/receipt Thu Apr 08 09:21:26 2021 +0000 @@ -16,6 +16,12 @@ BUILD_DEPENDS="libwrap-dev libwrap libconfig-dev libcap-dev" SUGGESTED="iptables" +current_version() +{ + wget -O - ${WGET_URL%/arch*}/releases 2>/dev/null | \ + sed '/tags.*tar/!d;s|.*tags/v\(.*\).tar.*|\1|;q' +} + # Rules to configure and make the package. compile_rules() { diff -r 2984cf98c782 -r 6b6d14c9f7e9 upx/receipt --- a/upx/receipt Wed Apr 07 15:56:56 2021 +0100 +++ b/upx/receipt Thu Apr 08 09:21:26 2021 +0000 @@ -18,7 +18,7 @@ current_version() { wget -O - ${WGET_URL%/arch*}/releases 2>/dev/null | \ - sed '/archive.*tar/!d;s|.*archive/v\(.*\).tar.*|\1|;q' + sed '/archive.*tar/!d;s|.*/v\(.*\).tar.*|\1|;q' } # Rules to configure and make the package. diff -r 2984cf98c782 -r 6b6d14c9f7e9 zstd/receipt --- a/zstd/receipt Wed Apr 07 15:56:56 2021 +0100 +++ b/zstd/receipt Thu Apr 08 09:21:26 2021 +0000 @@ -18,7 +18,7 @@ current_version() { wget -O - ${WGET_URL%/arch*}/releases 2>/dev/null | \ - sed '/archive.*tar/!d;s|.*archive/v\(.*\).tar.*|\1|;q' + sed '/archive.*tar/!d;s|.*/v\(.*\).tar.*|\1|;q' } # Rules to configure and make the package.