Trailing-Edge
-
PDP-10 Archives
-
BB-R595B-SM_11-9-85
-
mcb/xpt/xpt16.b16
There is 1 other file named xpt16.b16 in the archive. Click here to see a list.
module XPT16 (
IDENT = 'X01150'
) =
begin
!
! 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: Transport
!
! ABSTRACT:
!
! 16-bit or RSX-11M dependent routines for transport
!
! ENVIRONMENT: MCB
!
! AUTHOR: L. Webber , CREATION DATE: 20-Jul-79
!
! MODIFIED BY:
!
! 20-Jul-79 : VERSION 1.00
!
! 1.01 L. Webber, 21-Oct-80
! Change C_BUF and C_BUFA references to C_BIAS and C_ADDR
!
! 1.02 L. Webber, 11-Dec-80
! Modify to support MCB 3.1
!
! 1.03 L. Webber, 11-Feb-81
! Made XPT16 into three parallel modules: XPT16, TLI16 and XPE16.
! This mod. also comprises the addition of several new entry points
! over the last year. This is the last of the identically numbered
! mods. for the three -16 modules.
!
! 1.04 L. Webber, 17-Feb-81
! Made GETXDB CALL$ linkage.
!
! 1.05 L. Webber, 23-Feb-81
! Fix event logging class and Event Buffer specification.
!
! 1.06 L. Webber, 25-Feb-81
! Move $CDBV and $CBDMG to XPT16.
!
! 1.07 L. Webber, 10-Mar-81
! Take retry queue length out of CHKBUF accounting.
!
! 1.08 L. Webber, 13-Mar-81
! Add routine to untangle spawned CCBs.
!
! 1.09 L. Webber, 3-Apr-81
! Signal the ENTITY value in LOG_EVENT.
!
! 1.10 L. Webber, 28-Jul-81
! Fix UNSPAWN to specify the size of the buffer it is returning.
!
! 1.11 L. Webber, 18-Sep-81
! Take out routines GETSDB,RETSDB.
!
! 1.12 L. Webber, 24-Sep-81
! Take out routine MAPIN.
!
! 1.13 L. Webber, 24-Sep-81
! Take reference to Event_Buffer out of the signal in LOG_EVENT.
!
! 1.14 A. Peckham, 19-Apr-82
! Add XPT$GET_LINE_DB and XPT$GET_NODE_DB routines.
! Remove LOG_EVENT, GETLINE, GETNODE.
! Move $CBDMG and $CDBV back from XPE16
! and rename them to CBTD and CDTB respectively.
! Move GETXDB global to low psect.
!
! 1.15 A. Peckham, 6-May-82
! Eliminate RLS_BLK, GET_BLK, OC_ADD, GET_EX.
!
!--
!
! INCLUDE FILES:
!
require 'XPTMAC';
!
! TABLE OF CONTENTS
!
forward routine
XPT$GET_LINE_DB: XPT$LKG_NUM,
XPT$GET_NODE_DB: XPT$LKG_NUM,
GET_XPTDB: CALL$ novalue,
TOPOLOGY: CALL$,
CHKBUF: novalue;
!
! MACROS:
!
!
! EQUATED SYMBOLS:
!
!
! OWN STORAGE:
!
literal JUMP_TO = %o'137';
psect
global = XPTJMP (nowrite, execute);
global
GETXDB : vector [2] initial (JUMP_TO, GET_XPTDB),
GETTOP : vector [2] initial (JUMP_TO, TOPOLOGY);
undeclare JUMP_TO;
!
! EXTERNAL REFERENCES:
!
global
routine XPT$GET_LINE_DB (LINE) : XPT$LKG_NUM =
!++
! FUNCTIONAL DESCRIPTION:
!
! Returns the base address of the line data base entry for
! the specified line
!
! FORMAL PARAMETERS
!
! LINE Line number whose data base entry is to be
! located
!
! IMPLICIT INPUTS
!
! XPTDB
!
! ROUTINE VALUE:
!
! The address of the line data base entry for .LINE
!
! SIDE EFFECTS:
!
! NONE.
!
!--
begin
require 'XPTSYM';
LINE = .LINE - 1;
if .LINE lssu NLN
then
begin
LINE = .LINE*LINElength;
.XPTDB[XPTlindb] + .LINE
end
else
0
end; !End of XPT$GET_LINE_DB
global
routine XPT$GET_NODE_DB (NODE) : XPT$LKG_NUM =
!++
! FUNCTIONAL DESCRIPTION:
!
! Returns the base address of the node data base entry for
! the specified node number
!
! FORMAL PARAMETERS
!
! NODE Node number of the node whose data base is to be
! located
!
! IMPLICIT INPUTS
!
! XPTDB
!
! ROUTINE VALUE:
!
! Address of the node data base entry for .NODE
!
! SIDE EFFECTS:
!
! NONE.
!
!--
begin
require 'XPTSYM';
NODE = .NODE - 1;
if .NODE lssu NN
then
begin
NODE = .NODE*NODElength;
.XPTDB[XPTnoddb] + .NODE
end
else
0
end; !End of XPT$GET_NODE_DB
global
routine GET_XPTDB (DBADDR): CALL$ novalue =
!++
! FUNCTIONAL DESCRIPTION:
!
! Returns the address of the Transport data base in the specified location.
!
! FORMAL PARAMETERS
!
! DBADDR The address of an area to contain the doubleword
! address of the data base.
!
! IMPLICIT INPUTS
!
! NONE.
!
! ROUTINE VALUE:
! COMPLETION CODES:
!
! NONE.
!
! SIDE EFFECTS:
!
! NONE.
!
!--
begin
map DBADDR: ref vector[2];
external MCB$GAW_PROCESS_DATA_BASE: vector[2];
DBADDR[0] = .MCB$GAW_PROCESS_DATA_BASE[0];
DBADDR[1] = .MCB$GAW_PROCESS_DATA_BASE[1];
end; !End of GET_XPTDB
routine TOPOLOGY (_CCB): CALL$ =
!++
! FUNCTIONAL DESCRIPTION:
!
!
! FORMAL PARAMETERS
!
! _CCB Function CCB to be passed to the routine.
!
! IMPLICIT INPUTS
!
! NONE.
!
! ROUTINE VALUE:
! COMPLETION CODES:
!
! NONE.
!
! SIDE EFFECTS:
!
! NONE.
!
!--
begin
require 'XPTSYM';
stacklocal NODEs;
local CCB: ref block field (C_fields),
NODEb: ref NODEblock,
NODEn,WORK;
pointer PTR;
CCB = ._CCB;
MAP$(.CCB[C_BIAS]);
PTR = .CCB[C_ADDR];
NODEb = .XPTDB[XPTnoddb];
NODEs = NN;
ch$wchar_a(.NODEs<0,8>,PTR); ! Move in NN
ch$wchar_a(.NODEs<8,8>,PTR);
NODEn = 0;
WORK = 0;
do
begin
local TYPE;
NODEn = .NODEn + 1;
TYPE = 0^8; ! Assume node unreachable
if .Reach ! Node reachable -
then begin
TYPE = 3^8; ! Assume Phase III
if .Phase2_node
then TYPE = 2^8; ! Phase II
end;
WORK = .WORK or .TYPE;
WORK = .WORK^-2;
if .NODEn<0,2> eql 0
then begin
ch$wchar_a(.WORK,PTR);
WORK = 0;
end;
NODEb = vector[.NODEb,NODEsize];
end
while .NODEn lss .NODEs;
if .NODEn<0,2> neq 0
then begin
do (NODEn = .NODEn + 1; WORK = .WORK^-2) while .NODEn<0,2> neq 0;
ch$wchar_a(.WORK,PTR);
end;
PTR = ch$diff(.PTR,.CCB[C_ADDR]);
CCB[C_CNT] = .PTR; ! Set up buffer count
true
end; !End of TOPOLOGY
global
routine CDTB (BUF_PTR,LEN) =
!++
! FUNCTIONAL DESCRIPTION:
!
! This routine takes two parameters which describe a potential
! image numeric ASCII field, and attempt to convert it to binary.
! The number is assumed to be expressed in decimal radix. If a
! non-numeric character is encountered before the field is exhausted,
! an error code of -1 is returned.
!
! FORMAL PARAMETERS
!
! BUF_PTR - A character pointer to the field to
! be examined.
! LEN - The length of the field.
!
! IMPLICIT INPUTS
!
! NONE.
!
! ROUTINE VALUE: "Failure" or the converted binary number.
! COMPLETION CODES:
!
! < 0 : Failure - the whole field is not numeric.
! >= 0 : The binary number converted from the field.
!
! SIDE EFFECTS:
!
! NONE.
!
!--
begin
local VALUE;
pointer P;
P = .BUF_PTR;
VALUE = 0;
!
! Scan through specified string
!
incr I from 1 to .LEN do
begin
local DIGIT;
DIGIT = getb(P)-%c'0';
if (.DIGIT lss 0) !If the next character
or (.DIGIT gtr 9) ! is out of decimal range,
then return -1; ! then quit, otherwise
VALUE = (.VALUE*10) + .DIGIT; ! add it into accumulated value
end;
.VALUE
end; !End of CDTB
global
routine CBTD (PTR_ADDR,NUM) =
!++
! FUNCTIONAL DESCRIPTION:
!
! This routine, which is a short replacement for the -11S one,
! converts a number to decimal ASCII characters. At least one
! character will always be written; the number 0 will come out
! as '0'.
!
! FORMAL PARAMETERS
!
! PTR_ADDR Address of a pointer to the area where the
! number is to be expanded. The pointer will
! be updated to point past the expanded number.
!
! NUM The number to be expanded. The number will be
! treated as unsigned.
!
! IMPLICIT INPUTS
!
! NONE.
!
! ROUTINE VALUE: The number of characters written (1-6).
! COMPLETION CODES:
!
! NONE.
!
! SIDE EFFECTS:
!
! NONE.
!
!--
begin
local CHR,CNT;
CHR=(.NUM mod 10)+%c'0';
if .NUM gtr 9
then CNT=CBTD(.PTR_ADDR,.NUM/10)
else CNT=0;
ch$wchar_a (.CHR,.PTR_ADDR);
.CNT+1
end; !End of CBTD
%IF %VARIANT NEQ 0 %THEN
global
routine CHKBUF: novalue =
!++
! FUNCTIONAL DESCRIPTION:
!
! Does a check for lost buffers, by:
! 1) calculating the number of buffers outstanding from all other
! processes to Transport; and
! 2) subtracting the number of buffers outstanding from Transport
! to all other processes.
! If this number is not 0, there is a buffer missing somewhere.
!
! FORMAL PARAMETERS
!
! NONE.
!
! IMPLICIT INPUTS
!
! The following quotas and counters:
!
! INPUTquota $INPQ
! ECLquota $ECLQ
! LINEquota $LINQ
! INPUTcount
! REqueue_count
!
! ROUTINE VALUE:
! COMPLETION CODES:
!
! NONE.
!
! SIDE EFFECTS:
!
! Blows up the system if the buffer check fails.
!
!--
begin
local LINEb;
require 'XPTSYM';
local LC,COUNT: signed;
bind Q = max(($LINQ/(if NLN lss 3 then 1 else if NLN lss 7 then 2 else 3)),1);
COUNT = ($INPQ - .INPUTquota) ! Buffers in from ECL
- (LC = 0;
decr I from NLN to 1 do begin
LINEb = $XPT_GET_LINE_DB(.I); ! For each line:
LC = .LC + (Q - .LINEquota); ! Buffers out to line
LC = .LC - .INPUTcount; ! Buffers in from line
end;
.LC)
- ($ECLQ - .ECLquota); ! Buffers out to ECL
if .COUNT neq 0 then ! Oops...
SIGNAL_STOP(XPT$_BUF,.COUNT);
end; !End of CHKBUF
%FI
global
routine UNSPAWN(CCB): novalue =
!++
! FUNCTIONAL DESCRIPTION:
!
! Untangles a CCB spawned by Transport:
!
! 1. If the CCB has a buffer of its own, release it.
! 2. If the pass-through CCB (the one the spawned CCB points to)
! has had its buffer pointer adjusted, un-adjust it.
! 3. Release the spawned CCB.
!
! FORMAL PARAMETERS
!
! CCB Address of the spawned CCB.
!
! IMPLICIT INPUTS
!
! NONE.
!
! ROUTINE VALUE:
! COMPLETION CODES:
!
! NONE.
!
! SIDE EFFECTS:
!
! NONE.
!
!--
begin
map CCB: ref block field(C_XPT_fields);
bind CCB_P = .CCB[C_STK]: block field(C_fields);
local ADJ;
if ((ADJ=.CCB[C_XPT_ADJUST]) neq 0) then begin ! Nonzero adjustment factor:
CCB_P[C_ADDR] = ch$plus(.CCB_P[C_ADDR],-.ADJ); ! readjust pass-through
CCB_P[C_CNT] = .CCB_P[C_CNT] + .ADJ; ! buffer descriptor
end;
if ((.CCB[C_CHN] neq 0) ! If the spawned CCB
and (.CCB[C_BIAS] neq 0)) then ! has an SDB of
$MCB_RETURN_CCB_AND_BUFFER ! its own, release
(.CCB[C_XPT_ALLOCATION],.CCB) ! them both
else $MCB_RETURN_CCB(.CCB); ! Otherwise, just release the CCB
end; !End of UNSPAWN
end !End of module XPT16
eludom