wok-6.x view linld/stuff/src/XMM.ASM @ rev 19515

linld: multi initrd support
author Pascal Bellard <pascal.bellard@slitaz.org>
date Tue Nov 22 21:19:01 2016 +0100 (2016-11-22)
parents
children 7f92b23984dc
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 endp xmm_driver
66 ;***************************************************************
67 ;u32 xmm_alloc(void* drv, u32 size)
68 ;***************************************************************
69 global _xmm_alloc:near
70 proc _xmm_alloc near
72 pop bx
73 ifndef NO386
74 pop edx
75 push edx
76 dec edx
77 shr edx,10 ; to Kb
78 else
79 pop ax
80 pop dx
81 push dx
82 push ax
83 sub ax,1
84 sbb dx,0
85 mov cx,10
86 @@tokblp:
87 shr dx,1
88 rcr ax,1
89 loop @@tokblp
90 endif
91 inc dx
92 push cs
93 push bx
94 mov ah,09h ;allocate blk
95 call xmm_driver ;
96 dec ax
97 jnz @@err
98 ;now: dx=handle of the blk
99 mov ah,0Ch ;lock blk
100 call xmm_driver ;
101 dec ax
102 ;now: dx:bx=addr of blk
103 xchg ax,bx
104 jz @@ok
105 @@err:
106 xmm_fail:
107 xor ax,ax
108 cwd
109 @@ok:
110 retf
111 endp _xmm_alloc
113 ends _TEXT
115 end
117 ;###### END OF FILE ############################################