************ File SYS$SPECIFIC:[EVERHART]IOSUBNPAG56.MAR;5 37 ; X-56 GCE Glenn C. Everhart 10-Jun-1997 38 ; The "finipl8" processing as previously defined requires 39 ; that intercept code determine whether to clear ucb busy 40 ; and arrange for the next I/O to start. 41 ; This is too hard. Change the fast_finish macro to continue 42 ; I/O when called from contexts which otherwise would continue 43 ; it, and to just return when not. That way a routine called 44 ; via an irp$l_pid intercept can just execute, and the I/O 45 ; restart processing (normal in places like REQCOM) will be 46 ; done if the call came from something like REQCOM, but not 47 ; if it came from something like COM$POST. 48 ; Also arrange to check kernel stack in ioc$initiate 49 ; to see if it is above an "alert zone" (2 pagelets 50 ; has been determined experimentally to be enough). If the 51 ; kernel stack is in the alert zone, fork to clear it rather 52 ; than allowing recursive calls to overflow it. 53 ; ****** File SYS$SPECIFIC:[EVERHART.RIX]IOSUBNPAG.MAR;6 37 ; 38 ; 39 ; X-56 AEM Anne McElearney 21-May-1997 40 ; Check for a completion status of zero in IOC_STD$ALTREQCOM and 41 ; IOC_STD$REQCOM. If a status of zero is found, bugcheck. This 42 ; logic will only be included in the _MON version and it is an 43 ; attempt to prevent a process from hanging due to deletion of an IRP 44 ; when the requesting process specified an IOSA or IOSB. 45 ; ************ ************ File SYS$SPECIFIC:[EVERHART]IOSUBNPAG56.MAR;5 797 ; TYPE: Either IRP (causes error check) or anything else 798 ; ****** File SYS$SPECIFIC:[EVERHART.RIX]IOSUBNPAG.MAR;6 789 ; ************ ************ File SYS$SPECIFIC:[EVERHART]IOSUBNPAG56.MAR;5 855 ; Resume IS needed if RESUME is filled in. 856 ; This is done where the original call would have done I/O completion 857 ; and then started new I/O. 858 BRW DONE ; Finish things off. 859 NOHOOK: ****** File SYS$SPECIFIC:[EVERHART.RIX]IOSUBNPAG.MAR;6 846 RET ; Do not continue further. 847 ; (It is the user responsibility to continue via cleanup of the 848 ; IRP and reissue of REQCOM (or alt... or whatever) if a system 849 ; completion at IPL 8 is requested by this mechanism.) 850 NOHOOK: ************ ************ File SYS$SPECIFIC:[EVERHART]IOSUBNPAG56.MAR;5 866 EVAX_MFPR_PRBR ; R0/CPU data area 867 .IF IDN,TYPE,IRP 868 CLRB IRP$B_FLCK(R3) ; No fork IPL 869 .IFF 870 ASSUME CDRP$B_FLCK EQ CDRP$W_CDRPSIZE + 3 871 CLRL IRP$W_CDRPSIZE(R3) ; Actually clearing fork IPL ****** File SYS$SPECIFIC:[EVERHART.RIX]IOSUBNPAG.MAR;6 857 .IF IDN,TYPE,IRP 858 EVAX_MFPR_PRBR ; R0/CPU data area 859 CLRB IRP$B_FLCK(R3) ; No fork IPL 860 .IFF 861 CLRL IRP$W_CDRPSIZE(R3) ; Actually clearing fork IPL ************ ************ File SYS$SPECIFIC:[EVERHART]IOSUBNPAG56.MAR;5 886 .ENDC 887 BRB DONE ; Done with this one for now, pick up 888 ; later at EXE$FASTIO_FINISH 889 .ENDM FAST_FINISH ****** File SYS$SPECIFIC:[EVERHART.RIX]IOSUBNPAG.MAR;6 876 BRB DONE ; Done with this one for now, pick up 877 ; later at EXE$FASTIO_FINISH 878 .ENDC 879 .ENDM FAST_FINISH ************ ************ File SYS$SPECIFIC:[EVERHART]IOSUBNPAG56.MAR;5 1688 .IF DF CA$_MEASURE_IOT ****** File SYS$SPECIFIC:[EVERHART.RIX]IOSUBNPAG.MAR;6 1678 ; 1679 ; Perform this check only in IOSUBNPAG_MON which is used when SYSGEN 1680 ; parameter SYSTEM_CHECK is set. 1681 ; Check for final I/O status of zero in IRP. To aid in the 1682 ; debugging of improper use of this field, bugcheck if the status is zero. 1683 ; 1684 .IF DF CA$_IO_DEBUG ; if _MON Version 1685 .BRANCH_LIKELY 1686 EVAX_BNE R0,23$ ; continue if status is non-zero 1687 BUG_CHECK INCONSTATE,FATAL ; I/O status is zero 1688 23$: 1689 .ENDC ; 1690 1691 .IF DF CA$_MEASURE_IOT ************ ************ File SYS$SPECIFIC:[EVERHART]IOSUBNPAG56.MAR;5 1708 29$: FAST_FINISH TYPE=IRP, DONE=28$,DONT=27$ ; Do fast-finish 1709 ****** File SYS$SPECIFIC:[EVERHART.RIX]IOSUBNPAG.MAR;6 1711 29$: FAST_FINISH TYPE=IRP, DONE=28$,DONT=27$ ; Do fast-finish 1712 ************ ************ File SYS$SPECIFIC:[EVERHART]IOSUBNPAG56.MAR;5 2013 MOVL UCB$L_IRP(R5),R3 ; Get address of I/O packet. ****** File SYS$SPECIFIC:[EVERHART.RIX]IOSUBNPAG.MAR;6 2016 ; 2017 ; Perform this check only in IOSUBNPAG_MON which is used when SYSGEN 2018 ; parameter SYSTEM_CHECK is set. 2019 ; Check for final I/O status of zero in IRP. To aid in the 2020 ; debugging of improper use of this field, bugcheck if the status is zero. 2021 ; 2022 .IF DF CA$_IO_DEBUG ; if _MON Version 2023 .BRANCH_LIKELY 2024 EVAX_BNE R0,35$ ; continue if status is non-zero 2025 BUG_CHECK INCONSTATE,FATAL ; I/O status is zero 2026 35$: 2027 .ENDC ; 2028 2029 MOVL UCB$L_IRP(R5),R3 ; Get address of I/O packet. ************ ************ File SYS$SPECIFIC:[EVERHART]IOSUBNPAG56.MAR;5 2204 INSQUE (R3),@CPU$L_PSBL(R0) ; INSQUE into local IOPOST queue 2205 BNEQ 30$ ; Branch if queue not empty 2206 SOFTINT #IPL$_IOPOST ; Else signal I/O post interrupt 2207 BRW 30$ ; and exit 2208 2209 20$: 2210 .BRANCH_LIKELY 2211 BBS #IRP$V_FINIPL8, - ; If "FINIPL8" bit is clear treat 2212 IRP$L_STS(R3),35$ ; via IPL 4 2213 FAST_FINISH TYPE=CDRP,DONE=30$,DONT=10$ 2214 30$: RET ; Return to caller 2215 35$: 2216 ; ****** File SYS$SPECIFIC:[EVERHART.RIX]IOSUBNPAG.MAR;6 2220 .BRANCH_LIKELY 2221 BBC #IRP$V_FINIPL8, - ; If "FINIPL8" bit is clear treat 2222 IRP$L_STS(R3),14$ ; via IPL 4 2223 ; ************ ************ File SYS$SPECIFIC:[EVERHART]IOSUBNPAG56.MAR;5 2221 ; IRP$L_PID negative cases since we move the FINIPL8 check here, 2222 ; so the code in it will never be called. Also, 2223 ; this code needs to take out the forklock to be consistent with all ****** File SYS$SPECIFIC:[EVERHART.RIX]IOSUBNPAG.MAR;6 2228 ; IRP$L_PID negative cases, so the code in it will never be called. Also, 2229 ; this code needs to take out the forklock to be consistent with all ************ ************ File SYS$SPECIFIC:[EVERHART]IOSUBNPAG56.MAR;5 2227 ; R5 as expected. (Move it there so the called routine can be 2228 ; either JSB or CALL.) 2229 ; In this case we need to fork also since the presumption will normally be ****** File SYS$SPECIFIC:[EVERHART.RIX]IOSUBNPAG.MAR;6 2233 ; R3. 2234 ; In this case we need to fork also since the presumption will normally be ************ ************ File SYS$SPECIFIC:[EVERHART]IOSUBNPAG56.MAR;5 2234 FORKLOCK LOCK=UCB$B_FLCK(R5),PRESERVE=NO 2235 PUSHL R5 ****** File SYS$SPECIFIC:[EVERHART.RIX]IOSUBNPAG.MAR;6 2239 FORKLOCK LOCK=UCB$B_FLCK(R5),PRESERVE=YES 2240 PUSHL R5 ************ ************ File SYS$SPECIFIC:[EVERHART]IOSUBNPAG56.MAR;5 2240 FORKUNLOCK LOCK=UCB$B_FLCK(R5),CONDITION=RESTORE,PRESERVE=NO 2241 RET ; Do not continue further. 2242 2243 .DSABL LSB ****** File SYS$SPECIFIC:[EVERHART.RIX]IOSUBNPAG.MAR;6 2245 FORKUNLOCK LOCK=UCB$B_FLCK(R5),PRESERVE=YES,CONDITION=RESTORE 2246 RET ; Do not continue further. 2247 ; (It is the user responsibility to continue via cleanup of the 2248 ; IRP and reissue of REQCOM (or alt... or whatever) if a system 2249 ; completion at IPL 8 is requested by this mechanism.) 2250 14$: 2251 INSQUE (R3),@CPU$L_PSBL(R0) ; INSQUE into local IOPOST queue 2252 BNEQ 30$ ; Branch if queue not empty 2253 SOFTINT #IPL$_IOPOST ; Else signal I/O post interrupt 2254 BRW 30$ ; and exit 2255 2256 20$: .REPT 0 2257 .BRANCH_UNLIKELY 2258 BBS #IRP$V_COMPLX,- ; For right now, Fast I/O can't deal 2259 IRP$L_STS(R3),10$ ; with complex buffers 2260 2261 .BRANCH_UNLIKELY 2262 .IIF IDN,TYPE,IRP, BLBC ARG$_IOSTATUS1(AP),DONT ; Br if error (and not FASTPATH) 2263 .BRANCH_UNLIKELY 2264 TSTL IRP$L_PID(R3) ; System dispatch? 2265 BLSS 10$ ; Yes, don't fast-finish 2266 2267 ; 2268 ; Fast finish. Insert the IRP on the IPL8 fork queue with an FPC of 2269 ; the fast-finish routine in SYSFIOMAC. 2270 ; 2271 2272 ASSUME CPU$S_SWIQFL/CPU$K_NUM_SWIQS EQ 8 ; Assumption required for offest 2273 FQH_SIZE=8 ; Size of queue header 2274 OFFSET8=<8-6>*FQH_SIZE ; Offset of IPL8 fork queue from start 2275 ; of fork queue in Cpu Data Area 2276 ASSUME IRP$B_FLCK EQ IRP$W_CDRPSIZE+3 ; To clear FLCK, we're using CLRL 2277 ASSUME IRP$B_CD_TYPE EQ IRP$W_CDRPSIZE+2 ; not CLRB. 2278 CLRL IRP$W_CDRPSIZE(R3) ; Actually clearing fork IPL 2279 MOVAB G^EXE$FASTIO_FINISH,- ; Routine to execute 2280 IRP$L_FPC(R3) 2281 EVAX_STQ R3,IRP$Q_FR3(R3) ; Save IRP address 2282 INSQUE IRP$L_FQFL(R3),- ; Put the IRP on the queue head 2283 CPU$Q_SWIQFL+OFFSET8(R0) ; No need to softint - can only be 2284 ; here as IPL8 fork thread, so will 2285 ; RET back to dispatcher 2286 .ENDR 2287 2288 FAST_FINISH TYPE=CDRP,DONE=30$,DONT=10$ 2289 30$: RET ; Return to caller 2290 .DSABL LSB ************ ************ File SYS$SPECIFIC:[EVERHART]IOSUBNPAG56.MAR;5 2514 ; 2515 ; Check kernel stack for imminent overflow. If this may happen, fork 2516 ; first, using the IRP's fork block, and then continue, knowing that then 2517 ; the kernel stack is cleared. 2518 ; 2519 ; 2520 ; The following guard zone size works in cases tested, where 512 is 2521 ; too small. It is an experimental, not an analytical, number. 2522 ; 2523 KSP_GUARD_ZONE=1024 2524 ; 2525 ; The tests are: 2526 ; First, if SP is not within the guard zone of the current page (2 2527 ; pagelets here) we don't need to fork. 2528 ; Second: 2529 ; If SP is negative, we expect a guard page to exist. Then probe the 2530 ; next page down and if that is ok, do not fork. If SP is positive, 2531 ; we cannot rely on a guard page existing so fork. 2532 MCOML G^MMG$GL_BWP_MASK,R0 ; Get the page mask complement 2533 BICL3 R0,SP,R0 ; Mask off all but in-page bits of SP 2534 CMPL R0,#KSP_GUARD_ZONE ; Is this value above the guard? 2535 BGTR 12$ ; If gtr, yes, no need to fork 2536 ; We are within the guard zone. If the SP is positive we must fork. 2537 TSTL SP ; Is SP positive? 2538 BGTR 13$ ; Yes, we must fork. 2539 ; Form an address in next page down to probe. The "+8" can be anything in 2540 ; the range 1 to but just go down to the 2541 ; next quadword here. 2542 MOVAB -(SP),R0 ; Get an address in next page down 2543 IFNOWRT #8,(R0),13$,PRVMOD=#0 ; Check kernel access 2544 ; If we fall through, we don't need to fork, so go ahead and call the 2545 ; driver start entry. 2546 2547 ; Note: There is another copy of the code between 12$ and 13$ below in 2548 ; the area below label 150$. Be sure any changes here are reflected there 2549 ; also. 2550 12$: 2551 MOVL UCB$L_DDT(R5),R0 ;GET ADDRESS OF DRIVER DISPATCH TABLE ****** File SYS$SPECIFIC:[EVERHART.RIX]IOSUBNPAG.MAR;6 2561 MOVL UCB$L_DDT(R5),R0 ;GET ADDRESS OF DRIVER DISPATCH TABLE ************ ************ File SYS$SPECIFIC:[EVERHART]IOSUBNPAG56.MAR;5 2556 ; If we get to 13$, we must fork to clear the stack. 2557 13$: 2558 ; Store R5 in R4; we'll get it back after the fork. 2559 MOVL R5,R4 ; Store R5 in R4 for fork 2560 MOVB UCB$B_FLCK(R5),IRP$B_FLCK(R3) ; Set the fork lock correctly 2561 MOVAB IRP$L_FQFL(R3),R5 ; Fork on the IRP fork block 2562 FORK ROUTINE=150$,CONTINUE=14$,ENVIRONMENT=CALL 2563 14$: 2564 RET ; RET will restore R5 2565 ****** File SYS$SPECIFIC:[EVERHART.RIX]IOSUBNPAG.MAR;6 2566 2567 ************ ************ File SYS$SPECIFIC:[EVERHART]IOSUBNPAG56.MAR;5 2755 ; Fork routine to clear stack before calling driver start. 2756 ; NOTE!!! We use ENV=JSB here to avoid extra register manipulation, 2757 ; since R3 and R5 are set up as needed already. This saves a small 2758 ; number of instructions (but this code may be executed relatively 2759 ; often). 2760 150$: FORK_ROUTINE,ENVIRONMENT=JSB 2761 MOVL R4,R5 ; Get back R5 = UCB address 2762 ; The rest of this code is an exact copy of what is at 12$ above. Be sure 2763 ; any edits to one happen in the other. 2764 MOVL UCB$L_DDT(R5),R0 ;GET ADDRESS OF DRIVER DISPATCH TABLE 2765 PUSHL R5 ;UCB (Stack Arguments for CALLS) 2766 PUSHL R3 ;IRP 2767 CALLS #2, @DDT$PS_START_2(R0) ;START I/O OPERATION 2768 RSB ;RETURN TO CALLER. 2769 2770 ****** File SYS$SPECIFIC:[EVERHART.RIX]IOSUBNPAG.MAR;6 2757 ************ Number of difference sections found: 16 Number of difference records found: 179 DIFFERENCES /IGNORE=()/MERGED=1/OUTPUT=SYS$SPECIFIC:[EVERHART]IOS.DIFF;1- SYS$SPECIFIC:[EVERHART]IOSUBNPAG56.MAR;5- SYS$SPECIFIC:[EVERHART.RIX]IOSUBNPAG.MAR;6