wok diff linld/stuff/memcpy32.u @ rev 24986

Up nettle 3.7.3 again, need glib-networking rebuild to no break midori
author Stanislas Leduc <shann@slitaz.org>
date Wed May 11 08:28:28 2022 -0400 (2022-05-11)
parents
children
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/linld/stuff/memcpy32.u	Wed May 11 08:28:28 2022 -0400
     1.3 @@ -0,0 +1,117 @@
     1.4 +--- LINLD097/MEMCPY32.ASM
     1.5 ++++ LINLD097/MEMCPY32.ASM
     1.6 +@@ -22,70 +22,34 @@
     1.7 +         global  _is_rm32:near
     1.8 +         proc    _is_rm32 near
     1.9 + 
    1.10 +-                pushf
    1.11 +-                cli
    1.12 ++		pushf
    1.13 ++                push    dx
    1.14 + ; Check for oldies
    1.15 +-                push    sp
    1.16 +-                pop     ax
    1.17 +-                cmp     ax,sp
    1.18 +-                jne     @@bad   ;it is a 86/186, not a 286+
    1.19 ++		mov	ax, 0F000h
    1.20 ++		push	ax		; < 286 : flags[12..15] are forced 1
    1.21 ++		popf			; = 286 : flags[12..15] are forced 0
    1.22 ++		pushf			; > 286 : only flags[15] is forced 0
    1.23 ++		pop	dx
    1.24 ++		add	dh,ah		; NS=386+, NC=286
    1.25 ++		stc
    1.26 ++                js     @@bad   		;it is a 86/186/286, not a 386+
    1.27 + ; Check for vm
    1.28 +                 smsw    ax      ;SMSW cannot be trapped! :-)
    1.29 +                 test    al,1	;MSW_PE
    1.30 +-
    1.31 +-; We're in vm, this is 386+ (there is no vm in 286)
    1.32 ++; We're in vm
    1.33 +                 jnz     check_vcpi
    1.34 + 
    1.35 +-; We're in rm, chk for 386+
    1.36 +-                push    ds dx
    1.37 +-                push    0
    1.38 +-                pop     ds
    1.39 +-                mov     ax,offset excp6
    1.40 +-		mov	dx,cs
    1.41 +-                xchg    [06h*4  ],ax
    1.42 +-                xchg    [06h*4+2],dx
    1.43 +-               ;cmp     sp,sp           ;sets ZF - already done
    1.44 +-                xchg    eax,eax         ;triggers excp6 on 286 - clears ZF
    1.45 +-                mov     [06h*4  ],ax
    1.46 +-                mov     [06h*4+2],dx
    1.47 +-                pop     dx ds
    1.48 +-                jnz     @@bad   ;it's a 286
    1.49 +-
    1.50 + ; It's a 386 in real mode, chk for paging (crazy but possible)
    1.51 +-                push    eax
    1.52 +                 mov     eax,cr0
    1.53 +                 shl     eax,1   ;CR0_PG to CF
    1.54 +-                pop     eax
    1.55 +-                jc      @@bad   ;CR0_PG was set - real mode paging
    1.56 +-@@386rm:
    1.57 +-                mov     ax,1
    1.58 +-                popf
    1.59 +-                ret
    1.60 +-@@bad:          xor     ax,ax
    1.61 +-                popf
    1.62 +-                ret
    1.63 ++@@bad:		sbb	ax,ax	; ax=0h+!CF
    1.64 ++		inc	ax
    1.65 ++		jmp	@@end
    1.66 + 
    1.67 + ;***************************************************************
    1.68 +-;****** Helper int 6 handler: clears ZF, moves IP by 2 bytes
    1.69 +-;***************************************************************
    1.70 +-label   excp6 near
    1.71 +-@@oldFlags      =       (word bp+6)
    1.72 +-@@oldCS         =       (word bp+4)
    1.73 +-@@oldIP         =       (word bp+2)
    1.74 +-@@oldBP         =       (word bp+0)
    1.75 +-@@Flags_ZF      =       0040h
    1.76 +-                push	bp
    1.77 +-		mov	bp,sp
    1.78 +-                add     [@@oldIP],2
    1.79 +-                and     [byte low @@oldFlags],not @@Flags_ZF
    1.80 +-                pop     bp
    1.81 +-                iret
    1.82 +-
    1.83 +-;***************************************************************
    1.84 + ;****** Helper: checks for vcpi
    1.85 + ;***************************************************************
    1.86 + label   check_vcpi near
    1.87 +-                push    dx
    1.88 +                 push    ds
    1.89 + ; Check whether it is safe to call 67h (we trust only known EMM managers)
    1.90 +                 push    0
    1.91 +@@ -119,6 +83,7 @@
    1.92 +               ;;push    dx              ;$ save handle
    1.93 +                 mov     ax,0DE00h       ; check for vcpi present
    1.94 +                 int     67h
    1.95 ++                mov     al,2
    1.96 +                 test    ah,ah
    1.97 +                 jz      @@386vcpi
    1.98 +               ;;pop     dx              ;$ handle
    1.99 +@@ -126,11 +91,10 @@
   1.100 +               ;;int     67h
   1.101 + @@no_vcpi:
   1.102 +                 xor     ax,ax
   1.103 +-                jmp     @@ret
   1.104 + @@386vcpi:
   1.105 +-                mov     ax,2
   1.106 + @@ret:
   1.107 +                 pop     ds
   1.108 ++@@end:
   1.109 +                 pop     dx
   1.110 +                 popf
   1.111 +                 ret
   1.112 +@@ -214,7 +178,7 @@
   1.113 +                 jmp     short $+2
   1.114 + 
   1.115 + ;****** Return *************************************************
   1.116 +-@@ret:          lgdt    [oldGDTR]
   1.117 ++                lgdt    [oldGDTR]
   1.118 +                 pop     edi esi ecx eax ds es
   1.119 +                 popf
   1.120 +                 leave