|
|
1.1 root 1:
2: / i8086 coherent clist hack.
3:
4: ///////
5:
6: /LXXX: .long NCPCL+4
7:
8: /cltinit:
9: / pushf / s = sphi()
10: / cli
11: / mov NCLIST,%eax
12: / imull LXXX,%eax
13: / addl clistp,%eax
14: / sub %ecx,%ecx
15: / jmp loc32
16:
17: /loc33: mov %ecx,(%eax)
18: / mov %eax,%ecx
19: /loc32: sub $NCPCL+4, %eax
20: / cmp clistp,%eax
21: / jnb loc33
22:
23: / mov %ecx,cltfree
24: / call spl
25: / add $0x04,%esp
26: / ret
27:
28: /getq:
29: / push %esi
30:
31: / mov 8(%esp),%edx
32: / sub %ecx,%ecx
33: / cmp %ecx,(%edx) / if (cqp->cq_cc==0)
34: / je loc21
35:
36: / pushf / s = sphi()
37: / cli
38: / mov 12(%edx),%esi / op = cqp->cq_op [%esi]
39: / mov 16(%edx),%eax / ox = cqp->cq_ox [%eax]
40: / movb 4(%eax,%esi),%cl
41: / push %ecx / save = op->cl_ch[ox]
42: / decl (%edx) / if (--cqp->cq_cc == 0)
43: / je loc23
44: / inc %eax / ++ox
45: / mov %eax,16(%edx) / cqp->cq_ox = ox
46: / cmp $NCPCL,%eax / if (ox == NCPL)
47: / jne loc24
48:
49: /loc23: sub %eax,%eax
50: / mov %eax,16(%edx) / cqp->cq_ox = 0
51: / mov (%esi),%ecx / np = op->cl_fp
52: / mov %ecx,12(%edx) / cqp->cq_op = np
53: / cmp %eax,%ecx / if (np==0)
54: / jne loc25
55: / mov %eax,4(%edx) / cqp->cq_ip = 0
56: / mov %eax,8(%edx) / cqp->cq_ix = 0
57:
58: /loc25: mov cltfree,%ecx
59: / mov %ecx,(%esi) / op->cl_fp = cltfree
60: / mov %esi,cltfree / cltfree = op
61: / cmp %eax,cltwant / if (cltwant)
62: / je loc24
63: / mov %eax,cltwant / cltwant = 0
64: / push $cltwant
65: / call wakeup / wakeup(&cltwant)
66: / pop %eax
67:
68: /loc24: pop %esi
69: / call spl / spl(s)
70: / pop %eax
71: / mov %esi,%eax / return save
72: / pop %esi
73: / ret
74: /loc21:
75: / mov $-1,%eax / return -1
76: / pop %esi
77: / ret
78:
79: /putq:
80: / push %esi
81: / sub %eax,%eax
82: / pushf / s = sphi();
83: / cli
84: / mov 12(%esp),%edx / ebp = cqp
85: / mov 4(%edx),%esi / ip = cqp->cq_ip [%esi]
86: / mov 8(%edx),%ecx / ix = cqp->cq_ix [%ecx]
87: / cmp %eax,%ecx / if (ix==0) {
88: / jne loc26
89: / mov cltfree,%esi / ip = cltfree
90: / cmp %eax,%esi / if (ip==0)
91: / je loc27 / goto bad;
92: / mov (%esi),%ecx
93: / mov %ecx,cltfree / cltfree = cltfree->cl_fp
94: / mov %eax,(%esi) / ip->cl_fp = 0
95: / mov 4(%edx),%ecx / np = cqp->cq_ip
96: / cmp %eax,%ecx / if (np==0)
97: / jne loc29
98: / mov %esi,12(%edx) / cqp->cq_op = ip
99: / jmp loc30
100: / / else
101: /loc29: mov %esi,(%ecx) / np->cl_fp = ip
102:
103: /loc30: mov %esi,4(%edx) / cqp->cq_ip = ip
104: / mov %eax,%ecx / ix = 0
105: / / }
106:
107: /loc26:
108: / movb 16(%esp),%al / ip->cl_ch[ix] = c
109: / movb %al, 4(%esi,%ecx)
110: / inc %ecx / ix++
111: / cmp $NCPCL,%ecx / if (ix==NCPCL)
112: / jne loc31
113: / sub %ecx,%ecx / ix = 0
114:
115: /loc31: mov %ecx,8(%edx) / cqp->cq_ix = ix
116: / incl (%edx) / cqp->cq_cc++
117: / call spl / spl(s)
118: / add $4,%esp
119: / mov 12(%esp),%eax / return (c)
120: /loc28:
121: / pop %esi
122: / ret
123: /loc27:
124: / call spl / spl(s)
125: / add $4,%esp
126: / mov $-1,%eax / return -1
127: / jmp loc28
128:
129: /clrq:
130: / mov 4(%esp),%edx
131: / pushf
132: / cli
133:
134: /loc34: push %edx
135: / call getq
136: / pop %edx
137: / or %eax,%eax
138: / jge loc34
139:
140: / call spl
141: / pop %eax
142: / ret
143:
144: /loc35: movl $0x01,cltwant
145: / push %eax
146: / push %eax
147: / push $0x0100
148: / push $cltwant
149: / call sleep
150: / add $16,%esp
151: /waitq:
152: / sub %eax,%eax
153: / cmp %eax,cltfree
154: / jne loc35
155: / ret
156:
157: ///////
158:
159: / atbsyw() -- wait for AT disk controller to become not busy
160:
161: / Return: 0 = timeout
162: / * = not busy
163:
164: ///////
165: /atbsyw:
166: / mov $0x3FFFF, %ecx
167: / mov ATSREG, %edx
168: /loc16: inb (%dx)
169: / testb $BSY_ST, %al
170: / loopne loc16
171: / mov %ecx, %eax
172: / ret
173:
174: ///////
175:
176: / AT Hard Disk Assembler Support
177: / atbsyw() - wait while controller is busy
178: / atdrqw() - wait for controller to request data transfer
179:
180: ///////
181: ///////
182:
183: / atdrqw() -- wait for AT disk controller to initiate data request
184:
185: / Return: 0 = timeout
186: / * = data requested
187:
188: ///////
189:
190: /atdrqw:
191: / mov $0x3FFFF, %ecx
192: / mov ATSREG, %edx
193: /loc17: inb (%dx)
194: / testb $DRQ_ST, %al
195: / loope loc17
196: / mov %ecx, %eax
197: / ret
198:
199:
200: / Read master PIC state
201: / return 00:xx:yy:zz 4-byte int value
202: / xx: interrupt mask
203: / yy: isr
204: / zz: irr
205:
206: / .globl mchirp
207: /FOO .macro ch
208: / push ch
209: / call mchirp
210: / add $4,%esp
211: / .endm
212:
213: / .globl rd_m_pic
214: /rd_m_pic:
215: / pushfl
216: / cli
217: / sub %eax,%eax
218: / inb $PICM / interrupt mask to %eax:16..23
219: / shl $8,%eax
220: / movb $0x0B,%al / OCW3 - read isr
221: / outb $PIC
222: / IODELAY
223: / inb $PIC / in-service register to %eax:8..15
224: / shl $8,%eax
225: / movb $0x0A,%al / OCW3 - read irr
226: / outb $PIC
227: / IODELAY
228: / inb $PIC / irpt request register to %eax:0..7
229: / popfl
230: / ret
231:
232: / Read slave PIC state
233: / return 00:xx:yy:zz 4-byte int value
234: / xx: interrupt mask
235: / yy: isr
236: / zz: irr
237:
238: / .globl rd_s_pic
239: /rd_s_pic:
240: / pushfl
241: / cli
242: / sub %eax,%eax
243: / inb $SPICM / interrupt mask to %eax:16..23
244: / shl $8,%eax
245: / movb $0x0B,%al / OCW3 - read isr
246: / outb $SPIC
247: / IODELAY
248: / inb $SPIC / in-service register to %eax:8..15
249: / shl $8,%eax
250: / movb $0x0A,%al / OCW3 - read irr
251: / outb $SPIC
252: / IODELAY
253: / inb $SPIC / irpt request register to %eax:0..7
254: / popfl
255: / ret
256:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.