|
|
1.1 root 1: //////////
2: / From MSDOS MWC86 system call interface.
3: / Interrupt simulation.
4: / Modified for use with tertiary boot code for COHERENT.
5: /
6: / Modified September 1991 by La Monte H. Yarroll <[email protected]>
7: /
8: / DANGER!! THIS IS SELF MODIFYING CODE. IT WILL ONLY WORK IN A STRICTLY
9: / SINGLE THREADED ENVIRONMENT.
10: //////////
11:
12: #include "larges.h"
13:
14: //////////
15: / void
16: / intcall(src, dest, intnum)
17: / struct reg *src; /* All regs are loaded except flags */
18: / struct reg *dest; /* All regs are stored here */
19: / int intnum; /* Int number */
20: //////////
21:
22: src = 6+RASIZE
23: dest = src+PTRSIZE
24: intnum = dest+PTRSIZE
25:
26: .globl intcall_
27:
28: intcall_:
29: push si / Save register variables.
30: push di
31: push bp
32: mov bp, sp
33:
34: movb al, intnum(bp) / Get intnum in AL
35: movb cs:myint+1, al / Modify the code
36:
37: Lds si, src(bp) / Load DS:SI with src pointer.
38: mov ax, (si) / Set AX
39: mov bx, 2(si) / and BX
40: mov cx, 4(si) / and CX
41: mov dx, 6(si) / and DX
42: mov di, 10(si) / and DI,
43: push 12(si) / save src DS,
44: mov es, 14(si) / set ES
45: mov si, 8(si) / and SI
46: pop ds / and DS.
47: / Actually do the interrupt.
48: myint: int 0 / This instruction gets modified.
49:
50: / The interrupt handler preserves SS:SP.
51: / The iret to the handler pops the handler address and flags pushed above,
52: / the iret from the handler pops the retint address and flags.
53: retint:
54: mov bp, sp / Restore BP.
55: pushf / Save result flags
56: push es / and ES
57: push ds / and DS
58: push si / and SI.
59:
60: #if !LARGEDATA
61: mov si, ss
62: mov ds, si / Restore DS
63: mov es, si / and ES.
64: #endif
65:
66: Lds si, dest(bp) / Get dest in DS:SI.
67: mov (si), ax / Load dest with returned AX
68: mov 2(si), bx / and BX
69: mov 4(si), cx / and CX
70: mov 6(si), dx / and DX
71: pop 8(si) / and SI
72: mov 10(si), di / and DI
73: pop 12(si) / and DS
74: pop 14(si) / and ES
75: pop 16(si) / and flags.
76:
77: pop bp
78: pop di
79: pop si
80: Gret
81:
82: / end of intcall.m
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.