1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
#include <setjmp.h>
#if __AS386_16__
int
setjmp(env)
jmp_buf env;
{
#asm
pop cx ! PC
#if __FIRST_ARG_IN_AX__
mov bx,ax
#else
mov bx,sp
mov bx,[bx] ! TOS is prt -> env
#endif
mov [bx+0],cx ! PC
mov [bx+2],sp ! This registers are all that may be constant.
mov [bx+4],bp
mov [bx+6],si ! Is saving these the "right thing" ?
mov [bx+8],di
xor ax,ax
jmp cx
#endasm
}
void
longjmp(env, rv)
jmp_buf env;
int rv;
{
#asm
pop cx ! pc
#if __FIRST_ARG_IN_AX__
mov bx,ax ! env->
#else
pop bx ! env->
#endif
pop ax ! rv
mov cx,[bx+0] ! PC
mov sp,[bx+2]
mov bp,[bx+4]
mov si,[bx+6]
mov di,[bx+8]
jmp cx
#endasm
}
#endif
|