Google
 

Trailing-Edge - PDP-10 Archives - SRI_NIC_PERM_SRC_3_19910112 - stanford/5-swskit/environment.bli
There are 3 other files named environment.bli in the archive. Click here to see a list.
MODULE ENVIRO (MAIN  =  MAINLOOP)  = 
BEGIN
LIBRARY 'BLI:MONSYM';
MACRO
    SET_PRIVS =
	BEGIN
	BUILTIN JSYS;
	REGISTER T1=1, T2=2, T3=3;
	T1 = $FHSLF;
	JSYS (0, RPCAP, T1, T2, T3);
	T3 = .T3 OR SC_WHL OR SC_OPR;
	JSYS (0, EPCAP, T1, T2, T3);
	END
    %,

    SET_USER_IO =
	BEGIN
	BUILTIN JSYS;
	JSYS (1, USRIO);
	END
    %,

    GET_APR_ID =
	BEGIN
	BUILTIN MACHOP;
	MACHOP (%O'700', 0, APR_ID);
	END
    %,

    GET_PAG_STAT =
	BEGIN
	BUILTIN MACHOP;
	MACHOP (%O'701', 5, PAG_STAT);
	END
    %,

    FUNCT0 (CONT) =
	BEGIN
	BUILTIN MACHOP;
	OWN T1: BLOCK[2];
	T1[0, 31, 5, 0] = (CONT);
	T1[0, 0, 31, 0] = 0;
	MACHOP (%O'700', %O'12', T1);
	.T1[1, 0, 36, 0]
	END
    %,

    FUNCT1 (CONT) =
	BEGIN
	BUILTIN MACHOP;
	OWN T1: BLOCK[2];
	T1[0, 31, 5, 0] = (CONT);
	T1[0, 0, 31, 0] = 1;
	MACHOP (%O'700', %O'12', T1);
	.T1[1, 0, 36, 0]
	END
    %,

    FUNC12 (CONT,ADDR) =
	BEGIN
	BUILTIN MACHOP;
	OWN T1: BLOCK[2];
	T1[0, 31, 5, 0] = (CONT);
	T1[0, 8, 23, 0] = (ADDR) / %O'40000';
	T1[0, 0, 8, 0] = %O'12';
	MACHOP (%O'700', %O'12', T1);
	.T1[1, 0, 36, 0]
	END
    %,

    TMSG (TEXT) =
	BEGIN
	BUILTIN JSYS;
	REGISTER T1=1;
	T1= CH$PTR(UPLIT(%ASCIZ %STRING(%REMOVE(TEXT))));
	JSYS(0,PSOUT,T1);
	END
    %,

    NUMBER_OUTPUT (VALUE, RADIX, COLUMNS, FLAGS) =
	BEGIN
	BUILTIN JSYS;
	REGISTER T1=1, T2=2, T3=3;
	T1 = $PRIOU;
	T2 = (VALUE);
	T3 = ((RADIX)
	    %IF NOT %NULL(COLUMNS) %THEN
		OR ((COLUMNS) * %O'1000000') %FI
	    %IF NOT %NULL(FLAGS) %THEN
		OR (FLAGS) %FI);
	JSYS (1, NOUT, T1, T2, T3);
	END
    %,

    CRLF = %CHAR (%O'15', %O'12') %,

    INTERLEAVE = STATUS0<28, 2, 0> %,

	OFF_LINE = 0 %,

	ONE_WAY = 1 %,

	TWO_WAY = 2 %,

	FOUR_WAY = 3 %,

    CONTROLLER = STATUS1<24, 4, 0> %,

	CUSTOMER = 0 %,

	MA20 = 1 %,

	DMA20 = 2 %,

	MB20 = 3 %,

	MF20 = 5 %,

    LOWER_BOUND = STATUS1<14, 4, 0> %,

    UPPER_BOUND = STATUS1<10, 4, 0> %,

    REQUESTS = STATUS1<0, 4, 0> %,

	RQ0 = %O'10' %,

	RQ1 = 4 %,

	RQ2 = 2 %,

	RQ3 = 1 %,

    DESELECT = %O'10000000' %,

    UCODE_VER = APR_ID<18, 9, 0> %,

    FIFTY_HZ = APR_ID<17, 1, 0> %,

    CACHE = APR_ID<16, 1, 0> %,

    EXTENDED = APR_ID<15, 1, 0> %,

    APR_SERIAL_NO = APR_ID<0, 13, 0> %,

    CACHE_LOOK = PAG_STAT<17, 1, 0> %,

    CACHE_LOAD = PAG_STAT<16, 1, 0> %;

ROUTINE MAINLOOP: NOVALUE  = 
    BEGIN
    OWN
	APR_ID,
	PAG_STAT,
	PIECES,
	STATUS0,
	STATUS1,
	MF20_FLAG,
	APR_TYPE,
	CONTNO: VECTOR[256],
	ADDRESS: VECTOR[256],
	SIZE: VECTOR[256],
	RQS: VECTOR[256],
	CONTYPE: VECTOR[256],
	INT: VECTOR[256],
	NO_RQS: VECTOR[16] INITIAL(0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4);
    set_privs;
    SET_USER_IO;
    GET_APR_ID;
    GET_PAG_STAT;
    PIECES = 0;
    INCR C FROM 0 TO %O'37' DO
	BEGIN
	STATUS0 = FUNCT0(.C);
	STATUS1 = FUNCT1(.C);
	IF .STATUS1 NEQ 0 THEN
	    IF .INTERLEAVE EQL OFF_LINE THEN
		BEGIN
		CONTNO[.PIECES] = .C;
		ADDRESS[.PIECES] = 0;
		SIZE[.PIECES] = 0;
		RQS[.PIECES] = RQ0 OR RQ1 OR RQ2 OR RQ3;
		CONTYPE[.PIECES] = .CONTROLLER;
		INT[.PIECES] = OFF_LINE;
		PIECES = .PIECES + 1;
		END
	    ELSE
		IF .CONTROLLER NEQ MF20 THEN
		    BEGIN
		    CONTNO[.PIECES] = .C;
		    ADDRESS[.PIECES] = .LOWER_BOUND * %O'40000';
		    SIZE[.PIECES] = (.UPPER_BOUND + 1 - .LOWER_BOUND) * %O'40000';
		    SIZE[.PIECES] = (.SIZE[.PIECES] * .NO_RQS[.REQUESTS])/4;
		    RQS[.PIECES] = .REQUESTS;
		    CONTYPE[.PIECES] = .CONTROLLER;
		    INT[.PIECES] = .INTERLEAVE;
		    PIECES = .PIECES + 1;
		    END
		ELSE
		    BEGIN
		    LOCAL
			HIGH,
			LOW;
		    HIGH = -%O'40000';
		    LOW = 0;
		    INCR ADDR FROM 0 TO %O'17740000' BY %O'40000' DO
			BEGIN
			IF (FUNC12(.C, .ADDR) AND DESELECT) EQL 0 THEN HIGH = .ADDR
			ELSE
			    BEGIN
			    IF .LOW LSS .HIGH THEN
				BEGIN
				CONTNO[.PIECES] = .C;
				ADDRESS[.PIECES] = .LOW;
				SIZE[.PIECES] = .HIGH + %O'40000' - .LOW;
				RQS[.PIECES] = RQ0 OR RQ1 OR RQ2 OR RQ3;
				CONTYPE[.PIECES] = MF20;
				INT[.PIECES] = FOUR_WAY;
				PIECES = .PIECES + 1;
				END;
			    LOW = .ADDR + %O'40000';
			    END;
			END;
		    IF .LOW LSS .HIGH THEN
			BEGIN
			CONTNO[.PIECES] = .C;
			ADDRESS[.PIECES] = .LOW;
			SIZE[.PIECES] = .HIGH + %O'40000' - .LOW;
			RQS[.PIECES] = RQ0 OR RQ1 OR RQ2 OR RQ3;
			CONTYPE[.PIECES] = MF20;
			INT[.PIECES] = FOUR_WAY;
			PIECES = .PIECES +1;
			END;
		   MF20_FLAG = 1;
		   END;
	end;
    tmsg ((crlf, 'TOPS-20 Environment:', crlf, crlf));
    tmsg (('Processor serial number '));
    number_output(.apr_serial_no, 10);
    tmsg (crlf);
    apr_type = 2050;
    if .mf20_flag then apr_type = 2060;
    if not .cache then apr_type = 2040;
    if .apr_serial_no geq 4096 then apr_type = 2020;
    number_output(.apr_type, 10);
    TMSG ('  Model ');
    if .extended then tmsg ('B  ') else tmsg ('A  ');
    if .fifty_hz then tmsg (('50 Hz', crlf)) else tmsg (('60 Hz', crlf));
    tmsg ('Microcode version ');
    number_output(.ucode_ver, 8);
    tmsg ((' running',crlf));
    if .cache then
	begin
	if .cache_look then
	    if .cache_load then tmsg ('All caches are')
	    else tmsg ('Cache look is')
	else tmsg ('No caches are');
	tmsg ((' enabled', crlf));
	end;
    tmsg (('Logical memory configuration:', crlf));
    tmsg (('                  Controller', crlf));
    tmsg (('Address   Size  RQ0 RQ1 RQ2 RQ3  Contype Int', crlf));
    incr i from 0 to .pieces - 2 do
	begin
	LOCAL
	    BEST,
	    TEMP0,
	    TEMP1,
	    TEMP2,
	    TEMP3,
	    TEMP4,
	    TEMP5;
	best = .i;
	incr j from .i + 1 to .pieces - 1 do
	    if .address[.best] gtr .address[.j] then best = .j;
	if .i neq .best then
	    begin
	    TEMP0 = .CONTNO[.BEST];
	    temp1 = .address[.best];
	    temp2 = .size[.best];
	    temp3 = .rqs[.best];
	    temp4 = .contype[.best];
	    temp5 = .int[.best];
	    decr j from .best to .i + 1 do
		begin
		CONTNO[.J] = .CONTNO[.J - 1];
		address[.j] = .address[.j - 1];
		size[.j] = .size[.j - 1];
		rqs[.j] = .rqs[.j - 1];
		contype[.j] = .contype[.j - 1];
		int[.j] = .int[.j - 1];
		end;
	    CONTNO[.I] = .TEMP0;
	    address[.i] = .temp1;
	    size[.i] = .temp2;
	    rqs[.i] = .temp3;
	    contype[.i] = .temp4;
	    int[.i] = .temp5;
	    end;
	end;
    INCR I FROM 0 TO .PIECES - 2 DO
	BEGIN
	LOCAL
	    TEMP0,
	    TEMP1,
	    TEMP2,
	    TEMP3,
	    TEMP4,
	    TEMP5;
	IF .ADDRESS[.I] NEQ 0 THEN EXITLOOP;
	IF .INT[.I] NEQ OFF_LINE THEN
	    BEGIN
	    INCR J FROM .I+1 TO .PIECES - 1 DO
		BEGIN
		IF .ADDRESS[.J] NEQ 0 THEN EXITLOOP;
		IF .INT[.I] EQL OFF_LINE THEN
		    BEGIN
		    TEMP0 = .CONTNO[.J];
		    TEMP1 = .ADDRESS[.J];
		    TEMP2 = .SIZE[.J];
		    TEMP3 = .RQS[.J];
		    TEMP4 = .CONTYPE[.J];
		    TEMP5 = .INT[.J];
		    DECR K FROM .J TO .I + 1 DO
			BEGIN
			CONTNO[.K] = .CONTNO[.K - 1];
			ADDRESS[.K] = .ADDRESS[.K - 1];
			SIZE[.K] = .ADDRESS[.K - 1];
			RQS[.K] = .RQS[.K - 1];
			CONTYPE[.K] = .CONTYPE[.K - 1];
			INT[.K] = .INT[.K - 1];
			END;
		    CONTNO[.I] = .TEMP0;
		    ADDRESS[.I] = .TEMP1;
		    SIZE[.I] = .TEMP2;
		    RQS[.I] = .TEMP3;
		    CONTYPE[.I] = .TEMP4;
		    INT[.I] = .TEMP5;
		    END;
		END;
	    END;
	END;
    INCR I FROM 0 TO .PIECES - 1 DO
	BEGIN
	IF .INT[.I] EQL OFF_LINE THEN
	    TMSG ('Off-line        ')
	ELSE
	    BEGIN
	    NUMBER_OUTPUT (.ADDRESS[.I], 8, 8, (NO_LFL OR NO_ZRO));

!THIS IS A CROCK TO MAKE BLISS WORK
	    SIZE[.I] = .SIZE[.I] / 1024;
	    NUMBER_OUTPUT (.SIZE[.I], 10, 5, NO_LFL);

	    TMSG ('K  ');
	    END;
	IF (.RQS[.I] AND RQ0) EQL 0 THEN
	    TMSG ('--  ')
	ELSE
	    BEGIN
	    NUMBER_OUTPUT (.CONTNO[.I], 8, 2, (NO_LFL OR NO_ZRO));
	    TMSG ('  ');
	    END;
	IF (.RQS[.I] AND RQ1) EQL 0 THEN
	    TMSG ('--  ')
	ELSE
	    BEGIN
	    NUMBER_OUTPUT (.CONTNO[.I], 8, 2, (NO_LFL OR NO_ZRO));
	    TMSG ('  ');
	    END;
	IF (.RQS[.I] AND RQ2) EQL 0 THEN
	    TMSG ('--  ')
	ELSE
	    BEGIN
	    NUMBER_OUTPUT (.CONTNO[.I], 8, 2, (NO_LFL OR NO_ZRO));
	    TMSG ('  ');
	    END;
	IF (.RQS[.I] AND RQ3) EQL 0 THEN
	    TMSG ('--  ')
	ELSE
	    BEGIN
	    NUMBER_OUTPUT (.CONTNO[.I], 8, 2, (NO_LFL OR NO_ZRO));
	    TMSG ('  ');
	    END;
	SELECTONE .CONTYPE[.I] OF
	    SET
	    [CUSTOMER]: TMSG (' CUSTOMER ');
	    [MA20]: TMSG ('  MA20    ');
	    [DMA20]: TMSG ('  DMA20   ');
	    [MB20]: TMSG ('  MB20    ');
	    [MF20]: TMSG ('  MF20    ');
	    [OTHERWISE]: TMSG (' unknown  ');
	    TES;
	SELECTONE .INT[.I] OF
	    SET
	    [OFF_LINE]: TMSG (CRLF);
	    [ONE_WAY]: TMSG (('1', CRLF));
	    [TWO_WAY]: TMSG (('2', CRLF));
	    [FOUR_WAY]: TMSG (('4', CRLF));
	    TES;
	END;
    END;
END
ELUDOM