1 /* Copyright (C) 1995,1996 Robert de Bath <rdebath@cix.compulink.co.uk>
2 * This file is part of the Linux-8086 C library and is distributed
3 * under the GNU Library General Public License.
6 * These functions will not normally be useful for Linux-8086. But they
7 * can be used and may be useful in the kernel.
41 #if __FIRST_ARG_IN_AX__
57 #if __FIRST_ARG_IN_AX__
77 #if __FIRST_ARG_IN_AX__
99 #if __FIRST_ARG_IN_AX__
113 __doke_es(off
, value
)
118 #if __FIRST_ARG_IN_AX__
142 #if __FIRST_ARG_IN_AX__
176 #ifdef L___strnget_es
178 __strnget_es(d
, s
, c
)
183 register int i
= __strlen_es(s
);
185 /* else s[--c] = 0; ?? */
186 /* else return -E2BIG; ?? */
188 __movedata(__get_es(), s
, __get_ds(), d
, c
);
197 #if !__FIRST_ARG_IN_AX__
203 #if __FIRST_ARG_IN_AX__
211 scasb
! Scans
[ES
:DI
]
223 int86(intr
, in_regs
, out_regs
)
226 union REGS
* out_regs
;
233 push bp
! same
for new bp
236 mov ax
,[bp
-6] ! flags
for simulated
int
237 push cs
! iret address segment
238 mov bx
,#ret_addr ! iret address offset
240 and ah
,#$0C ! simulate interrupt flags
241 push ax
! flags are pushed first
244 mov es
,bx
! interrupt vectors in seg
0
247 shl bx
,#1 ! intr*4 => interrupt vector address
249 push
[bx
+2] ! fetch interrupt segment
251 push
[bx
] ! fetch interrupt offset
252 mov bx
,[bp
+6] ! input
union REGS
*
260 ! Ignore cflag
/flags
?
262 iret
! simulate interrupt
.
263 ! But won
't be nice for protected mode ...
265 ! Int $25/6 would need resetting sp:ss too ... should I ?
267 pop bp ! unzapped versions
270 pushf ! save interrupt flags
271 push bx ! save pointer register
272 mov bx,[bp+8] ! output union REGS*
280 mov word [bx+12],#0 ! cflag
294 int86x(intr, in_regs, out_regs, segr)
297 union REGS* out_regs;
305 push bp ! same for new bp
308 mov ax,[bp-6] ! flags for simulated int
309 push cs ! iret address segment
310 mov bx,#ret_addr ! iret address offset
312 and ah,#$0C ! simulate interrupt flags
313 push ax ! flags are pushed first
316 mov es,bx ! interrupt vectors in seg 0
319 shl bx,1 ! intr*4 => interrupt vector address
321 push word [bx+2] ! fetch interrupt segment
323 push word [bx] ! fetch interrupt offset
325 mov bx,[bp+10] ! struct SREGS*
329 mov bx,[bp+6] ! input union REGS*
337 ! Ignore cflag/flags ?
341 iret ! simulate interrupt
342 ! But won't be nice
for protected mode
...
345 ! Int $
25/6 would need resetting sp
:ss too
... should I
?
347 pop bp
! in
case it was zapped
349 pushf
! save interrupt flags
351 push cx
! save work
register
353 push bx
! save pointer
register
355 mov ds
,word
[bp
-2] ! restore original ds
356 mov bx
,[bp
+10] ! struct SREGS
*
360 mov bx
,[bp
+8] ! output
union REGS
*
367 mov word
[bx
+12],#0 ! cflag
384 #if __FIRST_ARG_IN_AX__
398 #endif /* __AS386_16__ */