wok diff linld/stuff/src/XMM.ASM @ rev 19571

linld: large image support with VCPI
author Pascal Bellard <pascal.bellard@slitaz.org>
date Thu Dec 22 21:06:17 2016 +0100 (2016-12-22)
parents bb42796dcd3b
children 76087975885f
line diff
     1.1 --- a/linld/stuff/src/XMM.ASM	Tue Nov 22 21:19:01 2016 +0100
     1.2 +++ b/linld/stuff/src/XMM.ASM	Thu Dec 22 21:06:17 2016 +0100
     1.3 @@ -60,26 +60,44 @@
     1.4  @@gotit:
     1.5  		call	[xmm_handler]
     1.6                  ret
     1.7 +xmm_fail:
     1.8 +                xor     ax,ax
     1.9 +                cwd
    1.10 +                retf
    1.11 +
    1.12          endp    xmm_driver
    1.13  
    1.14  
    1.15  ;***************************************************************
    1.16 -;u32 xmm_alloc(void* drv, u32 size)
    1.17 +;void xmm_alloc(struct image_himem *m)
    1.18 +;struct image_himem {
    1.19 +; 0    int fd;
    1.20 +; 2    u32 fallback;
    1.21 +; 6    u32 size;
    1.22 +;10    u32 remaining;
    1.23 +;14    u32 buf;
    1.24 +;18    u32 *bufv;
    1.25 +;20    char *errmsg;
    1.26 +;22    u32 chunk_size;
    1.27 +;26    void (*next_chunk)(struct image_himem *);
    1.28 +;28    u16 state;
    1.29 +;30    u16 fd2close;
    1.30 +;};
    1.31  ;***************************************************************
    1.32          global  _xmm_alloc:near
    1.33          proc    _xmm_alloc near
    1.34  
    1.35 +                pop     ax
    1.36                  pop     bx
    1.37 +                push    bx
    1.38 +                push    ax
    1.39  		ifndef	NO386
    1.40 -                pop     edx
    1.41 -                push    edx
    1.42 +		mov	edx,[bx+6]		; m->size
    1.43                  dec     edx
    1.44                  shr     edx,10          ; to Kb
    1.45  		else
    1.46 -                pop     ax
    1.47 -                pop     dx
    1.48 -                push    dx
    1.49 -                push    ax
    1.50 +		mov	ax,[bx+6]		; lo m->size
    1.51 +		mov	dx,[bx+8]		; hi m->size
    1.52  		sub	ax,1
    1.53  		sbb	dx,0
    1.54  		mov	cx,10
    1.55 @@ -89,25 +107,25 @@
    1.56  		loop	@@tokblp
    1.57  		endif
    1.58                  inc     dx
    1.59 -                push    cs
    1.60 -                push    bx
    1.61 +		push	bx
    1.62                  mov     ah,09h          ;allocate blk
    1.63                  call    xmm_driver      ;
    1.64                  dec     ax
    1.65 -                jnz     @@err
    1.66 +                jnz     @@goerr
    1.67                                          ;now: dx=handle of the blk
    1.68                  mov     ah,0Ch          ;lock blk
    1.69                  call    xmm_driver      ;
    1.70                  dec     ax
    1.71                                          ;now: dx:bx=addr of blk
    1.72                  xchg    ax,bx
    1.73 -                jz      @@ok
    1.74 +@@goerr:
    1.75 +		pop	bx
    1.76 +                jnz     @@err
    1.77 +		mov	[bx+14],ax	; lo m->buf
    1.78 +		mov	[bx+16],dx	; hi m->buf
    1.79  @@err:
    1.80 -xmm_fail:
    1.81 -                xor     ax,ax
    1.82 -                cwd
    1.83 -@@ok:
    1.84 -                retf
    1.85 +                ret
    1.86 +
    1.87          endp    _xmm_alloc
    1.88  
    1.89          ends    _TEXT