.TITLE SETCPULIM .IDENT \ISUQUOTA 3.0\ ; THIS ROUTINE IS CALLED THROUGH $CMKRNL. ; IT ALTERS THE CPU_LIMIT AND/OR EXTRA_CPU FOR A PROCESS. ; ; CALL SETCPULIM (PID, CPULIM, EXTRACPU) ; ; WHERE ; ; PID - PID OF PROCESS TO BE ALTERED ; CPULIM - NEW CPU_LIMIT. IF OMITTED THEN CPULIM UNCHANGED ; EXTRACPU - NEW CPU_EXTENSION. IF OMITTED THEN EXTRACPU UNCHANGED ; ; INVOKE THE ROUTINE AS FOLLOWS: ; ; $CMKRNL_S SETCPULIM,ARG_SETCPULIM ; ;ARG_SETCPULIM: ; .LONG 3 ; .LONG PID ; .LONG CPULIM ; .LONG EXTRACPU ; ; ERROR CODES RETURNED: ; ; 0 IF PID DOES NOT MATCH PCB$L_PID. ; ; SS$_INSFARG IF NOT ENOUGH ARGS SUPPLIED. ; ; SS$_NORMAL IF SUCCESS. ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ; ANTHONY E. BIBLE ; 104 COMPUTER SCIENCE ; IOWA STATE UNIVERSITY ; AMES, IA 50011 ; ; 515-294-5659 ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; .PAGE $IPLDEF $JPIDEF $PCBDEF $PHDDEF $PRDEF $SSDEF .PSECT CODE,RD,NOWRT,EXE,LONG .ENTRY SETCPULIM,^M ; VERIFY ENOUGH ARGUMENTS AND MOVE THEM INTO REGISTERS TO AVOID POSSIBLE ; PAGE FAULT AT ELEVATED IPL. IF AN ARGUMENT IS NOT PROVIDED THEN SET ; THE REGISTER VALUE TO -1. CMPL (AP),#3 ; VFY ENUF ARGS BGEQ 10$ MOVL #SS$_INSFARG,R0 ; SOLLY CHOLLY BRW RET_SETCPULIM 10$: MOVL #SS$_NORMAL,R0 ; INIT SUCCESS RETURN CODE MOVL @4(AP),R6 ; R6= PID TSTL 8(AP) ; IF ARG_2 THEN R7= CPULIM BNEQ 20$ ; ELSE R7= -1 MOVL #-1,R7 BRB 30$ 20$: MOVL @8(AP),R7 30$: TSTL 12(AP) ; IF ARG_3 THEN R8= EXTRACPU BNEQ 40$ ; ELSE R8= -1 MOVL #-1,R8 BRB GET_PCB 40$: MOVL @12(AP),R8 ; GET THE ADR OF THE PCB. ; THE TSTB ON THE ROUTINE RETURN ADDRESS IS TO PROTECT AGAINST POSSIBLE ; PAGE FAULTS AT ELEVATED IPL. ; INTERRUPTS ARE DISABLED AND THE PID IS COMPARED TO THE PCB PID ; TO VERIFY THE PROCESS HAS NOT GONE BYE-BYE ON THE WAY HERE. ; IF THE PROCESS IS NOT RESIDENT THEN SET NOSWAP ON THE PROCESS, ENABLE ; INTERRUPTS, AND $GETJPI ON THE PROCESS TO FORCE IT INTO BALANCE SET. GET_PCB: MOVZWL R6,R11 ; R11= PROCESS SLOT NUMBER MOVL @SCH$GL_PCBVEC[R11],R10 ; R10= ADR PCB TSTB RET_SETCPULIM ; NO PFLTS PLEASE DSBINT #IPL$_SYNCH ; DISABLE INNTERRUPTS CMPL R7,PCB$L_PID(R10) ; IS DIS DE GUY? BEQL 10$ ; YEPPER CLRL R0 ; ERROR RETURN BRB LOWER_IPL 10$: MOVL PCB$L_STS,R5 ; SAVE CURRENT PCB$L_STS BISL #1@PCB$V_PSWAPM,PCB$L_STS ; SET NOSWAP BITL #1@PCB$V_RES,PCB$L_STS(R10) ; PRCS IN BALANCE SET? BNEQ GET_PHD ; YES ENBINT ; ENABLE INTERRUPTS SUBL #20,SP ; WORK AREA FOR JPI LST MOVL SP,R11 ; WORK AREA BASE ADR MOVW #4,(R11) ; BUFR LEN MOVW #JPI$_CPUTIM,2(R11) ; JPI CODE FOR CPU USED MOVAL 16(R11),4(R11) ; ADR BUFR CLRQ 8(R11) ; NO VALUE LENGTH. END LIST FLAG. $GETJPI_S PIDADR=@4(AP),- ; FORCE PRCS INTO BALSET ITMLST=(R11) MOVL R0,(R11) ; SAVE RETURN CODE DSBINT #IPL$_SYNCH ; DISABLE INTERRUPTS MOVL (R11),R0 ; RESTORE GETJPI RETURN CODE ADDL #20,SP ; RLSE WORK AREA BITL #1@PCB$V_RES,PCB$L_STS(R10) ; IS HE IN BAL SET NOW? BEQL LOWER_IPL ; NO, GETJPI MUST HAVE FAILED. BITL #1@PCB$V_PSWAPM,R5 ; RESTORE PREVIOUS SWAP STATUS BNEQ GET_PHD ; PREVIOUS STS WAS NOSWAP BICL #1@PCB$V_PSWAPM,PCB$L_STS(R10) ; PREVIOUS STS WAS SWAP ; GET PHD ADDRESS AND REPLACE THE ENTRIES PROVIDED IN ARG_LIST. GET_PHD: MOVL PCB$L_PHD(R10),R9 ; R9= ADR PHD TSTL R7 ; IF R7<0 THEN NO CHANGE BLSS 10$ MOVL R7,PHD$L_CPULIM(R9) ; SET NEW CPULIM 10$: TSTL R8 ; IF R8<0 THEN NO CHANGE BLSS LOWER_IPL MOVL R8,PHD$L_EXTRACPU(R9) LOWER_IPL: ENBINT ; ENABLE INTERRUPTS RET_SETCPULIM: RET .PAGE .END