Trailing-Edge
-
PDP-10 Archives
-
BB-H348C-RM_1982
-
swskit-v21/listings/rsx11s/iosub.list
There are no other files named iosub.list in the archive.
IOSUB MACRO M1110 22-AUG-79 07:06 PAGE 3
1 .TITLE IOSUB
2 .IDENT /10/
3
4 ;
5 ; COPYRIGHT (C) 1974, 1978
6 ; DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS.
7 ;
8 ; THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY ONLY BE USED
9 ; OR COPIED IN ACCORDANCE WITH THE TERMS OF SUCH LICENSE.
10 ;
11 ; VERSION 10
12 ;
13 ; D. N. CUTLER 4-AUG-73
14 ;
15 ; PREVIOUSLY MODIFIED BY:
16 ;
17 ; P. J. BEZEREDI
18 ; D. N. CUTLER
19 ; C. A. D'ELIA
20 ; T. J. MILLER
21 ;
22 ; MODIFIED BY:
23 ;
24 ; P. J. BEZEREDI 30-NOV-76
25 ;
26 ; PB010 -- ADDITION OF RL11 AND RM03 SUPPORT.
27 ;
28 ; T. J. MILLER 3-JAN-77
29 ;
30 ; TM070 -- CORRECT ERROR IN $MUL ROUTINE.
31 ;
32 ; P. J. BEZEREDI 23-FEB-77
33 ;
34 ; PB017 -- ADDITION OF RK07 SUPPORT.
35 ;
36 ; T. J. MILLER 4-MAR-77
37 ;
38 ; TM075 -- ADDITION OF SUPPORT FOR BLOCK LOCKING IN
39 ; SHARED FILES.
40 ;
41 ; T. J. MILLER 27-APR-77
42 ;
43 ; TM081 -- CORRECT OBSCURE ERROR IN I/O KILL.
44 ;
45 ; T. J. MILLER 26-MAY-77
46 ;
47 ; TM086 -- MODIFY $IOFIN TO CALL COMMON EVENT FLAG SETTING
48 ; ROUTINE.
49 ;
50 ; T. J. MILLER 18-JUL-77
51 ;
52 ; TM095 -- ADDITION OF DYNAMIC UMR ALLOCATION.
53 ;
54 ; T. J. MILLER 12-SEP-77
55 ;
56 ; TM102 -- CHANGE CALL IN $IOFIN FROM $CHKPT TO $ICHKP TO
57 ; SUPPORT MULTIPLE I/O'S FOR CHECKPOINTABLE TASKS.
IOSUB MACRO M1110 22-AUG-79 07:06 PAGE 3-1
58 ;
59 ; T. J. MILLER 2-NOV-77
60 ;
61 ; TM105 -- ALLOW FOR DEVICE UNIT NUMBERS > 127.
62 ;
63 ; I/O RELATED ROUTINES
64 ;
65 ; MACRO LIBRARY CALLS
66 ;
67
68 .MCALL F11DF$,HDRDF$,HWDDF$,PCBDF$,PKTDF$,TCBDF$ ; TM075
69 000000 F11DF$ ;DEFINE WINDOW AND LOCK BLOCK OFFSETS ; TM075
70 000000 HDRDF$ ;DEFINE TASK HEADER OFFSETS ;**-1
71 000000 HWDDF$ ;DEFINE HARDWARE REGISTERS
72 000000 PCBDF$ ;DEFINE PARTITION CONTROL BLOCK OFFSETS
73 000000 PKTDF$ ;DEFINE I/O PACKET OFFSETS
74 000000 TCBDF$ ;DEFINE TASK CONTROL BLOCK OFFSETS
75
76 ;+
77 ; **-$ACHKP-ADDRESS CHECK PARAMETER BLOCK
78 ; **-$ACHKW-ADDRESS CHECK PARAMETER BLOCK WORD ALIGNED
79 ; **-$ACHK2-ADDRESS CHECK 2 BYTE DIRECTIVE PARAMETER BLOCK
80 ;
81 ; THESE ROUTINES ARE CALLED TO ADDRESS CHECK A TASK SPECIFIED PARAMETER
82 ; BLOCK TO INSURE IT IS WITHIN THE TASK'S ADDRESS SPACE AND ALIGNED PROPERLY.
83 ; IF EITHER CHECK FAILS, THEN A DIRECTIVE STATUS OF 'D.RS98' IS RETURNED.
84 ;
85 ; INPUTS:
86 ;
87 ; R0=STARTING ADDRESS OF THE BLOCK TO BE CHECKED.
88 ; R1=LENGTH OF THE BLOCK TO BE CHECKED IN BYTES.
89 ;
90 ; OUTPUTS:
91 ;
92 ; THE SPECIFIED BLOCK IS CHECKED FOR PROPER ALIGNMENT AND WHETHER
93 ; IT IS WITHIN THE TASK'S ADDRESS SPACE. IF EITHER CHECK FAILS,
94 ; THEN A DIRECTIVE STATUS OF 'D.RS98' IS RETURNED. ELSE A RETURN
95 ; TO THE CALLER IS EXECUTED.
96 ;
97 ; R0 AND R3 ARE PRESERVED ACROSS CALL.
98 ;-
99
100
101 .IF DF A$$CHK!M$$MGE
102
103 .ENABL LSB
104
105
106 .IF NDF M$$MGE
107
108 $ACHK2::MOV #2,R1 ;SET TO CHECK 2 BYTES
109
110 .IFTF
111
112 000000 010300 $ACHKP::MOV R3,R0 ;SET ADDRESS OF BLOCK TO CHECK
113
114 .IFF
IOSUB MACRO M1110 22-AUG-79 07:06 PAGE 3-2
115
116 000002 CALL $ACHCK ;ADDRESS CHECK WORD ALIGNED
117 000006 103411 BCS 10$ ;IF CS CHECK FAILURE
118 000010 CALL $RELOC ;RELOCATE PARAMETER BLOCK ADDRESS
119 000014 010167 172354 MOV R1,KISAR6 ;MAP TO PARAMETER BLOCK
120 000020 010203 MOV R2,R3 ;REDEFINE PARAMETER BLOCK ADDRESS
121 000022 RETURN ;
122
123 .ENDC
124
125
126 000024 $ACHKW::CALL $ACHCK ;ADDRESS CHECK WORD ALIGNED
127 000030 103046 BCC 50$ ;IF CC OKAY
128 000032 10$: DRSTS D.RS98 ;SET DIRECTIVE STATUS
129
130 ;+
131 ; **-$ACHKB-ADDRESS CHECK BYTE ALIGNED
132 ; **-$ACHCK-ADDRESS CHECK WORD ALIGNED
133 ;
134 ; THIS ROUTINE IS CALLED TO ADDRESS CHECK A BLOCK OF MEMORY TO SEE WHETHER
135 ; IT LIES WITHIN THE ADDRESS SPACE OF THE CURRENT TASK.
136 ;
137 ; INPUTS:
138 ;
139 ; R0=STARTING ADDRESS OF THE BLOCK TO BE CHECKED.
140 ; R1=LENGTH OF THE BLOCK TO BE CHECKED IN BYTES.
141 ;
142 ; OUTPUTS:
143 ;
144 ; C=1 IF ADDRESS CHECK FAILED.
145 ; C=0 IF ADDRESS CHECK SUCCEEDED.
146 ;
147 ; R0 AND R3 ARE PRESERVED ACROSS CALL.
148 ;-
149
150 000034 006200 $ACHCK::ASR R0 ;ODD ADDRESS?
151 000036 103443 BCS 50$ ;IF CS YES
152 000040 006300 ASL R0 ;REALIGN ADDRESS
153 000042 $ACHKB:: ;REFERENCE LABEL
154
155
156 .IF NDF M$$MGE
157
158 SAVNR ;SAVE R4 AND R5
159
160 .IFTF
161
162 000042 016702 000000G MOV $TKTCB,R2 ;GET TCB ADDRESS OF CURRENT TASK
163 000046 000241 CLC ;ASSUME TASK IS PRIVILEGED
164 000050 032762 010000 000036 BIT #T3.PRV,T.ST3(R2) ;PRIVILEGED TASK?
165 000056 001033 BNE 50$ ;IF NE YES
166 000060 005301 DEC R1 ;CALCULATE HIGHEST ADDRESS OF BLOCK
167 000062 060001 ADD R0,R1 ;
168 000064 103430 BCS 50$ ;IF CS ADDRESS WRAP AROUND
169
170 .IFF
171
IOSUB MACRO M1110 22-AUG-79 07:06 PAGE 3-3
172 000066 016702 000000G MOV $HEADR,R2 ;GET ADDRESS OF CURRENT TASK HEADER
173 000072 016202 000044 MOV H.WND(R2),R2 ;POINT TO NUMBER OF WINDOW BLOCKS
174 000076 012246 MOV (R2)+,-(SP) ;PUSH NUMBER OF WINDOW BLOCKS
175
176 .IFT
177
178 MOV $HEADR,R4 ;GET ADDRESS OF CURRENT TASK HEADER
179 MOV H.WND(R4),R2 ;POINT TO NUMBER OF WINDOW BLOCKS
180 MOV (R2)+,-(SP) ;PUSH NUMBER OF WINDOW BLOCKS
181 MOV (R2),R5 ;SAVE PCB ADDRESS OF TASK PARTITION
182
183 .IFTF
184
185 000100 005722 15$: TST (R2)+ ;IS NEXT WINDOW MAPPED? (W.BPCB)
186 000102 001405 BEQ 20$ ;IF EQ NO
187 000104 020012 CMP R0,(R2) ;COMPARE LOW LIMITS (W.BLVR)
188 000106 103403 BLO 20$ ;IF LO NOT IN DESCRIPTOR
189 000110 020162 000002 CMP R1,2(R2) ;COMPARE HIGH LIMITS (W.BHVR)
190 000114 101405 BLOS 25$ ;IF LOS BUFFER IS IN DESCRIPTOR
191 000116 062702 000016 20$: ADD #W.BLGH-2,R2 ;POINT TO NEXT DESCRIPTOR
192 000122 005316 DEC (SP) ;MORE DESCRIPTORS TO GO?
193 000124 003365 BGT 15$ ;IF GT YES
194 000126 000404 BR 30$ ;ELSE EXIT WITH CS
195 000130 25$: ;REFERENCE LABEL
196
197 .IFT
198
199 CMP -(R2),R5 ;TASK PARTITION?
200 BNE 40$ ;IF NE NO
201 CMP R0,H.GARD(R4) ;HEADER VIOLATION?
202 BHI 40$ ;IF HI NO
203
204 .IFF
205
206 000130 032762 000004 000014 BIT #4,W.BLPD-W.BLVR(R2) ;WRITE ACCESS PERMITTED?
207 000136 001002 BNE 40$ ;IF NE YES
208
209 .ENDC
210
211
212 000140 005126 30$: COM (SP)+ ;CLEAN STACK AND SET CARRY
213 000142 RETURN ;
214 000144 005726 40$: TST (SP)+ ;CLEAN STACK AND CLEAR CARRY
215 000146 50$: RETURN ;
216 .DSABL LSB
217
218 .ENDC
219
220
221 ;+
222 ; **-$CEFN-CONVERT EVENT FLAG NUMBER FOR DIRECTIVE
223 ; **-$CEFI-CONVERT EVENT FLAG NUMBER FOR I/O
224 ;
225 ; THIS ROUTINE IS CALLED TO CONVERT AN EVENT FLAG NUMBER TO AN
226 ; EVENT FLAG MASK WORD AND EVENT FLAG MASK ADDRESS. IF AN ILLEGAL
227 ; EVENT FLAG IS SPECIFIED, THEN A DIRECTIVE STATUS OF 'D.RS97' IS
228 ; RETURNED. ELSE THE EVENT FLAG NUMBER IS CONVERTED AND THE COM-
IOSUB MACRO M1110 22-AUG-79 07:06 PAGE 3-4
229 ; PONENT PARTS ARE RETURNED TO THE CALLER.
230 ;
231 ; INPUTS:
232 ;
233 ; R0=EVENT FLAG NUMBER TO BE CONVERTED.
234 ; R5=TCB ADDRESS OF THE TASK THE EFN APPLIES TO.
235 ;
236 ; OUTPUTS:
237 ;
238 ; C=1 IF NO EVENT FLAG NUMBER WAS SPECIFIED.
239 ; R0=ZERO.
240 ; R1=ZERO.
241 ; C=0 IF AN EVENT FLAG NUMBER WAS SPECIFIED.
242 ; R0=EVENT FLAG MASK WORD.
243 ; R1=EVENT FLAG MASK ADDRESS.
244 ;
245 ; R3 IS PRESERVED ACROSS CALL IF ENTRY AT $CEFI, ELSE R3 IS ADVANCED BY 2.
246 ;-
247
248 .ENABL LSB
249 000150 112300 $CEFN:: MOVB (R3)+,R0 ;GET EVENT FLAG NUMBER
250 000152 005203 INC R3 ;ADVANCE TO NEXT WORD
251 000154 010001 $CEFI:: MOV R0,R1 ;COPY EFN
252 000156 000261 SEC ;ASSUME NONE SPECIFIED
253 000160 001425 BEQ 30$ ;IF EQ NO EFN SPECIFIED
254 000162 005300 DEC R0 ;BACK OFF EFN BY ONE
255 000164 012702 000040 MOV #32.,R2 ;SET EFN DIVIDER
256 000170 010501 MOV R5,R1 ;POINT TO FIRST TASK MASK WORD
257 000172 062701 000022 ADD #T.EFLG,R1 ;
258 000176 020002 CMP R0,R2 ;IN TASK EFN SET?
259 000200 103405 BLO 10$ ;IF LO YES
260 000202 160200 SUB R2,R0 ;NORMALIZE TO COMMON SET
261 000204 020002 CMP R0,R2 ;LEGAL EFN?
262 000206 103013 BHIS 40$ ;IF HIS NO
263 000210 012701 000000G MOV #$COMEF,R1 ;POINT TO FIRST COMMON MASK WORD
264 000214 006202 10$: ASR R2 ;HALVE DIVIDER
265 000216 020002 CMP R0,R2 ;FIRST MASK WORD?
266 000220 103402 BLO 20$ ;IF LO YES
267 000222 160200 SUB R2,R0 ;NORMALIZE EFN
268 000224 005721 TST (R1)+ ;POINT TO SECOND MASK WORD
269 000226 006300 20$: ASL R0 ;CONVERT EFN TO WORD INDEX
270 000230 016000 000000G MOV $BTMSK(R0),R0 ;GET PROPER MASK WORD
271 000234 30$: RETURN ;
272 000236 40$: DRSTS D.RS97 ;SET DIRECTIVE STATUS
273
274 ;+
275 ; **-$DVMSG-DEVICE MESSAGE OUTPUT
276 ;
277 ; THIS ROUTINE IS CALLED TO SUBMIT A MESSAGE TO THE TASK TERMINATION
278 ; NOTIFICATION TASK. MESSAGES ARE EITHER DEVICE RELATED OR A CHECKPOINT
279 ; WRITE FAILURE FROM THE LOADER.
280 ;
281 ; INPUTS:
282 ;
283 ; R4=ADDITIONAL PARAMETER ; TM081
284 ; R5=ADDRESS OF THE UCB OR TCB THAT THE MESSAGE APPLIES TO. ;**-1
285 ;
IOSUB MACRO M1110 22-AUG-79 07:06 PAGE 3-5
286 ; OUTPUTS:
287 ;
288 ; A FOUR WORD PACKET IS ALLOCATED, R0 AND R5 ARE STORED IN THE
289 ; SECOND AND THIRD WORDS RESPECTIVELY, AND THE PACKET IS THREADED
290 ; INTO THE TASK TERMINATION NOTIFICATION TASK MESSAGE QUEUE.
291 ;
292 ; NOTE: IF THE TASK TERMINATION NOTIFICATION TASK IS NOT INSTALLED
293 ; OR NO STORAGE CAN BE OBTAINED, THEN THE MESSAGE REQUEST
294 ; IS IGNORED.
295 ;-
296
297 000240 $DVMSG:: ;REF LABEL
298
299
300 .IF DF T$$KMG
301
302 MOV R0,R3 ;SAVE MESSAGE NUMBER
303 TST $TKNPT ;TKTN INSTALLED?
304 BEQ 30$ ;IF EQ NO
305 MOV #8.,R1 ;SET LENGTH OF BLOCK NEEDED
306 CALL $ALOCB ;GET A CORE BLOCK
307 BCS 30$ ;IF CS DIDN'T GET ONE
308 MOV R0,R1 ;SET ADDRESS OF MESSAGE BLOCK
309 TST (R0)+ ;POINT TO SECOND WORD IN BLOCK
310 MOV R3,(R0)+ ;INSERT MESSAGE NUMBER
311 MOV R5,(R0)+ ; TM081
312 ;INSERT UCB OR TCB ADDRESS ; TM081
313 MOV R4,(R0) ;INSERT ADDITIONAL PARAMETER ; TM081
314 MOV $TKNPT,R0 ;PICK UP TKTN TCB ADDRESS ;**-1
315 CALLR $EXRQF ;REQUEST TKTN AND QUEUE MESSAGE
316
317 .IFF
318
319 000240 RETURN ;
320
321 .ENDC
322
323
324 .DSABL LSB
325
326 ;+
327 ; **-$GTPKT-GET I/O PACKET FROM REQUEST QUEUE
328 ;
329 ; THIS ROUTINE IS CALLED BY DEVICE DRIVERS TO DEQUEUE THE NEXT I/O REQUEST TO
330 ; PROCESS. IF THE DEVICE CONTROLLER IS BUSY, THEN A CARRY SET INDICATION IS
331 ; RETURNED TO THE CALLER. ELSE AN ATTEMPT IS MADE TO DEQUEUE THE NEXT REQUEST
332 ; FROM THE CONTROLLER QUEUE. IF NO REQUEST CAN BE DEQUEUED, THEN A CARRY
333 ; SET INDICATION IS RETURNED TO THE CALLER. ELSE THE CONTROLLER IS SET BUSY AND
334 ; A CARRY CLEAR INDICATION IS RETURNED TO THE CALLER.
335 ;
336 ; INPUTS:
337 ;
338 ; R5=ADDRESS OF THE UCB OF THE CONTROLLER TO GET A PACKET FOR.
339 ;
340 ; OUTPUTS:
341 ;
342 ; C=1 IF CONTROLLER IS BUSY OR NO REQUEST CAN BE DEQUEUED.
IOSUB MACRO M1110 22-AUG-79 07:06 PAGE 3-6
343 ; C=0 IF A REQUEST WAS SUCCESSFULLY DEQUEUED.
344 ; R1=ADDRESS OF THE I/O PACKET.
345 ; R2=PHYSICAL UNIT NUMBER.
346 ; R3=CONTROLLER INDEX.
347 ; R4=ADDRESS OF THE STATUS CONTROL BLOCK.
348 ; R5=ADDRESS OF THE UNIT CONTROL BLOCK.
349 ;
350 ; NOTE: R4 AND R5 ARE DESTROYED BY THIS ROUTINE.
351 ;-
352
353 000242 016504 000000G $GTPKT::MOV U.SCB(R5),R4 ;GET ADDRESS OF STATUS CONTROL BLOCK
354 000246 105764 000000G TSTB S.STS(R4) ;CONTROLLER BUSY?
355 000252 001107 BNE 70$ ;IF NE CONTROLLER IS BUSY
356
357
358 .IF DF E$$DVC
359
360 BICB #SP.EIP,S.PRI(R4) ;CLEAR ERROR IN PROGRESS
361
362 .ENDC
363
364
365 000254 010401 MOV R4,R1 ;SET POINTER TO I/O QUEUE LISTHEAD
366 000256 010100 10$: MOV R1,R0 ;SAVE ADDRESS OF PREVIOUS PACKET
367 000260 011001 MOV (R0),R1 ;GET ADDRESS OF NEXT PACKET
368 000262 001503 BEQ 70$ ;IF EQ NO MORE PACKETS TO SCAN
369 000264 016105 000010 MOV I.UCB(R1),R5 ;GET ADDRESS OF UNIT CONTROL BLOCK
370 000270 016503 000000G MOV U.ATT(R5),R3 ;UNIT ATTACHED?
371 000274 001420 BEQ 20$ ;IF EQ NO
372 000276 016102 000004 MOV I.TCB(R1),R2 ;GET ADDRESS OF REQUESTOR TASK TCB
373 000302 032762 010000 000036 BIT #T3.PRV,T.ST3(R2) ;TASK PRIVILEGED?
374 000310 001410 BEQ 15$ ;IF EQ NO
375
376
377 .IF DF D$$ISK
378
379 CMP R2,$LDRPT ;REQUESTING TASK THE LOADER?
380 BEQ 20$ ;IF EQ YES-ALWAYS BREAK THRU ATTACH
381
382 .ENDC
383
384
385 000312 032765 000000G 000000G BIT #DV.TTY,U.CW1(R5) ;DEVICE A TERMINAL?
386 000320 001404 BEQ 15$ ;IF EQ NO
387 000322 122761 000000C 000013 CMPB #IO.WLB/256.,I.FCN+1(R1) ;WRITE LOGICAL FUNCTION
388 000330 001402 BEQ 20$ ;IF EQ YES-BREAK THRU ATTACH
389 000332 020203 15$: CMP R2,R3 ;IS THIS THE APPROPRIATE TASK?
390 000334 001350 BNE 10$ ;IF NE NO
391 000336 011110 20$: MOV (R1),(R0) ;CLOSE UP LIST REMOVING ENTRY
392 000340 001002 BNE 30$ ;IF NE LAST ENTRY WAS NOT REMOVED
393 000342 010064 000002 MOV R0,2(R4) ;SET ADDRESS OF NEW LAST IN LIST
394 000346 010164 000000G 30$: MOV R1,S.PKT(R4) ;SET ADDRESS OF CURRENT I/O PACKET
395 000352 116102 000013 MOVB I.FCN+1(R1),R2 ;GET I/O FUNCTION CODE
396 000356 122702 000000C CMPB #IO.ATT/256.,R2 ;ATTACH FUNCTION?
397 000362 001020 BNE 40$ ;IF NE NO
398
399
IOSUB MACRO M1110 22-AUG-79 07:06 PAGE 3-7
400 .IF DF A$$CPS
401
402 000364 012700 000000C MOV #IE.PRI&377,R0 ;ASSUME PRIVILEGE VIOLATION
403 000370 005765 000000G TST U.CW1(R5) ;MOUNTABLE DEVICE?
404 000374 100004 BPL 35$ ;IF PL NO
405 000376 132765 000000C 000000G BITB #US.MNT!US.FOR,U.STS(R5) ;NOT MOUNTED OR FOREIGN?
406 000404 001427 BEQ 60$ ;IF EQ NO
407
408 .IFTF
409
410 000406 016100 000004 35$: MOV I.TCB(R1),R0 ;ASSUME SUCCESSFUL ATTACH
411 000412 005703 TST R3 ;UNIT ALREADY ATTACHED?
412
413
414 .IF DF D$$IAG
415
416 BEQ 36$ ;IF EQ NO
417
418 .IFF
419
420 000414 001413 BEQ 50$ ;IF EQ NO
421
422 .IFTF
423
424 000416 012700 000000C MOV #IE.DAA&377,R0 ;SET STATUS OF DEVICE ALREADY ATTACHED
425 000422 000420 BR 60$ ;
426
427
428 .IFT
429
430 36$: BITB #IQ.UMD,I.FCN(R1) ;IS THIS A DIAGNOSTIC ATTACH?
431 BEQ 50$ ;IF EQ NO
432 BIT #DV.UMD,U.CW1(R5) ;USER MODE DIAGNOSTICS SUPPORTED?
433 BEQ 37$ ;IF EQ NO
434 BISB #US.UMD,U.ST2(R5) ;INDICATE DIAGNOSTIC ATTACH
435 BR 50$ ;
436 37$: MOV #IE.IFC&377,R0 ;SET STATUS OF ILLEGAL FUNCTION
437 BR 60$ ;
438
439 .IFTF
440
441 000424 122702 000000C 40$: CMPB #IO.DET/256.,R2 ;DETACH FUNCTION
442 000430 001022 BNE 80$ ;IF NE NO
443 000432 012700 000000C MOV #IE.DNA&377,R0 ;ASSUME DEVICE NOT ATTCHED
444 000436 005703 TST R3 ;UNIT ATTACHED?
445 000440 001411 BEQ 60$ ;IF EQ NO
446 000442 005000 CLR R0 ;SET TO DETACH UNIT
447
448 .IFT
449
450 BICB #US.UMD,U.ST2(R5) ;RESET DIAGNOSTIC BIT
451
452 .ENDC
453
454
455 000444 010065 000000G 50$: MOV R0,U.ATT(R5) ;ATTACH/DETACH UNIT
456 000450 132765 000000G 000000G BITB #UC.ATT,U.CTL(R5) ;DOES DRIVER WANT CONTROL ON ATTACH/DETACH?
IOSUB MACRO M1110 22-AUG-79 07:06 PAGE 3-8
457 000456 001035 BNE 120$ ;IF NE YES
458 000460 012700 000000C MOV #IS.SUC&377,R0 ;SET SUCCESSFUL COMPLETION STATUS
459 000464 60$: CALL $IOALT ;FINISH I/O OPERATION
460 000470 000664 BR $GTPKT ;
461 000472 000261 70$: SEC ;SET CONTROLLER BUSY OR NO REQUEST
462 000474 000451 BR 130$ ;
463 000476 80$: ;REF LABEL
464
465 .IFT
466
467 000476 005765 000000G TST U.CW1(R5) ;DEVICE MOUNTABLE?
468 000502 100023 BPL 120$ ;IF PL NO
469
470
471 .IF DF D$$IAG
472
473 BITB #IQ.UMD,I.FCN(R1) ;IS THIS A DIAGNOSTIC FUNCTION?
474 BNE 120$ ;IF NE YES, IT CAN'T BE AN ACP FUNCTION
475
476 .ENDC
477
478
479 000504 022702 000007 CMP #7,R2 ;ACP FUNCTION?
480 000510 101020 BHI 120$ ;IF HI NO
481 ; TM075
482 ; TM075
483 .IF DF R$$LKL ; TM075
484 ; TM075
485 CMP #IO.ULK/256.,R2 ;UNLOCK FUNCTION? ; TM075
486 BEQ 90$ ;IF EQ YES ; TM075
487 ; TM075
488 .IFTF ; TM075
489 ; TM075
490 000512 162702 000000C SUB #IO.RVB/256.,R2 ;READ VIRTUAL BLOCK?
491 000516 001402 BEQ 90$ ;IF EQ YES
492 000520 005302 DEC R2 ;WRITE VIRTUAL BLOCK?
493 000522 001005 BNE 100$ ;IF NE NO
494 000524 90$: ;REF LABEL ; TM075
495 ; TM075
496 .IFT ; TM075
497 ; TM075
498 CALL $LCKPR ;PERFORM LOCK PROCESSING ; TM075
499 BCS 60$ ;IF CS, RETURN STATUS ; TM075
500 ; TM075
501 .ENDC ; TM075
502 ; TM075
503 ; TM075
504 000524 CALL $MPPKT ;ATTEMPT VIRTUAL TO LOGICAL BLOCK MAP ; TM075
505 000530 103402 BCS 100$ ;IF CS MAP FAILURE ;**-1
506 000532 005700 TST R0 ;ALL BLOCKS MAPPED?
507 000534 001406 BEQ 120$ ;IF EQ YES
508 000536 016500 000000G 100$: MOV U.ACP(R5),R0 ;GET ADDRESS OF ACP TCB
509 000542 CALL $EXRQP ;INSURE FILE SYSTEM IS ACTIVE
510 000546 000167 177470 JMP $GTPKT ;GO AGAIN ; TM075
511 ;**-1
512 .ENDC
513
IOSUB MACRO M1110 22-AUG-79 07:06 PAGE 3-9
514
515 000552 116403 000000G 120$: MOVB S.CON(R4),R3 ;GET CONTROLLER INDEX
516 000556 116502 000000G MOVB U.UNIT(R5),R2 ;SET PHYSICAL UNIT NUMBER
517 000562 016165 000024 000000G MOV I.PRM(R1),U.BUF(R5) ;INSERT RELOCATION BIAS IN UCB
518 000570 016165 000026 000002G MOV I.PRM+2(R1),U.BUF+2(R5) ;INSERT BUFFER ADDRESS IN UCB
519 000576 016165 000030 000000G MOV I.PRM+4(R1),U.CNT(R5) ;INSERT BYTE COUNT IN UCB
520 000604 105264 000000G INCB S.STS(R4) ;SET CONTROLLER BUSY
521 000610 152765 000000G 000000G BISB #US.BSY,U.STS(R5) ;SET UNIT BUSY
522 000616 000241 CLC ;INDICATE PACKET BEING RETURNED
523 000620 130$: RETURN ;
524
525 ;+
526 ; **-$BLKCK-LOGICAL BLOCK CHECK ROUTINE
527 ; **-$BLKC1-LOGICAL BLOCK CHECK ROUTINE (ALTERNATE ENTRY)
528 ;
529 ; THIS ROUTINE IS CALLED BY I/O DEVICE DRIVERS TO CHECK THE STARTING
530 ; AND ENDING LOGICAL BLOCK NUMBERS OF AN I/O TRANSFER TO A FILE
531 ; STRUCTURED DEVICE. IF THE RANGE OF BLOCKS IS NOT LEGAL, THEN $IODON
532 ; IS ENTERED WITH A FINAL STATUS OF "IE.BLK" AND A RETURN TO THE
533 ; DRIVER'S INITIATOR ENTRY POINT IS EXECUTED. ELSE A RETURN TO THE
534 ; DRIVER IS EXECUTED.
535 ;
536 ; INPUTS:
537 ;
538 ; R1=ADDRESS OF I/O PACKET.
539 ; R5=ADDRESS OF THE UCB.
540 ;
541 ; OUTPUTS:
542 ;
543 ; IF THE CHECK FAILS, THEN $IODON IS ENTERED WITH A FINAL STATUS
544 ; OF "IE.BLK" AND A RETURN TO THE DRIVER'S INITIATOR ENTRY POINT
545 ; IS EXECUTED.
546 ;
547 ; IF THE CHECK SUCCEEDS, THEN THE FOLLOWING REGISTERS ARE RETURNED
548 ; R0=LOW PART OF LOGICAL BLOCK NUMBER.
549 ; R1=POINTS TO I.PRM+12 (LOW PART OF USER LBN)
550 ; R2=HIGH PART OF LOGICAL BLOCK NUMBER.
551 ; R3=ADDRESS OF I/O PACKET.
552 ;-
553
554
555 .IF DF R$$JP1!R$$K11!R$$L11!R$$M11!R$$P11!R$$JS1!R$$611!T$$C11 ; PB010
556 ;**-1
557 $BLKCK::MOV R1,R3 ;SAVE ADDRESS OF I/O PACKET
558 ADD #I.PRM+11,R1 ;POINT PAST HIGH PART OF LBN
559 CLRB (R1)+ ;CLEAR EXCESS BYTE
560 $BLKC1:: ;ALTERNATE ENTRY POINT
561 MOV (R1),R0 ;GET LOW PART OF LBN
562 MOV -(R1),R2 ;GET HIGH PART OF LBN
563 MOV I.PRM+4(R3),-(SP) ;GET NUMBER OF BYTES TO TRANSFER
564 ADD #777,(SP) ;ROUND TO NEXT BLOCK
565 ROR (SP) ;CALCULATE NUMBER OF BLOCKS IN HIGH BYTE
566 CLRB (SP) ;CLEAR EXCESS BYTE
567 SWAB (SP) ;CALCULATE NUMBER OF BLOCK IN TRANSFER
568 ADD (SP)+,R0 ;CALCULATE HIGHEST BLOCK NUMBER + 1
569 ADCB R2 ;
570 BCS 20$ ;IF CS ILLEGAL BLOCK NUMBER
IOSUB MACRO M1110 22-AUG-79 07:06 PAGE 3-10
571 CMPB R2,U.CW2(R5) ;HIGH PART OF LBN LEGAL?
572 BHI 20$ ;IF HI NO
573 BLO 10$ ;IF LO YES
574 CMP R0,U.CW3(R5) ;LOW PART OF LBN LEGAL?
575 BHI 20$ ;IF HI NO
576 10$: MOV (R1)+,R2 ;RETRIEVE HIGH PART OF LBN
577 MOV (R1),R0 ;RETRIEVE LOW PART OF LBN
578 RETURN ;
579 20$: MOV (R5),R0 ;GET ADDRESS OF DEVICE DCB
580 MOV @D.DSP(R0),(SP) ;REPLACE RETURN ADDRESS TO INITIATOR
581 MOV #IE.BLK&377,R0 ;SET FINAL I/O STATUS
582
583 .ENDC
584
585
586 ;+
587 ; **-$IOALT-I/O DONE (ALTERNATE ENTRY)
588 ; **-$IODON-I/O DONE
589 ;
590 ; THIS ROUTINE IS CALLED BY DEVICE DRIVERS AT THE COMPLETION OF AN I/O REQUEST
591 ; TO DO FINAL PROCESSING. THE UNIT AND CONTROLLER ARE SET IDLE AND $IOFIN IS
592 ; ENTERED TO FINISH THE PROCESSING.
593 ;
594 ; INPUTS:
595 ;
596 ; R0=FIRST I/O STATUS WORD.
597 ; R1=SECOND I/O STATUS WORD.
598 ; R2=STARTING AND FINAL ERROR RETRY COUNTS IF ERROR LOGGING
599 ; DEVICE.
600 ; R5=ADDRESS OF THE UNIT CONTROL BLOCK OF THE UNIT BEING COMPLETED.
601 ; (SP)=RETURN ADDRESS TO DRIVER'S CALLER. ; TM095
602 ;
603 ; NOTE: IF ENTRY IS AT $IOALT, THEN R1 IS CLEAR TO SIGNIFY THAT THE
604 ; SECOND STATUS WORD IS ZERO.
605 ;
606 ; OUTPUTS:
607 ;
608 ; THE UNIT AND CONTROLLER ARE SET IDLE.
609 ;
610 ; R3=ADDRESS OF THE CURRENT I/O PACKET.
611 ;-
612
613 000622 005001 $IOALT::CLR R1 ;ZERO SECOND I/O STATUS WORD
614 000624 016504 000000G $IODON::MOV U.SCB(R5),R4 ;GET ADDRESS OF STATUS CONTROL BLOCK
615 000630 142765 000000G 000000G BICB #US.BSY,U.STS(R5) ;CLEAR UNIT BUSY
616 000636 105064 000000G CLRB S.STS(R4) ;CLEAR CONTROLLER BUSY
617
618
619 .IF DF E$$DVC
620
621 BITB #SP.EIP,S.PRI(R4) ;ERROR IN PROGRESS?
622 BEQ 15$ ;IF EQ NO ; TM095
623 MOV R1,-(SP) ;SAVE SECOND I/O STATUS WORD ;**-1
624 MOV S.BMSV(R4),R1 ;GET ADDRESS OF EMB
625 BEQ 10$ ;IF EQ NONE
626 MOV R0,-(SP) ;SAVE FIRST I/O STATUS WORD
627 TSTB R0 ;SUCCESSFUL FUNCTION?
IOSUB MACRO M1110 22-AUG-79 07:06 PAGE 3-11
628 BPL 5$ ;IF PL YES
629 NEG R2 ;SIGNAL UNSUCCESSFUL FUNCTION
630 5$: MOV R2,E.RTRY+2(R1) ;SAVE FINAL ERROR RETRY COUNT
631 CALL $QEMB ;QUEUE ERROR MESSAGE BLOCK
632 MOV (SP)+,R0 ;RESTORE I/O STATUS WORDS
633 10$: MOV (SP)+,R1 ;
634 15$: ;REF LABEL ; TM095
635
636 .ENDC
637
638
639 .IF DF M$$EXT ; TM095
640 ; TM095
641 BITB #UC.NPR,U.CTL(R5) ;IS IT AN NPR DEVICE? ; TM095
642 BEQ 20$ ;IF EQ NO, DOES NOT USE UMR'S ; TM095
643 BIT #DV.MXD,U.CW1(R5) ;IS IT A MASSBUS DEVICE? ; TM095
644 BNE 20$ ;IF NE NO ; TM095
645 MOV R4,R2 ;COPY SCB POINTER ; TM095
646 ADD #S.MPR,R2 ;POINT TO MAPPING ASSIGNMENT BLOCK ; TM095
647 CALL $DEUMR ;DEASSIGN ANY UMR'S ; TM095
648 MOV #$DQUMR,-(SP) ;PUSH ADDRESS TO CHECK FOR UMR WAIT ; TM095
649 ; TM095
650 .ENDC ; TM095
651 ; TM095
652 ; TM095
653 000642 016403 000000G 20$: MOV S.PKT(R4),R3 ;RETRIEVE ADDRESS OF I/O PACKET
654
655
656 .IF DF Q$$OPT
657
658 TST (R4) ;ANY OTHER I/O REQUESTS TO INITIATE?
659 BEQ $IOFIN ;IF EQ NO
660 MOV R3,R4 ;COPY I/O PACKET POINTER
661 ADD #I.PRM+14,R4 ;POINT TO LAST WORD FOR FORK BLOCK ; TM075
662 MOV R0,(R4) ;STORE I/O STATUS BLOCK CONTENTS ;**-1
663 MOV R1,-(R4) ;
664 CALL $FORK0 ;FORK HERE TO ALLOW NEXT I/O INITIATION
665 MOV R4,R0 ;RESTORE I/O STATUS BLOCK CONTENTS
666 MOV R5,R1 ;
667 SUB #I.PRM+10,R3 ;POINT TO BEGINNING OF FORK BLOCK ; TM075
668 ;**-1
669 .ENDC
670
671
672 ;+
673 ; **-$IOFIN-I/O FINISH
674 ;
675 ; THIS ROUTINE IS CALLED TO FINISH I/O PROCESSING IN CASES WHERE THE UNIT AND
676 ; CONTROLLER ARE NOT TO BE DECLARED IDLE.
677 ;
678 ; INPUTS:
679 ;
680 ; R0=FIRST I/O STATUS WORD.
681 ; R1=SECOND I/O STATUS WORD.
682 ; R3=ADDRESS OF THE I/O REQUEST PACKET.
683 ; ;**-1
684 ; OUTPUTS:
IOSUB MACRO M1110 22-AUG-79 07:06 PAGE 3-12
685 ;
686 ; THE FOLLOWING ACTIONS ARE PERFORMED
687 ;
688 ; 1-THE FINAL I/O STATUS VALUES ARE STORED IN THE I/O STATUS BLOCK IF
689 ; ONE WAS SPECIFIED.
690 ;
691 ; 2-THE I/O COUNT IS DECREMENTED AND TS.RDN IS CLEARED IN CASE ; TM086
692 ; THE TASK WAS BLOCKED FOR I/O RUNDOWN. ; TM086
693 ; ;**-3
694 ; 3-IF 'TS.CKR' IS SET, THEN IT IS CLEARED AND CHECKPOINTING OF
695 ; THE TASK IS INITIATED.
696 ;
697 ; 4-IF AN AST SERVICE ROUTINE WAS SPECIFIED, THEN AN AST IS QUEUED
698 ; FOR THE TASK. ELSE THE I/O PACKET IS DEALLOCATED.
699 ;
700 ; 5-A SIGNIFICANT EVENT OR EQUIVALENT IS DECLARED.
701 ;
702 ; NOTE: R4 IS DESTROYED BY THIS ROUTINE.
703 ;-
704
705 000646 016302 000020 $IOFIN::MOV I.IOSB+4(R3),R2 ;GET ADDRESS OF I/O STATUS BLOCK
706 000652 001411 BEQ 10$ ;IF EQ NO I/O STATUS BLOCK SPECIFIED
707
708
709 .IF DF M$$MGE
710
711 000654 016746 172354 MOV KISAR6,-(SP) ;SAVE CURRENT MAPPING
712 000660 016367 000016 172354 MOV I.IOSB+2(R3),KISAR6 ;MAP TO I/O STATUS BLOCK
713
714 .IFTF
715
716 000666 010022 MOV R0,(R2)+ ;SET FINAL I/O STATUS VALUES
717 000670 010112 MOV R1,(R2) ;
718
719 .IFT
720
721 000672 012667 172354 MOV (SP)+,KISAR6 ;RESTORE CURRENT MAPPING
722
723 .ENDC
724
725
726 000676 016301 000004 10$: MOV I.TCB(R3),R1 ;GET ADDRESS OF TASK CONTROL BLOCK
727 000702 010102 MOV R1,R2 ;POINT TO FIRST TASK STATUS WORD
728 000704 062702 000032 ADD #T.STAT,R2 ;
729 000710 105361 000003 DECB T.IOC(R1) ;DECREMENT I/O REQUEST COUNT
730 000714 042712 040000 BIC #TS.RDN,(R2) ;FREE TASK IF I/O RUNDOWN IS IN PROGRESS
731
732
733 .IF DF R$$LKL ; TM075
734 ; TM075
735 MOV I.PRM+16(R3),R0 ;PICK UP LOCK BLOCK ADDRESS ; TM075
736 BEQ 20$ ;IF EQ THERE IS NONE ; TM075
737 CMP R0,#140000 ;IS IT A RELOCATED USER ADDRESS? ; TM075
738 BHIS 20$ ;IF HIS YES ; TM075
739 DEC (R0) ;FREE LOCK FOR UNLOCKING ; TM075
740 20$: ;REF LABEL ; TM075
741 ; TM075
IOSUB MACRO M1110 22-AUG-79 07:06 PAGE 3-13
742 .ENDC ; TM075
743 ; TM075
744 ; TM075
745 .IF DF C$$CKP&D$$ISK
746
747 MOV R3,R4 ;SAVE PACKET ADDRESS
748 BIT #TS.CKR,(R2) ;CHECKPOINT REQUESTED?
749 BEQ 30$ ;IF EQ NO
750 BIC #TS.CKR,(R2) ;CLEAR CHECKPOINT REQUEST FLAG
751 CALL $ICHKP ;INITIATE TASK CHECKPOINTING ; TM102
752 30$: ;REF LABEL ;**-1
753
754
755 .IF DF D$$YNM&D$$SHF
756
757 MOV I.TCB(R4),R1 ;PICK UP ISSUING TASK'S TCB ADDRESS
758 MOV T.PCB(R1),R0 ;POINT TO TASK PCB
759 BIT #PS.LIO,P.STAT(R0) ;DID SHUFFLER DETECT A LONG I/O?
760 BEQ 35$ ;IF EQ NO
761 TSTB T.IOC(R1) ;IS I/O COUNT NOW ZERO?
762 BNE 35$ ;IF NE NO
763 BIC #PS.LIO,P.STAT(R0) ;CLEAR LONG I/O BIT
764 CALL $NXTSK ;REALLOCATE PARTITION
765 35$: ;REF LABEL
766
767 .ENDC
768
769
770 MOV R4,R3 ;RESTORE PACKET ADDRESS
771
772 .ENDC
773
774
775 000720 010546 MOV R5,-(SP) ;SAVE UCB ADDRESS ; TM086
776 000722 016305 000004 MOV I.TCB(R3),R5 ;SET TCB ADDRESS ;**-5
777 000726 116300 000003 MOVB I.EFN(R3),R0 ;GET EVENT FLAG NUMBER ;**-2
778 000732 CALL $SETF ;SET THE EVENT FLAG ; TM086
779 000736 010300 MOV R3,R0 ;COPY I/O PACKET ADDRESS ; TM086
780 ;**-6
781
782 .IF DF A$$TRP
783
784 000740 005723 TST (R3)+ ;POINT TO SECOND WORD
785 000742 012723 000044 MOV #I.LGTH,(R3)+ ;INSERT LENGTH OF BLOCK IN BYTES
786 000746 012723 000020 MOV #8.*2,(R3)+ ;SET NUMBER OF BYTES TO ALLOCATE ON USER STACK
787 000752 016023 000022 MOV I.AST(R0),(R3)+ ;INSERT AST ADDRESS
788 000756 001416 BEQ 70$ ;IF EQ NONE SPECIFIED
789 000760 012723 000001 MOV #1,(R3)+ ;INSERT NUMBER OF AST PARAMETERS
790 000764 016013 000014 MOV I.IOSB(R0),(R3) ;INSERT VIRTUAL ADDRESS OF I/O STATUS BLOCK
791 000770 010001 MOV R0,R1 ;COPY ADDRESS OF I/O PACKET
792 000772 010500 MOV R5,R0 ;CALCULATE ADDRESS OF AST LISTHEAD
793 000774 062700 000016 ADD #T.ASTL,R0 ;
794 001000 CALL $QINSF ;INSERT AST IN QUEUE
795 001004 010500 MOV R5,R0 ;COPY TCB ADDRESS ; TM086
796 001006 CALL $SETCR ;SET A SCHEDULE REQUEST FOR THE TASK ; TM086
797 001012 000402 BR 80$ ;
798
IOSUB MACRO M1110 22-AUG-79 07:06 PAGE 3-14
799 .ENDC
800
801
802 001014 70$: CALL $DEPKT ;DEALLOCATE I/O PACKET
803 001020 012605 80$: MOV (SP)+,R5 ;RESTORE UCB ADDRESS ; TM086
804 001022 RETURN ; ; TM086
805 ;**-3
806 ;+
807 ; **-$IOKIL-I/O KILL
808 ;
809 ; THIS ROUTINE IS CALLED TO FLUSH ALL I/O REQUESTS FOR THE CURRENT TASK FROM
810 ; A DEVICE QUEUE AND TO CANCEL THE CURRENT I/O OPERATION IN PROGRESS IF IT
811 ; IS ALSO FOR THE CURRENT TASK.
812 ;
813 ; INPUTS:
814 ;
815 ; R5=ADDRESS OF THE UCB OF THE DEVICE TO FLUSH REQUESTS FOR.
816 ;
817 ; OUTPUTS:
818 ;
819 ; IF THE SPECIFIED DEVICE IS NOT FILE STRUCTURED, THEN THE I/O RE-
820 ; REQUEST QUEUE IS FLUSHED AND THE CURRENT I/O OPERATION IN PROGRESS
821 ; IS CANCELLED.
822 ;
823 ; NOTE: R4 IS DESTROYED BY THIS ROUTINE.
824 ;-
825
826 001024 016504 000000G $IOKIL::MOV U.SCB(R5),R4 ;GET ADDRESS OF SCB
827 001030 016701 000000G MOV $TKTCB,R1 ;GET TCB ADDRESS OF CURRENT TASK
828 001034 005765 000000G TST U.CW1(R5) ;DEVICE-UNIT MOUNTABLE?
829 001040 100004 BPL 10$ ;IF PL NO
830 001042 132765 000000G 000000G BITB #US.MNT,U.STS(R5) ;DEVICE-UNIT MOUNTED?
831 001050 001425 BEQ 40$ ;IF EQ YES
832 001052 010403 10$: MOV R4,R3 ;COPY ADDRESS OF I/O QUEUE LISTHEAD
833 001054 010302 20$: MOV R3,R2 ;SAVE ADDRESS OF CURRENT ENTRY
834 001056 011203 MOV (R2),R3 ;GET ADDRESS OF NEXT ENTRY
835 001060 001421 BEQ 40$ ;IF EQ END OF LIST
836 001062 020163 000004 CMP R1,I.TCB(R3) ;REQUEST FOR CURRENT TASK?
837 001066 001372 BNE 20$ ;IF NE NO
838 001070 020563 000010 CMP R5,I.UCB(R3) ;REQUEST FOR SPECIFIED UCB?
839 001074 001367 BNE 20$ ;IF NE NO
840 001076 011312 MOV (R3),(R2) ;CLOSE UP LIST
841 001100 001002 BNE 30$ ;IF NE NO NEW LAST
842 001102 010264 000002 MOV R2,2(R4) ;SET ADDRESS OF NEW LAST
843 001106 012700 000000C 30$: MOV #IE.ABO&377,R0 ;SET FINAL STATUS TO ABORT
844 001112 005063 000022 CLR I.AST(R3) ;MAKE SURE THERE IS NO AST DECLARED
845 001116 CALL $IOFIN ;FINISH I/O REQUEST
846 001122 000740 BR $IOKIL ;GO AGAIN
847 001124 132765 000000G 000000G 40$: BITB #UC.KIL,U.CTL(R5) ;CALL DRIVER REGARDLESS OF ACTIVITY?
848 001132 001003 BNE 45$ ;IF NE YES
849 001134 105765 000000G TSTB U.STS(R5) ;UNIT BUSY?
850 001140 100031 BPL 50$ ;IF PL NO
851 001142 016400 000000G 45$: MOV S.PKT(R4),R0 ;GET ADDRESS OF CURRENT I/O PACKET
852 001146 011502 MOV (R5),R2 ;RETRIEVE ADDRESS OF DEVICE CONTROL BLOCK
853
854
855 .IF DF L$$DRV&M$$MGE
IOSUB MACRO M1110 22-AUG-79 07:06 PAGE 3-15
856
857 001150 016746 172352 MOV KISAR5,-(SP) ;SAVE APR5
858 001154 016203 000000G MOV D.PCB(R2),R3 ;GET DRIVER PCB ADDRESS
859 001160 001403 BEQ 47$ ;IF EQ DRIVER IS PART OF EXEC
860 001162 016367 000014 172352 MOV P.REL(R3),KISAR5 ;MAP THE DRIVER
861 001170 47$: ;
862
863 .IFTF
864
865 001170 016202 000000G MOV D.DSP(R2),R2 ;GET ADDRESS OF DRIVER DISPATCH TABLE
866 ; TM081
867 .IFT ; TM081
868 ; TM081
869 001174 001411 BEQ 49$ ;IF EQ DRIVER IS UNLOADED ; TM081
870 ; TM081
871 .IFTF ; TM081
872 ; TM081
873 001176 116403 000000G MOVB S.CON(R4),R3 ;GET CONTROLLER INDEX
874
875 ;
876 ; CALL DRIVER AT CANCEL I/O OPERATION ENTRY POINT WITH THE ARGUMENTS:
877 ;
878 ; R0=ADDRESS OF THE CURRENT I/O PACKET.
879 ; R1=ADDRESS OF THE TCB OF THE CURRENT TASK.
880 ; R3=CONTROLLER INDEX.
881 ; R4=ADDRESS OF THE STATUS CONTROL BLOCK.
882 ; R5=ADDRESS OF THE UNIT CONTROL BLOCK.
883 ;
884
885 001202 MTPS S.PRI(R4) ;;;LOCK OUT DEVICE INTERRUPTS
886 001210 CALL @D.VCAN(R2) ;;;CANCEL CURRENT REQUEST
887 001214 MTPS #0 ;;;ALLOW DEVICE INTERRUPTS
888
889 .IFT
890
891 001220 012667 172352 49$: MOV (SP)+,KISAR5 ;RESTORE APR5 ; TM081
892 ;**-1
893 .ENDC
894
895
896 001224 50$: RETURN ;
897
898 ;+
899 ; **-$MPLNE-MAP LOGICAL UNIT NUMBER FOR EXIT
900 ; **-$MPLUN-MAP LOGICAL UNIT NUMBER
901 ;
902 ; THIS ROUTINE IS CALLED TO VALIDATE A LOGICAL UNIT NUMBER (LUN) AND TO MAP
903 ; THE LUN INTO A UCB POINTER. IF AN ILLEGAL LUN IS SPECIFIED, THEN A
904 ; DIRECTIVE STATUS OF 'D.RS96' IS RETURNED. ELSE THE LUN IS MAPPED AND A
905 ; POINTER TO THE LUN AND UCB ARE RETURNED TO THE CALLER.
906 ;
907 ; INPUTS:
908 ;
909 ; R3=ADDRESS OF THE LUN.
910 ; R4=ADDRESS OF THE HEADER OF THE CURRENT TASK.
911 ; R5=ADDRESS OF THE TCB OF THE CURRENT TASK.
912 ;
IOSUB MACRO M1110 22-AUG-79 07:06 PAGE 3-16
913 ; OUTPUTS:
914 ;
915 ; C=1 IF NO DEVICE IS ASSIGNED TO THE SPECIFIED LUN.
916 ; R0=0.
917 ; C=0 IF A DEVICE IS ASSIGNED TO THE SPECIFIED LUN.
918 ; R0=ADDRESS OF THE UCB OF THE ASSIGNED DEVICE.
919 ;
920 ; IN EITHER CASE R1 IS RETURNED AS THE ADDRESS OF THE SECOND LUN
921 ; WORD IN THE TASK HEADER AND R3 IS ADVANCED BY 2.
922 ;-
923
924 .ENABL LSB
925 001226 005001 $MPLUN::CLR R1 ;GET LOGICAL UNIT NUMBER
926 001230 152301 BISB (R3)+,R1 ;
927 001232 005203 INC R3 ;POINT TO NEXT WORD
928 001234 005301 DEC R1 ;BACK OFF LUN BY 1
929 001236 020164 000074 CMP R1,H.NLUN(R4) ;LEGAL LUN?
930 001242 103030 BHIS 40$ ;IF HIS NO
931 001244 006301 $MPLNE::ASL R1 ;MULTIPLY LUN-1 BY 4
932 001246 006301 ASL R1 ;
933 001250 060401 ADD R4,R1 ;CALCULATE ADDRESS OF FIRST LUN WORD
934 001252 062701 000076 ADD #H.NLUN+2,R1 ;IN TASK HEADER
935 001256 000261 SEC ;ASSUME LUN NOT ASSIGNED
936 001260 012100 MOV (R1)+,R0 ;GET POINTER TO DEVICE UCB
937 001262 001417 BEQ 30$ ;IF EQ NO DEVICE ASSIGNED
938 001264 020060 000000G $MPLND::CMP R0,U.RED(R0) ;IS DEVICE REDIRECTED?
939 001270 001403 BEQ 10$ ;IF EQ NO
940 001272 016000 000000G MOV U.RED(R0),R0 ;GET POINTER TO REDIRECT UCB
941 001276 000772 BR $MPLND ;TRY AGAIN
942 001300 011002 10$: MOV (R0),R2 ;GET ADDRESS OF DEVICE DCB
943 001302 022762 044524 000000G CMP #"TI,D.NAM(R2) ;TERMINAL INPUT PSEUDO DEVICE?
944 001310 001003 BNE 20$ ;IF NE NO
945 001312 016500 000026 MOV T.UCB(R5),R0 ;GET ADDRESS OF "TI" UCB
946 001316 000762 BR $MPLND ;
947 001320 000241 20$: CLC ;INDICATE DEVICE ASSIGNED
948 001322 30$: RETURN ;
949 001324 40$: DRSTS D.RS96 ;SET DIRECTIVE STATUS
950 .DSABL LSB
951
952 ;+
953 ; **-$MPPHY-MAP TO PHYSICAL ADDRESS
954 ;
955 ; THIS ROUTINE IS CALLED TO MAP A RELOCATION BIAS AND DISPLACEMENT ADDRESS TO AN
956 ; 18 BIT PHYSICAL ADDRESS. IF THE INDICATED DEVICE IS NOT AN NPR AN DEVICE,
957 ; THEN THE RELOCATION BIAS AND DISPLACEMENT ADDRESS ARE RETURNED TO THE CALLER.
958 ; ELSE THE RELOCATION BIAS AND DISPLACEMENT ADDRESS ARE CONVERTED TO AN 18 BIT
959 ; PHYSICAL ADDRESS WHICH IS RETURNED TO THE CALLER.
960 ;
961 ; INPUTS:
962 ;
963 ; R1=RELOCATION BIAS.
964 ; R2=DISPLACEMENT ADDRESS.
965 ; R5=ADDRESS OF THE UNIT CONTROL BLOCK.
966 ;
967 ; OUTPUTS:
968 ;
969 ; IF DEVICE IS AN NPR DEVICE ON AN 18-BIT MACHINE, THEN ; TM086
IOSUB MACRO M1110 22-AUG-79 07:06 PAGE 3-17
970 ; R1=HIGH ORDER 2 BITS OF PHYSICAL ADDRESS IN BITS 4 AND 5;**-1
971 ; R2=LOW ORDER 16 BITS OF PHYSICAL ADDRESS.
972 ; IF DEVICE IS AN NPR DEVICE ON AN 11/70, THEN ; TM086
973 ; R1=HIGH ORDER 6 BITS OF PHYSICAL ADDRESS IN HIGH BYTE. ; TM086
974 ; R2=LOW ORDER 16 BITS OF PHYSICAL ADDRESS. ; TM086
975 ; IF DEVICE IS NOT AN NPR DEVICE, THEN
976 ; R1=RELOCATION BIAS.
977 ; R2=DISPLACEMENT ADDRESS.
978 ;
979 ; R0 AND R3 ARE PRESERVED ACROSS CALL.
980 ;-
981
982
983 .IF DF M$$MGE
984
985 001326 132765 000000G 000000G $MPPHY::BITB #UC.NPR,U.CTL(R5) ;NPR DEVICE?
986 001334 001417 BEQ 10$ ;IF EQ NO
987 001336 006302 ASL R2 ;REMOVE APR6 BIAS FROM DISPLACEMENT
988 001340 006302 ASL R2 ;
989 001342 000241 CLC ;GET 2 BITS OF RELOCATION BIAS
990 001344 006001 ROR R1 ;
991 001346 106002 RORB R2 ;TO FILL 8 LOW ORDER BITS OF ADDRESS
992 001350 006201 ASR R1 ;
993 001352 106002 RORB R2 ;
994 001354 000302 SWAB R2 ;SWAP TO COLLECT 8 MORE BITS
995 001356 150102 BISB R1,R2 ;INSERT UPPER 8 BITS OF ADDRESS
996 001360 000302 SWAB R2 ;SWAP BACK TO REAL ADDRESS
997 001362 105001 CLRB R1 ;CLEAR LOW BYTE OF UPPER BITS
998
999
1000 .IF NDF M$$EXT
1001
1002 001364 006201 ASR R1 ;SHIFT BITS 17 AND 18 OF ADDRESS
1003 001366 006201 ASR R1 ;INTO BITS 4 AND 5
1004 001370 006201 ASR R1 ;
1005 001372 006201 ASR R1 ;
1006
1007 .ENDC
1008
1009
1010 001374 10$: RETURN ;
1011
1012 .ENDC
1013
1014
1015 ;+
1016 ; **-$MPPKT-MAP I/O PACKET FUNCTION
1017 ;
1018 ; THIS ROUTINE IS CALLED TO MAP A READ/WRITE VIRTUAL FUNCTION IN AN I/O PACKET
1019 ; TO A READ/WRITE LOGICAL FUNCTION. IF THE CURRENT WINDOW DOES NOT MAP THE VIRTU
1020 ; FUNCTION, THEN A FAILURE INDICATION IS RETURNED. ELSE IF THE WINDOW COMPLETELY
1021 ; MAPS THE VIRTUAL FUNCTION, THEN THE LOGICAL BLOCK NUMBER IS STORED IN THE I/O
1022 ; PACKET AND THE READ/WRITE VIRTUAL FUNCTION IS CONVERTED TO ITS LOGICAL COUNTER
1023 ; PART. ELSE THE PARTIAL MAPPING RESULTS ARE RETURNED TO THE CALLER.
1024 ;
1025 ; INPUTS:
1026 ;
IOSUB MACRO M1110 22-AUG-79 07:06 PAGE 3-18
1027 ; R1=ADDRESS OF THE I/O PACKET.
1028 ;
1029 ; OUTPUTS:
1030 ;
1031 ; C=1 IF MAPPING FAILURE.
1032 ; C=0 IF MAPPING WAS SUCCESSFUL.
1033 ; IF R0 EQ 0, THEN
1034 ; I.FCN+1(R1)=IO.WLB/IO.RLB.
1035 ; I.PRM+10(R1)=HIGH PART OF MAPPED LBN.
1036 ; I.PRM+12(R1)=LOW PART OF MAPPED LBN..
1037 ; ELSE
1038 ; R0=NUMBER OF BLOCKS NOT MAPPED.
1039 ; R2=HIGH PART OF MAPPED LBN.
1040 ; R3=LOW PART OF MAPPED LBN.
1041 ;
1042 ; R1 IS PRESERVED ACROSS CALL.
1043 ;-
1044
1045
1046 .IF DF A$$CPS
1047
1048 001376 016103 000036 $MPPKT::MOV I.PRM+12(R1),R3 ;PICKUP LOW PART OF VBN
1049 001402 016102 000034 MOV I.PRM+10(R1),R2 ;PICKUP HIGH PART OF VBN
1050 001406 010146 MOV R1,-(SP) ;SAVE I/O PACKET ADDRESS
1051 001410 016100 000030 MOV I.PRM+4(R1),R0 ;GET LENGTH OF TRANSFER IN BYTES
1052 001414 017101 000006 MOV @I.LN2(R1),R1 ;GET ADDRESS OF WINDOW BLOCK
1053 001420 042701 000001 BIC #1,R1 ;MAKE SURE LOW BIT OF ADDRESS IS ZERO
1054 001424 CALL $MPVBN ;MAP VIRTUAL BLOCK NUMBER
1055 001430 012601 MOV (SP)+,R1 ;RETRIEVE I/O PACKET ADDRESS
1056 001432 103435 BCS 20$ ;IF CS MAPPING FAILURE
1057 001434 005700 TST R0 ;REQUEST COMPLETELY MAPPED?
1058 001436 001033 BNE 20$ ;IF NE NO
1059 001440 110261 000034 MOVB R2,I.PRM+10(R1) ;SET HIGH PART OF LBN
1060 001444 010361 000036 MOV R3,I.PRM+12(R1) ;SET LOW PART OF LBN
1061 001450 012746 000000G MOV #IO.WLB,-(SP) ;ASSUME WRITE LOGICAL FUNCTION
1062 001454 122761 000000C 000013 CMPB #IO.WVB/256.,I.FCN+1(R1) ;WRITE VIRTUAL FUNCTION?
1063 001462 001402 BEQ 10$ ;IF EQ YES
1064 001464 105266 000001 INCB 1(SP) ;CONVERT TO READ LOGICAL FUNCTION
1065 001470 012661 000012 10$: MOV (SP)+,I.FCN(R1) ;SET NEW FUNCTION CODE
1066
1067
1068 .IF DF M$$MGE
1069
1070 001474 010103 MOV R1,R3 ;SAVE I/O PACKET ADDRESS
1071 001476 016301 000024 MOV I.PRM(R3),R1 ;GET RELOCATION BIAS
1072 001502 016302 000026 MOV I.PRM+2(R3),R2 ;GET DISPLACEMENT ADDRESS
1073 001506 CALL $MPPHY ;MAP TO 18 BIT PHYSICAL ADDRESS
1074 001512 010163 000024 MOV R1,I.PRM(R3) ;INSERT 18 BIT PHYSICAL ADDRESS BACK
1075 001516 010263 000026 MOV R2,I.PRM+2(R3) ;INTO I/O PACKET
1076 001522 010301 MOV R3,R1 ;RESTORE I/O PACKET ADDRESS
1077 001524 000241 CLC ;MAKE SURE CARRY IS CLEAR
1078
1079 .ENDC
1080
1081
1082 001526 20$: RETURN ;
1083
IOSUB MACRO M1110 22-AUG-79 07:06 PAGE 3-19
1084 ;+
1085 ; **-$MPUBM-MAP UNIBUS TO MEMORY
1086 ;
1087 ; THIS ROUTINE IS CALLED BY UNIBUS NPR DEVICE DRIVERS TO LOAD THE
1088 ; NECESSARY UNIBUS MAP REGISTERS TO EFFECT A TRANSFER TO MAIN MEM-
1089 ; ORY ON AN 11/70 PROCESSOR WITH EXTENDED MEMORY.
1090 ;
1091 ; INPUTS:
1092 ;
1093 ; R4=ADDRESS OF DEVICE SCB.
1094 ; R5=ADDRESS OF DEVICE UCB.
1095 ;
1096 ; OUTPUTS:
1097 ;
1098 ; THE UNIBUS MAP REGISTERS NECESSARY TO EFFECT THE TRANSFER
1099 ; ARE LOADED.
1100 ;
1101 ; NOTE: REGISTER R3 IS PRESERVED ACROSS CALL.
1102 ;-
1103
1104
1105 .IF DF M$$EXT&M$$MGE
1106
1107 $MPUBM::MOV S.MPR+M.UMRA(R4),R0 ;GET ADDRESS OF FIRST MAP REGISTER ; TM095
1108 MOV S.MPR+M.UMRN(R4),-(SP) ;SET COUNT OF REGISTERS TO LOAD ; TM095
1109 MOVB S.MPR+M.BFVH(R4),R1 ;GET HIGH 6 BITS OF ADDRESS ; TM095
1110 MOV S.MPR+M.BFVL(R4),R2 ;GET LOW 16 BITS OF ADDRESS ; TM095
1111 10$: MOV R2,(R0)+ ;LOAD LOW 16 BITS OF ADDRESS ;**-4
1112 MOV R1,(R0)+ ;LOAD HIGH 6 BITS OF ADDRESS
1113 ADD #20000,R2 ;ADVANCE 8K BYTES
1114 ADC R1 ;
1115 SUB #4,(SP) ;ALL REGISTERS LOADED? ; TM095
1116 BGT 10$ ;IF GT NO ;**-1
1117 TST (SP)+ ;CLEAN STACK
1118 RETURN
1119
1120 .ENDC
1121
1122
1123 ;+
1124 ; **-$MPVBN-MAP VIRTUAL BLOCK NUMBER
1125 ;
1126 ; THIS ROUTINE IS CALLED TO MAP A VIRTUAL BLOCK NUMBER (VBN) TO A LOGICAL BLOCK
1127 ; NUMBER (LBN) VIA A WINDOW BLOCK THAT CONTAINS A SET OF MAPPING POINTERS.
1128 ;
1129 ; INPUTS:
1130 ;
1131 ; R0=NUMBER OF CONSECUTIVE BYTES THAT MUST BE MAPPED.
1132 ; R1=ADDRESS OF THE WINDOW BLOCK.
1133 ; R2=HIGH PART OF VBN.
1134 ; R3=LOW PART OF VBN.
1135 ;
1136 ; OUTPUTS:
1137 ;
1138 ; C=1 IF VBN CANNOT BE MAPPED VIA WINDOW BLOCK.
1139 ; C=0 IF VBN SUCCESSFULLY MAPPED TO LBN.
1140 ; R0=NUMBER OF UNMAPPED BLOCKS.
IOSUB MACRO M1110 22-AUG-79 07:06 PAGE 3-20
1141 ; R2=HIGH PART OF LBN.
1142 ; R3=LOW PART OF LBN.
1143 ;-
1144
1145 001530 $MPVBN::SAVNR ;SAVE NONVOLATILE REGISTERS
1146 001534 112146 MOVB (R1)+,-(SP) ;GET NUMBER OF MAPPING POINTERS
1147 001536 001432 BEQ 20$ ;IF EQ NO MAP POSSIBLE
1148 001540 062700 000777 ADD #777,R0 ;ROUND BYTES TO NEXT 256. WORD BLOCK
1149 001544 006000 ROR R0 ;CONVERT TO WORDS
1150 001546 105000 CLRB R0 ;CLEAR RESIDUAL BITS
1151 001550 000300 SWAB R0 ;SWAP NUMBER OF BLOCKS TO LOW BYTE
1152 001552 005201 INC R1 ;POINT TO HIGH PART OF STARTING VBN
1153 001554 005004 CLR R4 ;PICKUP HIGH PART OF STARTING VBN
1154 001556 152104 BISB (R1)+,R4 ;
1155 001560 005201 INC R1 ;STEP OVER STATUS BYTE
1156 001562 160402 SUB R4,R2 ;NORMALIZE HIGH PART OF VBN
1157 001564 103417 BLO 20$ ;IF LO MAP FAILURE
1158 001566 162103 SUB (R1)+,R3 ;NORMALIZE LOW PART OF VBN
1159 001570 005602 SBC R2 ;
1160 001572 001014 BNE 20$ ;IF NE MAP FAILURE
1161 001574 005721 TST (R1)+ ;ADVANCE PAST LOCK LIST POINTER ; TM075
1162 001576 005721 10$: TST (R1)+ ;POINT TO NEXT MAPPING POINTER
1163 001600 005004 CLR R4 ;PICKUP HIGH PART OF LBN
1164 001602 152104 BISB (R1)+,R4 ;
1165 001604 005046 CLR -(SP) ;PICKUP POINTER SIZE MINUS ONE
1166 001606 152116 BISB (R1)+,(SP) ;
1167 001610 021603 CMP (SP),R3 ;VBN MAPPED BY THIS POINTER?
1168 001612 103006 BHIS 30$ ;IF HIS YES
1169 001614 162603 SUB (SP)+,R3 ;NORMALIZE VBN FOR THIS POINTER
1170 001616 005303 DEC R3 ;
1171 001620 105316 DECB (SP) ;ANY POINTERS LEFT?
1172 001622 003365 BGT 10$ ;IF GT YES
1173 001624 000261 20$: SEC ;INDICATE MAPPING FAILURE
1174 001626 000426 BR 70$ ;
1175 001630 012105 30$: MOV (R1)+,R5 ;PICKUP LOW PART OF LBN
1176 001632 060300 ADD R3,R0 ;CALCULATE CONTIGUOUS BLOCKS REQUIRED
1177 001634 060503 ADD R5,R3 ;CONVERT VBN TO LBN
1178 001636 005502 ADC R2 ;
1179 001640 060402 ADD R4,R2 ;
1180 001642 005216 40$: INC (SP) ;CORRECT TO ACTUAL POINTER SIZE
1181 001644 161600 SUB (SP),R0 ;REDUCE CONTIGUOUS BLOCKS REQUIRED
1182 001646 003414 BLE 50$ ;IF LE CONTIGUOUS REQUIREMENT SATISFIED
1183 001650 105366 000002 DECB 2(SP) ;ANY MORE POINTERS?
1184 001654 003412 BLE 60$ ;IF LE NO
1185 001656 061605 ADD (SP),R5 ;CALCULATE NEXT LBN
1186 001660 005504 ADC R4 ;
1187 001662 120421 CMPB R4,(R1)+ ;HIGH PART OF LBN MATCH?
1188 001664 001006 BNE 60$ ;IF NE NO
1189 001666 005016 CLR (SP) ;CLEAR HIGH PART OF COUNT
1190 001670 112116 MOVB (R1)+,(SP) ;PICKUP POINTER SIZE MINUS ONE
1191 001672 020521 CMP R5,(R1)+ ;LOW PART OF LBN MATCH?
1192 001674 001762 BEQ 40$ ;IF EQ YES
1193 001676 000401 BR 60$ ;
1194 001700 005000 50$: CLR R0 ;INDICATE TOTAL MAP
1195 001702 005726 60$: TST (SP)+ ;CLEAN STACK AND INDICATE SUCCESS
1196 001704 005226 70$: INC (SP)+ ;CLEAN STACK
1197 001706 RETURN ;
IOSUB MACRO M1110 22-AUG-79 07:06 PAGE 3-21
1198
1199 .ENDC
1200
1201
1202 ;+ ; TM075
1203 ; **-$LCKPR-LOCK PROCESSING ROUTINE ; TM075
1204 ; ; TM075
1205 ; THIS ROUTINE FIRST DETERMINES IF A FILE I/O REQUEST IS TO A SHARED ; TM075
1206 ; FILE. IF SO, IT DETERMINES IF THE REQUEST IS AN UNLOCK QIO OR A ; TM075
1207 ; VIRTUAL BLOCK I/O REQUEST. IT THEN EITHER PERFORMS THE UNLOCK QIO ; TM075
1208 ; OR THE LOCK PROCESSING RESPECTIVELY. ; TM075
1209 ; ; TM075
1210 ; INPUTS: ; TM075
1211 ; ; TM075
1212 ; R1=I/O PACKET ADDRESS OF THE REQUEST ; TM075
1213 ; ; TM075
1214 ; OUTPUTS: ; TM075
1215 ; ; TM075
1216 ; C=0 IF NO LOCK PROCESSING WAS REQUIRED. ; TM075
1217 ; ; TM075
1218 ; C=1 IF AN UNLOCK WAS PERFORMED OR AN ERROR CONDITION OCCURED ; TM075
1219 ; DURING THE LOCK PROCESSING. ; TM075
1220 ; R0=I/O STATUS ; TM075
1221 ; ; TM075
1222 ; R1 IS PRESERVED. ; TM075
1223 ;- ; TM075
1224 ; TM075
1225 ; TM075
1226 .IF DF R$$LKL ; TM075
1227 ; TM075
1228 $LCKPR::MOV @I.LN2(R1),R3 ;POINT TO WINDOW BLOCK ; TM075
1229 BIC #1,R3 ;CLEAR INTERLOCK BIT ; TM075
1230 MOV #IE.ULK&377,R0 ;SET FOR UNLOCK ERROR STATUS ; TM075
1231 MOV W.LKL(R3),R2 ;POINT TO FIRST ENTRY IN LOCK LIST ; TM075
1232 BEQ 50$ ;IF EQ THERE IS NONE ; TM075
1233 SAVNR ;SAVE R4 AND R5 ; TM075
1234 MOV I.PRM+4(R1),R4 ;PICK UP BYTE COUNT FOR REQUEST ; TM075
1235 ADD #777,R4 ;ROUND TO NEXT DISK BLOCK ; TM075
1236 ROR R4 ;CONVERT TO SIZE IN BLOCKS ; TM075
1237 CLRB R4 ; ; TM075
1238 SWAB R4 ; ; TM075
1239 CMPB I.FCN+1(R1),#IO.ULK/256. ;IS THIS AN UNLOCK REQUEST? ; TM075
1240 BNE 100$ ;IF NE NO ; TM075
1241 ; TM075
1242 ; ; TM075
1243 ; UNLOCK PROCESSING ; TM075
1244 ; ; TM075
1245 ; THIS SECTION OF THE ROUTINE PERFORMS THE UNLOCK PROCESSING. RELEVANT ; TM075
1246 ; REGISTER CONTENTS AT THIS POINT ARE: ; TM075
1247 ; ; TM075
1248 ; R0=UNLOCK ERROR STATUS ; TM075
1249 ; R1=I/O PACKET ADDRESS ; TM075
1250 ; R2=ADDRESS OF THE FIRST LOCK BLOCK IN THE LOCK LIST ; TM075
1251 ; R3=POINTER TO CURRENT WINDOW ; TM075
1252 ; R4=BYTE COUNT OF CURRENT UNLOCK REQUEST ; TM075
1253 ; ; TM075
1254 ; TM075
IOSUB MACRO M1110 22-AUG-79 07:06 PAGE 3-22
1255 MOV I.PRM+12(R1),R5 ;CREATE BLOCK NUMBER SPECIFIED FLAG ; TM075
1256 BISB I.PRM+10(R1),R5 ; ; TM075
1257 10$: TSTB L.CNT(R2) ;THIS LOCK BLOCK IN USE? ; TM075
1258 BEQ 40$ ;IF EQ NO ; TM075
1259 TST R5 ;BLOCK NUMBER SPECIFIED? ; TM075
1260 BEQ 20$ ;IF EQ NO ; TM075
1261 CALL 180$ ;EXACT VBN AND COUNT MATCH? ; TM075
1262 BNE 40$ ;IF NE NO ; TM075
1263 20$: CMP L.WI1(R2),R3 ;SAME OWNER? ; TM075
1264 BNE 40$ ;IF NE NO ; TM075
1265 CLRB L.CNT(R2) ;UNLOCK THE LOCK ; TM075
1266 MOV #IS.SUC&377,R0 ;SET FOR SUCCESSFUL RETURN ; TM075
1267 TST R5 ;WAS THIS FOR AN EXPLICIT BLOCK NUMBER? ; TM075
1268 BNE 50$ ;IF NE YES ; TM075
1269 40$: MOV (R2),R2 ;POINT TO NEXT LOCK BLOCK ; TM075
1270 BNE 10$ ;IF NE THERE IS ONE ; TM075
1271 ; TM075
1272 ; ; TM075
1273 ; NO LOCK LIST EXISTS ; TM075
1274 ; ; TM075
1275 ; IF THE FUNCTION IS NOT AN UNLOCK FUNCTION, A SIMPLE RETURN OCCURS ; TM075
1276 ; WITH CARRY CLEAR. AN UNLOCK IN THIS CASE IS AN ERROR. (NOTE THAT ; TM075
1277 ; ALL UNLOCK REQUESTS FALL THROUGH HERE AS WELL.) ; TM075
1278 ; ; TM075
1279 ; TM075
1280 50$: CMPB I.FCN+1(R1),#<IO.ULK/256.>+1 ;SET CARRY IF UNLOCK ; TM075
1281 RETURN ; ; TM075
1282 ; TM075
1283 ; ; TM075
1284 ; LOCK PROCESSING ; TM075
1285 ; ; TM075
1286 ; THIS ROUTINE CHECKS FOR ATTEMPTED LOCK OVERLAPS, ATTEMPTS TO SET THE ; TM075
1287 ; NEW LOCK, AND PERFORMS THE IMPLIED UNLOCK. IF A NEW LOCK REQUEST ; TM075
1288 ; FOR AN EXPLICIT UNLOCKER IS DETECTED WHICH EXACTLY MATCHES AN EXISTING; TM075
1289 ; LOCK FOR THAT WINDOW IN BOTH STARTING VBN AND SIZE, THE LOCK BLOCK IS ; TM075
1290 ; SIMPLY REUSED. RELEVANT REGISTER CONTENTS AT THIS POINT ARE: ; TM075
1291 ; ; TM075
1292 ; R1=I/O PACKET ADDRESS ; TM075
1293 ; R2=ADDRESS OF FIRST LOCK BLOCK IN LOCK LIST ; TM075
1294 ; R3=ADDRESS OF FILE WINDOW ; TM075
1295 ; R4=BLOCK COUNT FOR CURRENT REQUEST ; TM075
1296 ; ; TM075
1297 ; TM075
1298 100$: CLR R5 ;INIT FREE NODE POINTER ; TM075
1299 MOV #IE.LCK&377,-(SP) ;PUSH LOCK ERROR STATUS ; TM075
1300 110$: TSTB L.CNT(R2) ;IS LOCK BLOCK IN USE? ; TM075
1301 BNE 120$ ;IF NE YES ; TM075
1302 TST R5 ;ALREADY HAVE FREE BLOCK? ; TM075
1303 BNE 150$ ;IF NE YES, LOOK AT NEXT LOCK BLOCK ; TM075
1304 BR 130$ ;ELSE CLAIM THIS BLOCK ; TM075
1305 120$: MOV L.WI1(R2),R0 ;PICK UP OWNER WORD ; TM075
1306 BIC #1,R0 ;CLEAR BIT FOR NO UNLOCK FLAG ; TM075
1307 CMP R0,R3 ;LOCK BELONG TO THIS WINDOW? ; TM075
1308 BNE 140$ ;IF NE NO, CHECK FOR OVERLAPS ; TM075
1309 BIT #WI.EXL,(R3) ;EXPLICIT UNLOCKER? ; TM075
1310 BEQ 125$ ;IF EQ NO, SAVE BLOCK FOR IMPLIED UNLOCK; TM075
1311 CALL 180$ ;EXACT VBN AND COUNT? ; TM075
IOSUB MACRO M1110 22-AUG-79 07:06 PAGE 3-23
1312 BNE 150$ ;IF NE NO ; TM075
1313 125$: MOV L.WI1(R2),R0 ;RETRIEVE OWNER WORD ; TM075
1314 ROR R0 ;CAN LOCK BLOCK BE REUSED? ; TM075
1315 BCS 170$ ;IF CS NO ; TM075
1316 130$: MOV R2,R5 ;SET TO REUSE THIS LOCK BLOCK ; TM075
1317 BR 150$ ;LOOK AT NEXT LOCK BLOCK ; TM075
1318 140$: CLR R0 ;PICK UP LOCK BLOCK COUNT ; TM075
1319 BISB L.CNT(R2),R0 ; ; TM075
1320 ADD L.VB1+2(R2),R0 ;CALCULATE NUMBER OF HIGHEST BLOCK +1 ; TM075
1321 MOVB L.VB1(R2),-(SP) ;PUSH HIGH ORDER BYTE ; TM075
1322 ADCB (SP) ;PROPAGATE CARRY ; TM075
1323 CMPB I.PRM+10(R1),(SP)+ ;OVERLAP? ; TM075
1324 BNE 145$ ;IF NE USE BRANCH BELOW ; TM075
1325 CMP I.PRM+12(R1),R0 ;OVERLAP? ; TM075
1326 145$: BHIS 150$ ;IF HIS NO ; TM075
1327 MOV R4,R0 ;COPY SIZE OF CURRENT REQUEST ; TM075
1328 ADD I.PRM+12(R1),R0 ;CALCULATE NUMBER OF HIGHEST BLOCK +1 ; TM075
1329 MOVB I.PRM+10(R1),-(SP) ;PUSH HIGH ORDER BYTE ; TM075
1330 ADCB (SP) ;PROPAGATE CARRY ; TM075
1331 CMPB L.VB1(R2),(SP)+ ;OVERLAP? ; TM075
1332 BNE 146$ ;IF NE USE BRANCH BELOW ; TM075
1333 CMP L.VB1+2(R2),R0 ;OVERLAP? ; TM075
1334 146$: BLO 170$ ;IF LO YES ; TM075
1335 150$: MOV (R2),R2 ;POINT TO NEXT LOCK BLOCK ; TM075
1336 BNE 110$ ;IF NE THERE IS ONE ; TM075
1337 CLC ;ASSUME SUCCESS ON READ VALIDATION ; TM075
1338 BIT #WI.WRV,(R3) ;IS THIS A WRITER? ; TM075
1339 BEQ 170$ ;IF EQ NO, SUCCESSFUL VALIDATION ; TM075
1340 MOV R5,R0 ;COPY POINTER TO SAVED LOCK BLOCK ; TM075
1341 BNE 160$ ;IF NE ONE WAS IN FACT SAVED ; TM075
1342 MOV #IE.NOD&377,(SP) ;SET FOR ALLOCATION FAILURE STATUS ; TM075
1343 MOV R1,-(SP) ;SAVE I/O PACKET ADDRESS ; TM075
1344 MOV #L.LGTH,R1 ;PICK UP SIZE OF LOCK BLOCK ; TM075
1345 CALL $ALOCB ;ALLOCATE LOCK BLOCK ; TM075
1346 MOV (SP)+,R1 ;RESTORE I/O PACKET ADDRESS ; TM075
1347 BCS 170$ ;IF CS ALLOCATION FAILURE ; TM075
1348 MOV @W.LKL(R3),(R0) ;POINT NEW BLOCK TO SECOND ONE IN LIST ; TM075
1349 MOV R0,@W.LKL(R3) ;POINT FIRST BLOCK IN LIST TO NEW ONE ; TM075
1350 160$: TST (R0)+ ;ADVANCE TO OWNER WORD ; TM075
1351 MOV R0,I.PRM+16(R1) ;SAVE POINTER TO OWNER WORD ; TM075
1352 MOV R3,(R0) ;SET OWNER WORD ; TM075
1353 INC (R0)+ ;SET NO UNLOCK FLAG ; TM075
1354 MOVB I.PRM+10(R1),(R0)+ ;SET HIGH PART OF VBN ; TM075
1355 MOVB R4,(R0)+ ;SET BLOCK COUNT ; TM075
1356 MOV I.PRM+12(R1),(R0) ;SET LOW PART OF VBN ; TM075
1357 170$: MOV (SP)+,R0 ;PICK UP ERROR STATUS ; TM075
1358 RETURN ; ; TM075
1359 ; TM075
1360 ; ; TM075
1361 ; ROUTINE TO CHECK FOR EXACT VBN AND BLOCK COUNT MATCH ; TM075
1362 ; ; TM075
1363 ; INPUTS: ; TM075
1364 ; ; TM075
1365 ; R1=I/O PACKET ADDRESS ; TM075
1366 ; R2=LOCK BLOCK ADDRESS ; TM075
1367 ; R4=BYTE COUNT ; TM075
1368 ; ; TM075
IOSUB MACRO M1110 22-AUG-79 07:06 PAGE 3-24
1369 ; OUTPUTS: ; TM075
1370 ; ; TM075
1371 ; ALL REGISTERS PRESERVED. ; TM075
1372 ; ; TM075
1373 ; Z=1 IF EXACT MATCH. ; TM075
1374 ; ; TM075
1375 ; Z=0 IT NO MATCH. ; TM075
1376 ; ; TM075
1377 ; TM075
1378 180$: CMP L.VB1+2(R2),I.PRM+12(R1) ;MATCH ON LOW ORDER? ; TM075
1379 BNE 190$ ;IF NE NO ; TM075
1380 CMPB L.VB1(R2),I.PRM+10(R1) ;MATCH ON HIGH ORDER? ; TM075
1381 BNE 190$ ;IF NE NO ; TM075
1382 TST R4 ;COUNT SPECIFIED? ; TM075
1383 BEQ 190$ ;IF EQ NO ; TM075
1384 CMPB L.CNT(R2),R4 ;MATCH ON COUNT? ; TM075
1385 190$: RETURN ; ; TM075
1386 ; TM075
1387 .ENDC ; TM075
1388 ; TM075
1389 ; TM075
1390 ;+
1391 ; **-$RELOC-RELOCATE USER VIRTUAL ADDRESS
1392 ;
1393 ; THIS ROUTINE IS CALLED TO TRANSFORM A 16 BIT USER VIRTUAL ADDRESS
1394 ; INTO A RELOCATION BIAS AND DISPLACEMENT IN BLOCK RELATIVE TO APR6.
1395 ;
1396 ; INPUTS:
1397 ;
1398 ; R0=USER VIRTUAL ADDRESS TO RELOCATE.
1399 ;
1400 ; OUTPUTS:
1401 ;
1402 ; R1=RELOCATION BIAS TO BE LOADED INTO PAR6.
1403 ; R2=DISPLACEMENT IN BLOCK PLUS 140000 (PAR6 BIAS).
1404 ;
1405 ; R0 AND R3 ARE PRESERVED ACROSS CALL.
1406 ;-
1407
1408 001710 $RELOC:: ;REF LABEL
1409
1410
1411 .IF NDF M$$MGE
1412
1413 MOV R0,R2 ;COPY PHYSICAL ADDRESS
1414 CLR R1 ;CLEAR RELOCATION BIAS
1415
1416 .IFF
1417
1418 001710 010001 MOV R0,R1 ;COPY VIRTUAL ADDRESS
1419 001712 005002 CLR R2 ;ZERO APR NUMBER ACCUMULATOR
1420 001714 006301 ASL R1 ;COLLECT APR NUMBER
1421 001716 006102 ROL R2 ;
1422 001720 006301 ASL R1 ;
1423 001722 006102 ROL R2 ;
1424 001724 006301 ASL R1 ;
1425 001726 006102 ROL R2 ;
IOSUB MACRO M1110 22-AUG-79 07:06 PAGE 3-25
1426 001730 006302 ASL R2 ;CONVERT TO APR INDEX
1427 001732 105001 CLRB R1 ;CLEAR EXTRANEOUS BITS
1428 001734 000301 SWAB R1 ;COLLECT BLOCK NUMBER IN LOW BYTE
1429 001736 006001 ROR R1 ;
1430 001740 066201 177640 ADD UISAR0(R2),R1 ;CALCULATE RELOCATION BIAS
1431 001744 010002 MOV R0,R2 ;COPY VIRTUAL ADDRESS
1432 001746 042702 177700 BIC #177700,R2 ;CLEAR ALL BUT DISPLACEMENT IN BLOCK
1433 001752 052702 140000 BIS #140000,R2 ;SET APR 6 BIAS
1434
1435 .ENDC
1436
1437
1438 001756 RETURN ;
1439
1440 ;+
1441 ; **-$RELOM-RELOCATE AND MAP ADDRESS
1442 ;
1443 ; THIS ROUTINE IS CALLED TO TRANSFORM A 16 BIT USER VIRTUAL ADDRESS
1444 ; INTO A RELOCATION BIAS AND DISPLACEMENT IN BLOCK RELATIVE TO APR6
1445 ; AND LOAD THESE VALUES FOR ACCESS BY THE CALLER.
1446 ;
1447 ; INPUTS:
1448 ;
1449 ; R0=USER VIRTUAL ADDRESS TO RELOCATE.
1450 ;
1451 ; OUTPUTS:
1452 ;
1453 ; R0=DISPLACEMENT IN BLOCK.
1454 ; KISAR6 IS LOADED WITH THE RELOCATION BIAS.
1455 ;
1456 ; R3 IS PRESERVED ACROSS CALL.
1457 ;-
1458
1459
1460 .IF DF M$$MGE
1461
1462 001760 $RELOM::CALL $RELOC ;RELOCATE USER VIRTUAL ADDRESS
1463 001764 010167 172354 MOV R1,KISAR6 ;SET KERNEL MAPPING REGISTER
1464 001770 010200 MOV R2,R0 ;SET DISPLACEMENT IN BLOCK ADDRESS
1465 001772 RETURN ;
1466
1467 .ENDC
1468
1469
1470 ;+
1471 ; **-$RLCH-RELEASE CHANNEL
1472 ;
1473 ; THIS ROUTINE IS CALLED TO RELEASE A CHANNEL. THE CHANNEL STATUS IS SET TO
1474 ; IDLE AND AN ATTEMPT IS MADE TO DEQUEUE THE NEXT DRIVER WAITING TO USE THE
1475 ; CHANNEL. IF NO DRIVER IS WAITING, THEN A RETURN TO THE CALLER IS EXECUTED.
1476 ; ELSE THE DRIVER IS DEQUEUED, THE CHANNEL STATUS IS SET TO BUSY, THE DRIVER
1477 ; IS CALLED, AND THEN A RETURN TO THE CALLER IS EXECUTED.
1478 ;
1479 ; INPUTS:
1480 ;
1481 ; R5=ADDRESS OF THE UNIT CONTROL BLOCK.
1482 ;
IOSUB MACRO M1110 22-AUG-79 07:06 PAGE 3-26
1483 ; OUTPUTS:
1484 ;
1485 ; THE CHANNEL STATUS IS SET TO IDLE AND AN ATTEMPT IS MADE TO DEQUEUE
1486 ; THE NEXT DRIVER WAITING TO USE THE CHANNEL.
1487 ;
1488 ; R0, R1, AND R2 ARE PRESERVED ACROSS CALL.
1489 ;
1490 ; NOTE: R4 IS DESTROYED BY THIS ROUTINE.
1491 ;-
1492
1493
1494 .IF DF M$$IXD
1495
1496 .ENABL LSB
1497 $RLCH:: MOV U.SCB(R5),R4 ;GET ADDRESS OF SCB
1498 MOV S.CCB(R4),R4 ;GET ADDRESS OF CHANNEL CONTROL BLOCK
1499 CLR 4(R4) ;SET CHANNEL IDLE
1500 TST (R4) ;ANY DRIVER IN WAIT QUEUE?
1501 BEQ 10$ ;IF EQ NO
1502 MOV R0,-(SP) ;SAVE R0, R1, R2, AND R5
1503 MOV R1,-(SP) ;
1504 MOV R2,-(SP) ;
1505 MOV R5,-(SP) ;
1506
1507
1508 .IF DF L$$DRV&M$$MGE
1509
1510 MOV KISAR5,-(SP) ;SAVE APR5
1511
1512 .IFTF
1513
1514 MOV R4,R0 ;SET ADDRESS OF WAIT QUEUE LISTHEAD
1515 CALL $QRMVF ;REMOVE DRIVER FROM QUEUE
1516 ADD #10,R1 ;POINT PAST SAVED R1
1517
1518 .IFT
1519
1520 MOV (R1),KISAR5 ;MAP THE DRIVER
1521
1522 .IFTF
1523
1524 MOV -(R1),R4 ;RETRIEVE ADDRESS OF SCB
1525 MOV -(R1),R5 ;RETRIEVE ADDRESS OF UCB
1526 CALL 20$ ;SET CHANNEL BUSY
1527 CALL @-(R1) ;CALL DRIVER
1528
1529 .IFT
1530
1531 MOV (SP)+,KISAR5 ;RESTORE APR5
1532
1533 .ENDC
1534
1535
1536 MOV (SP)+,R5 ;RESTORE R5, R2, R1, AND R0
1537 MOV (SP)+,R2 ;
1538 MOV (SP)+,R1 ;
1539 MOV (SP)+,R0 ;
IOSUB MACRO M1110 22-AUG-79 07:06 PAGE 3-27
1540 10$: RETURN ;
1541
1542 ;+
1543 ; **-$RQCH-REQUEST CHANNEL
1544 ;
1545 ; THIS ROUTINE IS CALLED TO REQUEST EXCLUSIVE USE OF A CHANNEL. IF THE
1546 ; CHANNEL IS CURRENTLY BUSY, THEN THE CALLING DRIVER IS THREADED INTO THE
1547 ; CHANNEL WAIT QUEUE AND A RETURN TO THE CALLER OF THE DRIVER IS EXECUTED.
1548 ; ELSE THE CHANNEL STATUS IS SET TO BUSY AND A RETURN TO THE CALLING DRIVER
1549 ; IS EXECUTED.
1550 ;
1551 ; INPUTS:
1552 ;
1553 ; R4=ADDRESS OF STATUS CONTROL BLOCK.
1554 ; R5=ADDRESS OF UNIT CONTROL BLOCK.
1555 ; (SP)=RETURN ADDRESS OF CALLER.
1556 ; 2(SP)=RETURN ADDRESS OF CALLER OF CALLER.
1557 ;
1558 ; OUTPUTS:
1559 ;
1560 ; IF THE CHANNEL IS IDLE, THEN IT IS SET BUSY AND A RETURN TO THE
1561 ; CALLER IS EXECUTED. ELSE THE CALLER IS THREADED INTO THE CHANNEL
1562 ; WAIT QUEUE AND A RETURN TO THE CALLER'S CALLER IS EXECUTED.
1563 ;-
1564
1565 $RQCH:: MOV S.CCB(R4),R0 ;GET ADDRESS OF CHANNEL CONTROL BLOCK
1566 TST 4(R0) ;CHANNEL BUSY?
1567 BEQ 20$ ;IF EQ NO
1568 MOV R4,R1 ;CALCULATE ADDRESS OF LAST WORD IN FORK BLOCK
1569 ADD #S.FRK+6,R1 ;
1570 MOV R4,(R1) ;SAVE ADDRESS OF SCB
1571 MOV R5,-(R1) ;SAVE ADDRESS OF UCB
1572 MOV (SP)+,-(R1) ;SAVE DRIVER RETURN ADDRESS
1573 TST -(R1) ;POINT TO START OF BLOCK
1574 CALLR $QINSF ;INSERT BLOCK IN CHANNEL WAIT QUEUE
1575 20$: MOV R5,4(R0) ;SET CHANNEL BUSY
1576 CLR R0 ;PICKUP VECTOR ADDRESS
1577 BISB S.VCT(R4),R0 ;
1578 ASL R0 ;CALCULATE ACTUAL VECTOR ADDRESS
1579 ASL R0 ;
1580 MOV S.CCB+2(R4),(R0)+ ;INSERT INTERRUPT ROUTINE ADDRESS
1581 MOV S.CCB+4(R4),(R0) ;INSERT INTERRUPT PS WORD
1582 RETURN ;
1583 .DSABL LSB
1584
1585 .ENDC
1586
1587
1588 ;+
1589 ; **-$SCDVT-SCAN DEVICE TABLES
1590 ; **-$SCDV1-SCAN DEVICE TABLES (ALTERNATE ENTRY)
1591 ;
1592 ; THIS ROUTINE IS A CO-ROUTINE THAT IS CALLED TO SCAN THE DEVICE TABLES. FOR EAC
1593 ; UNIT CONTROL BLOCK THE CALLER IS RECALLED.
1594 ;
1595 ; INPUTS:
1596 ;
IOSUB MACRO M1110 22-AUG-79 07:06 PAGE 3-28
1597 ; R3=LIST POINTER (IF ENTRY AT $SCDV1)
1598 ;
1599 ; OUTPUTS:
1600 ;
1601 ; C=1 IF NO MORE ENTRIES EXIST IN THE DEVICE TABLES.
1602 ; C=0 IF THE NEXT DEVICE TABLE ENTRY IS BEING RETURNED.
1603 ; R3=ADDRESS OF THE DEVICE CONTROL BLOCK.
1604 ; R4=ADDRESS OF THE STATUS CONTROL BLOCK.
1605 ; R5=ADDRESS OF THE UNIT CONTROL BLOCK.
1606 ;-
1607
1608 001774 012703 000000G $SCDVT::MOV #$DEVHD,R3 ;GET ADDRESS OF FIRST DCB ADDRESS
1609 002000 012604 $SCDV1::MOV (SP)+,R4 ;REMOVE RETURN ADDRESS FROM STACK
1610 002002 011303 10$: MOV (R3),R3 ;GET ADDRESS OF NEXT DCB
1611 002004 001433 BEQ 30$ ;IF EQ NO MORE
1612 002006 016305 000000G MOV D.UCB(R3),R5 ;POINT TO FIRST UCB
1613 002012 032765 000000G 000000G BIT #DV.PSE,U.CW1(R5) ;PSEUDO DEVICE?
1614 002020 001370 BNE 10$ ;IF NE YES
1615 002022 116346 000001G MOVB D.UNIT+1(R3),-(SP) ;CALCULATE NUMBER OF UCB'S TO SCAN
1616 002026 166316 000000G SUB D.UNIT(R3),(SP) ;
1617 002032 105216 INCB (SP) ; ; TM105
1618 002034 010346 20$: MOV R3,-(SP) ;SAVE DCB ADDRESS
1619 002036 010546 MOV R5,-(SP) ;SAVE UCB ADDRESS
1620 002040 010446 MOV R4,-(SP) ;SET RETURN ADDRESS
1621 002042 016504 000000G MOV U.SCB(R5),R4 ;GET ADDRESS OF STATUS CONTROL BLOCK
1622 002046 000241 CLC ;INDICATE ENTRY
1623 002050 CALL @(SP)+ ;CALL THE CALLER
1624 002052 012604 MOV (SP)+,R4 ;REMOVE RETURN ADDRESS
1625 002054 012605 MOV (SP)+,R5 ;RESTORE UCB ADDRESS
1626 002056 012603 MOV (SP)+,R3 ;RESTORE DCB ADDRESS
1627 002060 066305 000000G ADD D.UCBL(R3),R5 ;POINT TO NEXT UCB
1628 002064 105316 DECB (SP) ;ANY MORE UCB'S TO SCAN?
1629 002066 001362 BNE 20$ ;IF NE YES ; TM105
1630 002070 005726 TST (SP)+ ;CLEAN STACK ;**-1
1631 002072 000743 BR 10$ ;GO AGAIN
1632 002074 000261 30$: SEC ;INDICATE NO ENTRY
1633 002076 000114 JMP (R4) ;RETURN TO CALLER
1634
1635 ;+ ; TM095
1636 ; **-$ASUMR-ASSIGN UNIBUS MAPPING REGISTERS ; TM095
1637 ; ; TM095
1638 ; THIS ROUTINE IS CALLED TO ASSIGN A CONTIGUOUS SET OF UMR'S. NOTE THAT; TM095
1639 ; FOR THE SAKE OF SPEED, THE LINK WORD OF EACH MAPPING ASSIGNMENT BLOCK ; TM095
1640 ; POINTS TO THE UMR ADDRESS (2ND) WORD OF THE BLOCK, NOT THE FIRST WORD.; TM095
1641 ; THE CURRENT STATE OF UMR ASSIGNMENT IS REPRESENTED BY A LINKED LIST OF; TM095
1642 ; MAPPING ASSIGNMENT BLOCKS, EACH BLOCK CONTAINING THE ADDRESS OF THE ; TM095
1643 ; FIRST UMR ASSIGNED AND THE NUMBER OF UMR'S ASSIGNED TIMES 4. THE ; TM095
1644 ; BLOCKS ARE LINKED IN THE ORDER OF INCREASING FIRST UMR ADDRESS. ; TM095
1645 ; ; TM095
1646 ; INPUTS: ; TM095
1647 ; ; TM095
1648 ; R0=POINTER TO A MAPPING REGISTER ASSIGNMENT BLOCK. ; TM095
1649 ; M.UMRN(R0)=NUMBER OF UMR'S REQUIRED * 4. ; TM095
1650 ; ; TM095
1651 ; OUTPUTS: ; TM095
1652 ; ; TM095
1653 ; ALL REGISTERS ARE PRESERVED. ; TM095
IOSUB MACRO M1110 22-AUG-79 07:06 PAGE 3-29
1654 ; ; TM095
1655 ; C=0 IF THE UMR'S WERE SUCCESSFULLY ASSIGNED. ; TM095
1656 ; ALL FIELDS OF THE MAPPING REGISTER ASSIGNMENT BLOCK ; TM095
1657 ; ARE INITIALIZED AND THE BLOCK IS LINKED INTO ; TM095
1658 ; THE ASSIGNMENT LIST. ; TM095
1659 ; C=1 IF THE UMR'S COULD NOT BE ASSIGNED. ; TM095
1660 ;- ; TM095
1661 ; TM095
1662 ; TM095
1663 .IF DF M$$EXT ; TM095
1664 ; TM095
1665 $ASUMR::SAVNR ;SAVE R4 AND R5 ; TM095
1666 TST (R0)+ ;SKIP OVER LINK WORD (M.LNK) ; TM095
1667 MOV #$UMRHD+2,R5 ;POINT TO UMR ASSIGNMENT LISTHEAD + 2 ; TM095
1668 10$: MOV R5,R4 ;SAVE POINTER TO PREVIOUS ; TM095
1669 BEQ 30$ ;IF EQ ASSIGNMENT FAILURE ; TM095
1670 MOV (R5),(R0) ;POINT TO NEXT FREE UMR (M.UMRA)(M.UMRA); TM095
1671 ADD M.UMRN-M.UMRA(R5),(R0) ;(M.UMRA) ; TM095
1672 MOV #UBMPR+<31.*4>,-(SP) ;PUSH POINTER PAST LAST UMR ; TM095
1673 MOV -(R5),R5 ;POINT TO NEXT ASSIGNMENT BLOCK (M.LNK) ; TM095
1674 BEQ 20$ ;IF EQ THERE IS NONE ; TM095
1675 MOV (R5),(SP) ;SET NEXT ALLOCATED UMR ADDRESS (M.UMRA); TM095
1676 20$: SUB (R0),(SP) ;CALCULATE # OF FREE UMR'S * 4 (M.UMRA) ; TM095
1677 CMP (SP)+,M.UMRN-M.UMRA(R0) ;ENOUGH UMR'S AVAILABLE? ; TM095
1678 BLO 10$ ;IF LO NO ; TM095
1679 MOV R0,-(R4) ;LINK NEW BLOCK TO PREVIOUS (M.LNK) ; TM095
1680 MOV (R0),R4 ;SAVE FIRST UMR ADDRESS (M.UMRA) ; TM095
1681 MOV R5,-2(R0) ;POINT NEW BLOCK TO NEXT IN LIST (M.LNK); TM095
1682 MOV R4,R5 ;DUPLICATE FIRST UMR ADDRESS ; TM095
1683 BICB #UBMPR!34,R5 ;MASK OUT ALL BUT HI 2 BITS IN LOW BYTE ; TM095
1684 BIC R5,R4 ;CLEAR OUT HIGH BYTE AND HIGH 2 BITS ; TM095
1685 ASR R5 ;SHIFT HIGH 2 BITS TO BITS 4 & 5 ; TM095
1686 ASLB R4 ;CALCULATE HIGH BYTE OF LOW 16 BITS ; TM095
1687 ASL R4 ; (LOSING BIT 200 FIRST) ; TM095
1688 ASL R4 ; ; TM095
1689 SWAB R4 ;FORM LOW SIXTEEN BITS OF ADDRESS ; TM095
1690 MOV R4,M.UMVL-2(R0) ;SET UP LOW 16 BITS OF ADDRESS ; TM095
1691 MOVB R5,M.UMVH-2(R0) ;SET BITS 4 & 5 ; TM095
1692 30$: DEC R0 ;PNT BACK TO LINK WORD PRESERVING CARRY ; TM095
1693 DEC R0 ; ; TM095
1694 RETURN ; ; TM095
1695 ; TM095
1696 ;+ ; TM095
1697 ; **-$DEUMR-DEASSIGN UNIBUS MAPPING REGISTERS ; TM095
1698 ; ; TM095
1699 ; THIS ROUTINE IS CALLED TO DEASSIGN A CONTIGUOUS BLOCK OF UMR'S. IF ; TM095
1700 ; THE MAPPING ASSIGNMENT BLOCK IS NOT IN THE LIST, NO ACTION IS TAKEN. ; TM095
1701 ; NOTE THAT FOR THE SAKE OF ASSIGNMENT SPEED, THE LINK WORD POINTS TO ; TM095
1702 ; THE UMR ADDRESS (2ND) WORD OF THE ASSIGNMENT BLOCK. ; TM095
1703 ; ; TM095
1704 ; INPUTS: ; TM095
1705 ; ; TM095
1706 ; R2=POINTER TO ASSIGNMENT BLOCK. ; TM095
1707 ; ; TM095
1708 ; OUTPUTS: ; TM095
1709 ; ; TM095
1710 ; R0 AND R1 ARE PRESERVED. ; TM095
IOSUB MACRO M1110 22-AUG-79 07:06 PAGE 3-30
1711 ;- ; TM095
1712 ; TM095
1713 $DEUMR::TST (R2)+ ;SKIP OVER LINK WORD (M.LNK) ; TM095
1714 MOV #$UMRHD+2,R3 ;POINT TO ASSIGNMENT LISTHEAD + 2 ; TM095
1715 10$: CMP -(R3),R2 ;IS IT THE NEXT ONE? (M.LNK) ; TM095
1716 BEQ 20$ ;IF EQ YES ; TM095
1717 MOV (R3),R3 ;ELSE POINT TO NEXT IN LIST (M.LNK) ; TM095
1718 BNE 10$ ;IF NE THERE IS ONE ; TM095
1719 BR 30$ ;ELSE MAPPING ASSIGNMENT BLK NOT IN LIST; TM095
1720 20$: MOV -(R2),(R3) ;UNLINK THE BLOCK (M.LNK)(M.LNK) ; TM095
1721 30$: RETURN ; ; TM095
1722 ; TM095
1723 ;+
1724 ; **-$STMAP-SET UP UNIBUS MAPPING ADDRESS
1725 ;
1726 ; THIS ROUTINE IS CALLED BY UNIBUS NPR DEVICE DRIVERS TO SET UP THE
1727 ; UNIBUS MAPPING ADDRESS, FIRST ASSIGNING THE UMR'S. IF THE UMR'S ; TM095
1728 ; CANNOT BE ALLOCATED, THE DRIVER'S MAPPING ASSIGNMENT BLOCK IS PLACED ; TM095
1729 ; IN A WAIT QUEUE AND A RETURN TO THE DRIVER'S CALLER IS EXECUTED. THE ; TM095
1730 ; ASSIGNMENT BLOCK WILL EVENTUALLY BE DEQUEUED WHEN THE UMR'S ARE ; TM095
1731 ; AVAILABLE AND THE DRIVER WILL BE REMAPPED AND RETURNED TO WITH R1-R5 ; TM095
1732 ; PRESERVED AND THE NORMAL OUTPUTS OF THIS ROUTINE. THE DRIVER'S ; TM095
1733 ; CONTEXT IS STORED IN THE ASSIGNMENT BLOCK AND FORK BLOCK WHILE IT IS ; TM095
1734 ; BLOCKED AND IN THE WAIT QUEUE. ONCE A DRIVER'S MAPPING ASSIGNMENT ; TM095
1735 ; BLOCK IS PLACED IN THE UMR WAIT QUEUE, IT IS NOT REMOVED FROM THE ; TM095
1736 ; QUEUE UNTIL THE UMR'S ARE SUCCESSFULLY ASSIGNED. THIS STRATEGY ; TM095
1737 ; ASSURES THAT WAITING DRIVERS WILL BE SERVICED FIFO AND THAT DRIVER'S ; TM095
1738 ; WITH LARGE REQUESTS FOR UMR'S WILL NOT WAIT INDEFINATELY. ; TM095
1739 ; ;**-1
1740 ; INPUTS:
1741 ;
1742 ; R4=ADDRESS OF DEVICE SCB.
1743 ; R5=ADDRESS OF DEVICE UCB.
1744 ; (SP)=RETURN TO DRIVER'S CALLER. ; TM095
1745 ;
1746 ; OUTPUTS:
1747 ;
1748 ; UNIBUS MAP ADDRESSES ARE SET UP IN THE DEVICE UCB AND THE
1749 ; ACTUAL PHYSICAL ADDRESS IS MOVED TO THE SCB.
1750 ;
1751 ; NOTE: REGISTERS R1, R2, AND R3 ARE PRESERVED ACROSS CALL.
1752 ;-
1753 ;**-3
1754 $STMAP::MOV R4,R0 ;COPY SCB POINTER ; TM095
1755 ADD #S.MPR+M.LGTH,R0 ;POINT PAST MAPPING ASSIGNMENT BLOCK ; TM095
1756 MOV U.BUF+2(R5),-(R0) ;SAVE LOW 16 BITS ADDRESS (M.BFVL) ; TM095
1757 MOVB U.BUF+1(R5),-(R0) ;SAVE HIGH 6 BITS OF ADDRESS (M.BFVH) ; TM095
1758 DEC R0 ;POINT BACK TO NEXT WORD ; TM095
1759 MOV U.CNT(R5),-(R0) ;TEMORARILY STORE BYTE COUNT (M.UMVL) ; TM095
1760 CLR -(R0) ;INITIALIZE UMR COUNT (M.UMRN) ; TM095
1761 10$: ADD #4,(R0) ;INCREASE COUNT FOR ONE UMR (M.UMRN) ; TM095
1762 SUB #20000,2(R0) ;REDUCE BYTE COUNT BY 8K BYTES (M.UMVL) ; TM095
1763 BCC 10$ ;IF CC MORE BYTES TO GO ; TM095
1764 TST -(R0) ;(M.UMRA) ; TM095
1765 MOV -(R0),-(SP) ;SAVE POSSIBLE WAIT QUEUE LINK (M.LNK) ; TM095
1766 CALL $ASUMR ;ATTEMPT TO ASSIGN REQUIRED UMR'S ; TM095
1767 BCC 20$ ;IF CC SUCCESSFUL, CHECK FOR UMR WAIT ; TM095
IOSUB MACRO M1110 22-AUG-79 07:06 PAGE 3-31
1768 TST (SP)+ ;CLEAR STACK ; TM095
1769 ADD #S.FRK+6,R4 ;POINT INTO FORK BLOCK ; TM095
1770 MOV R5,(R4) ;SAVE R5 IN FORK BLOCK (S.FRK+6) ; TM095
1771 MOV (SP)+,-(R4) ;SAVE DRIVER'S RETURN ADDRESS (S.FRK+4) ; TM095
1772 CALL $WTUMR ;WAIT FOR CHANGE IN UMR ASSIGNMENT ; TM095
1773 MOV (R4)+,-(SP) ;RESTORE DRIVER'S RETURN ADDR (S.FRK+4) ; TM095
1774 MOV (R4)+,R5 ;RESTORE R5 (S.FRK+6) ; TM095
1775 MOV (R4),KISAR5 ;REMAP DRIVER (S.FRK+10) ; TM095
1776 SUB #S.FRK+10,R4 ;RESTORE R4 ; TM095
1777 BR $STMAP ;TRY AGAIN ; TM095
1778 20$: MOV M.UMVL(R0),U.BUF+2(R5) ;STORE LOW WORD OF UMR VIRT ADDR ; TM095
1779 MOVB M.UMVH(R0),U.BUF(R5) ;STORE HIGH SIX BITS ; TM095
1780 CLRB U.BUF+1(R5) ;CLEAR HIGH-ORDER BYTE ; TM095
1781 CMP $UMRWT,R0 ;WAS THIS CALLER WAITING? ; TM095
1782 BNE 30$ ;IF NE NO ; TM095
1783 MOV (SP),$UMRWT ;DEQUEUE CURRENT CALLER'S BLOCK ; TM095
1784 BNE 30$ ;IF NE NOT END OF LIST ; TM095
1785 MOV #$UMRWT,$UMRWT+2 ;UPDATE LAST IN LIST POINTER ; TM095
1786 30$: TST (SP)+ ;CLEAR STACK ; TM095
1787 ; TM095
1788 ;+ ; TM095
1789 ; **-$DQUMR-DEQUEUE FROM UMR WAIT ; TM095
1790 ; ; TM095
1791 ; CONTROL IS TRANSFERRED HERE TO SEE IF A DRIVER IS WAITING FOR UMR ; TM095
1792 ; ASSIGNMENT. FIRST THE CALLING DRIVER IS CALLED BACK AS A COROUTINE. ; TM095
1793 ; WHEN THE CALLING DRIVER ISSUES A RETURN BACK TO THIS ROUTINE, A CHECK ; TM095
1794 ; IS MADE TO SEE IF ANY DRIVERS ARE WAITING FOR UMR'S. IF SO THE WAIT- ; TM095
1795 ; ING DRIVER'S CONTEXT IS RESTORED WITHOUT ACTUALLY DEQUEUEING THE ; TM095
1796 ; MAPPING ASSIGNMENT BLOCK AND CONTROL IS PASSED BACK TO THE ORIGINAL ; TM095
1797 ; UMR ASSIGNMENT ROUTINE. ; TM095
1798 ; ; TM095
1799 ; INPUTS: ; TM095
1800 ; ; TM095
1801 ; (SP)=RETURN ADDRESS TO DRIVER'S CALLER.. ; TM095
1802 ; ; TM095
1803 ; OUTPUTS: ; TM095
1804 ; ; TM095
1805 ; IF ANYONE IS WAITING THEIR CONTEXT IS RESTORED AND THE ALLOCA- ; TM095
1806 ; TION ROUTINE IS CALLED BACK. ; TM095
1807 ;- ; TM095
1808 ; TM095
1809 .ENABL LSB ; TM095
1810 $DQUMR::CALL @(SP)+ ;CALL THE CALLER AS COROUTINE ; TM095
1811 MOV $UMRWT,R0 ;ANYONE WAITING FOR UMR ASSIGNMENT? ; TM095
1812 BEQ 10$ ;IF EQ HE HAS SINCE GONE AWAY ; TM095
1813 TST (R0)+ ;POINT TO SAVED R1 ; TM095
1814 MOV (R0)+,R1 ;RESTORE SAVED REGISTERS ; TM095
1815 MOV (R0)+,R2 ; ; TM095
1816 MOV (R0)+,R3 ; ; TM095
1817 MOV (R0)+,R4 ; ; TM095
1818 JMP @(R0)+ ;JUMP BACK TO ALLOCATION ROUTINE ; TM095
1819 ; TM095
1820 ;+ ; TM095
1821 ; **-$WTUMR-WAIT FOR CHANGE IN UMR STATE ; TM095
1822 ; ; TM095
1823 ; THIS ROUTINE STORES R1-R4 AND THE RETURN PC IN THE MAPPING ASSIGNMENT ; TM095
1824 ; AND QUEUES THE BLOCK IN THE UMR WAIT QUEUE FOR A SUBSEQUENT RECALL TO ; TM095
IOSUB MACRO M1110 22-AUG-79 07:06 PAGE 3-32
1825 ; THE CALLER WHEN THE STATE OF UMR ASSIGNMENT CHANGES. NOTE THAT IT IS ; TM095
1826 ; POSSIBLE FOR THE MAPPING ASSIGNMENT BLOCK TO ALREADY BE IN THE WAIT ; TM095
1827 ; QUEUE, BUT IF IT IS IT CAN ONLY BE AT THE HEAD OF THE QUEUE. ; TM095
1828 ; ; TM095
1829 ; INPUTS: ; TM095
1830 ; ; TM095
1831 ; R0=POINTER TO UMR ASSIGNMENT BLOCK ; TM095
1832 ; ; TM095
1833 ; OUTPUTS: ; TM095
1834 ; ; TM095
1835 ; THE ASSIGNMENT BLOCK IS QUEUED IN THE UMR WAIT QUEUE. ; TM095
1836 ; THE CALLER IS EVENTUALLY RETURNED TO AT SYSTEM STATE WITH R1-R4 ; TM095
1837 ; PRESERVED. ; TM095
1838 ;- ; TM095
1839 ; TM095
1840 $WTUMR::MOV (SP)+,12(R0) ;STORE RETURN ADDR TO ALLOCATE ROUTINE ; TM095
1841 CMP R0,$UMRWT ;MAPPING ASSIGNMENT BLK ALREADY IN LIST?; TM095
1842 BEQ 10$ ;IF EQ YES ; TM095
1843 MOV R0,@$UMRWT+2 ;LINK BLOCK TO LAST IN QUEUE ; TM095
1844 MOV R0,$UMRWT+2 ;UPDATE LAST IN LIST POINTER ; TM095
1845 CLR (R0)+ ;ZERO LINK WORD ; TM095
1846 MOV R1,(R0)+ ;SAVE CALLER'S REGISTERS ; TM095
1847 MOV R2,(R0)+ ; ; TM095
1848 MOV R3,(R0)+ ; ; TM095
1849 MOV R4,(R0)+ ; ; TM095
1850 10$: RETURN ;RETURN TO CALLER'S CALLER ; TM095
1851 .DSABL LSB ; TM095
1852 ;**-7
1853 .ENDC
1854
1855
1856 ;+
1857 ; **-$ECCOR-COMMON ECC CORRECTION CODE FOR RP04/RK06.
1858 ;
1859 ; THIS ROUTINE APPLIES THE ECC CORRECTION ALGORITHM AND DETERMINES
1860 ; IF OFFSET RECOVERY IS REQUIRED (IF SUPPORTED).
1861 ;
1862 ; INPUTS:
1863 ;
1864 ; R1=CONTENTS OF ERROR REGISTER
1865 ; R2=CSR ADDRESS
1866 ; R3=ADDRESS OF FIRST ECC REGISTER
1867 ; R5=UCB ADDRESS
1868 ;
1869 ; OUTPUTS:
1870 ;
1871 ; R3=CONTROLLER INDEX
1872 ; C=0 IF OFFSET RECOVERY IS NOT REQUIRED
1873 ; R0=IS.SUC&377
1874 ; R1=BYTES ACTUALLY TRANSFERRED
1875 ; R2, R4, R5 ARE UNMODIFIED
1876 ; U.BUF AND U.BUF+2 ARE UPDATED (VIA $RELOP)
1877 ;
1878 ; OR C=1 IF OFFSET RECOVERY IS REQUIRED
1879 ; R0=NUMBER OF GOOD BYTES TRANSFERED
1880 ; R1-R5 ARE UNMODIFIED
1881 ;
IOSUB MACRO M1110 22-AUG-79 07:06 PAGE 3-33
1882 ; FIRST CALCULATE THE BYTE OFFSET TO THE START OF BLOCK TRANSFERRED
1883 ;-
1884
1885
1886 .IF DF S$$ECC
1887
1888 $ECCOR::MOV 2(R2),R0 ;GET NEGATIVE NUMBER OF WORDS REMAINING
1889 ASL R0 ;CONVERT TO NEGATIVE BYTES REMAINING
1890 ADD U.CNT(R5),R0 ;CALCULATE NUMBER OF BYTES TRANSFERED
1891 MOV R0,-(SP) ;SAVE NUMBER OF BYTES TRANSFERRED
1892
1893 .IF DF R$$JPO!R$$6OF!R$$MOF ; PB010
1894 ;**-1
1895 SEC ;ASSUME OFFSET RECOVERY IS REQUIRED
1896 BEQ 40$ ;IF EQ NO BYTES TRANSFERED
1897 BIT #600,R1 ;HEADER COMPARE OR CRC ERROR?
1898 BNE 10$ ;IF NE YES
1899
1900 .IFTF
1901
1902 DEC R0 ;CALCULATE OFFSET TO START OF BLOCK
1903 10$: BIC #777,R0 ;CLEAR RESIDUE
1904
1905 .IFT
1906
1907 BIT #10700,R1 ;ECC HARD ERROR?
1908 BNE 40$ ;IF NE YES
1909
1910 .ENDC
1911
1912
1913 ;
1914 ; SECOND CALCULATE BYTE OFFSET IN BLOCK AND POSITION PATTERN SHIFT COUNT
1915 ;
1916
1917 MOV (R3)+,R1 ;GET STARTING BIT NUMBER
1918 DEC R1 ;CONVERT TO RELATIVE BIT NUMBER
1919 MOV R1,-(SP) ;SAVE STARTING RELATIVE BIT NUMBER
1920 BIC #^C<17>,R1 ;ISOLATE SHIFT COUNT
1921 BIC R1,(SP) ;CLEAR SHIFT COUNT IN RELATIVE BIT NUMBE
1922 CLC ;CALCULATE OFFSET TO FIRST BYTE IN BLOCK
1923 ROR (SP) ;
1924 ASR (SP) ;
1925 ASR (SP) ;
1926 ADD (SP),R0 ;CALCULATE OFFSET TO FIRST BYTE IN TRANS
1927
1928 ;
1929 ; THIRD SHIFT CORRECTION PATTERN INTO PLACE
1930 ;
1931
1932 MOV (R3),R3 ;GET CORRECTION PATTERN WORD
1933 CLR (SP) ;CLEAR SECOND WORD
1934 20$: DEC R1 ;ANY MORE SHIFTS TO PERFORM?
1935 BLT 30$ ;IF LT NO
1936 ASL R3 ;DOUBLE LEFT SHIFT
1937 ROL (SP) ;
1938 BR 20$ ;
IOSUB MACRO M1110 22-AUG-79 07:06 PAGE 3-34
1939
1940 ;
1941 ; FOURTH APPLY FIRST CORRECTION
1942 ;
1943
1944 30$: CALL 50$ ;APPLY ECC CORRECTION
1945
1946 ;
1947 ; FIFTH APPLY SECOND CORRECTION
1948 ;
1949
1950 MOV (SP)+,R3 ;RETRIEVE SECOND PATTERN WORD
1951 ADD #2,R0 ;UPDATE COUNT
1952 CALL 50$ ;APPLY ECC CORRECTION
1953
1954 ;
1955 ; SIXTH FINISH OR CONTINUE PREVIOUS FUNCTION
1956 ;
1957
1958 MOV #IS.SUC&377,R0 ;ASSUME SUCCESSFUL TRANSFER
1959 CLC ;OFFSET RECOVERY NOT REQUIRED
1960 MOV (SP),R1 ;RETRIEVE BYTES TRANSFERRED
1961 40$: INC (SP)+ ;CLEAN STACK
1962 MOVB S.CON(R4),R3 ;SET CONTROLLER INDEX
1963 RETURN ;
1964
1965 ;
1966 ; ECC CORRECTION ROUTINE
1967 ;
1968
1969 50$: CMP R0,U.CNT(R5) ;BYTE OFFSET WITHIN RANGE?
1970 BHIS 60$ ;IF HIS NO
1971 CALL $RELOP ;RELOCATE PHYSICAL ADDRESS
1972 MOV (R1),-(SP) ;COPY CURRENT DATA WORD
1973 BIC R3,(R1) ;.NOT.PATTERN.AND.DATA WORD
1974 BIC (SP)+,R3 ;.NOT.DATA WORD.AND.PATTERN
1975 BIS R3,(R1) ;PATTERN.OR.DATA WORD
1976 60$: RETURN ;
1977
1978 .ENDC
1979
1980
1981 ;+
1982 ; **-$RELOP-RELOCATE UNIBUS PHYSICAL ADDRESS
1983 ;
1984 ; THIS ROUTINE RELOCATES A UNIBUS PHYSICAL ADDRESS TO A KISAR6
1985 ; BIAS AND DISPLACEMENT.
1986 ;
1987 ; INPUTS:
1988 ;
1989 ; R0=BYTE OFFSET FROM ADDRESS IN U.BUF+1 AND U.BUF+2
1990 ; R5=UCB ADDRESS
1991 ; U.BUF+1(R5)=HIGH ORDER BITS OF PHYSICAL ADDRESS
1992 ; U.BUF+2(R5)=LOW ORDER BITS OF PHYSICAL ADDRESS
1993 ;
1994 ; OUTPUTS:
1995 ;
IOSUB MACRO M1110 22-AUG-79 07:06 PAGE 3-35
1996 ; KISAR6=CALCULATED BIAS (MAPPED SYSTEM)
1997 ; R1=REAL ADDRESS OR DISPLACEMENT
1998 ;-
1999
2000
2001 .IF DF D$$IAG!S$$ECC
2002
2003 $RELOP:: ;
2004
2005
2006 .IF DF M$$MGE
2007
2008 MOV U.BUF(R5),-(SP) ;RETRIEVE ORIGINAL MEMORY EXTENSION BITS
2009 BIC #^C<1400>,(SP) ;ISOLATE MEMORY EXTENSION BITS ; PB017
2010 ;**-1
2011 .IFTF
2012
2013 MOV U.BUF+2(R5),R1 ;RETRIEVE STARTING BUFFER ADDRESS
2014 ADD R0,R1 ;CALCULATE ADDRESS OF WORD TO BE CORRECT
2015
2016 .IFT
2017
2018 ADCB 1(SP) ;PROPAGATE ADDRESS CARRY
2019 SWAB R1 ;SWAP STARTING BUFFER ADDRESS
2020 BISB R1,(SP) ;MERGE 8 BITS OF UPPER ADDRESS BIAS
2021 ASL R1 ;COLLECT REMAINING TWO BITS
2022 ROL (SP) ;
2023 ASL R1 ;
2024 ROL (SP) ;
2025 MOV (SP)+,KISAR6 ;SET BUFFER RELOCATION BIAS
2026 CLRB R1 ;CLEAR LOW BYTE OF STARTING ADDRESS
2027 SWAB R1 ;SWAP ADDRESS BACK
2028 ASR R1 ;SETUP APR6 ADDRESS
2029 ASR R1 ;
2030 BIS #140000,R1 ;
2031
2032 .ENDC
2033
2034
2035 RETURN ;
2036
2037 .ENDC
2038
2039
2040 ;+
2041 ; **-$CRPAS - COMMON REGISTER PASS ROUTINE
2042 ;
2043 ; THIS SUBROUTINE IS USED TO PASS THE CONTENTS OF THE DEVICE REGISTERS
2044 ; BACK TO THE DIAGNOSTIC TASK. ALL REGISTERS ARE PASSED IN THE ORDER
2045 ; IN WHICH THEY APPEAR ON THE UNIBUS.
2046 ;
2047 ; NOTE: THIS ROUTINE MAKES USE OF THE ERROR LOGGING ENTRIES S.ROFF AND
2048 ; S.RCNT IN THE SCB. THEREFORE ERROR LOGGING MUST BE ENABLED IN
2049 ; ORDER TO USE THIS ROUTINE.
2050 ;
2051 ; INPUTS:
2052 ;
IOSUB MACRO M1110 22-AUG-79 07:06 PAGE 3-36
2053 ; R1=I/O PACKET ADDRESS
2054 ; R2=CSR ADDRESS
2055 ; R4=SCB ADDRESS
2056 ;
2057 ; OUTPUTS:
2058 ;
2059 ; R0,R2 ARE PRESERVED
2060 ;-
2061
2062
2063 .IF DF D$$IAG
2064
2065 $CRPAS::MOV R0,-(SP) ;SAVE R0
2066
2067
2068 .IF DF M$$MGE
2069
2070 MOV I.PRM+14(R1),KISAR6 ;SET RELOCATION BIAS
2071
2072 .ENDC
2073
2074
2075 MOV I.PRM+16(R1),R0 ;GET REGISTER BUFFER ADDRESS
2076 MOV R2,-(SP) ;PRESERVE INITIAL CSR ADDRESS
2077 MOVB S.ROFF(R4),R2 ;GET OFFSET TO FIRST REGISTER
2078 ADD (SP),R2 ;ADD CSR ADDRESS
2079 MOVB S.RCNT(R4),R1 ;GET NUMBER OF REGISTERS TO XFER
2080 10$: MOV (R2)+,(R0)+ ;TRANSFER A REGISTER
2081 DEC R1 ;DONE YET?
2082 BNE 10$ ;IF NE NO
2083 MOV (SP)+,R2 ;RESTORE CSR ADDRESS
2084 MOV (SP)+,R0 ;RESTORE R0
2085 RETURN
2086
2087 .ENDC
2088
2089
2090 ;+
2091 ; **-$MUL-INTEGER MULTIPLY MAGNITUDE NUMBERS
2092 ;
2093 ; INPUTS:
2094 ;
2095 ; R0=MULTIPLIER.
2096 ; R1=MULTIPLICAND.
2097 ;
2098 ; OUTPUTS:
2099 ;
2100 ; DOUBLE WORD RESULT IS RETURNED WITH THE
2101 ; HIGH PART IN R0 AND THE LOW PART IN R1.
2102 ;
2103 ; REGISTERS R2, R3, R4, AND R5 ARE PRESERVED ACROSS CALL.
2104 ;-
2105
2106 .ENABL LSB
2107 002100 010046 $MUL:: MOV R0,-(SP) ;SAVE R0 FOR ADDS
2108 002102 012746 000021 MOV #21,-(SP) ;SET REPEAT COUNT
2109 002106 005000 CLR R0 ;CLEAR HIGH PART
IOSUB MACRO M1110 22-AUG-79 07:06 PAGE 3-37
2110 002110 006000 10$: ROR R0 ;DOUBLE RIGHT SHIFT
2111 002112 006001 ROR R1 ;
2112 002114 103002 BCC 20$ ;IF CC DO NOT ADD
2113 002116 066600 000002 ADD 2(SP),R0 ;
2114 002122 005316 20$: DEC (SP) ;DECREMENT REPEAT COUNT ;**-1
2115 002124 003371 BGT 10$ ;IF GT MORE TO GO
2116 002126 000415 BR 50$ ;EXIT TO CALLER
2117
2118 ;+
2119 ; **-$DIV-INTEGER DIVIDE MAGNITUDE NUMBERS
2120 ;
2121 ; INPUTS:
2122 ;
2123 ; R0=DIVIDEND.
2124 ; R1=DIVISOR.
2125 ;
2126 ; OUTPUTS:
2127 ;
2128 ; QUOTIENT IS RETURNED IN R0 AND REMAINDER IN R1.
2129 ;
2130 ; REGISTERS R2, R3, R4, AND R5 ARE PRESERVED ACROSS CALL.
2131 ;-
2132
2133 002130 012746 000020 $DIV:: MOV #20,-(SP) ;SET LOOP COUNT
2134 002134 010146 MOV R1,-(SP) ;SAVE DIVISOR FOR SUBTRACTS
2135 002136 005001 CLR R1 ;CLEAR REMAINDER
2136 002140 006300 30$: ASL R0 ;DOUBLE LEFT SHIFT
2137 002142 006101 ROL R1 ;
2138 002144 020116 CMP R1,(SP) ;SUBTRACT OUT DIVISOR?
2139 002146 103402 BLO 40$ ;IF LO NO
2140 002150 161601 SUB (SP),R1 ;SUBTRACT OUT DIVISOR
2141 002152 005200 INC R0 ;ADD IN LOW BIT
2142 002154 005366 000002 40$: DEC 2(SP) ;DECREMENT REPEAT COUNT
2143 002160 003367 BGT 30$ ;IF GT MORE TO GO
2144 002162 022626 50$: CMP (SP)+,(SP)+ ;CLEAN STACK
2145 002164 RETURN ;
2146 .DSABL LSB
2147
2148 000001 .END
IOSUB MACRO M1110 22-AUG-79 07:06 PAGE 3-38
SYMBOL TABLE
AS.DEL= 000010 F.FOWN 000010 IO.WVB= ****** GX PS.DEL= 000010 T.IOC 000003
AS.EXT= 000004 F.FPRO 000012 IS.SUC= ****** GX PS.DRV= 000020 T.LBN 000041
AS.RED= 000001 F.FSEQ 000004 I$$RDN= 000000 PS.FXD= 004000 T.LDV 000044
AS.WRT= 000002 F.FSQN 000007 I.AST 000022 PS.LIO= 001000 T.LNK 000000
A$$CHK= 000000 F.FVBN 000044 I.ATTL= 000044 PS.NSF= 000400 T.MXSZ 000050
A$$CPS= 000000 F.HDLB 000016 I.EFN 000003 PS.OUT= 100000 T.NAM 000006
A$$TRP= 000000 F.LBN 000022 I.FCN 000012 PS.PER= 002000 T.OFF 000060
A.AST 000006 F.LGTH 000052 I.IOSB 000014 PS.PIC= 000100 T.PCB 000046
A.BYT 000004 F.LINK 000000 I.LGTH= 000044 PS.SYS= 000040 T.PRI 000002
A.CBL 000002 F.LKL 000050 I.LNK 000000 P$$RTY= 000000 T.RCVL 000012
A.DQSR 177776 F.NACS 000032 I.LN2 000006 P$$TPT= 000000 T.RRFL 000064
A.IOC 000003 F.NLCK 000033 I.PRI 000002 P.BLKS 000016 T.SRCT 000063
A.KSR5 177774 F.NWAC 000034 I.PRM 000024 P.BUSY 000024 T.STAT 000032
A.LGTH= 000014 F.SCHA 000015 I.TCB 000004 P.IOC 000003 T.ST2 000034
A.MPCT 000011 F.SIZE 000026 I.UCB 000010 P.LNK 000000 T.ST3 000036
A.NPR 000010 F.STAT 000034 KDSAR0= 172360 P.MAIN 000012 T.TCBL 000030
A.PCB 000012 F.UCHA 000014 KDSDR0= 172320 P.NAM 000004 T.UCB 000026
A.PCBL 000000 G$$TPP= 000000 KISAR0= 172340 P.OWN 000026 T2.ABO= 000100
A.PRI 000002 G$$TTK= 000000 KISAR5= 172352 P.PRI 000002 T2.AST= 100000
A.PRM 000012 H$$RTZ= 000074 KISAR6= 172354 P.REL 000014 T2.BFX= 004000
A.STAT 000010 H.CSP 000000 KISAR7= 172356 P.SIZE 000016 T2.CAF= 000400
A.TCB 000004 H.CUIC 000010 KISDR0= 172300 P.STAT 000030 T2.CHK= 020000
A.TCBL 000006 H.DSW 000046 KISDR6= 172314 P.SUB 000010 T2.CKD= 010000
CMODE = 140000 H.DUIC 000012 KISDR7= 172316 P.SWSZ 000022 T2.DST= 040000
C$$ORE= 002000 H.EFLM 000004 K$$CNT= 177546 P.TCB 000026 T2.FXD= 002000
DV.PSE= ****** GX H.EFSV 000040 K$$CSR= 177546 P.WAIT 000020 T2.HLT= 000200
DV.TTY= ****** GX H.FCS 000050 K$$IEN= 000115 R$$DER= 000000 T2.SPN= 000004
D.DSP = ****** GX H.FORT 000052 K$$LDC= 000001 R$$EXV= 000000 T2.STP= 000020
D.NAM = ****** GX H.FPSA 000042 K$$TPS= 000074 R$$SND= 000000 T2.TIO= 001000
D.PCB = ****** GX H.FPVA 000034 L$$ASG= 000000 R$$11M= 000000 T2.WFR= 000001
D.RS96= ****** GX H.GARD 000072 L$$DRV= 000000 R$$11S= 000000 T3.ACP= 100000
D.RS97= ****** GX H.HDLN 000002 L.CNT 000005 SISDR0= 172200 T3.CAL= 000100
D.RS98= ****** GX H.IPC 000016 L.LGTH 000010 SR0 = 177572 T3.CLI= 001000
D.UCB = ****** GX H.IPS 000014 L.LNK 000000 SR3 = 172516 T3.MCR= 004000
D.UCBL= ****** GX H.ISP 000020 L.VB1 000004 SWR = 177570 T3.NET= 000020
D.UNIT= ****** GX H.LUN 000076 L.WI1 000002 S$$YSZ= 001740 T3.NSD= 000200
D.VCAN= ****** GX H.NLUN 000074 MPAR = 172100 S.CON = ****** GX T3.PMD= 040000
FC.CEF= 020000 H.NML 000061 MPCSR = 177746 S.PKT = ****** GX T3.PRV= 010000
FC.DIR= 040000 H.ODVA 000022 M$$CRB= 000124 S.PRI = ****** GX T3.REM= 020000
FC.FCO= 010000 H.ODVL 000024 M$$MGE= 000000 S.STBK= 000012 T3.ROV= 000040
FC.WAC= 100000 H.OVLY 000054 M$$NET= 000000 S.STS = ****** GX T3.RST= 000400
FE.CAL= 000040 H.PFVA 000032 M$$NT2= 000000 TPS = 177564 T3.SLV= 002000
FE.CEX= 020000 H.RCVA 000036 N$$LDV= 000001 TS.BLK= 170700 UBMPR = 170200
FE.DRV= 000010 H.RRVA 000062 PIRQ = 177772 TS.CKP= 000200 UC.ATT= ****** GX
FE.EXP= 000200 H.SPRI 000060 PMODE = 030000 TS.CKR= 000100 UC.KIL= ****** GX
FE.EXT= 000001 H.TKVA 000026 PR0 = 000000 TS.EXE= 100000 UC.NPR= ****** GX
FE.EXV= 000004 H.TKVL 000030 PR1 = 000040 TS.MSG= 020000 UDSAR0= 177660
FE.LSI= 000400 H.VEXT 000056 PR4 = 000200 TS.NRP= 010000 UDSDR0= 177620
FE.MUP= 000002 H.WND 000044 PR5 = 000240 TS.OUT= 000400 UISAR0= 177640
FE.MXT= 040000 IE.ABO= ****** GX PR6 = 000300 TS.RDN= 040000 UISAR4= 177650
FE.NLG= 100000 IE.DAA= ****** GX PR7 = 000340 TS.RUN= 004000 UISAR5= 177652
FE.PKT= 000100 IE.DNA= ****** GX PS = 177776 T.ACTL 000052 UISAR6= 177654
FE.PLA= 000020 IE.PRI= ****** GX PS.APR= 000007 T.ASTL 000016 UISAR7= 177656
F.DREF 000036 IO.ATT= ****** GX PS.CHK= 010000 T.ATT 000054 UISDR0= 177600
F.DRNM 000040 IO.DET= ****** GX PS.CKP= 040000 T.CPCB 000004 UISDR4= 177610
F.FEXT 000042 IO.RVB= ****** GX PS.CKR= 020000 T.DPRI 000040 UISDR5= 177612
F.FNUM 000002 IO.WLB= ****** GX PS.COM= 000200 T.EFLG 000022 UISDR6= 177614
IOSUB MACRO M1110 22-AUG-79 07:06 PAGE 3-39
SYMBOL TABLE
UISDR7= 177616 V.FIEX 000023 WI.DLK= 010000 W.VBN 000002 $IODON 000624RG
US.BSY= ****** GX V.FMAX 000014 WI.EXL= 040000 W.WISZ 000003 $IOFIN 000646RG
US.FOR= ****** GX V.FPRO 000034 WI.EXT= 002000 X$$DBT= 000000 $IOKIL 001024RG
US.MNT= ****** GX V.FRBK 000040 WI.LCK= 004000 $ACHCK 000034RG $MPLND 001264RG
U.ACP = ****** GX V.IBLB 000010 WI.RDV= 000400 $ACHKB 000042RG $MPLNE 001244RG
U.ATT = ****** GX V.IBSZ 000011 WI.WRV= 001000 $ACHKP 000000RG $MPLUN 001226RG
U.BUF = ****** GX V.IFWI 000002 W.BATT 000006 $ACHKW 000024RG $MPPHY 001326RG
U.CNT = ****** GX V.LGTH 000046 W.BFPD 000014 $BTMSK= ****** GX $MPPKT 001376RG
U.CTL = ****** GX V.LRUC 000041 W.BHVR 000004 $CEFI 000154RG $MPVBN 001530RG
U.CW1 = ****** GX V.SBCL 000017 W.BLGH 000020 $CEFN 000150RG $MUL 002100RG
U.RED = ****** GX V.SBLB 000022 W.BLPD 000016 $COMEF= ****** GX $QINSF= ****** GX
U.SCB = ****** GX V.SBSZ 000020 W.BLVR 000002 $DEPKT= ****** GX $RELOC 001710RG
U.STS = ****** GX V.STAT 000044 W.BNPD 000015 $DEVHD= ****** GX $RELOM 001760RG
U.UNIT= ****** GX V.TRCT 000000 W.BOFF 000012 $DIV 002130RG $SAVNR= ****** GX
VC.BMW= 000002 V.VCHA 000032 W.BPCB 000000 $DVMSG 000240RG $SCDVT 001774RG
VC.IFW= 000001 V.VFSQ 000036 W.BSIZ 000010 $EXRQP= ****** GX $SCDV1 002000RG
V$$CTR= 001200 V.VOWN 000026 W.CTL 000000 $GTPKT 000242RG $SETCR= ****** GX
V$$RSN= 000031 V.VPRO 000030 W.FCB 000006 $HEADR= ****** GX $SETF = ****** GX
V.FCB 000004 V.WISZ 000016 W.LKL 000010 $IOALT 000622RG $TKTCB= ****** GX
V.FFNU 000045 WI.BPS= 100000 W.RTRV 000012
. ABS. 177776 000
002166 001
ERRORS DETECTED: 0
VIRTUAL MEMORY USED: 6379 WORDS ( 25 PAGES)
DYNAMIC MEMORY: 7204 WORDS ( 27 PAGES)
ELAPSED TIME: 00:01:13
[11,24]IOSUB,SY0:[11,34]IOSUB/-SP=[1,1]EXEMC/ML,[11,10]RSXMC/PA:1,IOSUB