Trailing-Edge
-
PDP-10 Archives
-
decuslib10-04
-
43,50325/swap.bli
There are no other files named swap.bli in the archive.
! File: SWAP.BLI
!
! This work was supported by the Advanced Research
! Projects Agency of the Office of the Secretary of
! Defense (F44620-73-C-0074) and is monitored by the
! Air Force Office of Scientific Research.
MODULE SWAP(LOWSEG,TIMER=EXTERNAL(SIX12))=
BEGIN
!
! THIS MODULE HANDLES THE INTERSEGMENT CALLS FOR THE OVERLAY VERSION
!
EXTERNAL
SWAPDEV,
SWAPPPN,
NOWSEG, ! CURRENT SEGMENT NUMBER
SEGBLK; ! BLOCK USED IN GETSEG UUO
BIND ENTRY=#400010; ! ADDRESS OF SEGMENT ENTRY ROUTINE
BIND
NULLSEG = 0,
ONCEONLY = SIXBIT 'B11SG1',
INITIO = SIXBIT 'B11SG1',
DOMODULE = SIXBIT 'B11SG2',
DELAYDRIVER = SIXBIT 'B11SG3',
TNBIND = SIXBIT 'B11SG3',
CODEDRIVER = SIXBIT 'B11SG4',
FINALDRIVER = SIXBIT 'B11SG4',
SYNINIT = SIXBIT 'B11SG2',
SYMPURGE = SIXBIT 'B11SG2';
BIND SEGTABLE = PLIT (
NULLSEG,
ONCEONLY,
DOMODULE,
INITIO,
DELAYDRIVER,
TNBIND,
CODEDRIVER,
FINALDRIVER,
SYNINIT,
SYMPURGE
);
MACHOP CALLI = #47,
TTCALL = #51,
PUSH = #261,
POP = #262,
JFCL = #255;
MACRO SAVE(X)=PUSH(SREG,X)$, RESTORE(X)=POP(SREG,X)$;
MACRO SEGNAME = SEGBLK[1]$,
SETUPSEGBLK=
BEGIN
SEGBLK[0]_.SWAPDEV;
SEGBLK[2]_SEGBLK[3]_SEGBLK[5]_0;
SEGBLK[4]_.SWAPPPN;
END$;
FORWARD GETSEG;
ROUTINE SEGERR(SEGNUM)=
BEGIN
! REPORT FAILURE TO GET SEGMENT REQUESTED AND EXIT
EXTERNAL DEVICE;
! MUST NOT USE THE USUAL OUTPUT ROUTINES HERE
! BECAUSE TTY CHANNEL MAY NOT HAVE BEEN OPENED.
LOCAL TMPNUM;
TTCALL(3,PLIT (ASCIZ ';CANNOT GET SEGMENT '));
TMPNUM_.SEGNUM+"0";
TTCALL(1,TMPNUM);
TTCALL(3,PLIT (ASCIZ '?M?J'));
CALLI(0,#12)
END;
GLOBAL ROUTINE GETSEG(N)=
BEGIN
OWN T,SAVSREG;
REGISTER R[5]; ! MUST SAVE ALL REGISTERS
IF (SEGNAME_.SEGTABLE[.N]) EQL .SEGTABLE[.NOWSEG] THEN (NOWSEG_.N; RETURN .VREG);
! SETUPSEGBLK;
R_1^18;
CALLI(R,#11); JFCL(0,0);
IF .SEGNAME NEQ 0 THEN
BEGIN
R_SEGBLK<0,0>;
SAVE(FREG); SAVSREG_.SREG;
T_0;
CALLI(R,#40);
T_-1;
SREG_.SAVSREG; RESTORE(FREG);
IF .T NEQ 0 THEN SEGERR(.N);
END;
NOWSEG_.N;
.VREG
END;
GLOBAL ROUTINE SEGCALL(PARAM,NEWSEG)=
BEGIN
BIND RTN=NEWSEG[1];
LOCAL OLDSEG,VAL;
IF .SEGTABLE[.NEWSEG] EQL .SEGTABLE[.NOWSEG] THEN RETURN ENTRY(.PARAM,.NEWSEG);
OLDSEG_.NOWSEG;
GETSEG(.NEWSEG);
VAL_ENTRY(.PARAM,.NEWSEG);
IF .RTN<0,18> GTR ENTRY THEN GETSEG(.OLDSEG);
.VAL
END;
.VREG
END
ELUDOM