wok view linld/stuff/src/XMM.ASM @ rev 19538

linld: add 'linld <kernel> <cmdline>' syntax
author Pascal Bellard <pascal.bellard@slitaz.org>
date Fri Dec 02 12:37:59 2016 +0100 (2016-12-02)
parents bb42796dcd3b
children 76087975885f
line source
1 ;***************************************************************
2 ;****** This file is distributed under GPL
3 ;***************************************************************
4 ideal
5 %crefref
6 %noincl
7 %nomacs
8 p386
10 group DGROUP _TEXT,_BSS
11 assume cs:DGROUP,ds:DGROUP
13 segment _BSS byte public use16 'BSS'
15 global xmm_handler:dword
16 xmm_handler dd ?
18 ends _BSS
20 segment _TEXT byte public use16 'CODE'
22 ;***************************************************************
23 ;void enable_a20_xmm();
24 ;***************************************************************
25 global _enable_a20_xmm:near
26 proc _enable_a20_xmm near
28 mov ah,03h ;global enable a20
29 call xmm_driver ;
30 mov ah,05h ;local enable a20
31 ;jmp xmm_driver ;
33 endp _enable_a20_xmm
35 ;***************************************************************
36 ;Call xmm driver addr or 0 if no xmm
37 ;void xmm_driver()
38 ;***************************************************************
39 global xmm_driver:near
40 proc xmm_driver near
42 cmp [xmm_handler],0
43 jne @@gotit
45 xchg ax,cx ; save cmd
46 mov ax,4300h
47 int 2fh
48 mov bx,offset xmm_fail
49 push cs
50 pop es
51 cmp al,80h
52 jne @@err
53 mov ax,4310h
54 int 2fh
55 @@err:
56 xchg ax,cx ; restore cmd
57 push es
58 push bx
59 pop [xmm_handler]
60 @@gotit:
61 call [xmm_handler]
62 ret
63 xmm_fail:
64 xor ax,ax
65 cwd
66 retf
68 endp xmm_driver
71 ;***************************************************************
72 ;void xmm_alloc(struct image_himem *m)
73 ;struct image_himem {
74 ; 0 int fd;
75 ; 2 u32 fallback;
76 ; 6 u32 size;
77 ;10 u32 remaining;
78 ;14 u32 buf;
79 ;18 u32 *bufv;
80 ;20 char *errmsg;
81 ;22 u32 chunk_size;
82 ;26 void (*next_chunk)(struct image_himem *);
83 ;28 u16 state;
84 ;30 u16 fd2close;
85 ;};
86 ;***************************************************************
87 global _xmm_alloc:near
88 proc _xmm_alloc near
90 pop ax
91 pop bx
92 push bx
93 push ax
94 ifndef NO386
95 mov edx,[bx+6] ; m->size
96 dec edx
97 shr edx,10 ; to Kb
98 else
99 mov ax,[bx+6] ; lo m->size
100 mov dx,[bx+8] ; hi m->size
101 sub ax,1
102 sbb dx,0
103 mov cx,10
104 @@tokblp:
105 shr dx,1
106 rcr ax,1
107 loop @@tokblp
108 endif
109 inc dx
110 push bx
111 mov ah,09h ;allocate blk
112 call xmm_driver ;
113 dec ax
114 jnz @@goerr
115 ;now: dx=handle of the blk
116 mov ah,0Ch ;lock blk
117 call xmm_driver ;
118 dec ax
119 ;now: dx:bx=addr of blk
120 xchg ax,bx
121 @@goerr:
122 pop bx
123 jnz @@err
124 mov [bx+14],ax ; lo m->buf
125 mov [bx+16],dx ; hi m->buf
126 @@err:
127 ret
129 endp _xmm_alloc
131 ends _TEXT
133 end
135 ;###### END OF FILE ############################################