Trailing-Edge
-
PDP-10 Archives
-
bb-kl11l-bm_tops20_v7_0_tsu03_2_of_3
-
t20src/mxnpag.b36
There are 20 other files named mxnpag.b36 in the archive. Click here to see a list.
module NMUPAG ( ! TOPS (36 bit) page memory allocator
ident = 'X00.03',
language (bliss36)
) =
begin
! COPYRIGHT (c) DIGITAL EQUIPMENT CORPORATION 1985, 1989.
! ALL RIGHTS RESERVED.
!
! 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 THAT IS NOT SUPPLIED BY DIGITAL.
!++
! Facility: LSG DECnet Network Management
!
! Abstract: This module contains the routines needed to handle
! "page" (512 36 bit word) allocations.
!
! Environment: TOPS10/TOPS20 user mode, MCB RSX user task
!
! Author: Steven M. Jenness, Creation date: 16-Sep-80
!
!--
!
! Include files
!
library 'MXNLIB'; ! All required definitions
%if $TOPS20
%then
library 'MONSYM'; ! Monitor symbols
library 'MXJLNK'; ! JSYS linkage definitions
%fi
!
! Global routines
!
forward routine
NMU$PAGE_ALLOCATOR; ! Define global entry points
!
! Data base for page allocator
!
literal
LOW_PAGE = %O'610000', ! Lowest page number to allocate
HIGH_PAGE = %O'677000', ! Highest page number to allocate
PAGE_LENGTH = %O'1000'; ! Number of words in a page
own
NEXT_PAGE : INITIAL (LOW_PAGE), ! Next page to be allocated
PAGE_QUEUE : Q_HEADER; ! Queue of available pages
!
! Macros
!
%if $TOPS20 %then
macro
WRITE_ENABLE (ADDR) =
begin
DECLARE_JSYS (SPACS);
if not $$SPACS ((($FHSLF ^ 18) or (ADDR ^ -9)), (PA_WR or PA_RD))
then TASK_ERROR ('Failed to write enable a page');
end %,
WRITE_PROTECT (ADDR) =
begin
DECLARE_JSYS (SPACS);
if not $$SPACS ((($FHSLF ^ 18) or (ADDR ^ -9)), (PA_RD))
then TASK_ERROR ('Failed to write protect a page');
end %;
%fi
!
! External references
!
external routine
NMU$QUEUE_MANAGER; ! Queue management routines
external
%debug_data_base;
%global_routine ('NMU$PAGE_INITIALIZE') : novalue =
!++
! Functional description:
!
! This routine initializes the page allocation data
! base.
!
! Formal parameters: none
!
! Routine value: none
! Side effects:
!
! NEXT_PAGE is set to LOW_PAGE
! PAGE_QUEUE is cleared
!
!--
begin
NEXT_PAGE = LOW_PAGE;
NMU$QUEUE_RESET (PAGE_QUEUE);
%debug (PAGE_TRACE,
(TRACE_INFO ('Page allocator initialized')));
end; ! End of NMU$PAGE_INITIALIZE
%global_routine ('NMU$PAGE_GET') =
!++
! Functional description:
!
! This routine allocates a page (512 words) on TOPS10 and
! TOPS20 systems. This is useful for IPCF transactions.
!
! Formal parameters: none
!
! Routine value:
!
! Page number allocated.
!
! Side effects: none
!
!--
begin
local
PAGE_ADDRESS;
builtin
LSH;
%if $TOPS20 %then
%debug (always,
(begin
if (PAGE_ADDRESS = .PAGE_QUEUE <0,18,0>) neq PAGE_QUEUE
then WRITE_ENABLE (.PAGE_ADDRESS);
if (PAGE_ADDRESS = .(.PAGE_ADDRESS) <0,18,0>) neq PAGE_QUEUE
then WRITE_ENABLE (.PAGE_ADDRESS);
end));
PAGE_ADDRESS = NMU$QUEUE_REMOVE (PAGE_QUEUE);
if .PAGE_ADDRESS eql 0 then NEXT_PAGE = (PAGE_ADDRESS = .NEXT_PAGE) + PAGE_LENGTH;
if (.PAGE_ADDRESS lss LOW_PAGE) or (.PAGE_ADDRESS gtr HIGH_PAGE)
then TASK_ERROR ('No pages available to be allocated');
begin
register T1, T2;
builtin MACHOP;
MACHOP (HRLI, T1, .PAGE_ADDRESS);
MACHOP (HRRI, T1, .PAGE_ADDRESS + 1);
MACHOP (MOVEI, T2, .PAGE_ADDRESS + PAGE_LENGTH - 1);
MACHOP (SETZM, 0, .PAGE_ADDRESS);
MACHOP (BLT, T1, 0, T2);
end;
%debug (PAGE_TRACE,
(TRACE_INFO ('Page %O allocated', LSH (.PAGE_ADDRESS, -9))));
%debug (always,
(begin
local
FIRST_PAGE;
if (FIRST_PAGE = .PAGE_QUEUE <0,18,0>) neq PAGE_QUEUE
then WRITE_PROTECT (.FIRST_PAGE);
end));
%fi ! End of %if $TOPS20
%if $TOPS10 %then
if (PAGE_ADDRESS = NMU$QUEUE_REMOVE (PAGE_QUEUE)) eql 0 then
begin
builtin UUO;
register T1;
local ARGLST : vector [2];
PAGE_ADDRESS = .NEXT_PAGE;
NEXT_PAGE = .NEXT_PAGE + PAGE_LENGTH;
if .PAGE_ADDRESS lss LOW_PAGE or .PAGE_ADDRESS gtr HIGH_PAGE
then TASK_ERROR ('No pages available to be allocated');
T1 = $PAGCD ^ 18 + ARGLST;
ARGLST [0] = 1;
ARGLST [1] = LSH (.PAGE_ADDRESS, -9) ;
UUO (1, PAGE$(T1));
end
else
begin
register T1;
builtin MACHOP;
literal HRLZ = %o '514';
MACHOP (SETZM, 0, .PAGE_ADDRESS);
MACHOP (HRLZ, T1, PAGE_ADDRESS);
MACHOP (HRRI, T1, .PAGE_ADDRESS + 1);
MACHOP (BLT, T1, .PAGE_ADDRESS + PAGE_LENGTH - 1);
end;
%fi
LSH (.PAGE_ADDRESS, -9)
end; ! End of NMU$PAGE_GET
%global_routine ('NMU$PAGE_RELEASE', PAGE) : novalue =
!++
! Functional description:
!
! This routine releases a page that has been allocated
! using either the NMU$PAGE_GET calls.
!
! Formal parameters:
!
! PAGE Page number
!
! Routine value: none
! Side effects: none
!
!--
begin
local
PAGE_ADDRESS;
builtin
LSH;
PAGE_ADDRESS = LSH (.PAGE, 9);
%if $TOPS20 %then
%debug (always,
(begin
local
LAST_PAGE;
if (LAST_PAGE = .PAGE_QUEUE <18,18,0>) neq PAGE_QUEUE
then WRITE_ENABLE (.LAST_PAGE);
end));
%fi
%debug (PAGE_TRACE,
(TRACE_INFO ('Page %O released', .PAGE)));
if (.PAGE_ADDRESS lss LOW_PAGE) or (.PAGE_ADDRESS gtr HIGH_PAGE)
then TASK_ERROR ('Attempt to release invalid page');
NMU$QUEUE_INSERT (PAGE_QUEUE, .PAGE_ADDRESS);
%if $TOPS20 %then
%debug (always,
(begin
WRITE_PROTECT (.PAGE_ADDRESS);
if (PAGE_ADDRESS = .(.PAGE_ADDRESS) <18,18,0>) neq PAGE_QUEUE
then WRITE_PROTECT (.PAGE_ADDRESS);
end));
%fi
end; ! End of NMU$PAGE_RELEASE
end ! End of module NMUPAG
eludom
! Local Modes:
! Mode:BLISS
! Auto Save Mode:0
! Comment Column:40
! Comment Rounding:+1
! End: