Trailing-Edge
-
PDP-10 Archives
-
BB-X116C-SB
-
10,7/mcb/mcblib.m11
There are 15 other files named mcblib.m11 in the archive. Click here to see a list.
; [Beginning of MCBLIB]
;
;
; COPYRIGHT (c) 1980, 1981, 1982
; DIGITAL EQUIPMENT CORPORATION
; Maynard, Massachusetts
;
; This software is furnished under a license and may be used
; and copied only in accordance with the terms of such license
; and with the inclusion of the above copyright notice. This
; software or any other copies thereof may not be provided or
; otherwise made available to any other person. No title to
; and ownership of the software is hereby transferred.
;
; The information in this software is subject to change
; without notice and should not be construed as a commitment
; by DIGITAL EQUIPMENT CORPORATION.
;
; DIGITAL assumes no responsibility for the use or reliability
; of its software on equipment which is not supplied by
; DIGITAL.
;
;++
; FACILITY: MCB User's Library
;
; ABSTRACT:
;
; This library contains the macros and symbol
; definitions necessary to a process for operation
; within MCB.
;
; ENVIRONMENT: RSX kernel mode with EIS
;
; AUTHOR: Alan D. Peckham, CREATION DATE: 20-MAR-80
;
; MODIFIED BY:
;--
;
; Synchronous calls
;
.MACRO CALL$A a0,a1,a2,a3,a4,a5,a6,a7,a8,a9
.NARG C..ARG
...C = 10.
.IRP a,<a9,a8,a7,a6,a5,a4,a3,a2,a1,a0>
.IF GE,<C..ARG-...C>
.IF NB,<a>
PUSH$S a
.IFF
.PRINT ; Argument missing, substituting zero.
PUSH$S #0
.ENDC
.ENDC
...C = ...C-1
.ENDM
.IRP num,<\C..ARG>
PUSH$S #num
.ENDM
.ENDM CALL$A
.MACRO CALL$C rtn, args
C..IDX = 0
.IRP nam,<EXVEN>
.IF IDN,<rtn>,<#$'nam>
C..IDX = -C..IDX
.MEXIT
.ENDC
C..IDX = C..IDX-2
.ENDM
.IF LT,C..IDX
.ERROR ; Invalid routine name 'rtn'
.MEXIT
.ENDC
.MCALL CALL$A,PUSH$S,POP$S
.GLOBL $CALLI
CALL$A args
.IRP num,<\C..IDX>
PUSH$S #num
.ENDM
CALL $CALLI
POP$S ,\C..ARG+2
.ENDM CALL$C
.MACRO CALL$E adr, pix, args
.MCALL CALL$A,PUSH$S,POP$S
.GLOBL $CALLE
CALL$A args
PUSH$S <adr,pix>
CALL $CALLE
POP$S ,\C..ARG+3
.ENDM CALL$E
.MACRO CALL$I nam, args
.MCALL CALL$A,PUSH$S,POP$S
.GLOBL $CALLI
CALL$A args
PUSH$S nam
CALL $CALLI
POP$S ,\C..ARG+2
.ENDM CALL$I
.MACRO CALL$L adr, args
.MCALL CALL$A,PUSH$S,POP$S
.GLOBL $CALL
CALL$A args
PUSH$S <adr>
CALL $CALL
POP$S ,\C..ARG+2
.ENDM CALL$L
.MACRO CALL$P adr, pix, args
.MCALL CALL$A,PUSH$S,POP$S
.GLOBL $CALLP
CALL$A args
PUSH$S <adr,pix>
CALL $CALLP
POP$S ,\C..ARG+3
.ENDM CALL$P
;
; CCB definitions
;
.MACRO CCBDF$
.ASECT
. = 0
C.LNK: .BLKW 1 ; Forward link
C.CHN: .BLKW 1 ; Addr of next CCB in buffer chain
C.STK: .BLKW 1 ; CCB stack pointer
C.OWN: .BLKB 0 ; Process index of owner
.BLKW 1
C.LIN: ; Line number (outdated)
C.LIX: .BLKB 1 ; Line index
C.PIX: .BLKB 1 ; Data base index
C.FNC: .BLKB 1 ; Function code
C.MOD: .BLKB 1 ; Function code modifier
C.STS: .BLKW 1 ; Status word
C.BUF: .BLKW 2 ; Buffer address doubleword
C.CNT: .BLKW 1 ; Buffer byte count
C.PRM: .BLKW 0 ; Parameter area:
C.PRM1: .BLKW 1 ; ...
C.PRM2: .BLKW 1 ; ...
C.PRM3: .BLKW 1 ; ...
C.PRM4: .BLKW 1 ; ...
C.PRM5: .BLKW 1 ; ...
. = 0
.PSECT
FC.AST = 0*2 ; Asynchronous notification
FD.AST = 0*2 ; maximum defined AST modifier
FC.XME = 1*2 ; Transmit enable
FD.XME = 0*2 ; maximum defined XME modifier
FC.RCE = 2*2 ; Receive enable:
FM.DAT = 0*2 ; Data buffer being returned
FM.RTN = 1*2 ; Buffer from recovery request
FD.RCE = 2*2 ; maximum defined RCE modifier
FC.KIL = 3*2 ; Kill I/O
FM.KIL = 0*2 ; Receive and transmit kill
FM.CRA = 1*2 ; Receive kill
FM.XKL = 2*2 ; Transmit kill
FD.KIL = 2*2 ; maximum defined KIL modifier
FC.CTL = 4*2 ; Control
FM.STR = 1*2 ; Start
FM.STP = 2*2 ; Stop
FM.NM = 3*2 ; Network Management request
FM.SET = 5*2 ; Set characteristics
FM.GET = 6*2 ; Get characteristics
FD.CTL = 6*2 ; maximum defined CTL modifier
FC.TIM = 5*2 ; Timeout
FM.STM = 0*2 ; Short timeout
FM.LTM = 1*2 ; Long timeout
FD.TIM = 5*2 ; maximum defined TIM modifier
FC.XCP = 6*2 ; Transmit complete
FD.XCP = FD.XME ; maximum defined XCP modifier
FC.RCP = 7*2 ; Receive complete
FM.SYN = 2*2 ; Preceede with SYNchs
FD.RCP = FD.RCE ; maximum defined RCP modifier
FC.KCP = 10*2 ; Kill complete
FD.KCP = FD.KIL ; maximum defined KCP modifier
FC.CCP = 11*2 ; Control complete
FD.CCP = FD.CTL ; maximum defined CCP modifier
FC.SYS = FC.TIM ; MCB system services
FM.PWF = 2*2 ; Power recovery
FM.PIN = 3*2 ; Process initialization
FM.CCB = 4*2 ; CCB available
FM.RDB = 5*2 ; RDB available
FD.SYS = FD.TIM ; maximum defined SYS modifier
CS.SUC = 0.*10+1 ; Success
CE.ABO = -1.*10+0 ; Operation aborted
CE.ERR = -2.*10+0 ; General error
CE.MOP = -3.*10+0 ; MOP message received
CE.SRC = -4.*10+0 ; Start received
CE.RTE = -5.*10+0 ; Receive error threshold
CE.NTE = -6.*10+0 ; NAK error threshold
CE.TMO = -7.*10+0 ; REP threshold error
CE.BUF = -16.*10+0 ; Buffer allocation failure
CE.DCR = -17.*10+0 ; Data CRC error
CE.HFE = -18.*10+0 ; Header format error
CE.MTL = -19.*10+0 ; Message too long
CE.ROV = -20.*10+0 ; Receiver overrun
CE.DEV = -21.*10+2 ; Hard device error
CE.DIS = -22.*10+0 ; Disconnect detected
CE.UDR = -23.*10+0 ; Transmitter underrun
.ENDM CCBDF$
;
; Dispatch table building macros
;
.MACRO DSP$B beg,dflt,mod
.IIF NB,<beg>,beg:
$$TABG =.
.MACRO DSP$ off,adr
.IF NB,<off>
.IF NE,<.-$$TABG-<off'mod'>>
.ERROR off ;Dispatch offset out of sequence
.MEXIT
.ENDC
.ENDC
.IF NB,<adr>
.WORD adr
.IFF
.IF NB,<dflt>
.WORD dflt
.IFF
.GLOBL $DSPCR
.WORD $DSPCR
.ENDC
.ENDC
.ENDM DSP$
.MACRO DSP$E off
.IF NB,<off>
.IF GT,<.-$$TABG-2-<off'mod'>>
.ERROR off ; Already beyond end of table !
.MEXIT
.ENDC
.REPT <.-$$TABG-<off'mod'>>/2
.IF NB,<dflt>
.WORD dflt
.IFF
.GLOBL $DSPCR
.WORD $DSPCR
.ENDC
.ENDR
.ENDC
.ENDM DSP$E
.ENDM DSP$B
;
; MCB crash code definitions
;
.MACRO MCBDF$ dfn
.MACRO MCBD$F nam,lvl,txt
.IF NB,<dfn>
.IF NB,<nam>
dfn nam,lvl,\.....L,<txt>
.ENDC
.....L = .....L+1
.IFF
.GLOBL nam
.ENDC
.ENDM MCBD$F
.IF NB,<dfn>
.....L = 0
.ENDC
MCBD$F CS$SUC,1,<normal completion>
MCBD$F SS$BPT,4,<BPT instruction>
MCBD$F SS$DTE,4,<Master DTE "magic finger">
MCBD$F SS$EMT,4,<EMT instruction>
MCBD$F SS$FPU,4,<Floating point error>
MCBD$F SS$INS,4,<Illegal instruction>
MCBD$F SS$IOT,4,<IOT instruction>
MCBD$F SS$MMU,4,<Segment fault>
MCBD$F SS$MPE,4,<Memory parity error>
MCBD$F SS$NXM,4,<Odd or non-existant address>
MCBD$F SS$PRQ,4,<Program interrupt request>
MCBD$F SS$PWF,4,<Power failure>
MCBD$F SS$STK,4,<Stack overflow>
MCBD$F SS$STP,4,<Continue from SIGNAL_STOP>
MCBD$F SS$TRP,4,<TRAP instruction>
MCBD$F CE$EVT,3,<Network Management Event>
MCBD$F CE$RCL,3,<Routine being entered>
MCBD$F CE$RRT,3,<Routine exiting>
MCBD$F CE$CCF,0,<CCB allocation failure>
MCBD$F CE$CBF,0,<CCB/buffer allocation failure>
MCBD$F CE$RBF,0,<RDB allocation failure>
MCBD$F CE$BFF,0,<buffer allocation failure>
MCBD$F CE$CQE,0,<CCB queue is empty>
MCBD$F CE$PRF,0,<process name is not in system>
MCBD$F CE$PRU,0,<process name is in use>
MCBD$F CE$ACV,2,<resource access violation>
MCBD$F CE$BFI,4,<the CEXBUF partition is invalidly defined>
MCBD$F CE$BFP,4,<the CEXBUF partition does not exist>
MCBD$F CE$BFR,2,<buffer address invalid>
MCBD$F CE$BFS,4,<the CEXBUF partition is mapped on nonexistant core>
MCBD$F CE$CBA,4,<insufficient DSR to allocate CCBs>
MCBD$F CE$CBB,2,<RDB being returned as CCB>
MCBD$F CE$CBR,2,<CCB address invalid>
MCBD$F CE$CPY,4,<the length of a buffer copy is too long>
MCBD$F CE$DDO,4,<a DDM database is being accessed by a foreigner>
MCBD$F CE$DLO,4,<a DLC database is being accessed by a foreigner>
MCBD$F CE$DSP,4,<no dispatch address for CCB dispatch>
MCBD$F CE$DSR,2,<a DSR address is invalid>
MCBD$F CE$EXV,0,<Invalid exception vector>
MCBD$F CE$FRE,2,<Free resource being returned>
MCBD$F CE$IBR,0,<RDB recovery request made when RDB is available>
MCBD$F CE$ILV,4,<call must be made from device interrupt>
MCBD$F CE$IPR,2,<a device has interrupted at a priority higher than provided>
MCBD$F CE$LEN,2,<resource length invalid>
MCBD$F CE$LIX,4,<invalid line index>
MCBD$F CE$OWN,2,<resource being returned by a foreign process>
MCBD$F CE$PIX,4,<invalid proces index>
MCBD$F CE$PLV,4,<call must be made from process>
MCBD$F CE$PRI,2,<Invalid interrupt priority>
MCBD$F CE$RBA,4,<insufficient DSR to allocate RDBs>
MCBD$F CE$RBB,2,<CCB being returned as RDB>
MCBD$F CE$RBC,4,<insufficient CEXBUF to allocate RDBs>
MCBD$F CE$RBR,2,<RDB bias/address invalid>
MCBD$F CE$RES,2,<insufficient resources>
MCBD$F CE$RLV,4,<call must be made from RSX driver>
MCBD$F CE$RND,2,<invalid random number interval>
MCBD$F CE$RPX,4,<UCB contains invalid process index>
MCBD$F CE$SYN,2,<SYNCH block already active>
MCBD$F CE$TMB,4,<invalid timer block specified>
MCBD$F CE$UCB,4,<process does not have UCB>
MCBD$F CE$VEC,2,<Invalid interrupt vector>
MCBD$F CE$VCF,2,<Interrupt vector already free>
MCBD$F CE$VCU,2,<Interrupt vector already in use>
MCBD$F CE$TMU,2,<Invalid short timer time unit>
MCBD$F CE$PRM,2,<Invalid parameter in CEX request>
MCBD$F CE$PRA,2,<Process to kill still active>
MCBD$F CE$SLF,2,<System line has no processes>
.ENDM MCBDF$
;
; Buffer move calls
;
.MACRO MFBF$S lng,frmb,frma,toa
.IIF NB,<toa>, MOV toa,R2
.IIF NB,<lng>, MOV lng,R3
MOV frmb,-(SP)
MOV frma,-(SP)
.GLOBL $MVFBF
CALL $MVFBF
BIT (SP)+,(SP)+
.ENDM MFBF$S
.MACRO MTBF$S lng,frma,tob,toa
.IIF NB,<frma>, MOV frma,R2
.IIF NB,<lng>, MOV lng,R3
MOV tob,-(SP)
MOV toa,-(SP)
.GLOBL $MVTBF
CALL $MVTBF
BIT (SP)+,(SP)+
.ENDM MTBF$S
;
; Create a process header
;
.MACRO PHD$B nam,idn
.PSECT
PHD$A: .RAD50 /nam/
.BYTE 3,1
.IF NB,<idn>
.RAD50 /idn/
.NCHR PHD$L,<idn>
.REPT 6-PHD$L/3
.WORD 0
.ENDR
.IFF
.WORD 0,0
.ENDC
.WORD 0,0,0,0
.GLOBL MCB$V0,MCB$V1
.WORD MCB$V0,MCB$V1,0,0
.WORD 0,0,0,0
.MACRO PHD$D llc,dlc,ddm
. = PHD$A+12
.IRP a,<llc,dlc,ddm>
.IF NB,<a>
.WORD a
.IFF
.GLOBL .DSPCR
.WORD .DSPCR
.ENDC
.ENDM
.ENDM PHD$D
.MACRO PHD$E
. = PHD$A+40
.ENDM PHD$E
.MACRO PHD$I int1,int2,int3
. = PHD$A+30
.NARG PHD$L
.IRP n,<\PHD$L>
.BYTE n
.ENDM
. = PHD$A+32
.WORD int1,int2,int3
.ENDM PHD$I
.MACRO PHD$S sig
. = PHD$A+10
.WORD sig
.ENDM PHD$S
.ENDM PHD$B
;
; Bliss: SIGNAL (status)
;
.MACRO SGNL$S a0,a1,a2,a3,a4,a5,a6,a7,a8,a9
.MCALL POP$S,PUSH$S
.NARG .....L
.IRP arg,<a9,a8,a7,a6,a5,a4,a3,a2,a1,a0>
.....L = .....L+1.
.IF GT,<.....L-10.>
PUSH$S arg
.ENDC
.ENDM
.....L = .....L-10.
.IRP num,<\.....L>
PUSH$S #num
.ENDM
.GLOBL $IGNAL
CALL $IGNAL
.IRP num,<\.....L+1>
POP$S ,num
.ENDM
.ENDM SGNL$S
;
; Bliss: SIGNAL_STOP (status)
;
.MACRO STOP$S a0,a1,a2,a3,a4,a5,a6,a7,a8,a9
.MCALL POP$S,PUSH$S
.NARG .....L
.IRP arg,<a9,a8,a7,a6,a5,a4,a3,a2,a1,a0>
.....L = .....L+1.
.IF GT,<.....L-10.>
PUSH$S arg
.ENDC
.ENDM
.....L = .....L-10.
.IRP num,<\.....L>
PUSH$S #num
.ENDM
.GLOBL $STOP
CALL $STOP ; MCB will NOT return !
.ENDM STOP$S
;
; SYNCH block
;
.MACRO SYNDF$
.ASECT
. = 0
S.LNK: .BLKW 1 ; Scheduler link word.
S.PDB: .BLKW 1 ; Process descriptor block address.
S.DSP: .BLKW 1 ; Resume address.
. = 0
.PSECT
.ENDM SYNDF$
;
; Timer block definitions
;
.MACRO TMBDF$
.ASECT
. = 0
.BLKW 1 ; (reserved for RSX)
.BLKB 1 ; ...
T.UNT: .BLKB 1 ; Time interval unit:
TU.MS = 0. ; Milliseconds
TU.SEC = 2. ; Seconds
T.IDN: .BLKW 1 ; Timer identifier
.BLKW 4 ; (reserved for RSX)
T.TIM: .BLKW 1 ; Time interval
; (in milliseconds)
T.PDB: .BLKW 1 ; Process descriptor block address
T.LEN: .BLKW 0
.PSECT
.ENDM TMBDF$
;
; Data base description macros
;
.MACRO DAT$ m,t
.MCALL DAT$DF
DAT$DF
$$DAT = 0
.ENDM DAT$
.MACRO MPX$ m,t
.MCALL DAT$DF
DAT$DF
$$DAT = 1
.ENDM MPX$
.MACRO DAT$DF
.MACRO COR$D l
.BLKW 2
.IF B,<l>
.IRP n,<\$$LVL>
$$L'n = .
.ENDM
$$LVL = $$LVL+1
. = 0
.ENDC
.ENDM COR$D
.MACRO DSR$W l
.BLKW 1
.IF B,<l>
.IRP n,<\$$LVL>
$$L'n = .
.ENDM
$$LVL = $$LVL+1
. = 0
.ENDC
.ENDM DSR$W
.MACRO END$ lng
.IF NB,<lng>
.IF GT,<.-120000>
lng = .-120000
.IFF
lng = .
.ENDC
.ENDC
.IF NE,<$$LVL>
$$LVL = $$LVL-1
.IRP n,<\$$LVL>
. = $$L'n
.ENDM
.IFF
.IF NE,<$$DAT>
$$DAT = 0
. = 0
.IFF
. = 0
.PSECT
.ENDC
.ENDC
.ENDM END$
.IRP u,<B,W>
.MACRO CHR$'u t,list
$$CNT = 0
.IF B,<list>
.PRINT ; The CHR$'u macro has changed; consult documentation.
.IRP n,<t>
$$CNT = $$CNT+1
.ENDM
.IFF
.IRP n,<list>
$$CNT = $$CNT+1
.ENDM
.ENDC
.BLK'u $$CNT
.ENDM CHR$'u
.IRP m,<CTL,LIX,STA,TRB,UNT>
.MACRO m'$'u
.BLK'u 1
.ENDM m'$'u
.ENDM
.ENDM
.MACRO CSR$W
.BLKW 1
.ENDM CSR$W
.MACRO LST$D
.BLKW 2
.ENDM LST$D
.MACRO SYN$X
.BLKW 3
.ENDM SYN$X
.MACRO TMB$X
.BLKW 11
.ENDM TMB$X
.MACRO VFY$ val
.ENDM VFY$
$$LVL = 0
.ASECT
. = 0
.ENDM DAT$DF
;
; Useful miscellaneous macros
;
.MACRO GET$A dsp,bas,reg
MOV bas,reg
ADD #'dsp,reg
.ENDM GET$A
.MACRO MAP$ bias
.GLOBL KISAR6
.IF IDN,<bias>,<#0>
CLR @#KISAR6
.IFF
MOV bias,@#KISAR6
.ENDC
.ENDM MAP$
.MACRO MAP$S
.GLOBL KISAR6
MOV (SP)+,@#KISAR6
.ENDM MAP$S
.MACRO POP$S list,num
.IF NB,<list>
.IRP v,<list>
.IF NB,<v>
MOV (SP)+,v
.IFF
INC (SP)+
.ENDC
.ENDM
.IFF
.IF LE,<num-4>
.REPT num/2
CMP (SP)+,(SP)+
.ENDR
.REPT num&1
TST (SP)+
.ENDR
.IFF
ADD #<num*2>,SP
.ENDC
.ENDC
.ENDM POP$S
.MACRO PUSH$S list
.IRP v,<list>
.IF IDN,<v>,<#0>
CLR -(SP)
.IFF
.IF B,<v>
CLR -(SP)
.IFF
MOV v,-(SP)
.ENDC
.ENDC
.ENDM
.ENDM PUSH$S
.MACRO SAV2$S
.GLOBL $SAVE2
JSR R1,$SAVE2
S.PARM = 4.*2
.ENDM SAV2$S
.MACRO SAV3$S
.GLOBL $SAVE3
JSR R1,$SAVE3
S.PARM = 5.*2
.ENDM SAV3$S
.MACRO SAV4$S
.GLOBL $SAVE4
JSR R1,$SAVE4
S.PARM = 6.*2
.ENDM SAV4$S
.MACRO SAV5$S
.GLOBL $SAVE5
JSR R1,$SAVE5
S.PARM = 7.*2
.ENDM SAV5$S
.MACRO SMAP$ bias
.GLOBL KISAR6
MOV @#KISAR6,bias
.ENDM SMAP$
.MACRO SMAP$S
.GLOBL KISAR6
MOV @#KISAR6,-(SP)
.ENDM SMAP$S
;
; NRM supplement
;
.MACRO NRM$P adr
.MCALL CALL$P,POP$S,PUSH$S
.GLOBL $PDVID,adr
PUSH$S R2
MOV #^RNRM,R2
CALL $PDVID
CALL$P #adr,R2
POP$S R2
.ENDM NRM$P
.MACRO PCB$C num
.IIF NB,<num>, MOV num,R0
.MCALL NRM$P
NRM$P $PCBCL
.ENDM PCB$C
.MACRO PCB$D num
.IIF NB,<num>, MOV num,R0
.MCALL NRM$P
NRM$P $PCBDB
.ENDM PCB$D
.MACRO PCB$F num
.IIF NB,<num>, MOV num,R0
.MCALL NRM$P
NRM$P $PCBFL
.ENDM PCB$F
.MACRO PCB$O ccb
.IIF NB,<ccb>, MOV ccb,R4
.MCALL NRM$P
NRM$P $PCBOP
.ENDM PCB$O
.MACRO TCB$D num
.IIF NB,<num>, MOV num,R0
.MCALL NRM$P
NRM$P $TCBDB
.ENDM TCB$D
;
; [End of MCBLIB]