wok annotate linld/stuff/src/XMM.ASM @ rev 21757

tazboot: spave 40k+ for zImage
author Pascal Bellard <pascal.bellard@slitaz.org>
date Mon Jun 24 16:31:09 2019 +0200 (2019-06-24)
parents d0b13dc0fe1c
children 04ffefac5707
rev   line source
pascal@19515 1 ;***************************************************************
pascal@19515 2 ;****** This file is distributed under GPL
pascal@19515 3 ;***************************************************************
pascal@19515 4 ideal
pascal@19515 5 %crefref
pascal@19515 6 %noincl
pascal@19515 7 %nomacs
pascal@19636 8 ifdef NO386
pascal@19636 9 p8086
pascal@19636 10 else
pascal@19515 11 p386
pascal@19636 12 endif
pascal@19515 13
pascal@19515 14 group DGROUP _TEXT,_BSS
pascal@19515 15 assume cs:DGROUP,ds:DGROUP
pascal@19515 16
pascal@19515 17 segment _BSS byte public use16 'BSS'
pascal@19515 18
pascal@19515 19 xmm_handler dd ?
pascal@19515 20
pascal@19515 21 ends _BSS
pascal@19515 22
pascal@19515 23 segment _TEXT byte public use16 'CODE'
pascal@19515 24
pascal@19515 25 ;***************************************************************
pascal@19515 26 ;void enable_a20_xmm();
pascal@19515 27 ;***************************************************************
pascal@19515 28 global _enable_a20_xmm:near
pascal@19515 29 proc _enable_a20_xmm near
pascal@19515 30
pascal@19515 31 mov ah,03h ;global enable a20
pascal@19515 32 call xmm_driver ;
pascal@19515 33 mov ah,05h ;local enable a20
pascal@19515 34 ;jmp xmm_driver ;
pascal@19515 35
pascal@19515 36 endp _enable_a20_xmm
pascal@19515 37
pascal@19515 38 ;***************************************************************
pascal@19515 39 ;Call xmm driver addr or 0 if no xmm
pascal@20142 40 ;void xmm_driver(ah)
pascal@19515 41 ;***************************************************************
pascal@19515 42 proc xmm_driver near
pascal@19515 43
pascal@19876 44 push si
pascal@19876 45 mov si,offset xmm_handler
pascal@19636 46 ifndef NO386
pascal@20142 47 cmp [dword si],0
pascal@19636 48 else
pascal@20426 49 mov cx,[word si]
pascal@20426 50 or cx,[word si+2]
pascal@19636 51 endif
pascal@19515 52 jne @@gotit
pascal@19515 53
pascal@21757 54 push ax ; save cmd
pascal@20142 55 mov ax,4300h ; installation check in al
pascal@19515 56 int 2fh
pascal@19515 57 mov bx,offset xmm_fail
pascal@21757 58 push ds
pascal@19515 59 pop es
pascal@19515 60 cmp al,80h
pascal@19515 61 jne @@err
pascal@20142 62 mov ax,4310h ; get driver address in es:bx
pascal@19515 63 int 2fh
pascal@19515 64 @@err:
pascal@21757 65 pop ax ; restore cmd
pascal@20426 66 mov [si],bx
pascal@20426 67 mov [si+2],es
pascal@19515 68 @@gotit:
pascal@20426 69 call [dword si] ; far ptr [si]
pascal@20142 70 dec ax ; Z=1=OK
pascal@19876 71 pop si
pascal@19515 72 ret
pascal@19538 73 xmm_fail:
pascal@19538 74 xor ax,ax
pascal@19538 75 cwd
pascal@19538 76 retf
pascal@19538 77
pascal@19515 78 endp xmm_driver
pascal@19515 79
pascal@19515 80
pascal@20142 81 struc image_himem ;struct image_himem {
pascal@20142 82 fd dw ? ; 0 int fd;
pascal@20142 83 fallback dd ? ; 2 u32 fallback;
pascal@20142 84 size dd ? ; 6 u32 size;
pascal@20142 85 remaining dd ? ;10 u32 remaining;
pascal@20142 86 buf dd ? ;14 u32 buf;
pascal@20142 87 bufv dw ? ;18 u32 *bufv;
pascal@20142 88 errmsg dw ? ;20 char *errmsg;
pascal@20142 89 chunk_size dd ? ;22 u32 chunk_size;
pascal@20142 90 next_chunk dw ? ;26 void (*next_chunk)(struct image_himem *);
pascal@20142 91 state dw ? ;28 u16 state;
pascal@20142 92 fd2close dw ? ;30 u16 fd2close;
pascal@20142 93 ends ;};
pascal@20142 94
pascal@19515 95 ;***************************************************************
pascal@20538 96 ;_fastcall void xmm_alloc(struct image_himem *m)
pascal@19515 97 ;***************************************************************
pascal@20528 98 global @xmm_alloc$qp11image_himem:near
pascal@20528 99 proc @xmm_alloc$qp11image_himem near
pascal@19515 100
pascal@19515 101 ifndef NO386
pascal@20142 102 mov edx,[(image_himem bx).size] ; m->size
pascal@20142 103 ;dec edx
pascal@19515 104 shr edx,10 ; to Kb
pascal@20486 105 inc edx
pascal@20486 106 mov ah,89h ;allocate blk of EDX kilobytes
pascal@19515 107 else
pascal@20142 108 ;mov ax,-1
pascal@20142 109 ;cwd
pascal@20142 110 ;add ax,[word (image_himem bx).size] ; lo m->size
pascal@20142 111 ;adc dx,[word (image_himem bx+2).size] ; hi m->size
pascal@20142 112 mov ax,[word (image_himem bx).size] ; lo m->size
pascal@20142 113 mov dx,[word (image_himem bx+2).size] ; hi m->size
pascal@20142 114 mov cl,16-10
pascal@20142 115 extrn N_LXLSH@:near
pascal@20142 116 call N_LXLSH@
pascal@20486 117 inc dx
pascal@20486 118 mov ah,9h ;allocate blk of DX kilobytes (<64Mb)
pascal@19515 119 endif
pascal@19538 120 push bx
pascal@19515 121 call xmm_driver ;
pascal@19538 122 jnz @@goerr
pascal@19515 123 ;now: dx=handle of the blk
pascal@19515 124 mov ah,0Ch ;lock blk
pascal@19515 125 call xmm_driver ;
pascal@19515 126 ;now: dx:bx=addr of blk
pascal@19515 127 xchg ax,bx
pascal@19538 128 @@goerr:
pascal@19538 129 pop bx
pascal@19538 130 jnz @@err
pascal@20142 131 mov [word (image_himem bx).buf],ax ; lo m->buf
pascal@20142 132 mov [word (image_himem bx+2).buf],dx ; hi m->buf
pascal@19515 133 @@err:
pascal@19538 134 ret
pascal@19538 135
pascal@20528 136 endp @xmm_alloc$qp11image_himem
pascal@19515 137
pascal@19515 138 ends _TEXT
pascal@19515 139
pascal@19515 140 end
pascal@19515 141
pascal@19515 142 ;###### END OF FILE ############################################