"Science, Faculty of"@en . "Computer Science, Department of"@en . "DSpace"@en . "UBCV"@en . "Wu, Jean"@en . "2010-07-08T03:58:24Z"@en . "1986"@en . "Master of Science - MSc"@en . "University of British Columbia"@en . "In high-speed data acquisition systems where efficient data interrupt handling is the central issue, it is often desirable to off-load the real-time data acquisition tasks to a dedicated front-end processor (FEP), leaving the host to handle only the non-real-time tasks. The front-end processor in such a system setup requires an executive program which must be individually designed to handle the functions dedicated to it. This thesis documents the design and implementation of such a FEP operating system.\r\nThe FEP hardware module we are concerned with consists of a DCJ-11 microprocessor, 128 Kbytes physical memory and a Q-bus to which various interface devices are attached. By applying the layering principle, the FEP operating system can be organized into a 5-layer hierarchy; each layer building on top of the services provided by the lower layers.\r\nThe FEP operating system has been implemented and tested at TRIUMF where a new, high-speed data acquisistion system is being developed."@en . "https://circle.library.ubc.ca/rest/handle/2429/26209?expand=metadata"@en . "FLOSY: A NONPREEMPTIVE FEP OPERATING SYSTEM by J E A N WU B.Sc, The University of British Columbia, 1976 A THESIS SUBMITTED IN PARTIAL FULFILMENT OF THE REQUIREMENTS FOR THE DEGREE OF MASTER OF SCIENCE in THE FACULTY OF GRADUATE STUDIES Department of Computer Science We accept this thesis as conforming to the required standard THE UNIVERSITY OF BRITISH COLUMBIA October 1986 \u00C2\u00A9 Jean Wu, 1986 In presenting this thesis in partial fulfilment of the requirements for an advanced degree at The University of British Columbia, I agree that the Library shall make it freely available for reference and study. I further agree that permission for extensive copying of this thesis for scholarly purposes may be granted by the Head of my Department or by his or her representatives. It is understood that copying or publication of this thesis for financial gain shall not be allowed without my written permission. Department of Computer Science The University of British Columbia 2075 Wesbrook Place Vancouver, Canada V6T 1W5 Date: October 1986 Abstract In high-speed data acquisition systems where efficient data interrupt handling is the central issue, it is often desirable to o f f - load the real-t ime data acquisition tasks to a dedicated front-end processor (FEP), leaving the host to handle only the non-real- t ime tasks. The front-end processor in such a system setup requires an executive program which must be individually designed to handle the functions dedicated to it. This thesis documents the design and implementation of such a FEP operating system. The FEP hardware module we are concerned with consists of a DCJ-11 microprocessor, 128 Kbytes physical memory and a Q-bus to which various interface devices are attached. By applying the layering principle, the FEP operating system can be organized into a 5-layer hierarchy; each layer building on top of the services provided by the lower layers. The FEP operating system has been implemented and tested at TRIUMF where a new, high-speed data acquisistion system is being developed. ii Table of Contents Abstract ii Table of Contents iii List of Tables v List of Figures vi Acknowledgements vii 1. INTRODUCTION 1 1.1 Background 1 1.2 Motivat ion 2 1.3 System Overview 3 2. FEP FUNCTIONAL REQUIREMENTS 6 2.1 Data Acquis i t ion Procedures 6 2.2 Functional Specifications 9 2.3 Scheduling Scheme , 10 2.4 Performance Requirement 11 3. HARDWARE DESCRIPTIONS 12 3.1 C A M A C 12 3.2 Hardware Organization 14 3.3 Host Computer 14 3.4 FEP Module 14 3.4.1 CPU 15 3.4.2 Memory 18 3.4.3 The Q-Bus and Interface Devices 18 3.4.4 Interrupt/Trap Handling 19 3.5 Host Computer to FEP Interface 20 3.6 FEP To C A M A C System Crate Interface 21 3.7 FEP-To-Hos t Blocked Data Transfer 21 4. FLOSY ARCHITECTURE 23 iii 4.1 Memory Management 23 4.2 Process Management 25 4.2.1 FLOSY Run Time Environment 27 4.2.2 Process Run Time Environment 29 4.2.3 Context Switching 32 4.3 Real-Time Clock Management 34 4.3.1 Timer Procedure Management 35 4.4 Inter-Machine Communications 36 4.4.1 Processing Commands From The Host Computer 37 4.4.2 Information Transfer To The Host Computer 39 4.4.3 C A M A C Interrupt Management 41 4.5 FLOSY Startup Procedure 42 5. IMPLEMENTATION 43 5.1 Future Enhancements .44 References 46 Appendix 1 - Hos t - to-FEP Commands .47 Appendix 2 - FLOSY Source Code .49 iv List of Tables Table I - PSW Bit Descriptions 1 6 Table II - Process Control Block 2 6 v List of Figures Figure 1 - System Overview 4 Figure 2 - Process State Transition Diagram 8 Figure 3 - Physical Organization of the Data Acquis i t ion System 13 Figure 4 - Programming Model 15 Figure 5 - 16-Bit Virtual to 22-Bit Physical Address Translation 18 Figure 6 - FLOSY Virtual Address Space 28 Figure 7 - Process Virtual Address Space 31 Figure 8 - Kernel- to-User Mode Switching 33 Figure 9 - Act ive Timer Queue 35 Figure 10 - Free Timer Queue 36 Figure 11 - Hos t - to-FEP Command Buffer Structure 38 Figure 12 - FEP- to -Hos t Reply Buffer Structure 38 Figure 13 - Ring Buffer Data Structure for information Transfer 39 Figure 14 - Encoding for Buffer Transfers 39 Figure 15 - Encoding for Error Condition Transfers 39 vi Acknowledgements This project is part of the ongoing data acquisition system upgrade effort at TRIUMF. I wish to express my special thanks to Dr. G. Ludgate for his unfailing patience in introducing to me the world of C A M A C , and for his many contributions in the design of FLOSY. The FLOSY code included in Appendix 2 has been developed entirely by Dr. Ludgate. Many thanks to Dr. S. Chanson for his guidence and encouragement throughout the project. vii CHAPTER 1 INTRODUCTION The object of this thesis is to design and implement an executive program for a front-end processor required in a new high-speed data acquisition system being developed at TRIUMF. This chapter wi l l present some background information about TRIUMF, its current data acquisition system and associated shortfalls, fo l lowed by an overview of the new data acquisition system being developed. 1.1 Background TRIUMF i s . Canada's national meson faci l i ty . It provides facilities for experiments in subatomic research with beams of pions, muons, protons and neutrons. Experiments underway in facilities are monitored by a large number of particle detectors and electronic modules which we shall refer to as the CAMAC 1 system. Among other things, a C A M A C system is set up to measure properties of the occurrences of nuclear physics events and to generate interrupts to signal the event occurrences to an attached processor. A data acquisition system, then, is the hardware and software complex which must process these event interrupts, fetch the experimental data from C A M A C on an event-by-event basis and analyze the data on-line and/or store the data on an external storage device for of f - l ine analysis. The typical nuclear physics experiment at TRIUMF involves acquiring data at a rate of several hundred events per second. When an event occurs, analogue data from the experiment are digitized by a set of C A M A C modules. One module in the C A M A C system wi l l raise a flag, known as a L A M , which causes an * C A M A C wi l l be discussed in Chapter 3. 1. interrupt to an attached processor. The processor must service the interrupt by reading digital data from the set of C A M A C modules and finally clearing the L A M , thus freeing the C A M A C modules to monitor subsequent events. A l l events that occur while the modules are waiting for their data to be read are lost. It is therefore of utmost importance that events be handled as fast as possible, i.e., they must be handled in real-time. Presently each C A M A C system is attached to a PDP-11/34 computer running under Digital Equipment Corporation's R S X - 1 1 / M operating system. Each of these computers can handle one experiment at a time. To conduct an experiment a user runs a software package called MULTI, which consists of five concurrent R S X - 1 1 / M tasks, including one data acquisition task that reads event data into a R S X - 1 1 / M sharable common region. MULTI enables users to carry out data acquisition, control the experiment and perform on-line and off - l ine data analysis. 1.2 Motivation A major problem with the current data acquisition systems is that the same computer must handle all of the data acquisition, control and analysis tasks. The data acquisition task, which has a higher priority than the other tasks, can easily consume most, if not a l l , of the CPU time, leaving the remaining CPU capacity (about 19% [14]) to analyze only a small fraction of the event data on- l ine . Consequently, the complete data are typically saved on a magnetic tape and analyzed after the experiment, either on the same computer or on a different, usually more powerful, computer. One solution to the problem of insufficient on-l ine analyzing power is to replace the PDP-11 computers with more powerful processors. With the technological advances in experimental hardware, nuclear physics experiments have become much more sophisticated over the years. The performance demand on the data acquisition system has also increased beyond that which can be supplied by 2 mini-computers. In upgrading the data acquisition system one must then look into mainframe computers. But due to the multi-tasking nature of most existing operating systems for large computers, they tend to respond s lowly to real-time events. A better configuration for the data acquisition system is to o f f - load the real-time requirement of data acquisition into a separate processor, and leave the host computer free to devote 100% of its CPU time to event analysis and control functions with no real-time constraints. This is the solution chosen for the new data acquisition system. 1.3 System Overview The new data acquisition system is logically organized as shown in Figure 1. Attached to the C A M A C system is a processor, known as a front-end processor (FEP), whose main respons ib i l i ty is to carry out the actual data acquisition tasks. The FEP in turn is attached to a host computer which is to perform non-real- t ime functions such as experiment control and data analysis. Users wi l l conduct experiments by interacting only with the host computer. At appropriate t imes, the host computer wi l l download data acquisition-related code into the FEP for execution. During the course of an experiment, users can control the progress of the experiment by issuing various commands, which the host computer w i l l pass onto the FEP for processing. The data acquired from C A M A C on an event-by-event basis are buffered in the FEP memory and transferred back, in fixed sized blocks, to the host computer's memory where they are analyzed and recorded on tape or disk. 3 Physical Experimental Set Up Analogue Data Control Signals CAMAC System (Analogue-to- Digital) ( Convertors ) Digital Ex peri mental Data CAMAC Commands Buffered Data \"ARBURST) Control Commands Host Computer (VAX 11/750) Figure 1 System Overview This system organization makes it possible to separate the data acquisition system into two components: the real-time component and the non-real-t ime component; and the appropriate hardware and software can be selected for each component. The computer selected for the host computer is a V A X 11/750 computer, which is to run under Digital Equipment Corporation's V M S operating system. This V A X computer offers sufficient processing power that more than one experiment could now be conducted simultaneously on the data acquisition system. The hardware selected for the FEP is a C A M A C module called the STARBURST and wi l l be described in Chapter 3. Two sets of supervisory level software are required in the new system organization. In the host computer a supervisory process is required to multiplex commands from all users to the FEP, to load data acquisition-related code into the FEP, and to accept and distribute the acquired data from the FEP back to the appropriate analysis processes. On the FEP, a special purpose executive program or operating system is required to coordinate the execution of data acquisition software and to pass the acquired data back to the host computer. We have named this FEP operating system FLOSY (or FEP Little Operating SYstem). The design and implementation of FLOSY wi l l be the subject of the remainder of this thesis. 5 CHAPTER 2 FEP FUNCTIONAL REQUIREMENTS This chapter wi l l define the functional and performance requirements of the FEP operating system. But first a brief description of the software required in carrying out a typical experiment on the data acquisition system at TRIUMF. 2.1 Data Acquisition Procedures A typical experiment at TRIUMF is monitored by a large number of C A M A C hardware modules which are completely software-controlled. To conduct an experiment, it is first necessary to initialize all the hardware modules that are to be involved in the experiment by executing an appropriate software procedure. Once initialized, the hardware begins to monitor the nuclear physics events and generate interrupts as events are detected. Software procedures are again required to handle these interrupts as they occur. It is also sometimes necessary to temporarily pause then continue the experiment. Finally, at the end of an experiment an appropriate software procedure must be executed to close down the hardware involved in the experiment. In summary, associated with every experiment is a set of data acquisition-related software procedures which the user must develop. These procedures may be categorized into three groups according to the way they are to be invoked by FLOSY: 1. Command procedures. These procedures are to be executed in conjunction with user-issued control, commands and must have system-defined names. They typically perform hardware-setting functions such as initializing, pausing and continuing the experiment. Minimal ly , each experiment must have an associated BEGIN_RUN and an END_RUN procedure which initializes and stops, respectively, the 6 experiment. 2. Interrupt-handling procedures. Each of these procedures handles a particular type of event detected by the C A M A C system and is executed upon the generation of a particular interrupt by a C A M A C module. Typical ly , they fetch some data from the C A M A C module, may perform some arithmetic transformation on the data, write the data into an output buffer associated with the experiment, and finally clear the L A M causing the interrupt in the appropriate C A M A C module. The user must define an interrupt-handling procedure for each possible event type expected during an experiment. Each event type is associated with an unique eight-bit number called B.GL which is associated with the address of the C A M A C module that generates the event interrupt. 3. Timer procedures. These procedures are to be executed repeatedly at specific time intervals. They perform routine tasks such as reading a temperature or other measurements. Timer procedures are optional, i.e., they need not be included in an experiment. A l l procedures are developed, compiled and linked in the host computer as elements of a single data acquisition program, then downloaded into the FEP memory for execution as a data acquisition process. Along with the program downloaded into the FEP memory is a per-process table which wi l l indicate for each constituent procedure: \u00E2\u0080\u00A2 the procedure entry point, \u00E2\u0080\u00A2 the maximum length of data output from the procedure, \u00E2\u0080\u00A2 the associated B.GL (for event-handling procedures), and \u00E2\u0080\u00A2 the repetition time interval (for timer procedures). The per-process table is generated by a special compiler which translates the user program from a FORTRAN-l ike language, called T W O T R A N , into PDP-11 machine executable code. 7 [INITIAL STATE] STOP.PROCESS START_PROCESS F i gu re 2 P r o c e s s S t a t e T r a n s i t i o n D i a g r a m 2.2 Functional Specifications A s mentioned earlier, the FEP's job is to carry out, for each ongoing experiment, the actual data acquisiton task by executing the appropriate data acquisition procedure. Specif ical ly , for each ongoing experiment the FEP must serve the fol lowing four functions: 1. To accept and process control commands from the host computer. The control commands to be processed are summarized in Appendix 1, along with an associated hexidecimal value, and actions to be taken by FLOSY. Some commands wi l l require FLOSY to execute an appropriate user-defined procedure, while others require only that FLOSY provide a system service or some system information in return. In particular, commands such as BEGIN_RUN, P A U S E _ R U N , etc. are to al low users to have dynamic control of the progress of an experiment and to bring the experiment from one state to another. Figure 2 shows the state transitions of a data acquisition process and the commands that are accepted in each state. It is the FEP's responsibility to verify that commands are processed in an acceptable order according to the transition diagram. The user wi l l give commands in the symbol ic form, but the host computer w i l l translate them into corresponding hexidecimal values before passing them to FLOSY for processing. 2. To execute an interrupt-handling procedure upon an event interrupt. Upon detecting a monitored physics event, a C A M A C module wi l l place the B.GL value of the module in a hardware interface register and interrupt the FEP. By matching the B.GL value in the interface register with those in the per-process tables, FLOSY wi l l be able to locate and execute the appropriate procedure to handle the event. Furthermore, FLOSY must ensure that each B.GL value is used by no more than one experiment at a time. 3. To execute timer procedures at specified time intervals. The per-process table indicates the procedures that are timer procedures and 9 the corresponding repetition intervals. The FEP must try its best to execute these procedures at the specified time intervals. 4. To manage output buffers and to arrange for the acquired data to be passed back to the host computer. At any given time, each experiment is associated with exactly one output buffer into which all data pertained to the experiment are written. The FEP must monitor the amount of data written into the buffer so far, and when necessary, or when instructed to do so by a user, arrange to have the current buffer transferred to the host computer's memory, in 8-Kbyte blocks, and find the experiment a new buffer. 2.3 Scheduling Scheme In a real-t ime environment such as a high-speed data acquisition system, the objective is to handle as many events as possible as they arise. A l l events are considered equally important, i.e., no event should be allowed to preempt the processing of another event. A s for timer procedures and command procedures, the functions they perform are considered as important as event processing and are therefore not to be interrupted either. Thus, once a user procedure has begun execution, it must be allowed to execute to completion without being interrupted by another user procedure. In other words, the scheduling scheme used by the FEP operating system must be a nonpreemptive scheme. Inherent in the nonpreemptive scheme is that the system throughput w i l l be strictly better than that in a preemptive scheme since context-switching overhead is kept at a minimum, and hence more events can be processed in a given time interval. Note that data is not lost from C A M A C modules if two events occur close in time and the processing of the second event has to wait for the completion of the first. 10 2.4 Performance Requirement Implicit in the foregoing description is that the single overriding performance requirement for the FEP operating system is speed. If by \"sacrificing\" a resonable amount of memory we can improve the operating system speed, then the sacrifice is considered justified. 11 CHAPTER 3 HARDWARE DESCRIPTIONS A n overview of the C A M A C system and the physical organization of the data acquisition system wi l l be presented in this chapter. Those hardware modules and relevant hardware features that pertain to the FEP operating system design wi l l also be summarized. Complete details are outlined in manufacturer's handbooks and data sheets as referenced in the text. 3.1 CAMAC C A M A C [1] is a set of mechanical, electrical .-and signal interface standards defined in ANSI/IEEE std 583-1982. It is mostly used for interfacing experiments and other equipment to data acquisition and control computers. C A M A C permits modules of various designs and from diverse sources to be housed in a common enclosure, called crate, and operate from a common power supply. At the rear of a crate are bussed lines, called the Dataway, which interconnect the stations within a crate and are used to transfer data and control information to and from the plug-in modules in the crate. Two or more C A M A C crate assemblies can be interconnected and attached to a computer or controller via branch-highways. The crate controller, located at the extreme right of the crate, handles all communications between the modules and the dataway, and also between the crates and a computer or other external controller. A C A M A C module is a modular functional plug-in unit that mounts in one or more normal stations of a C A M A C crate and conforms to the C A M A C standards. 12 A M C 1111 C / 2 P T I 1 1 D / 2 _L_I_ s T A R B U R S T C E S S C I 2 2 8 0 Q-Bus BC RO All NP H E R 7 BC RO AU NP CL H E R # 1 E C M x 2 x t r o 1 1 e e r Systen Crate Branch Highway UNIBUG VAK 11/750 (HDst Computer) Branch Highway < > u U U CC 3 3 3 r 0 e e e a t n t r r r r M i i M e 0 0 0 0 1 d d d 1 u u u e 1 1 1 r e e e > More user c ra tes User Crate * 1 < > u U U CC 3 3 3 f 0 e e e a t e n r r r t M M Ii r 0 0 0 0 1 1 d d d u u u e 1 1 1 r e e e User Crate * 7 (Maximum) Figure 3 Physical Organization of the Data Acquisition System 13 3.2 Hardware Organization The physical organization of the data acquisition system is as shown in Figure 3, where the STARBURST (which is the front-end processor module) and all interface modules are housed in a crate called the system crate. A system crate [11] is a C A M A C crate assembly in which specialized plug-in units are used to link one or more sources of commands to one or more branch highway drivers. In our case, the STARBURST and the V A X computer are the two command sources in the system crate; and the M X - C T R - 3 Executive Controller [9,10] is the crate controller which contains the priority arbitration circuits used to allocate mastership of the system crate to either of the command sources requesting data from C A M A C modules. The user crates represent the C A M A C system which digitizes the experimental data and raise L A M (Look At Me) signals to indicate physics event occurrences. The Branch Coupler [12] provides the interface between the System Crate and the branch highway which connect the user crates. Various device features wi l l be described in the fol lowing sections. 3.3 Host Computer The host computer of the data acquisition system is a V A X 11/750 computer. It is connected to the System Crate via an interface device [13] which consists of two C A M A C modules: a control module called PTI-11C-2 and a data module called PTI-11D-2 . Through this interface device the host computer is able to perform various C A M A C control functions on the STARBURST; but the reverse is not true. The interface device is driven by the V A X computer from the UNIBUS. 3.4 FEP Module 14 The FEP hardware is a s ingle-board module called STARBURST [3]. The board is packaged as a single width C A M A C module and is manufactured by CES of Geneva, Switzerland. The STARBURST consists of a PDP-11/70 C P U , 128 Kbytes of memory and a Q-bus to which peripherals are attached. 3.4.1 CPU GENERAL PURPOSE SYSTEM CONTROL MEMORY SYSTEM RO RO' KSP | PSW | | LTC | | CACHE CTRL | R1 R1' SSP R2 R2' USP | PIRQ | | MAINT | | MEM SYS ERR J R3 A3* R4 R4' 1 * f CPU ERROR | | MIT/MISS | R5 R5-FLOATING POINT EPS | | FEC | | FEA | ACCUMULATORS 164 BIT) MMRO MEMORY MANAGEMENT | MMR1 | | MMR2 | | MMR3 PAGE REGISTERS (32 BIT) KERNEL (00) SUPERVISOR 101) USER 111) PAR PDR PAR PDR in 8 I SPACE AND B 0 SPACE Figure 4 - Programming Model PAR PDR i r The CPU is Digital Equipment Corporation's DCJ-11 16-bit microprocessor chip [5] implementing the full PDP-11 processor architecture [6]. The microprocessor provides the performance of a PDP-11/70 and supports the full PDP-11 instruction set, including floating point instructions. The processor can operate at priority levels zero to seven and in three protection modes: kernel, supervisor or user mode. Figure 4 shows the programming model of the processor registers. There are two groups of six general purpose registers, designated RO\u00E2\u0080\u0094R5 and RO\u00E2\u0080\u0094R5'. The group being used is selected by bit 11 in the processor status word . 15 KSP, S S P , USP are the three system stack pointers (SP), one for each of the three protection modes. Only one is visible to the user at a given time, selected by bits <14;15> (or bits <12:13>) of the processor status word. The program counter (PC) contains the 16-bit virtual address of the next instruction stream word to be accessed. The processor status word (PSW) maintains various information fields that determines some system oriented functions. Its bits are described in Table I. Table I PSW Bit Descriptions Bit Description 15:14 Current operating mode (00=kernel, 01 =supervisor, 11 =user) 13:12 The previous operating mode, coded the same as bits 15:14. 11 Selects the groups of general register to be used (1:R0'-R5'; 0:R0-R5). 10:09 Not used. 08 Reserved. 07:05 Current processor priority level , may be 0-7. 04 The trap bit; when set (1), the proessor traps to loc 14 at the end of the current instruction. 03 Condition code N , set when the previous operation result was negative. 02 Condition code Z, set when the previous operation result was zero. 01 Condition code V, set when the previous operation resulted in an arithematic overf low. 00 Condition code C, set when the previous operation caused a carry out of the most significant bit of the result. The Program Interrupt Request Register (PIRQ) implements a software interrupt facil i ty. A request is initiated by setting one of bits <15:09> which corresponds to a program interrupt request for priority levels seven to one. When the interrupt is acknowledged, the processor vectors to address octal 240 for a service routine. The DCJ11 chip contains a memory management unit (MMU) which translates the program's 16-bit virtual address into either an 18-bit or a 22-bit physical address. Since the Q-bus uses 22-bit addresses, the M M U is used to translate 16-bit virtual addresses into 22-bit physical addresses. Associa ted with the memory management unit are four registers, MMR0\u00E2\u0080\u0094MMR3, which provide M M U 16 control and record various MMU-re la ted status information. For each processor mode there are sixteen paging registers, eight of these are for instruction (I) space references and eight for data (D) space references. These paging registers provide a mechanism for dividing a program's virtual address space into up to sixteen pages of variable sizes (up to 4 Kwords). With the M M U operating, each page can be loaded independently into physical memory and accessed using the information stored in an associated paging register. Each paging register consists of a page address register (PAR) part and a page descriptor register (PDR) part. The page address register contains the starting address of the page as a block (an unit of 64 bytes) number in physical memory while the page descriptor register contains information related to page expansion, page length and access control. The 16-bit virtual address is interpreted as having 3 fields: bits <15;13> make up the Act ive Page Field (APF), bits <12:6> make up the block number f ield, and bits <5:0> make up the displacement in block f ield. Referring to Figure 5, the logical sequence in constructing a 22-bit physical address from a 16-bit virtual address is as fo l lows : 1. The current protection mode and reference space (I or D) select a set of page address register to be used. 2. The active page field of the virtual address selects 1 of 8 PARs (PARO\u00E2\u0080\u0094PAR7) from the appropriate set. 3. The selected page address register contains the starting address of the currently active page as a block number in physical memory. 4. The block number from the virtual address is added to the content of the selected page address register to yield the number of the block in physical memory, this is bits <21;06> of the physical address. 5. The displacement in block from the virtual address is joined to the physical block number to yield the 22\u00E2\u0080\u0094bit physical address. 17 15 13 12 6 5 1 10 1 111 111 1 0 0 1 1 0 Selects PAR6 Page Base Address APF Block Number Displacement I In Block \u00C2\u00A9 1 0 1 1 101 1 0 0 1 10 0 0 0 \u00E2\u0080\u0094 I 1 I ' I ADDER 22-Bit Physical Address 1 O i l 101 1 1 0 101 111 1 0 0 1 1 0 \u00E2\u0080\u0094 i 1 1 1 i i i 21 6 5 0 Figure 5 16-Bit Virtual to 22-Bit Physical Address Translation 3.4.2 Memory The STARBURST has 128 Kbytes of on-board physical memory which is dual-ported, i.e., the memory can be accessed independently from the CPU and from the host computer (using the C A M A C bus into which the module plugs). The memory is organized as the lowest 128Kb of the 4Mb physical address space of the Q-bus . 3.4.3 The Q-Bus and Interface Devices The STARBURST is equipped with a front-panel communication bus, called the Q-bus , to which all compatible peripheral devices and interface modules can be attached. The Q-bus uses 22-bit addresses. Interface modules are hardware which make other devices or processors accessible to a computer. They appear to programmers as a set of device registers which are accessed like memory locations. By PDP-11 conventions, the device registers have been assigned addresses in the top 8 Kbytes of physical 18 address space which is referred to as the I/O page. The STARBURST is equipped with three on-board peripherals: 1. A real-time clock, which is set to a 60 Hz frequency. It has a vector location at octal 100 and an associated hardware interrupt priority of six. 2. A RS232 interface which allows the user to operate the microprocessor in Online Debugging Terminal (ODT) mode, i.e., to respond to commands and information entered via a console terminal. 3. A C A M A C interface, to be described in Section 3.5. In addition, a System Crate interface is connected to the Q-bus (Section 3.6). 3.4.4 Interrupt/Trap Handling Devices connected to the STARBURST's Q-bus request for processor services by generating interrupts. Similar ly , contitions internal to the CPU related to hardware/software errors generate traps for operating system service. In the PDP-11s ' architecture, both interrupts and traps are handled by the same hardware mechanism. Following an interrupt or trap, the CPU saves the current PSW and PC in its internal registers accessible only to microcodes, new PC and PS are reloaded from two consecutive words (called the vector location) located in the low area of kernel virtual address, and finally, the original PC and PS are stored into the newly current stack (kernel/supervisor/user stack depending on the new PSW). Each external device has a different vector location and has an associated hardware interrupt priority of between 4 and 7. Both the actual vector locations and interrupt priorities are determined by \"hard wir ing\" and can only be changed with difficulty. The CPU can operate at priority levels zero to seven, as maintained by bits <5;7> of PSW. A n external device cannot interrupt the CPU unless the CPU is operating at a lower priority level than the device's hardware interrupt priority. 19 3.5 Host Computer to FEP Interface The V A X 11/750 to STARBURST interface is provided by STARBURST's on-board C A M A C peripheral. This interface allows the STARBURST to accept up to eight C A M A C interrupts; in particular, it enables the FEP to accept command interrupts from the host computer. A s mentioned earlier, both the host computer and the FEP have independent access to the STARBURST memory. The communication between the host and the FEP, then, can be achieved by using a portion of the shared memory as a mailbox for exchanging messages. To issue a command, the host computer first writes a command into a command buffer located in the mailbox region, then, through the C A M A C peripheral, generates an interrupt to the FEP. Upon accepting the interrupt from the host, the FEP retrieves the command from the command buffer, processes the command and writes a reply for the host in a reply buffer, which is another mutually agreed-upon memory location. Note that the FEP cannot interrupt the host for the reply. It is assumed that since the FEP can process a command much faster than the host computer can access its replies, by the time the host computer comes around to look for its reply, the reply wi l l l ikely be there already. The FEP can, however, increment a message counter in the reply buffer whenever it writes a new reply. The host checks the counter to distinguish a new reply from an old one. Among the interface registers of the C A M A C peripheral is a STARBURST Interrupt Register (SIR) whose physical address is at octal 17766004. The register is divided into two 8-bit groups. Each bit in these two groups correspond to a specific interrupt source. In particular bits 3 and. 11 correspond to the interrupt from the host. When bit 11 is set (1), the interrupt is enabled. To clear the interrupt, bit 3 must be set (1). 3.6 FEP To CAMAC System Crate Interface 20 The FEP to the C A M A C System Crate interface is provided by a System Crate Interface module called CES SCI 2280 [4] which allows programs running in the STARBURST complete control over the entire C A M A C . system attached to the system crate. This interface module is attached to the STARBURST's Q-bus , and appears to a programmer as a set of programmable registers in the I/O page. It has a single interrupt vector at location octal 170 and a hardware interrupt priority of 4. When an event is detected by a user module in the C A M A C system, the module raises a signal in the crate known as a L A M . A l l L A M s in a crate are converted to a Graded L A M (GL) and the OR of all GLs in every user crate is gated by the crate controller onto a single \"branch demand\" line in the branch highway. The Branch Coupler picks up the \"branch demand\" and passes it to the SCI 2280 interface. The SCI 2280 interface selects one branch demand at a time from all Branch Couplers in the system crate, prioritizes all GLs on the branch and eventually produces an 8-bit branch+GL (B.GL) value which is associated with the address of the module which raised the highest priority L A M . The 3-bit branch number and the 5-bit GL value are put in bits <9;7> and bits <6:2>, respectively, of an interface register known as the Interrupt Handling Register (IHR) and an interrupt is sent to the STARBURST. The B.GL value allows the STARBURST's operating system to determine a unique procedure to service the L A M . It is also through this interface module that interrupt-handling procedures are able to read data from user modules and clear the L A M s causing the interrupt. 3.7 FEP-To-Host Blocked Data Transfer Experimental data collected by each data acquisition program on an event by event basis are buffered in the STARBURST's memory. When a buffer is full, or when the user issues a command to \"flush\" the buffer, FLOSY must arrange to 21 have the buffer content transferred to the host computer's memory. This transfer is handled by a direct memory access (DMA) device called A M C - 1 1 [8] located on the extreme left of the system crate. This D M A device is attached to the host computer's UNIBUS and is controlled by the V A X computer. It is able to transfer up to a block size of 4K C A M A C words at a time. When there is information to be transferred to the host computer, FLOSY can put the address of the information block in a \"mailbox\" region in its memory and raises its own L A M through the C A M A C peripheral. The V A X - t o - S T A R B U R S T interface program, which resides on the V A X , polls the STARBURST every 100 mill iseconds to check for the presence of this L A M . If the L A M is set, the host computer retrieves the buffer address from the mailbox region and initiates a data transfer by the D M A device. Once a data transfer is completed, the host computer writes a completion indication in the mailbox region. FLOSY must check the mailbox region at regular time intervals for the completion indication and return those buffers, whose contents have been transferred to the host, back to its free buffer pool . 22 CHAPTER 4 FLOSY ARCHITECTURE A layered organization for an operating system was first proposed by Dijkstra [7]. This approach has the system functions partitioned into components, and the components are organized into a layered hierarchy such that the component at a higher hierarchy can be build upon the services provided by the components in the lower hierarchies. The higher a layer, the less dependent it is on the hardware. This layering structure makes the design and implementation of an operating system cleaner and more elegant. Comer applied the same principle in the XINU operating system [2]. It is from XINU we have taken various design ideas for FLOSY. Following the XINU approach, we partition the FLOSY architecture into the fol lowing components (from low hierarchy to high hierarchy): 1. Memory management 2. Process management 3. Real-t ime clock management 4. Intermachine communications 5. FLOSY startup procedure Each of these components wi l l be described in the fol lowing sections. 4.1 Memory Management The main memory is the only physical resource that FLOSY must manage. In designing the memory management for FLOSY, we have only one constrain, that the output buffer of each experiment must be of 8 Kbyte size (the transfer capacity of the D M A device). From past experience, it is also known that 8 Kbyte is a sufficient upper bound for user procedure code in any experiment. 23 To make the most efficient use of the memory generally requires that the memory manager maintains variable-sized memory blocks. The hardware does provjde registers which would facilitate such a memory management. However, to achieve the maximum executing efficiency of FLOSY, it is essential to keep the memory management as simple as possible. Efficient memory usage is not the main issue for FLOSY, good executing speed is. A very simple memory management is to divide the physical memory into f ixed-sized blocks and allocate or deallocate memory space in block units. This f ixed-sized block memory management has several advantages over a variable-sized block memory management: 1. there is no need to keep track of memory fragment sizes; 2. it is not necessary to merge consecutive memory blocks or to search for a suitable block since all memory blocks are of the same size; 3. memory management register manipulations can be kept to a minimum. FLOSY implements the f ixed-sized partition memory management by dividing the 128 Kbyte memory into 16 8-Kbyte pages. FLOSY requires one page for its own purposes. The addresses (as a 64-byte block number) of the remaining 15 pages are stored on a stack. The operations required to manipulate the stack are simply G E T _ P A G E , which pops the address of a free memory block from the top of the stack, and P U T _ P A G E , which puts the address of a freed memory page back to the top of the stack. GET_PAGE is used when the procedure code of a new process is to be loaded into the FEP memory, or when a new buffer is required by a process. PUT_PAGE is used when a buffer is released or when a process is removed from the FEP. For any given data acquisition process, exactly two blocks of memory need to be allocated; one for the process code and one for its output buffer. The code page wi l l remain fixed throughout an experiment while the buffer page may change from time to time as buffers are fi l led and exchanged for empty buffers by FLOSY. The advantages for fixed sized block memory mangement mentioned 24 above apply. However some memory wastage may result in cases when less than 8 Kbyte block is actually required for the user code. But given that the expected system load at any given time is only between one and three experiments, the efficiency gained in the execution speed far outweighs any inefficiency in memory utilization of the scheme. 4.2 Process Management In the context of our problem, we shall use the term process to refer to a set of data acquisition procedures belonging to the same experiment that reside in the FEP memory. Since more than one experiment may be carried out at the same time, multiple concurrent processes can exist. FLOSY maintains the information about processes in a process table. Each entry in the process table is a process control block, or process descriptor, which contains the essential information about a process. Among the process control block information, as described in Table II, is PCB.ST which keeps the state of the process; an UNALLOCATED state indicates that the table entry is not used. The PCB.CP and PCB.BF are necessary for FLOSY to access the information in the process code region and to transfer control to the process. The remaining information are process parameters which are used to tag all data associated with the process. Addi t ional ly , FLOSY maintains two global variables, F.LPRC and F.NPS, to indicate the current process ID and the number of processes currently in the FEP respectively. Each process is identified by a unique numeric identifier which corresponds to the byte offset of the process ' control block in the process table. Our processes do not share code, nor can they create new processes. A process comes into existance at the time FLOSY creates a control block for a new experiment, and dies when this control block is nullified, i.e., the process slot status is set to U N A L L O C A T E D . A l l processes reside in the main memory throughout the entire duration of an experiment. 25 Table II Process Control Block Field Name Field Descriptions PCB.ST Process-s lo t status; this corresponds to the states in the process state transition diagram (Figure 2). PCB.CP Process code page address, represented as a physical block number. PCB.BF Process buffer page address, again, represented as a physical block number. PCB.BC Buffer count; the number of output buffers allocated to the process so far (set to 0 at BEGIN_RUN). PCB.CR The current RUN NUMBER (increment by 1 at BEGIN_RUN, unless PCB.NR is nonzero, in which case PCB.CR is set to PCB.NR at BEGIN_RUN) PCB.NR The RUN NUMBER to be used at the next BEGIN_RUN; it is set by the SET_RUN_NUMBER command. PCB.CC The current CONDITION value; set to PCB.NC at BEGIN_RUN) PCB.NC The CONDITION value to be used at the next BEGIN_RUN; it is set by the SET_CONDITION command. PCB.CS The current SETUP value (set to PCB.NS at BEGIN_RUN). PCB.NS The SETUP value to be used at the next BEGIN_RUN; it is set by the SET_SETUP command. PCB.EN The EXPERIMENT NUMBER set by the user via the SET_EXPERIMENT_NUMBER command. PCB.GN V A X _ G R O U P _ N U M B E R of the owning partition; set via the A L L O C A T E _ P R O C _ S L O T command. PCB.NA PCB.NA/NB is a two-word variable keeping the number of events PCB.NB written into the buffer so far (initialized to 1 at BEGIN_RUN). PCB.NL PCB.NL/NH is a two-word variable keeping the limit on the number PCB.NH of events; it is set by the SET_EVENTS command; when the limit is exceeded, the process is stopped. A process is normally hibernating, or sleeping, until an interrupt occurs which necessitates the execution of a particular procedure of the process. FLOSY determines the location of the procedure to execute, then transfers the processor control to the process, thus waking up the process. Once started, a procedure executes to completion (interrupted only by the real-time clock) then goes back to sleep, returning the processor control back to FLOSY. The procedure to be executed next is entirely dependent on the interrupt that occurs next. A l l user procedures are independent of each other, including register usage; hence register contents need not be saved at the end of a procedure execution. 26 4.2.1 FLOSY Run Time Environment The virtual address space of FLOSY is divided into the fol lowing segments: 1. Interrupt Vectors - This segment contains pairs of PC and PSW values that are to be loaded into the respective registers upon an interrupt or trap; by PDP-11 conventions, these vectors are located in the low area of kernel mode virtual address space. 2. FLOSY stack - used for storing temporary data. 3. Host-FEP communications buffers - this is the mailbox region used for communications between the host and the FEP. 4. Global data structures - e.g., the process table, the stack containing free memory page addresses. 5. Code segment - FLOSY code. 6. I/O page - memory management registers and interface registers reside in this segment; by PDP-11 conventions, this is the top 8 Kbytes of the physical address space. 7. Process code page - for reading the per-process table information from a process temporarily mapped into the kernel virtual address space. 8. Process buffer page - for writing event data into a process buffer. The 16-bit register size provided by the DCJ-11 chip allows the virtual address space of any program to be up to 64 Kbyte long. This 64 Kbyte address space can be divided into up to 16 virtual pages (8 pages for instructions (I), 8 pages for data (D)), and one pair of paging registers is provided to manage each of these pages. The D space mapping may optionally be turned off by setting a bit in the memory management register M M R 3 , in which case all mapping wi l l be done using the I space memory management registers. We have chosen to turn the D space mapping off since the 8 pages provided by the I space mapping are sufficient for our purposes. 27 Virtual Page # 0 6 Page Content Interrupt Vectors, Stack Area, Host-FEP CommuracationBuffera, Global Data Structures and FLOSY Code. Not Used Current Process Output Buffer Page Not Used Current Process Code Page Not Used Not Used I/O Page 16-Bit Virtual Address 000,000 to 017,777 020,000 to 037,777 040,000 to 057,777 060,000 to 077,777 100,000 to 117,777 120,000 to 137,777 140,000 to 157,777 160,000 to 177,777 22-Bit Physical Address Dynami-cally Mapped Dynami-cally Mapped PAR Register Content 00,000,000 to 000,000 00,017,777 Dynami-cally Loaded Dynami-cally Loaded 17,760,000 to 177,600 17,777,777 Figure 6 FLOSY Virtual Address Space 28 The 8 segments of FLOSY virtual address space, as described above, are grouped into four virtual pages as shown in Figure 6, where segments 1 to 5 are assigned the lower 8 Kbyte virtual addresses, which is also mapped onto the physical memory page zero. The I/O page must be in a virtual page by itself since it must be mapped onto the top 8 Kbytes of the physical address space. The process code page and buffer page are allocated virtual pages 4 and 2 respectively, and are dynamically mapped to the physical locations of a user code page and buffer page whenever user information accesses are necessary. 4.2.2 Process Run Time Environment The TWOTRAN compiler, which translates user procedures from the high-level TWOTRAN language into PDP-11 machine executable code, divides the virtual address space of a process into the fol lowing segments: 1. A 256-entry per-process table. Each entry in the table describes a procedure in the process, and consists of the fol lowing information; The procedure entry point, relative to zero; a zero entry indicates a non-existing procedure. The entry offset within this table is used as the procedure number by FLOSY. The maximum length of output from the procedure. The associated B.GL value, if it is an interrupt-handling procedure. The repetition time interval, in 0.1 second units, if it is a timer procedue. The event type, an integer used to tag the event data written by this procedure. 2. Process stack - shared among all procedures in the process. 3. Common variable region - shared variables for all procedures in the process. 4. Local variable region. 5. Code region - contains all procedure code. 6. The I/O page - to access the interface registers for reading the experimental data and for clearing the L A M ' s . 29 7. The output buffer - to write event data. The virtual address space of a process is as shown in Figure 7, where segments 1 to 5 are assigned virtual addresses within the same virtual page and wi l l be loaded into one physical memory page. The I/O page, again, must be in a virtual page by itself. To prevent user procedures from accessing the memory management registers, which reside in the higher range of the I/O page and come after the interface registers, the page length field (bits <14;8>) of the page descriptor register for this page is set to less than the full 8 Kbyte size. Thus, any attempt to access the address outside the page length would cause a page length abort. The buffer page is assigned the virtual address zero, and wi l l be mapped onto the physical location of the process output buffer at run time. 30 Virtual Page # 0 6 Page Content P r o c e s s Ou tpu t B u f f e r Not Used Not Used Not Used Per-Process Table, Process Stack Common Variables, Local Variables, Procedure Code Not Used Not Used I/O Page 16-Bit Virtual Address 000,000 to 017,777 020,000 to 037,777 040,000 to 057,777 060,000 to 077,777 100,000 to 117,777 120,000 to 137,777 140,000 to 157,777 160,000 to 177,777 22-Bit Physical Address Dynami-cally Mapped PAR Register Content Dynami-cally Loaded Dynami- Dynami-cally cally Mapped Loaded 000,000,000 to 000,000 00,017,777 17,760,000 to 177,600 17,777,777 Figure 7 Process Virtual Address Space 31 4.2.3 Context Switching In carrying out its supervisory functions, FLOSY executes in the kernel mode, which is the most priviledged processor mode. User processes, however, execute in the user mode so that they can be prevented from executing some priviledged instructions or accessing priviledged information. When an interrupt occurs which requires the execution of a user procedure, the fol lowing sequence of operations are carried out by FLOSY: 1. Determine the ID of the process to be woken. 2. Map the kernel virtual pages 2 and 4 to the physical addresses of the selected process buffer page and process code page respectively. 3. Check if the remaining space in the user buffer is sufficient to hold the maximum output by the next user procedure (the first two bytes of the user buffer is used to store the current user data size, which is also the pointer to the next available location in the buffer). If not, FLOSY queues the current buffer for transfer to the host, requests a new buffer from the memory manager, initializes the buffer pointer and remaps the user virtual page zero to the new buffer location. 4. Transfer processor control to the process. The actual switching from kernel to user mode requires that both PC and PSW be reloaded all in one instruction. Furthermore, the setup must be such that at the end of a user procedure, processor control can be returned to FLOSY at the proper address. The exact sequence of instructions for context switching is as in Figure 8. .32 ;Save contents of those registers ; that are needed below and ; set RO=procedure # to cal l . mov # P S - ( s p ) mov #urtn-(sp) mov #144200-(sp) mov #P.TBL,-(sp) mov rO-(sp) bis #4000,#PS mov #8,r1 mov (sp)+,r5 rti urtn: Save current PS on stack Save return PC on stack Push a user PSW on stack setting: current mode = user, previous mode = kernel, register set to use = 1 (R0-R5') and processor priority = 4. Push user space entry point on stack R0 = data acquistion procedure # Switch to register set 1 (R0'-R5') R1 = length of the event header R5' = procedure # to cal l . PC < - (sp) + PS < - (sp) + (switch to user mode) Return here from user space via a BPT instruction. clc rts pc ;(Restore registers) ;Clear carry for success ;Return to the calling procedure Figure 8 Kernel- to-User Mode Switching The mechanism is to first save FLOSY's own return address and PSW on the kernel stack, push the address of the user space entry point and a proper user mode PSW value onto the same stack, then execute the RTI instruction. The effect of the RTI instruction is to have the PC and PSW reloaded from the top of the kernel stack, in one operation. Processor control is thus transferred to the user space entry point and from there to the handler procedure by a subroutine cal l . The user space entry point is a sequence of instructions generated by the TWOTRAN compiler and placed at the beginning of the process code segment. This sequence of code serves as the interface between FLOSY and all user procedures, i.e., it is the entry point to all user procedures from FLOSY and the 33 point to which all user procedures return upon complet ion. FLOSY passes the procedure number of the procedure it wishes to call in register R5\ The last instruction of the user space entry point is a BPT instruction that effects a return of control to FLOSY. This instruction causes a trap sequence with a trap vector address of octal 14, i.e., the user mode PSW and PC are pushed onto kernel stack and the new PC and PSW are reloaded from location octal 14 in the kernel virtual address space. The service procedure of this trap pops the user PS and PC off the kernel stack, and then executes a RTI instruction, which causes a return to the procedure in FLOSY which originally called the user procedure! 4.3 Real-Time Clock Management The STARBURST is equipped with a real-time clock which is set at a 60 Hz frequency. This clock is used by FLOSY for three purposes: 1. To maintain a t ime-of -day clock which is used by all processes. The t ime-of -day clock is a 12-byte data structure; the high 8 bytes can be initialized to a given value by a user command \"SET_TIME\"; the lower 4 bytes are initialized to zero at each \"SET_TIME command and its value is incremented by 1 at each clock interrupt processed to maintain its precision. 2. To manage user timer procedures (described in the next section). 3. To synchronize information transfers between the FEP and the host computer (described in section 4.4.2). For all three purposes above, a 0.1 second precision wi l l suffice. To modify all the data affected at every clock interrupt (60 times a second) constitutes an unnecessary CPU overhead. We therefore simulate a 10 Hz clock by performing the data manipulations associated with the clock interrupt only at every 6th clock interrupt. This is accomplished by including the fol lowing sequence of instructions at the beginnng of the timer interrupt service procedure: 34 dec T.CNT ;decrement T.CNT by 1 (T.CNT set to 6 ;at system initialization) beq 10$ ;if 0, branch to 10$ rti ;else return from interrupt 10$ mov #6,T.CNT ;reset T.CNT to 6 ;perform all operations associated ;with the interrupt 4.3.1 Timer Procedure Management Timer procedures are user procedures that are to be executed repetitively at user-specif ied time intervals. While the executions of event-handling procedures and command procedures are hardware interrupt driven, timer procedure executions are not, and must be managed by FLOSY. FLOSY maintains all timer procedures of all processes in one s ingly- l inked list, ordered by the time at which the procedures are to be executed. As shown in Figure 9, each list element, representing one active timer procedure, contains a delay value (T.DELT), the process ID and the procedure number of the timer procedure (T.PN), the execution interval of the procedure (T.ABDT), and a pointer to the next list element (T.NEXT). The delay value represents the time interval, in units of one tenth of a second, relative to its predecessor, until the time the procedure should be executed. T.HEAD T. T.IH T. T. \u00E2\u0080\u0094 T. T.IH T. T. \u00E2\u0080\u0094 > \u00E2\u0080\u00A2 \u00E2\u0080\u00A2 \u00E2\u0080\u00A2 \u00E2\u0080\u0094 > T. T.IH T. T. \u00E2\u0080\u0094 DELT ABDT HEXT DZIT ABDT HZXT DZLT ABDT HZXT T. DZLT T.IH T. ABDT T. \u00E2\u0080\u0094 NZXT T.TATL 0 Figure 9 Act ive Timer Queue 35 At every clock interrupt processed, FLOSY decrements the delay value of the first queue element by one unit. When the delay value reaches zero, the procedure is due for execution. FLOSY- then sets bit 13 in the PIRQ register, thus queuing a software interrupt at priority 4. Whenever the processor drops to an appropriate priority, the software interrupt wi l l cause the processor to trap to vector location octal 240. The associated interrupt service routine deletes the first list element from the active timer queue, notes the procedure ID stored in the list element, re-inserts the \u00E2\u0080\u00A2 element at the appropriate place in the queue using the T.ABDT value as the new delay value, thereby implementing the repetitive nature of these procedures, then finally transfers control to the appropriate process. A l l timer procedures of a process are inserted into the active timer list at the time the process enters the \"RUNNING' state, and are deleted when the process is STOPPED or PAUSED. A l l free timer list elements are linked in a separate list with its own head and tail pointers (Figure 10). T.HFRE T. \u00E2\u0080\u0094 HZXT T. \u00E2\u0080\u0094 NZXT T. \u00E2\u0080\u0094 HZXT T. \u00E2\u0080\u0094 KEXT 0 T.TFRE Figure 10 Free Timer Queue 4.4 Inter-Machine Communications At all times the FEP is under the control of the host computer. Communications between the FEP and the host computer is necessary when: 36 1. the host computer sends a command to be processed; and 2. a buffer or message needs to be transferred to the host computer's memory. A s mentioned in Chapter 3, communication between the FEP and the host is achieved via a shared memory and the interrupt facil i ty. 4.4.1 Processing Commands From The Host Computer Two data structures are defined for processing commands from the host: 1. Command buffer - structured as in Figure 11. 2. Reply buffer - structured as in Figure 12. Note that the host computer is able to buffer multiple commands, if necessary, in its own data region and pass these commands to FLOSY one at a time. When a command is to be processed by FLOSY, the host writes the command and the associated parameters in the appropriate fields of the command buffer at the fixed address and interrupts the FEP. When this interrupt is acknowledged, it wi l l be fielded through vector location octal 360. The corresponding interrupt service procedure reads the command and the PID fields, increments the CB.WC value by 1 to indicate to the host that it has accepted the command, then calls the appropriate subroutine to process the command. The reply to each command is minimally a condition code whose value is placed in the second field of the reply buffer to indicate the success or failure in processing the command. Addit ional data associated with the reply are placed in the data field of the reply buffer. Since the FEP cannot interrupt the host computer, the command/reply synchronization is accomplished by FLOSY setting the RB.WC value to the CB.WC value at the end of each command processing. The host resets the CB.WC at the beginning of each command, and checks the RB.WC before accepting the data in the reply buffer as the reply to the last command. 37 CB.WC - the command counter CB.CMD - the command as a numeric value CB.PID - ID of the process to which the command is to apply CB.LEN - length,in words, of parameters, to follow CB.DAT - a 20-word field containing the command parameters Figure 11 Hos t - to -FEP Command Buffer Structure RB.WC - the reply counter RB.CV - condition value RB.PID - ID of the process for which the la3t command was processed RB.LEN - length, in words, of reply data to follow RB.DAT - a 100-word field containing the reply data to the last command Figure 12 FEP- to-Hos t Reply Buffer Structure 38 4.4.2 Information Transfer To The Host Computer D.Y D.S D.PCL D.NEXT D.Y D.S D.PCL D.NEXT y D.Y D.S D.PCL D.NEXT * \u00E2\u0080\u00A2 D.Y D.S D.PCL D.NEXT^ \u00E2\u0080\u0094y - \u00E2\u0080\u0094? Figure 13 Ring Buffer Data Structure for Information Transfer 15 14 13 12 10 9 4 3 0 T y p e PID Buffer Addre33 As A Physical 0 V i i i i i Page * I l i Figure 14 Encoding for Buffer Transfers 15 14 13 12 10 9 8 7 0 0 T y p e 1 i \u00C2\u00B0 PID 1 1 i C o n d i t o n V a l u e I I I i i i i Figure 15 Encoding for Error Condition Transfers There are two types of information that needs to be transferred to the host computer: 1. Process output buffers - as an experiment progresses, its buffer is fi l led with the collected data and must be copied to the host's memory. 2. Error condition signals - these are error conditions detected but which cannot be handled by FLOSY, and have to be conveyed to the host for possible error corrections. Some examples are memory parity error, missing user procedures, and undefined service requests. The error conditions are represented as one-byte integers with pre-defined meanings. Associa ted with the data transfer is a ring buffer data structure shown in Figure 13. Each buffer contains 3 information fields and a pointer to the next buffer. The last buffer points back to the first buffer. The two associated pointers are D.SB and D.NF; D.SB points to the first buffer which contains an encoded information item to be transferred; D.NF points to the next free buffer in the structure. Furthermore, two 1-word information encoding are defined as in Figures 14- & 15 where each encodes the information enough for the host computer to retrieve the proper information from the FEP memory. Initially the 3 fields of each buffer have symbol ic values DSDONE, DVDONE and NULL respectively, representing a null information. When either of the above two types of information is to be transferred, the appropriate information is encoded according to the formats defined and entered into both the D.V and D.S fields of the next free buffer element pointed at by D.NF. A L A M is raised (by setting bit 2 of the Interrupt Register of the C A M A C Crate interface) to indicate \"data ready\" to the host. The host computer polls for this L A M every 100 mill iseconds. When it detects the L A M , it clears the L A M and begins searching through the ring buffer structure starting at the element pointed at by the D.SB pointer. For each buffer element it finds where the D.V field is not a DVDONE word pattern, it transfers the information indicated by the encoded D.V field to the host. At the completion of each transfer, it writes a DVDONE pattern into the D.V field 40 and goes on to the next buffer element until it reaches one with the D.V field set to DVDONE. The D M A device is initiated when the type of information to be transferred is a user buffer. At each clock interrupt, FLOSY checks the D.V field of the buffer element pointed at by the D.SB pointer. If the DVDONE pattern is found, it queues a priority level 5 software interrupt. The associated interrupt handling procedure scans through the ring buffer structure starting at the element pointed at by the D.SB pointer. For each element which has the D.V field set to DVDONE, it looks at the D.S field to determine if it was a user buffer which had been transferred. If so, it returns the freed buffer page to the free memory pool . In either case, FLOSY re-init ializes all three fields in the buffer element (to mark it free), advances the D.SB pointer to the next buffer element and updates D.NITM, the number of items sti l l to be transferred. The procedure terminates when an element with D.V not equal to DVDONE is found or D.NITM is zero. 4.4.3 CAMAC Interrupt Management One main data structure in FLOSY remains to be described; it deals with the management of C A M A C interrupts for physics events. A s mentioned in Chapter 3, each interrupt from the C A M A C system signals a physics event occurrence, and is assoicated with a C A M A C module whose address, represented as an 8-bit B.GL value, is placed in an interface register. It is FLOSY's job to determine from the B.GL value the proper user procedure to invoke to handle the interrupt. FLOSY manages this by defining a 256-word array called S.PN; each entry in S.PN corresponds to a unique B.GL value. The array is initialized to zeros at system initialization time. A s each new process is loaded into the FEP, FLOSY scans through the per-process table, and for every procedure whose B.GL entry is non-zero, FLOSY enters the process ID and procedure number (encoded as an one-word integer) at the S.PN entry that corresponds to the B.GL value, thus reserving the B.GL value for the process. Later attempts to use the B.GL 41 value by another process wi l l cause an error signal to be sent to the host computer. Upon each C A M A C interrupt acknowledgment, the associated interrupt handling procedure retrieves the B.GL value from the interface register, uses it to retrieve the process ID and procedure number of the data acquisition procedure from the S.PN array, and transfers processor control to the proper process. 4.5 FLOSY Startup Procedure FLOSY itself is loaded into the FEP memory starting at physical address zero by a loader that resides in the host. Once it is loaded, the host issues a C A M A C command to the FEP which in turn triggers a Power Fail event in the STARBURST. The result is an interrupt sequence in an unmapped CPU through the vector location octal 24. The PC at this vector location is 'FLOSY' , the entry point to FLOSY. The instruction sequence at this location first disables all interrupts, then calls a series of initialization procedures which are necessary for proper operation. When the initialization procedure is completed, interrupts are enabled and FLOSY enters a wa i t - loop , i.e., it executes a wait instruction, which puts the processor in an idle wait state. It remains in this state until an interrupt occurs, and transfers control to the proper interrupt handling procedure. At the end of each interrupt, FLOSY returns to the idle-wait loop. 42 CHAPTER 5 IMPLEMENTATION FLOSY, as described in Chapter 4, has been implemented in PDP-11 M A C R O - 1 1 Assembler language. It comprises approximately 4500 lines of source code, including comments. The compiled code requires approximately 4 Kbyte of memory. A listing of the source code is included in Appendix 2, and is divided into the fol lowing 8 modules: 1. Memory Management (MM$) Module This module comprises the memory manager. It includes GET_PAGE and PUT_PAGE procedures (which manipulate the free memory pool) and other procedures which manipulate the memory management registers. 2. User Process Service (UPS$) Module The purpose of this module is to hide the details of interactions with a data acquisition process from the rest of the operating system. It includes routines which deal with tasks such as verifying the correctness of the per-process table and transferring control to the user process. 3. Timer Service (TS$) Module This module comprises all subroutines that deal with the real-time clock as described in section 4.3, including procedures that manage the timer queues. 4. C A M A C Crate Interrupt (CCI$) Module This module comprises routines that manipulate the C A M A C Crate Interface registers. 5. External Command Service (EIS$) Module There is one procedure to handle each of the commands from the host computer. Modules 4 and 5 together handle the host command processing. 6. Data Transfer Service (DTS$) Module This module comprises all procedures that manipulate the ring buffer associated with the information transfer from STARBURST to the host 43 computer. 7. System Crate Interface (SCI$) Module This module comprises all procedures that manipulate the system crate interface registers and the S.PN data structure (in managing the B.GL interrupts). 8. Interrupt Handling Service (IHS$) Module: A l l interrupt service procedures are grouped in this module. There is one interrupt service procedure for each possible interrupt and trap. To-date , simple experiments have been conducted to verify that the code included in Appendix 2 performs the expected functions. But due to the fact that the software development work on the host computer is not yet complete, no performance data are available. This is for future work on the project. 5,1 Future Enhancements A s the data acquisition is tested and used, development work is expected to continue on FLOSY. Some future enhencement anticipated for FLOSY are: 1. Time Limit For User Procedures: Currently when a user procedure takes control of the processor, it is allowed to execute to completion. This may cause potential problems when a procedure errorneously enters an infinite loop, thus holding up all experiments in the system. Due to the varied requirements of data acquisition procedures, it is difficult to impose a common time limit for all user procedures. A possibi l i ty for future implementation may be to have the user specify an upper limit on the time requirement for each procedure, and have FLOSY monitor the time used by each procedure, taking appropriate actions when the time limit is exceeded. 2. Run Time Library It is planned that FLOSY shall supply some commonly used subroutines such 44 as SINE, COSINE functions for user procedures. This may be implemented by loading the library routines at a fixed memory location, and allocate a virtual page in user code for library routines, which wil l be mapped to the physical location of the library procedure code at execution time. 3. TWOTRAN WRITE Output A WRITE statement is to be provided in the TWOTRAN language to dump various information from user procedures into a buffer location separate from the 8 Kbyte data buffer. The content of this second buffer wi l l then be transferred to the host computer on a per-WRITE basis. By defining a third information encoding format similar to those in Figures 14 and 15, the mechanism used for transferring experiment data buffer and error conditions to the host can be used for transferring this second buffer data item. Finally, the plan at TRIUMF is to install a number of data acquisition systems all organized in the fashion described in this thesis. Each data acquisition system wi l l have a front end processor running FLOSY. 45 References 1. Clout, P., \"A C A M A C Primer\", In-house document L A - U R - 8 2 - 2 7 1 8 , Los Alamos National Laboratory, Los Alamos , New Mexico 87545. 2. Comer, D., \"Operating System Design, The XINU Approach\", Prentice Hall , Inc., New Jersey. 3. Creative Electronic Systems, \"The User Manual for the CES 2180 Line of Units: STARBURST Fast Processors\", Document A C C 2180 family, ma Rev. 1.01. 4. Creative Electronic Systems, \"SCI 2280 Q22 - System Crate User's Manual\", Document SCI2280, ds Rev;1.00. 5. Digital Equipment Corporation, \"KDJ11-A CPU Module User's Guide\", E K - K D J 1 1 A - U G - P R E . 6. Digital Equipment Corporation, \"PDP-11 Architecture Handbook\", 1983-84. 7. Dijkstra, E.W., \"The Structure of the T H E ' Multiprogramming System\", Communications of the A C M , May 1968, 341-346. 8. Fisher Controls Data Sheet, \"Autonomous Memory Channel A M C - 1 1 \" , ECA211, A.2951-9. 9. Fisher Controls Data Sheet, \"Configuring C A M A C System Controllers\", ECA211, A.2951-1. 10. Fisher Controls Data Sheet, \"Executive Controllers MX-CTR-3 ,4 ,5 and 6\", ECA211, A.2951-2. \u00E2\u0080\u00A2 11. Fisher Controls Data Sheet, \"Fisher System Crate Philosophy\", ECA212, A.2951-22. 12. Fisher Controls Data Sheet, \"(Parallel) Branch Coupler, B R - C P R - 4 , B R - C P R - 4 - 1 \" , ECA211, A.2952-30. 13. Fisher Controls Data Sheet, \"PDP-11, V A X and LSI-11 Interface Type SI -11-2\" , ECA211, A.2951-23. 14. Mi les , T. and Satanove, A . , \"TRIUMF's Data Acquis i t ion System\", IEEE Transactions on Nuclear Science, V o l . NS-30 , No.5, October 1983, 3746-3749. 46 Appendix 1 Host-to-FEP Commands Command Name (Parameters) Hex Value Act ions To Be Taken by the FEP A L L O C A T E _ PROC_SLOT ( V A X Group#) 0001 Allocate 2 memory pages, create a descriptor for a new process, and enter the V A X Group# into the descriptor; return a process ID and the address of one of the two allocated memory pages to the host computer (the host wi l l load the process code into this page). START PROCESS (Pid 1) 0002 Initialize the descriptor and all necessary flags for the given process so that an experiment may begin; write a ' D A - S T A R T E D event' 2 into the output buffer. BEGIN RUN (Pid 1) 0003 Write a 'BEGIN-RUN event' 2 into the process output buffer; execute the user procedure 'BEGIN-RUN' which initializes the experiment hardware and enable L A M interrupts; begin executing all user timer procedures at appropriate intervals for the process. FLUSH (Pid 1) 0004 Queue the current output buffer for transfer to the host computer and allocate a new buffer for the process. USER_CMD (Pid 1) 0005 Write a ' S Y S T E M - U S E R - C M D event' to the process output buffer; execute the user procedure indicated in the command buffer. P A U S E RUN (P'd 1) 0006 Write a 'PAUSED event' 2 into the output buffer; execute the user-defined P A U S E procedure; temporarily stop processing BGL's and timer procedures for the process. CONTINUE_RUN (Pid 1) 0007 Write a 'SYSTEM-CONTINUE event' 2 into the output buffer; begin to accept BGL's for the process again; execute user procedure 'CONTINUE', which re-enables appropriate hardware and G L A M s , and al low the timer procedures to execute again. END_RUN (Pid 1) 0008 Execute the user procedure 'END_RUN' which disables the appropriate hardware and G L A M ' s . STOP_PROCESS (Pid 1) 000A Stop the indicated process regardless of its current state, and return the process to UNALLOCATED state; release all memory and the descriptor associated with the process. 47 Appendix 1 Host-to-FEP Commands (cont'd) Command Name (Parameters) Hex Value Act ions To Be Taken by the FEP G E T _ S T A T U S (Pid 1 or Zero) 000B Return status information about FLOSY and DA processes in the FEP such as time, date, FLOSY version number, number of active data acquisition processes, etc. SET_TIME OOOC Set the base value of the t ime-of -day clock maintained by FLOSY. SET_RUN_ NUMBER (Pid 1 , Run#) 000D Set the PCB.NR field of the process descriptor to the indicated value. SET_EVENTS (Pid\Event#) 000E Set the limit on the number of events to run for, for the given process to the given number; when this limits is reached, the process enters the 'ENDED' state. SET_SETUP (Pidi.value) 000F Set the SETUP value of the given process to be the given value. SET_ CONDITION (Pid^value) 0010 Set the CONDITION value of the given process to the indicated value. SET E X P E R I M E N T , NUMBER (Pid 1 , Exp#) 0012 Set the EXPERIMENT NUMBER of the process to the indicated value. Pid is an 8-bit unsigned integer Process ID assigned by FLOSY (as a reply to the A L L O C A T E _ P R O C E S S command) to a data acquisition process. \"Events\" referred to here are data structures written by FLOSY into the process output buffer; the data structure consists of an event length, event type, event number and several data words read from C A M A C modules associated with the event. 48 Appendix 2 - FLOSY Source Code 49 \u00E2\u0080\u00A2 t i t l e MAIN . p s e c t $ c o d e l , r w , i , l c l , r e l , c o n . i d e n t / O / . e n a b l e LC ************************************************** * * * * * * * * * * * * * * * * * * * * * \u00E2\u0080\u00A2j/m? FLOSY REAL TIME KERNAL * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * The FLOSY r e a l t i m e k e r n a l i s d e s i g n e d t o p r o v i d e a n e x e c u t i o n e n v i r o n m e n t f o r and manage t h e common r e q u i r e m e n t s o f d a t a a c q u i s i t i o n p r o c e s s e s p a r t i c i p a t i n g i n t h e V A X - b a s e d TRIUMF d a t a a c q u i s i t i o n and a n a l y s i s s y s t e m . * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * . page FEP$ d e s i g n p a r a m e t e r s . The c o n s t a n t s f o l l o w i n g c a n be m o d i f i e d , s u b j e c t t o t h e r e s t r i c t i o n s s t a t e d i n t h e comments a c c o m p a n y i n g e a c h p a r a m e t e r . These a r e g l o b a l c o n s t a n t s and a l t e r t h e memory r e q u i r e m e n t s o f t h e o p e r a t i n g s y s t e m . F$VERS F$NP 1 5 F$NPC ==: 256 , F$NT 2 0 . FLOSY VERSION NUMBER 1 9 8 6 - 1 0 - 0 1 E x t e r n a l r e p r e s e n t a t i o n o f t h e number o f p r o c e s s e s t h e FEP c a n e x e c u t e c o n c u r r e n t l y where 5 comes f r o m 5 * (1 c o d e page + 2 0 / P b u f f e r s ) = 15 E x t e r n a l r e p r e s e n t a t i o n o f t h e number o f p r o c e d u r e s s u p p o r t e d f o r e a c h p r o c e s s where t h e l i m i t o f 256 comes f r o m t h e memory a v a i l a l e t o e a c h p r o c e s s f o r i t s t a b l e s a n d c o d e . CHANGING THIS NUMBER INVOLVED CHANGING THE TWOTRAN COMPILER. E x t e r n a l r e p r e s e n t a t i o n o f t h e number o f t i m e r s s u p p o r t e d , i n t o t a l , by FLOSY f o r a l l DA P r o c e s s e s . . page FEP$ C o n d i t i o n V a l u e s y m b o l i c d e f i n i t i o n s . These a r e r e t u r n e d b y t h e s y n c h r o n o u s V A X / F E P c o m m a n d / r e p l y p r o t o c o l p r o v i d e d b y t h e E I S $ modu le and s i g n a l l e d b t t h e EMT i n s t r u c t i o n . F o r t h e l a t t e r u se t h e v a l u e s o f t h e s y m b o l s must be r e s t r i c t e d t o 8 - b i t s . CALALL ==:1. ; P r o c e s s s l o t a l r e a d y ALLOCATED. CALUNA ==:42. ; P r o c e s s s l o t a l r e a d y UNALLOCATED. CBADGL ==:2. ; B a d B . G L 50 CBDC ==: 4 3 . ; B a d CONDITION v a l u e . CBDIDL ==; 3 . ; Bad i n s e r t - d a t a - l e n g t h . CBDEN ==: 3 9 . ; Bad e x p e r i m e n t number . CBDET ==! 4 8 . ; Bad e v e n t T Y P E . CBDEV ==: 4 4 . ; Bad NUMBER EVENTS. CBDFPA ==: 4 . ; FPA e x c e p t i o n , H a l t i n g . CBDMMU ==; 2 9 . ; MMU e x c e p t i o n , H a l t i n g . CBDPID == 4 1 . , Bad P I D . CBDPQO == 3 0 . ; Bad PIRQ 0 i n t e r r u p t . CBDPQ1 == 3 1 . ; Bad PIRQ 1 i n t e r r u p t . CBDPQ2 == 3 2 . Bad PIRQ 2 i n t e r r u p t . CBDPQ3 == 3 3 . , Bad PIRQ 3 i n t e r r u p t . CBDPQ6 == 3 4 . ; Bad PIRQ 6 i n t e r r u p t . CBDPQ7 == 3 5 . , Bad PIRQ 7 i n t e r r u p t . CBDPVA == 4 7 . , Bad p r o c e d u r e V A . CBDRN == 4 5 . , Bad RUN NUMBER. CBDS == 4 6 . Bad SETUP. CBDST == . 6 . Bad p r o c e s s s t a t e CBDTIM == 3 7 . Bad t i m e r s e t t i n g . C B F F L == . 7 . B u f f e r s u c c e s s f u l l y f l u s h e d . CCPUER == : 8 . CPU e r r o r , h a l t i n g . CDPBGL == : 9 . D u p l i c a t e B . G L . CGLDSB == 1 0 . B . G L d i s a b l e d . C I L L I N == : 1 1 . \u00E2\u0080\u00A2 I l l e g a l i n s t r u c t i o n , h a l t i n g . C I N I T == : 1 2 . FEP i n i t i a l i z e d . CINVLD == : 1 3 . I n v a l i d command r e c e i v e d . CNBR == : 1 4 . [No BEGIN_RUN p r o c e d u r e CNC == : 1 5 . [No CONTINUE p r o c e d u r e CNDCM == : 1 6 . [No DO_COMMAND p r o c e d u r e CNER == : 1 7 . [No END_RUN p r o c e d u r e CNMPS == : 3 6 . ;No more p r o c e s s s l o t s . CNOPRC == : 1 8 . ;No p r o c e s s d e f i n e d f o r t h e i n d i c a t e d [ s l o t . CNOPRD == : 3 8 . [No s u c h p r o c e d u r e d e f i n e d . CNP == : 1 9 . ;No PAUSE p r o c e d u r e CNST == : 4 0 . (No MAIN p r o g r a m d e f i n e d . CPARER == : 2 0 . ; P a r i t y e r r o r , H a l t i n g . CPRALL == : 2 1 . [ P r o c e s s s l o t a l l o c a t e d . CPRDAL == : 2 2 . ; P r o c e s s s l o t d e a l l o c a t e d . C S L A L L == : 2 3 . [ P r o c e s s s l o t a l l o c a t e d . CSUCES == : 2 4 . [ S u c e s s f u l . CTRAP == : 2 8 . [TRAP i n s t r u c t i o n u s e d . CTMOUT == : 2 5 . [ T i m e o u t . CUNAGL == : 2 6 . [ U n a l l o c a t e d B . G L r e c i e v e d . CUNXIN == : 2 7 . [ U n e x p e c t e d i n t e r r u p t . \u00E2\u0080\u00A2 page FEP$ DA PROCESS STATES F$ALOC == : 1 . ;DA p r o c e s s ALLOCATED F$END == : 2 . ;DA p r o c e s s ENDED F$PAUS ==r : 3 . ;DA p r o c e s s PAUSED F$RUN == : 4 . [DA p r o c e s s RUNNING F$STRT == : 5 . ;DA p r o c e s s STARTED F$UNAL == : 6 . [DA p r o c e s s UNALLOCATED 51 FEP$ r e g i s t e r d e f i n i t i o n s i n t h e I / O p a g e . F$PIRQ \u00E2\u0080\u0094 : 1 7 7 7 7 2 ; A d d r e s s o f t h e C P U ' s PIRQ r e g i s t e r . F$PS ==:177776 ; A d d r e s s o f P r o c e s s o r S t a t u s w o r d . .page K e r n a l v i r t u a l page 0 i s u s e d by FLOSY f o r c o d e and d a t a s t r . ZERO = . : I N I T I A L I Z E THE POWERUP VECTOR TO ALLOW THE STARBURST TO BE STARTED BY A DATAWAY CAMAC COMMAND A ( 1 ) F ( 2 8 ) THAT SIMULATES A POWERUP CONDITION. .=ZERO+24 ;STARBURST CAMAC C r a t e p e r i p h e r a l i n t e r r u p t ; v e c t o r . . w o r d FLOSY ; S t a r t FLOSY i n i t i a l l y a t CPU p r i o r i t y 7 , t o \u00E2\u0080\u00A2word 340 [ h o l d o f f t h e c l o c k i n t e r r u p t u n t i l i n i t [ c o m p l e t e . . . * * * * * * SXACK STARTS AT 1000 * * * * * * * ; l O O O ( o c t a l ) b y t e s = 5 1 2 ( d e c ) by te s=256 words=128 i n t e r r u p t v e c t o r s . .page .=ZERO +1002 ; S t a r t a d d r e s s o f t h e d a t a s t r u c t u r e s , FEP$ The d a t a s t r u c t u r e FEP$COMMAND_BUFFER i s u sed b y t h e h o s t t o p a s s a command, t h e t a r g e t PID and a rgumen t s t o t h e FEP when i t r e q u e s t s s e r v i c e s . The s e r v i c e s a r e c a r r i e d o u t b y t h e E I S $ m o d u l e . C B . W C : : . w o r d 0 C r e a t e a one word f i e l d c o n t a i n i n g a command c o u n t e r . C B . C M D : : . w o r d 0 \ C r e a t e a one word f i e l d c o n t a i n i n g t h e FEP command. C B . P I D : : . w o r d 0 C r e a t e a one word f i e l d c o n t a i n i n g ; t h e t a r g e t DA p r o c e s s P I D . C B . L E N : : . w o r d 0 \u00E2\u0080\u00A2 C r e a t e a one word f i e l d c o n t a i n i n g t h e # o f words o f p a r a m e t e r s [ t o f o l l o w . C B . D A T : : . b l k w 20 \u00E2\u0080\u00A2 C r e a t e a 20 word f i e l d c o n t a i n i n g p a r a m e t e r s f r o m t h e VAX f o r t h e \u00E2\u0080\u00A2 c u r r e n t command. FEP$ The d a t a s t r u c t u r e FEP$REPLY_BUFFER i s u s e d b y FLOSY t o r e t u r n a c o n d i t i o n code f o r a p a r t i c u l a r h o s t command, a n d p o s s i b l y d a t a , t o t h e C3 c o m p u t e r . The h o s t p o l l s t h e r e g i o n f o r r e p l i e s . R B . W C : : . w o r d 0 R B . C V : : . w o r d 0 R B . P I D : : . w o r d 0 R B . L E N : : . w o r d 0 C r e a t e a one word f i e l d c o n t a i n i n g a r e p l y c o u n t e r . C r e a t e a one word f i e l d c o n t a i n i n g t h e F E P ' s r e t u r n e d c o n d i t i o n v a l u e . C r e a t e a one word f i e l d c o n t a i n i n g t h e t a r g e t DA p r o c e s s P I D . C r e a t e a one word f i e l d c o n t a i n i n g t h e number o f words o f r e p l y d a t a f o l l o w i n g . 52 R B . D A T : : . b l k w 1 0 0 . ; C r e a t e a h u n d r e d word f i e l d c o n t a i n i n g ; d a t a f o r t h e VAX f rom t h e c u r r e n t ; command. . page DTS$ The d a t a s t r u c t u r e DTS$V_RING_BUFFER i s u s e d by t h e FLOSY DTS$ modu le and t h e h o s t S0I$ module t o ' q u e u e ' t h e \" f u l l \" b u f f e r s and c o n d i t i o n v a l u e s a w a i t i n g t r a n s f e r i n t o t h e h o s t c o m p u t e r , b y t h e h o s t . The d a t a s t r u c t u r e DTS$S_RING_BUFFER i s u s e d by t h e FLOSY DTS$ modu le as a c o p y o f t h e v a l u e l o a d e d i n t o t h e c o r r e s p o n d i n g e l e m e n t o f t h e DTS$V_RING_BUFFER. T h i s a l l o w s t h e h o s t t o o v e r w r i t e t h e v a l u e s t o r e d i n t h e DTS$V_RING_BUFFER w i t h o u t t h e DTS$ modu le l o s i n g t r a c k o f t h e \" f u l l \" b u f f e r s and c o n d i t i o n v a l u e s a w a i t i n g t r a n s f e r i n t o t h e h o s t , by t h e C3 c o m p u t e r . D$RBSZ ==:32. D . V : : . b l k w D$RBSZ D . S : : . b l k w D$RBSZ D . S B : : . w o r d 0 D . N F : : . w o r d D . N I T M : : . w o r d D . N E X T : : . b l k w D . P C L : : . b l k w 0 0 D$RBSZ D$RBSZ D R S $ K _ R I N G _ B U F F E R _ S I Z E . D e f i n e t h e s i z e o f t h e r i n g - b u f f e r s i n w o r d s . DTS$V_RING_BUFFER. A l l o c a t e room f o r more t h a n t h e t o t a l number o f 0 / P b u f f e r s t o l e a v e room f o r a number o f c o n d i t i o n v a l u e s . DTS$S_RING_BUFFER. A l l o c a t e room f o r more t h a n t h e t o t a l number o f 0 / P b u f f e r s t o l e a v e room f o r a number o f c o n d i t i o n v a l u e s . D T S $ S T I L L _ B U S Y . The p o i n t e r t o t h e \"head o f t h e q u e u e \" i n t h e r i n g b u f f e r . DTS$NEXT_FREE. The p o i n t e r t o t h e \"head o f q u e u e \" i n t h e r i n g b u f f e r s . DTS$NUMBER_ITEMS. The number o f i t e m s o n t h e o u t p u t \" q u e u e \" . DTS$NEXT_ELEMENT. A r r a y o f p o i n t e r s t o t h e n e x t b u f f e r a r o u n d t h e r i n g . D T S $ P C _ L 0 C A T I 0 N . The PC v a l u e o f t h e i n s t r u c t i o n t h a t o r i g i n a l l y r e q u e s t e d t h e o u t p u t v i a T R A P , EMT o r I O T . T h i s i s r e a d by t h e V A X . . page FEP$ S u n d r y g l o b a l v a r i a b l e s o f t h e o p e r a t i n g s y s t e m . F . L P R C : : . w o r d 0 F . N P S : : . w o r d 0 C o n t a i n s t h e number o f t h e l a s t p r o c e s s i n v o k e d by any i n t e r r u p t . The number o f p r o c e s s e s c u r r e n t l y a l l o c a t e d - s l o t s . FEP$ The P r o c e s s e s C o n t r o l B l o c k . 53 P C B . B C : \u00E2\u0080\u00A2 b l k w F$NP ; BUFFER_COUNT i e number o f 0 / P b u f f e r s o u t p u t has been r e q u e s t e d f o r . P C B . B F : . b l k w F$NP ; O / P - B U F F E R - P A G E PHYSICAL BLOCK NUMBER. P C B . C C : : . b l k w F$NP ; C u r r e n t CONDITION v a l u e . P C B . C D : . b l k w F$NP ; CODE-PAGE PHYSICAL BLOCK NUMBER. P C B . C R : . b l k w F$NP , C u r r e n t RUN NUMBER. P C B . C S : . b l k w F$NP , C u r r e n t SETUP v a l u e . P C B . E N : \u00E2\u0080\u00A2 b l k w F$NP EXPERIMENT-NUMBER. P C B . G N . b l k w F$NP VAX-GROUP-NUMBER o f t h e o w n i n g p a r t i t i o n . P C B . N C . b l k w F$NP , N e x t CONDITION v a l u e . P C B . N A . b l k w F$NP ACQUIRED NUMBER OF EVENTS l o w o r d e r P C B . N B \u00E2\u0080\u00A2 b l k w F$NP w o r d and h i g h o r d e r w o r d . P C B . N L . b l k w F$NP L I M I T NUMBER OF EVENTS l o w o r d e r word P C B . N H . b l k w F$NP and h i g h o r d e r w o r d . PCB.NR . b l k w F$NP \u00E2\u0080\u00A2Next RUN NUMBER. P C B . N S . b l k w F$NP N e x t SETUP v a l u e . P C B . S T \u00E2\u0080\u00A2 b l k w F$NP ,DA p r o c e s s - s l o t STATUS. P C B . B : . b l k w F$NP [Number o f a c t i v e B G L ' s . P C B . T : . b l k w F$NP [Number o f a c t i v e t i m e r s . P C B . L 1 . b l k w F$NP [ P r o c e s s l o a d t i m e (6 w o r d s ) . P C B . L 2 : . b l k w F$NP P C B . L 3 . b l k w F$NP P C B . L 4 . b l k w F$NP P C B . L 5 : . b l k w F$NP P C B . L 6 : . b l k w F$NP P C B . B 1 : . b l k w F$NP [ P r o c e s s BEGINRUN t i m e (6 w o r d s ) . P C B . B 2 : . b l k w F$NP P C B . B 3 : . b l k w F$NP P C B . B 4 : . b l k w F$NP P C B . B 5 : . b l k w F$NP P C B . B 6 i.blkw F$NP .page MM$ The d a t a s t r u c t u r e MM$BUFFER_POOL m a i n t a i n s a r e c o r d o f t h e p h y s i c a l pages i n t h e STARBURST t h a t a r e f r e e f o r u s e a s : - DA p r o c e s s ' s 0 / P b u f f e r s - o r f o r DA p r o c e s s c o d e p a g e s . The r e g i o n MPOOL i s u s e d as a s t a c k , e n d i n g a t t h e f l a g BEND, h a v i n g a s t a c k p o i n t e r o f MSP. ; ;FLOSY p r e a l l o c a t e s p h y s i c a l page 0 . M . P O O L : : . b l k w 1 5 . [ R e s e r v e s p a c e f o r t h e r e m a i n i n g 15 ; f r e e p a g e s . M . E N D : : . w o r d 0 ; M a r k t h e end o f t h e s t a c k s t r u c t u r e ; w i t h - 1 . M . S P : : . w o r d M.POOL ;The s t a c k p o i n t e r . SCI$ The d a t a s t r u c t u r e SCI$BGL_TABLE r e c o r d s t h e h a n d l e r p r o c e d u r e ID f o r e a c h o f t h e 256 p o s s i b l e B G L ' s . The a d d r e s s o f a BGL i n t h e t a b l e i s c a l c u l a t e d f r o m : ( ( b r a n c h * 3 2 ) + GL) * 2 0<= b r a n c h <=7, 1<= GL <=24 E a c h l o c a t i o n t h a t i s n o n - z e r o c o n t a i n s t h e p r o c e d u r e ID o f t h e . 54 h a n d l e r w h i c h has t h e one word f o r m : LSB = DA p r o c e s s P I D , MSB = p r o c e d u r e number i n t h e p r o c e s s . S . P N : : . b l k w 2 5 6 . ; C r e a t e a r e g i o n t o h o l d t h e 256 B . G L ; p r o c e d u r e I D ' S . S . N A C T : : . w o r d 0 ; T o t a l number o f a c t i v e b g l ' s . S . B G L : : . w o r d 0 ; S a v e d BGL v a l u e o f t h e l a s t BGL ; c a u s i n g a n i n t e r r u p t b y t h e SCI ; p e r i p h e r a l . . page TS$ The d a t a s t r u c t u r e TS$TIMER_TABLE m a i n t a i n s t h e queues a s s o c i a t e d w i t h t h e r e a l t i m e c l o c k . E n t r i e s a r e queued o n t o t h e t i m e r queue whenever a DA p r o c e s s r e q u i r e s a p r o c e d u r e t o be s c h e d u l e d on a p e r i o d i c b a s i s . T$NTMR ==: 2 * F$NT T$HEAD ==:T$NTMR T $ T A I L ==:T$NTMR + 2 T$HFRE ==:T$NTMR + 4 T$TFRE ==:T$NTMR + 6 T . N E X T : : . b l k w F$NT . b l k w 4 . T . P R E V : : . b l k w F$NT . b l k w 4 . T . P N : : . b l k w F$NT . b l k w 4 . T . D E L T : : . b l k w F$NT . b l k w 4 . T . A B D T : : . b l k w F$NT . b l k w 4 . T . C N T : : . w o r d 0 T . B T O D : : . b l k w 4 T . C L K L : : . w o r d 0 T . C L K H : : . w o r d 0 T . N A C T : : . w o r d 0 T . N F R E : : . w o r d 0 T . U F L G : : . w o r d 0 T . U T M R : : . w o r d 0 D e f i n e t h e maximum p o i n t e r v a l u e f o r a TID f r o m t h e max number o f t i m e r s t o s u p p o r t i n t o t a l . P o i n t e r t o t h e head o f t h e a c t i v e t i m e r Q and i t s t a i l . P o i n t e r t o t h e head o f t h e f r e e t i m e r Q and i t s t a i l . A r r a y o f p o i n t e r s t o t h e n e x t e l e m e n t o f t h e Q . Space f o r ' h e a d ' s and ' t a i l ' s . A r r a y o f p o i n t e r s t o t h e p r e v e l e m e n t o f t h e Q . Space f o r ' h e a d ' s and ' t a i l ' s . A r r a y c o n t a i n i n g t h e p r o c e d u r e number o f t h e t i m e r h a n d l e r ( i e . < p r o c e d u r e #, P I D > ) . Space f o r ' h e a d ' s and ' t a i l ' s . A r r a y c o n t a i n g t h e a c t i v e t i m e r Q d e l t a - t i m e Space f o r ' h e a d ' s and ' t a i l ' s . A r r a y c o n t a i n g t h e i n t i a l d e l t a - t i m e o f a t i m e r on t h e a c t i v e t i m e r Q . Space f o r ' h e a d ' s and ' t a i l ' s . The t i c k s - t o - q u a n t u m p r e s c a l e r . The 8 - b y t e V A X - f o r m a t b a s e - t i m e . The l o w o r d e r word o f t h e 10Hz d e l t a c l o c k and t h e h i g h o r d e r w o r d . Number o f t i m e r s on t h e a c t i v e t i m e r Q . Number o f e l e m e n t s on t h e f r e e t i m e r Q . ' U s e r - t i m e r s - a c t i v e ' f l a g . Coun t down t i m e r f o r t h e c u r r e n t t i m e r n o t y e t e x p i r e d . .page UPS$ The d a t a s t r u c t u r e UPS$SYSTEM_EVENT_STRUCTURE d e f i n e s t h e s t r u c t u r e 55 ; o f e v e n t s o u t p u t by t h e UPS$WRITE_SYSTEM_EVENT (UWSYEV) p r o c e d u r e . U . S Y E V : : ; S t a r t o f t h e s y s t e m - e v e n t ; c o n s t r u c t i o n b u f f e r . ;The EVENT.LENGTH ;The E V E N T . C L A S S and t h e E V E N T . T Y P E . ;The l o w o r d e r EVENT.EVENT_NUMBER. ;The h i g h o r d e r EVENT.EVENT_NUMBER. ; E V E N T . D A T A c o n t e n t s . ;Word L Of t h e FLOSY t i m e i n E V E N T . D A T A . T I M E ;Word 2 o f t h e FLOSY t i m e i n E V E N T . D A T A . T I M E ;Word 3 o f t h e FLOSY t i m e i n E V E N T . D A T A . T I M E ;Word 4 o f t h e FLOSY t i m e i n E V E N T . D A T A . T I M E ;Word 5 o f t h e FLOSY t i m e i n E V E N T . D A T A . T I M E ;Word 6 Of t h e FLOSY t i m e i n E V E N T . D A T A . T I M E U . L E N : : . w o r d U . C T : : . w o r d U . E N L : : . w o r d U . E N H : : . w o r d 0 0 0 0 U D . T M 1 : : . w o r d U D . T M 2 : : . w o r d U D . T M 3 : : . w o r d U D . T M 4 : : . w o r d U D . T M 5 : : . w o r d U D . T M 6 : : . w o r d 0 0 0 0 0 0 \u00E2\u0080\u00A2 page . t i t l e IHS$ ******************************************** * * * * * * * * * * * * * * * * * * * * INTERRUPT HANDLING MODULE * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * IHS i s t h e I n t e r r u p t H a n d l i n g M o d u l e IHS$ f o r t h e FLOSY o p e r a t i n g s y s t e m . E a c h e n t r y p o i n t ( e x c e p t I H S I N I ) i s ' c a l l e d ' ( e . f i e l d e d ) by t h e P D P - 1 1 INTERRUPT mechan i sm whenever t h e e x t e r n a l - d e v i c e ' s h a r d w a r e i n t e r r u p t p r i o r i t y and t h e C P U ' s i n t e r n a l p r i o r i t y a r e p r o p e r l y r e l a t e d , o r by TRAP o r ABORT c o n d i t i o n s . FLOSY was w r i t t e n w i t h t h e f o l l o w i n g f i x e d I P L a s s i n g m e n t s : - 6 : F o r t h e r e a l t i m e c l o c k . T h i s i s n o t l a t c h e d and c a n t h e r e f o r e be m i s s e d i f t h e CPU p r i o r i t y r i s e s above 5 . - 5 : F o r t h e PIRQ l e v e l 5 i n t e r r u p t t h a t i n d i c a t e s t h a t a b u f f e r has b e e n s u c c e s s f u l l y t r a n s f e r e d t o t h e VAX c o m p u t e r . T h i s i s r a i s e d by t h e r e a l t i m e c l o c k h a n d l e r ( a b o v e ) . - 4 : a ) F o r t h e PIRQ l e v e l 4 i n t e r r u p t t h a t i n d i c a t e s a DA p r o c e s s t i m e r has c o m p l e t e d and r e q u i r e s s e r v i c i n g b y a DA p r o c e s s ' s p r o c e d u r e . b ) F o r t h e CAMAC p e r i p h e r a l t h a t i n d i c a t e s t h e VAX has l e f t a command f o r t h e E I S $ m o d u l e . c ) F o r t h e S y s t e m C r a t e I n t e r f a c e p e r i p h e r a l t h a t i n d i c a t e s t h a t a GLAM r e q u i r e s s e r v i c i n g b y a DA p r o c e s s ' s p r o c e d u r e . A c c e s s t o a n y d a t a s t r u c t u r e b y components o f FLOSY a r e s y n c h r o n i -z e d by r a i s i n g t h e CPU I P L t o a common s y n c h - I P L f o r t h e d a t a s t u c t u r e . The modu le c o m p r i s e s t h e f o l l o w i n g p r o c e d u r e s : - I H S I N I t o i n i t i a l i z e t h e i n t e r r u p t v e c t o r r e g i o n o f v i r t u a l a d d r . - IHSERR t o a c c e p t i n e t r r u p t s f r o m u n e x p e c t e d v e c t o r s . - IHS4 t o f i e l d t h e n o n - m a s k a b l e CPU e r r o r s . - IHS10 t o f i e l d i l l e g a l i n s t r u c t i o n t r a p s . - IHS14 t o f i e l d BPT i n s t r u c t i o n t r a p s . - IHS20 t o f i e l d IOT i n s t r u c t i o n t r a p s . 56 - IHS24 t o f i e l d t h e p o w e r f a i l t r a p s . - IHS30 t o f i e l d EMT i n s t r u c t i o n t r a p s . - IHS34 t o f i e l d TRAP i n s t r u c t i o n t r a p s . - IHS100 t o f i e l d t h e r e a l t i m e c l o c k i n t e r r u p t s . - IHS114 t o f i e l d t h e p a r i t y e r r o r i n t e r r u p t s . - IHS170 t o f i e l d t h e SCI p e r i p h e r a l i n t e r r u p t . - IHS240 t o f i e l d t h e P I R Q - r e g i s t e r i n t e r r u p t . - IHS244 t o f i e l d FPA e x c e p t i o n s . - IHS250 t o f i e l d MMU e x c e p t i o n s . - IHS360 t o f i e l d t h e CAMAC C r a t e p e r i p h e r a l i n t e r r u p t s . * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * I H S I N I i s t h e I H S $ I N I T I A L I Z E p r o c e d u r e T h i s p r o c e d u r e i n i t i a l i z e s t h e i n t e r r u p t h a n d l i n g v e c t o r s f o r t h e STARBURST a t s y s t e m s t a r t u p . The v e c t o r 24 i s i n i t i a l i z e d by a d a t a d e c l a r a t i o n a t t h e s t a r t o f FLOSY t o a l l o w s t a r t u p v i a an i n t e r r u p t g e n e r a t e d by t h e CAMAC p e r i p h e r a l . T h i s r o u t i n e s e t s up a l l v e c t o r s by s o f t w a r e i n c a s e t h e s y s t e m i s r e - i n i t i a l i z e d and t h e v e c t o r s need r e s e t t i n g . I H S I N I : 10$: c l r r 0 mov # I H S E R R , ( r 0 ) + mov # 3 4 0 , ( r 0 ) + cmp r 0 , # 7 0 0 b i t 10$ mov #IHS4,@#4 mov #340,@#6 mov #IHS10,@#10 mov #340,@#12 mov #IHS14,@#14 mov # 2 0 0 , \u00C2\u00A7 # 1 6 mov #IHS20,@#20 mov #240,@#22 mov #IHS24,@#24 mov #340, ) . I f B . G L u n a l l o c a t e d jump. D u p l i c a t e t h e p r o c e d u r e - I D i n t o R 5 . Ge t o n l y t h e PID i n t o RO. Move t h e p r o c e d u r e number i n t o t h e l o w b y t e . Ge t o n l y t h e p r o c e d u r e - n u m b e r i n R 5 . See i f t h e c u r r e n t DA p r o c e s s matches t h e one s e r v i c e i s r e q u e s t e d f o r . I f i t i s n o t t h e n jump t o map i t i n t o k e r n a l VA 66 25$: 20$: mov add adc mov j s r b c s j s r r t i s p l mov j s r s p l b r i n o p r d : EMT r t i i u n b g l : EMT j s r j s r r t i i b d b g l : EMT j s r r t i F . L P R C , r O # l , P C B . N A ( r O ) P C B . N B ( r O ) r 5 , r 0 p c , U C D A P i n o p r d p c , S E N I r O , F . L P R C pc ,MAPPRC 4 25$ CNOPRD CUNAGL p c , S D S B G L p c , S E N I CBADGL p c , S D S B G L p c , S E N I ; G e t t h e c u r r e n t DA p r o c e s s P I D . ; I n c 2 - w o r d # o f e v e n t s Ge t p r o c d - # ( i n i n t . f o r m a t ) t o e x e c u t e i n RO. C a l l t h e DA p r o c e s s ' s p r o c e d u r e . E x i t i n e r r o r E n a b l e S y s t e m C r a t e i n t e r r u p t s . and r e t u r n f rom t h e i n t e r r u p t . S e t I P L t o MM$ s y n c h v a l u e . S e t a new c u r r e n t - D A - p r o c e s s P I D . Map i t s c o d e - and O / P - b u f f e r p a g e s i n t o k e r n a l V A . R e s e t t h e I P L . R e t u r n t o t h e m a i n l i n e c o d e . S i g n a l 'No such p r o c e d u r e ' c o n d . c o d e . and r e t u r n f rom t h e i n t e r r u p t . S i g n a l ' U n a l l o c a t e d B . G L r e c e i v e d ' c o n d c o d e . A n i n t e r r u p t has o c c u r e d f rom a n u n a l l o c a t e d B . G L so d i s a b l e t h a t B . G L , E n a b l e Sys t em C r a t e i n t e r r u p t s . and r e t u r n f rom t h e i n t e r r u p t . S i g n a l ' U s e r d i d n o t r e s e t B . G L ' c o n d c o d e , The u s e r has n o t d i s a b l e d t h e B . G L c a u s i n g t h i s i n t e r r u p t so d i s a b l e t h a t B . G L . E n a b l e Sys t em C r a t e i n t e r r u p t s , and r e t u r n f r o m i n t e r r u p t . \u00E2\u0080\u00A2page IHS240 i s t h e IHS$HANDLE_240 p r o c e d u r e . T h i s p r o c e d u r e f i e l d s t h e P I R Q - r e g i s t e r t r a p . T h i s i n t e r r u p t i s r a i s e d b y h a r d w a r e a s a t r a p and f i e l d e d i n k e r n a l VA a t CPU p r i o r i t y 5 t h r o u g h v e c t o r 2 4 0 . T h i s i n t e r r u p t i s r a i s e d a t v a r y i n g h a r d w a r e p r i o r i t i e s d e p e n d i n g on t h e v a l u e i n t h e PIRQ r e g i s t e r . A n y h a r d w a r e p r i o r i t y be tween 1 a n d 5 c a n be s e l e c t e d b y t h e u s e r BUT NO HIGHER DUE TO THE CLOCK. I H S 2 4 0 : : m o v b @#F$PIRQ,@#F$PS S e t C P U - p r i o r i t y = P I R Q - p r i o r i t y (max 5) t o s i m u l a t e an i n t e r r u p t o f t h a t p r i o r i t y b y t h e h o s t . mov r 0 , - ( s p ) Save RO. mov r l , - ( s p ) Save R l . mov r 2 , - ( s p ) Save R 2 . mov r 3 , - ( s p ) \u00E2\u0080\u00A2Save R 3 . mov r 4 , - ( s p ) Save R 4 . mov r 5 , - ( s p ) ;Save R 5 . mov @#F$PIRQ,rO \u00E2\u0080\u00A2Get i n t e r r u p t p r i o r i t y r e g i s t e r b i c #177761, rO and mask o f f unwanted b i t s . b i c i b i t t b ( r O ) , @ # F $ P I R Q ; C l e a r t h e PIRQ p r i = 5 b i t t o j s r p c , @ i p r q t b ( r 0 ) mov ( s p ) + , r 5 ; c l e a r t h e i n t e r r u p t . [ C a l l i n t e r r u p t h a n d l e r s u b r o u t i n e . [ R e s t o r e R 5 . 67 i p r q t b : i b i t t b : mov ( s p ) + , r 4 ; R e s t o r e R 4 . mov ( s p ) + , r 3 , R e s t o r e R 3 . mov ( s p ) + , r 2 , R e s t o r e R 2 . mov ( s p ) + , r l R e s t o r e R l . mov ( s p ) + , r O , R e s t o r e R 0 , r t i and r e t u r n . PIRQ i n t e r r u p t h a n d l e r s . . w o r d IHERRO No p r i = 0 i n t e r r u p t h a n d l e r d e f i n e d . . w o r d IHERR1 No p r i = l i n t e r r u p t h a n d l e r d e f i n e d . . w o r d IHERR2 \u00E2\u0080\u00A2 No p r i = 2 i n t e r r u p t h a n d l e r d e f i n e d . . w o r d IHERR3 No p r i = 3 i n t e r r u p t h a n d l e r d e f i n e d . . w o r d IH2404 ; P r i = 4 i n t e r r u p t h a n d l e r d e f i n e d . . w o r d IH2405 ; P r i = 5 i n t e r r u p t h a n d l e r d e f i n e d . . w o r d IHERR6 ; No p r i = 6 i n t e r r u p t h a n d l e r d e f i n e d . . w o r d IHERR7 ; No p r i = 7 i n t e r r u p t h a n d l e r d e f i n e d . ;PIRQ mask b i t s . . w o r d 0 ; T h e r e a r e no p r i = 0 i n t e r r u p t s . . w o r d 1000 ; PIRQ p r i o = l i n t e r r u p t mask . \u00E2\u0080\u00A2 word 2000 ; PIRQ p r i o = 2 i n t e r r u p t mask . . w o r d 4000 ; PIRQ p r i o = 3 i n t e r r u p t mask . . w o r d 10000 ; PIRQ p r i o = 4 i n t e r r u p t mask . . w o r d 20000 ; PIRQ p r i o = 5 i n t e r r u p t mask . . w o r d 40000 ; PIRQ p r i o = 6 i n t e r r u p t mask . . w o r d 100000 PIRQ p r i o = 7 i n t e r r u p t mask . The IHERR p r o c e d u r e h a n d l e s a l l PIRQ i n t e r r u p t s f o r w h i c h no h a n d l e r p r o c e d u r e has been d e f i n e d . IHERRO: :EMT CBDPQ0 ; S i g n a l \" B a d PIRQ 0 i n t e r r u p t \" . r t s p c ; a n d r e t u r n . I H E R R I : :EMT CBDPQ1 ; S i g n a l \" B a d PIRQ 1 i n t e r r u p t \" . r t s p c ; a n d r e t u r n . I H E R R 2 : :EMT CBDPQ2 ; S i g n a l \" B a d PIRQ 2 i n t e r r u p t \" . r t s p c ; a n d r e t u r n . I H E R R 3 : :EMT CBDPQ3 ; S i g n a l \" B a d PIRQ 3 i n t e r r u p t \" . r t s p c ; a n d r e t u r n . I H E R R 6 : :EMT CBDPQ6 ; S i g n a l \" B a d PIRQ 6 i n t e r r u p t \" . r t s p c ; a n d r e t u r n . I H E R R 7 : :EMT CBDPQ7 ; S i g n a l \" B a d PIRQ 7 i n t e r r u p t \" . r t s p c ; a n d r e t u r n . The IH2404 p r o c e d u r e h a n d l e s an i n t e r r u p t t h r o u g h v e c t o r 2 4 0 , f o r t h e PIRQ r e g i s t e r . The i n t e r r u p t i s r a i s e d by t h e PIRQ r e g i s t e r a t h a r d w a r e p r i o r i t y 4 and f i e l d e d i n k e r n a l VA a t CPU p r i o r i t y 5 . Whereupon t h e s o f t w a r e s e t s t h e CPU p r i o r i t y t o 4 . The PIRQ p r i o = 4 s o f t w a r e i n t e r r u p t i s r e s e r v e d f o r t h e t i m e r s u p p o r t (TS$) m o d u l e . The i n t e r r u p t i n d i c a t e s t o FLOSY t h a t a DA p r o c e s s ' s t i m e r has e x p i r e d and r e q u i r e s s e r v i c i n g . I t i n t e r r u p t s no l o w e r p r i o r i t y c o d e t h a t u se s t h e g e n e r a l r e g i s t e r s e t z e r o , h e n c e none must be s a v e d . I H 2 4 0 4 : j s r p c , T A C T 0 ; A c c e p t t i m e r i n t and be r e t u r n e d t h e ; p r o c e d u r e - I D i n R0 ( i e . < p r o c - # , P I D > ) . mov r 0 , r 5 ; D u p l i c a t e t h e p r o c e d u r e - I D i n t o R 5 . movb r 0 , r 0 ; G e t o n l y t h e PID i n t o R 0 . 68 20$: 30$: swab r 5 ;Move t h e p r o c e d u r e number i n t o t h e l o w b y t e . movb r 5 , r 5 ; G e t o n l y t h e p r o c e d u r e - n u m b e r i n R 5 . cmp r O , F . L P R C ; S ee i f t h e c u r r e n t DA p r o c e s s ma tches t h e ; one s e r v i c e i s r e q u e s t e d f o r . b e q 20$ ; I f i t i s t h e n jump o v e r m a p p i n g i t i n t o ; k e r n a l V A . s p l 5 ; S e t I P L t o MM$ s y n c h v a l u e . mov r O , F . L P R C ; S e t a new c u r r e n t - D A - p r o c e s s P I D . j s r pc ,MAPPRC ;Map i t s c o d e - and O / P - b u f f e r pages ; i n t o k e r n a l V A . s p l 4 ; R e s e t t h e I P L . mov F . L P R C , r O ; G e t t h e c u r r e n t DA p r o c e s s P I D . add # l , P C B . N A ( r 0 ) ; I n c 2 - w o r d # o f e v e n t s adc P C B . N B ( r O ) mov r 5 , r 0 ; G e t t h e p r o c e d u r e # ( i n i n t e r n a l f o r m a t ) ; t o e x e c u t e i n RO. j s r p c , U C D A P ; C a l l t h e DA p r o c e s s ' s p r o c e d u r e . b c s 30$ ; E x i t i n e r r o r c l c ; C l e a r c a r r y f o r s u c c e s s r t s p c ; and r e t u r n . EMT CNOPRD ; S i g n a l 'No s u c h p r o c e d u r e 1 c o n d i t i o n c o d e . sec ; S e t c a r r y f o r f a i l u r e r t s p c ; and r e t u r n . The IH2405 p r o c e d u r e h a n d l e s an i n t e r r u p t t h r o u g h v e c t o r 2 4 0 , f o r t h e PIRQ r e g i s t e r . The i n t e r r u p t i s r a i s e d b y t h e PIRQ r e g i s t e r a t h a r d w a r e p r i o r i t y 5 and f i e l d e d i n k e r n a l VA a t CPU p r i o r i t y 5 . Whereupon t h e s o f t w a r e s e t s t h e CPU p r i o r i t y t o 5 . The PIRQ p r i o = 5 s o f t w a r e i n t e r r u p t i s r e s e r v e d f o r s u p p o r t i n g t h e d a t a t r a n s f e r s e r v i c e s (DTS$) m o d u l e . I t i n d i c a t e s t h e c o m p l e t i o n o f t h e p r o t o c o l i n v o l v e d i n t h e t r a n s f e r o f ' s i g n a l m e s s a g e s ' a n d \" f u l l \" b u f f e r s o f d a t a t o t h e h o s t . The i n t e r r u p t i n d i c a t e s t o FLOSY t h a t an 0 / P b u f f e r o r c o n d i t i o n message has been s u c c e s s f u l l y t r a n s f e r e d t o t h e h o s t and t h e b u f f e r s p a c e c a n now be d e a l l o c a t e d . T h i s p r o c e d u r e a p p e a r s t o l o o p n e e d l e s s l y , a s one e l e m e n t o f t h e queue s h o u l d be f r e e d up p e r i n t e r r u p t . . . b u t we may m i s s a n i n t e r r u p t somehow. I t i n t e r r u p t s l o w e r p r i o r i t y = 4 code t h a t u s e s t h e g e n e r a l r e g i s t e r s e t z e r o , h e n c e a l l r e g i s t e r s u s e d must be s a v e d . T h i s was done by t h e c a l l e r o f t h i s r o u t i n e , n a m e l y IHS$HANDLE_240 ( I H S 2 4 0 ) . The g e n e r a l r e g i s t e r s a r e u s e d a s f o l l o w s i n t h e p r o c e d u r e : R0 - C o n t a i n s t h e r e t u r n e d - b u f f e r p o i n t e r ( i f p r e s e n t ) e l s e 0 . I H 2 4 0 5 : j s r b c s t s t b e q j s r p c , D G E T B F 10$ rO IH2405 pc ,MPUTPG Get b a c k an e l e m e n t ( b u f f e r o r c o n d . c o d e ) f rom t h e o u t p u t queue t o t h e h o s t . I f t h e h o s t f o o l e d us o r t h e r e a r e no more e l e m e n t s o f t h e queue f i n i s h e d w i t h t h e n jump. Was a b u f f e r r e t u r n e d ( c o u l d be c o n d . code ) ? ? ? I f n o t t h e n l o o p t o see i f o t h e r e l e m e n t s a r e done w i t h . E l s e r e t u r n t h e b u f f e r - p o i n t e r t o MM$ 69 10$: b r r t s IH2405 p c t h a t was r e t u r n e d f rom DGETBF i n RO and l o o p b a c k t o see i f a n y o t h e r e l e m e n t s a r e done w i t h , and r e t u r n . .page IHS244 i s t h e IHS$HANDLE_244 p r o c e d u r e . T h i s p r o c e d u r e f i e l d s t h e F P A - e x c e p t i o n n o n - m a s k a b l e t r a p . T h i s i n t e r r u p t i s r a i s e d by h a r d w a r e a s a n o n - m a s k a b l e i n t e r r u p t and f i e l d e d i n k e r n a l VA a t CPU p r i o r i t y 7 t h r o u g h v e c t o r 2 4 4 . I H S 2 4 4 : : m o v mov mov mov mov mov mov sub mov mov j s r j s r* h a l t r 0 , - ( s p ) r l , - ( s p ) r 2 , - ( s p ) r 3 , - ( s p ) r 4 , - ( s p ) r 5 , - ( s p ) 1 2 . ( s p ) , r 2 # 2 , r 2 F . L P R C , r l #CBDFPA,rO pc ,DPUTMS p c , C G E N L M Save RO f o r e x a m i n a t i o n . Save R l . Save R 2 . Save R 3 . Save R 4 . Save R 5 . Copy p r e v i o u s P C i n t o R2 t a k i n g i n t o a c c o u n t t h a t R 0 - 5 have been s a v e d on t h e s t a c k . Ge t t h e P C o f t h e i l l e g a l i n s t r u c t i o n i n R 2 . Get t h e c u r r e n t PID i n R l . Ge t s i g n a l \" B a d FPA e x c e p t i o n , h a l t i n g \" i n RO. Send c o n d i t i o n v a l u e t o t h e h o s t . I f o u t p u t \" q u e u e \" f u l l t h e n i g n o r e i t . S e t LAM f o r h o s t t o \" s e e \" s i g n a l i s w a i t i n g H a l t C P U . IHS250 i s t h e IHS$HANDLE_250 p r o c e d u r e . T h i s p r o c e d u r e f i e l d s t h e M M U - e x c e p t i o n n o n - m a s k a b l e t r a p . T h i s i n t e r r u p t i s r a i s e d b y h a r d w a r e a s a n o n - m a s k a b l e i n t e r r u p t and f i e l d e d i n k e r n a l VA a t CPU p r i o r i t y 7 t h r o u g h v e c t o r 2 5 0 . I H S 2 5 0 : : m o v mov mov mov mov mov mov sub mov mov j s r j s r h a l t r 0 , - ( s p ) r l , - ( s p ) r 2 , - ( s p ) r 3 , - ( s p ) r 4 , - ( s p ) r 5 , - ( s p ) 1 2 . ( s p ) , r 2 # 2 , r 2 F . L P R C , r l #CBDMMU,r0 pc ,DPUTMS p c , C G E N L M Save RO f o r e x a m i n a t i o n . Save R l . Save R 2 . Save R 3 . Save R 4 . Save R 5 . Copy p r e v i o u s P C i n t o R2 t a k i n g i n t o a c c o u n t t h a t R 0 - 5 have been s a v e d on t h e s t a c k . G e t t h e P C o f t h e i l l e g a l i n s t r u c t i o n i n R 2 . Get t h e c u r r e n t PID i n R l . Ge t s i g n a l \" B A D MMU e x c e p t i o n , h a l t i n g \" i n RO. Send c o n d i t i o n v a l u e t o t h e h o s t . I f o u t p u t \" q u e u e \" f u l l t h e n i g n o r e i t . S e t LAM f o r h o s t t o \" s e e \" s i g n a l i s w a i t i n g H a l t C P U . 70 . page IHS360 i s t h e IHS$HANDLE_360 p r o c e d u r e . The IHS360 p r o c e d u r e f i e l d s t h e CAMAC C r a t e i n t e r r u p t . The i n t e r r u p t i s r a i s e d b y t h e CAMAC C r a t e p e r i p h e r a l a t h a r d w a r e p r i o r i t y 4 and f i e l d e d i n k e r n a l VA a t CPU p r i o . 4 t h r o u g h v e c t o r 360 As s u c h i t i n t e r r u p t s no l o w e r p r i o r i t y c o d e t h a t u se s t h e g e n e r a l r e g i s t e r s e t z e r o , hence none a r e s a v e d . IHS360 c a l l s t h e a p p r o p r i a t e E I S $ modu le p r o c e d u r e s . The g e n e r a l r e g i s t e r s a r e u s e d as f o l l o w s i n t h i s p r o c e d u r e : RO - c o n t a i n s t h e s y m b o l i c command I H S 3 6 0 : : j s r p c , C R E S E T ; R e s e t t h e CAMAC C r a t e p e r i p h i n t . mov # C I N V L D , R B . C V , S e t \" i n v a l i d c m d \" r e p l y c o n d v a l u e . mov C B . C M D , r 0 , Get h o s t command i n R 0 . b e q 10$ Command z e r o n o t a l l o w e d . cmp r 0 , # 1 8 . Compare w i t h maximum number o f commmands b h i 10$ I f g r e a t e r t h a n maximum t h e n e r r o r e x i t . mov #CBDPID,RB.CV S e t ' B a d P I D ' c o n d i t i o n v a l u e . b i c # 1 , C B . P I D , C l e a r b i t 1 a s a PID i s a l w a y s e v e n . cmp C B . P I D , # 2 * F $ N P , See i f t h e P ID i s t o o l a r g e . b h i s 10$ I f i t i s t h e n e r r o r e x i t . i n c CB.WC I n d i c a t e and a c c e p t e d t o t h e h o s t . mov # C I N V L D , R B . C V S e t \" i n v a l i d c m d \" r e p l y c o n d v a l u e . a s l rO Make rO i n t o an a r r a y o f f s e t , j s r p c , @ i c m d t b ( r 0 ) and c a l l E I S $ h a n d l e r s u b r . mov CB.WC,RB.WC I n d i c a t e r e p l y r e a d y t o t h e h o s t r t i and r e t u r n . 1 0 $ : c l r R B . L E N S e t z e r o - d a t a r e t u r n e d i n r e p l y . i n c CB.WC I n d i c a t e cmd r e a d , t o t h e h o s t . mov CB.WC,RB.WC I n d i c a t e r e p l y r e a d y t o h o s t . r t i E X I T I L L E G A L CMD WITHIN CMD-# RANGE. i e r r : mov C B . P I D , R B . P I D [Set t h e r e p l y P I D . c l r R B . L E N \u00E2\u0080\u00A2 R e t u r n z e r o d a t a r t s p c , and r e t u r n . Jump t a b l e f o r E I S $ modu le i n t e r f a c e . i c m d t b : . w o r d i e r r [Cmd 0 , I l l e g a l command. \u00E2\u0080\u00A2 word EALLOC [Cmd 1, EIS$ALLOCATE_PROC SLOT \u00E2\u0080\u00A2 word ESTRTP rCmd 2 , EIS$START_PROCESS . w o r d EBEGRN \u00E2\u0080\u00A2Cmd 3 , E I S $ B E G I N RUN . w o r d EFLUSH \u00E2\u0080\u00A2Cmd 4 , E I S $ F L U S H . w o r d EUSCMD [Cmd 5 , EIS$USER COMMAND \u00E2\u0080\u00A2 word EPAUSE [Cmd 6 , E IS$PAUSE RUN \u00E2\u0080\u00A2 word ECONT [Cmd 7 , EIS$CONTINUE_RUN \u00E2\u0080\u00A2 word EENDRN [Cmd 8, EIS$END_RUN . w o r d i e r r pCmd 9 , was EIS$DEALLOCATE PROC SLOT . w o r d ESTOPP [Cmd 1 0 , E I S $ S T 0 P PROCESS \u00E2\u0080\u00A2 word EGETST [Cmd 1 1 , EIS$GET STATUS \u00E2\u0080\u00A2 word ESETTM [Cmd 1 2 , E I S $ S E T TIME . w o r d ESETRN [Cmd 1 3 , E I S $ S E T RUN NUMBER . w o r d ESETEV [Cmd 14 , E I S $ S E T EVENTS . w o r d ESETS [Cmd 1 5 , EIS$SET_SETUP . w o r d ESETC [Cmd 1 6 , E I S $ S E T CONDITION \u00E2\u0080\u00A2 word i e r r [Cmd 1 7 , was EIS$RESTART OS \u00E2\u0080\u00A2 word ESETEN [Cmd 1 8 , E I S $ S E T EXPT_NUMBER \u00E2\u0080\u00A2 page . t i t l e CCI$ ********************************************* * * * * * * * * * * * * * * Qj^jflAC CRATE HANDLER * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * CCI$ i s t h e CAMAC C r a t e P e r i p h e r a l h a n d l e r M o d u l e f o r t h e FLOSY o p e r a t i n g s y s t e m . * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * C$FR C$SR C$IR ==:166000 ==:166002 ==:166004 ;164 000 t o 165 777 a r e 512 CAMAC F c o d e r e g s . p e r i p h e r a l ' s F u n c t i o n R e g i s t e r a d d r e s s . ; P e r i p h e r a l ' s S t a t u s R e g i s t e r a d d r e s s . ; P e r i p h e r a l ' s I n t e r r u p t R e g i s t e r a d d r e s s . C C I I N I i s t h e C C I $ I N I T I A L I Z E p r o c e d u r e . The p r o c e d u r e i n i t i a l i z e s t h e t h r e e c o n t r o l and s t a t u s r e g i s t e r s o f t h e CAMAC C r a t e p e r i p h e r a l . O n l y t h e i n t e r r u p t t h r o u g h v e c t o r 360 i s e n a b l e d and n o t t h o s e a t 3 4 0 , 3 4 4 , 3 5 0 , 3 5 4 , 3 6 4 , 3 7 0 a n d 3 7 4 . T h i s p e r i -p h e r a l a l w a y s i n t e r r u p t s a t h / w I P L = 4 . C C I I N I : : c l r c l r c l r mov c l c r t s @#C$FR @#C$SR @#C$IR ' #4000,@#C$IR p c ; C l e a r t h e F u n c t i o n r e g i s t e r . ; C l e a r t h e s t a t u s r e g i s t e r . ; D i s a b l e a l l 8 p o s s i b l e i n t e r r u p t s . ; E n a b l e o n l y t h e CAMAC da t away i n t e r r u p t ; ( B I T 1 1 ) a t v e c t o r 360 i e . A ( 1 ) F ( 2 5 ) . ; C l e a r c a r r y f o r s u c c e s s . ; R e t u r n CRESET i s t h e CCI$RESET p r o c e d u r e The p r o c e d u r e r e s e t s t h e A ( 1 ) F ( 2 5 ) CAMAC C r a t e i n t e r r u p t i n t h e CAMAC C r a t e p e r i p h e r a l . C R E S E T : : b i s c l c r t s # 1 0 , \u00C2\u00A7 # C $ I R p c S e t b i t 3 t o r e s e t t h e ' d a t a w a y ' i n t e r r u p t . C l e a r c a r r y f o r s u c c e s s , a n d r e t u r n . CGENLM i s t h e CCI$GENERATE_LAM p r o c e d u r e The p r o c e d u r e s e t s t h e STARBURST L A M . C G E N L M : : b i s c l c r t s #4,@#C$IR p c ; S e t t h e STARBURST's own L A M . T h i s must be ; c l e a r e d b y t h e h o s t when i t s e r v i c e s t h e LAM ; C l e a r c a r r y f o r s u c c e s s . ; R e t u r n . . page . t i t l e DTS$ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * nATA TRANSFER MODULE * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * DTS$ i s t h e d a t a t r a n s f e r s e r v i c e s modu le f o r F L O S Y . The module p r o v i d e s s e r v i c e s f o r t h e t r a n s f e r o f f u l l d a t a - b u f f e r s , s i g n a l s and WRITE r e c o r d s t o t h e h o s t . The modu le c o m p r i s e s t h e f o l l o w i n g p r o c e d u r e s : 72 - D T S I N I t o i n i t i a l i z e t h e modu le d a t a s t r u c t u r e s . - DPUTBF t o t r a n s f e r a \" f u l l \" b u f f e r t o t h e h o s t . - DPUTMS t o t r a n s f e r a c o n d i t i o n v a l u e t o t h e h o s t . - DPUTWR t o t r a n s f e r a TWOTRAN WRITE r e c o r d t o t h e h o s t . - DGETBF t o r e t u r n a n \" e m p t y \" b u f f e r f r o m t h e h o s t f o l l o w i n g a ' d o n e ' i n t e r r u p t b y t h e h o s t . - DTSFRK t o c r e a t e a PIRQ l e v e l 5 i n t e r r u p t i f c o m p l e t e d e l e m e n t s a r e f o u n d on t h e o u t p u t q u e u e . ,****************************************** ,******************************************** D$SDNE ==:177776 D$VDNE ==:177777 DRS$K_STARBURST_DONE. B i t p a t t e r n , t h a t i n d i c a t e s t h e STARBURST has r e c e i v e d b a c k t h e empty b u f f e r f r o m t h e h o s t , i n t h e r i n g b u f f e r s . DRS$K_VAX_D0NE. b i t p a t t e r n , t h a t i n d i c a t e s t h e VAX has s u c c e s s f u l l y t r a n s f e r e d t h e \" f u l l \" b u f f e r f r o m t h e r i n g b u f f e r i n t o t h e h o s t c o m p u t e r , i n t h e r i n g b u f f e r . DTSINI i s t h e D T S $ I N I T I A L I Z E p r o c e d u r e . T h i s p r o c e d u r e i n i t i a l i z e s t h e d a t a s t r u c t u r e u s e d by t h e m o d u l e . D T S I N I : 1 0 $ : I t i s o n l y c a l l e d a t FLOSY i n i t t i m e . I n i t i a l i z e t h e d / s . c l r D . S B S e t DTS$STILL_BUSY p o i n t e r t o z e r o c l r D . N F , S e t DTS$NEXT_FREE p o i n t e r .to z e r o . c l r D . N I T M Z e r o DTS$NUMBER_ITEMS, t h e c u r r e n t # o f i t e m s on t h e o u t p u t \" q u e u e \" . mov # D $ R B S Z - l , r 0 , S e t t h e l o o p c o u n t e r o v e r e v e r y w o r d . a s l r 0 \u00E2\u0080\u00A2Doub le i t t o make t h e number o f b y t e s . mov r 0 , r l Save t h i s number f o r l a t e r . mov # D $ S D N E , D . V ( r 0 ) r S e t D T S $ V . . . r i n g b u f f e r e l e m e n t t o ; DTS$K STARBURST DONE c l r D . P C L ( r O ) \u00E2\u0080\u00A2 C l e a r D T S $ P C _ L 0 C A T I 0 N . mov # D $ S D N E , D . S ( r 0 ) ;Se t D T S $ S . . . r i n g b u f f e r e l e m e n t t o ; DTS$K_STARBURST_DONE mov r 0 , D . N E X T ( r 0 ) \u00E2\u0080\u00A2Set t h e DTS$NEXT_ELEMENT t o p o i n t t o a d d # 2 , D . N E X T ( r O ) ; t h e n e x t e l e m e n t o f t h e r i n g b u f f e r ; s t r u c t u r e . sub # 2 , r 0 ;Decrement t h e b y t e c o u n t e r by two bge 10$ ; and l o o p i f z e r o has been d o n e . c l r D . N E X T ( r l ) ; F i x up t h e t o p e l emen t o f DTS$NEXT_ELEMENT ; a r r a y , t o make i t i n t o a r i n g o f p o i n t e r s c l c [ C l e a r c a r r y f o r s u c c e s s . r t s p c ( E X I T . DPUTBF i s t h e DTS$PUT_BUFFER p r o c e d u r e . T h i s p r o c e d u r e p l a c e s an e l e m e n t i n t o an o u t p u t r i n g b u f f e r t h a t r e p r e s e n t s a \" f u l l \" b u f f e r o f a DA p r o c e s s . T h e s e \" f u l l \" b u f f e r s a w a i t T r a n s f e r t o t h e h o s t by t h e h o s t . D P U T B F : : c m p D.NITM,#D$RBSZ ;See i f t h e r i n g - b u f f e r i s f u l l , b h i s 10$ ; I f i t i s t h e n jump. 73 i n c D . N I T M | E l s e i n c r e m e n t t h e number o f i t e m s on t h e o u t p u t \" q u e u e . b i c #174177, rO , L e a v e o n l y t h e 4 - b i t p h y s i c a l - p a g e # f r o m t h e MM$ p o i n t e r . a s h # - 7 . , r 0 S h i f t t h e page-# r i g h t b y 7 b i t s . b i c # 1 7 7 7 7 0 , r l , L e a v e o n l y t h e 3 - b i t P I D . a s h # 1 0 . , r l S h i f t t h e PID l e f t by 10 b i t s . b i s r O , r l Combine t h e two b i t - p a t t e r n s i n R l b i s # 0 2 0 0 0 0 , r l S e t t h e e l e m e n t - t y p e t o B U F F E R - O / P . mov D . N F , r O Ge t t h e NEXT_FREE p o i n t e r . mov r l , D . S ( r O ) P l a c e t h e combined b i t - p a t t e r n i n t o D T S $ S _ . mov r l , D . V ( r O ) and DTS$V_RING_BUFFER a t t h e DTS$NEXT_FREE ; e l e m e n t . mov r 2 , D . P C L ( r O ) \u00E2\u0080\u00A2 S t o r e t h e c a l l e r s P C . mov D . N E X T ( r O ) , D . N F [Advance t h e DTS$NEXT_FREE p o i n t e r \u00E2\u0080\u00A2 a r o u n d t h e r i n g . c l c [ C l e a r c a r r y f o r s u c c e s s r t s p c ; and e x i t . s ec [Set c a r r y f o r f a i l u r e r t s p c [ and e x i t . DPUTMS i s t h e DTS$PUT_MESSAGE p r o c e d u r e . T h i s p r o c e d u r e p l a c e s an e l e m e n t i n t o an o u t p u t r i n g b u f f e r t h a t r e p r e s e n t s t h e s i g n a l l e d c o n d i t i o n v a l u e o f a DA p r o c e s s . These c o n d i t i o n v a l u e s a w a i t t r a n s f e r t o t h e h o s t b y t h e h o s t . DPUTMS: :cmp D.NITM,#D$RBSZ See i f t h e r i n g - b u f f e r i s f u l l . b h i s 10$ I f i t i s t h e n jump. i n c D . N I T M , E l s e i n c r e m e n t t h e number o f i t e m s o n t h e o u t p u t \" q u e u e . b i c #177400 , rO L e a v e o n l y t h e 8 - b i t c o n d i t i o n v a l u e . b i c # 1 7 7 7 7 0 , r l \u00E2\u0080\u00A2Leave o n l y t h e 3 - b i t P I D . a s h # 1 0 . , r l \u00E2\u0080\u00A2 S h i f t t h e P ID l e f t b y 10 b i t s . b i s r 0 , r l \u00E2\u0080\u00A2Combine t h e two b i t - p a t t e r n s i n R l . b i s # 0 4 0 0 0 0 , r l S e t t h e e l e m e n t - t y p e t o S I G N A L . mov D . N F , r 0 Ge t t h e NEXT_FREE p o i n t e r . mov r l , D . S ( r 0 ) [ P l a c e t h e c o m b i n e d b i t - p a t t e r n i n t o D T S $ S _ . mov r l , D . V ( r 0 ) [ and DTS$V_RING_BUFFER a t N E X T _ F R E E . mov r 2 , D . P C L ( r 0 ) \u00E2\u0080\u00A2 S t o r e t h e c a l l e r s P C . mov D . N E X T ( r 0 ) , D . NF [Advance t h e NEXT_FREE p t r . a r o u n d t h e r i n g . c l c [ C l e a r c a r r y f o r s u c c e s s r t s p c ; and e x i t . 1 0 $ : sec [Se t c a r r y f o r f a i l u r e r t s p c [ and e x i t . DPUTWR i s t h e DTS$PUT_WRITE_RECORD p r o c e d u r e . T h i s p r o c e d u r e p l a c e s an e l e m e n t i n t o an o u t p u t r i n g b u f f e r t h a t r e p r e s e n t s t h e v a l u e o f an a d d r e s s o f a r e c o r d o f d a t a c r e a t e d i n a DA p r o c e s s ' s W R I T E - b u f f e r by a TWOTRAN WRITE s t a t e m e n t . The r e c o r d a w a i t s t r a n s f e r t o t h e h o s t by t h e h o s t . DPUTWR::cmp D.NITM,#D$RBSZ [See i f t h e r i n g - b u f f e r i s f u l l , b h i s 10$ [ I f . i t i s t h e n jump. i n c D . N I T M ; E l s e i n c r e m e n t t h e number o f i t e m s o n t h e 74 10$: o u t p u t \" q u e u e . b i c #177400, rO , L e a v e o n l y t h e 8 - b i t w r i t e - r e c o r d a d d r e s s . b i c # 1 7 7 7 7 0 , r l L e a v e o n l y t h e 3 - b i t P I D . a s h # 1 0 . , r l \u00E2\u0080\u00A2 S h i f t t h e P ID l e f t b y 10 b i t s . b i s r O , r l Combine t h e two b i t - p a t t e r n s i n R l . b i s # 0 6 0 0 0 0 , r l S e t t h e e l e m e n t - t y p e t o WRITE-RECORD. mov D . N F , r 0 Ge t t h e NEXT_FREE p t r . . mov r l , D . S ( r O ) P l a c e t h e combined b i t - p a t t e r n i n t o D T S $ S _ . mov r l , D . V ( r O ) \u00E2\u0080\u00A2 and DTS$V_RING_BUFFER a t N E X T _ F R E E . mov r 2 , D . P C L ( r O ) ; S t o r e t h e c a l l e r s P C . mov D . N E X T ( r O ) , D . N F ;Advance t h e NEXT_FREE p t r . a r o u n d t h e r i n g . c l c \u00E2\u0080\u00A2 C l e a r c a r r y f o r s u c c e s s r t s p c f and e x i t . s ec ;Se t c a r r y f o r f a i l u r e r t s p c ; and e x i t . DGETBF i s t h e DTS$GET_BUFFER p r o c e d u r e . T h i s p r o c e d u r e r e t r i e v e s e l e m e n t s f r o m t h e queue o f o u t g o i n g \" f u l l \" b u f f e r s o r s i g n a l l e d c o n d i t i o n v a l u e s . O n l y b u f f e r - p t r . s ( a s r e q u i r e d b y t h e MM$ p r o c e d u r e s a r e r e t u r n e d , v a l u e s f o r c o n d i t i o n - v a l u e s o r t h e P I D o f t h e s e n d i n g DA p r o c e s s ( o r FLOSY) a r e n o t r e t u r n e d ( b u t c o u l d b e ) . D G E T B F : : m o v cmp bne d e c c l r mov b i t bne b i t b e q b i c a s h mov 2 0 $ : mov mov c l r mov . c l c r t s 1 0 $ : sec r t s D . S B , r l D . V ( r l ) , # D $ V D N E 10$ D . N I T M rO D . S ( r l ) , r 2 #40000 , r2 20$ #20000 , r2 20$ #177760 , r2 # 7 , r 2 r 2 , r 0 # D $ S D N E , D . S ( r l ) # D $ S D N E , D . V ( r l ) D . P C L ( r l ) D . N E X T ( r l ) , D . S B p c p c Ge t DTS$STILL_BUSY p t r . . I f D T S $ V . . . e l emen t v a l u e i s n o t DTS$K_VAX_D0NE t h e n b r a n c h i n e r r o r as t h e h o s t f o o l e d us i n t o t h i n k i n g i t had f r e e d up an e l e m e n t o r t h i s r o u t i n e was c a l l e d t o o many t i m e s . D e c r e a s e t h e number o f i t e m s on o u t p u t Q . S e t ' r e t u r n e d b u f f e r number ' t o 0 . Ge t t h e o r i g i n a l v a l u e o f t h e e l emen t j u s t s e n t I f e l e m e n t n o t o f t y p e BUFFER t h e n jump o u t . L e a v e o n l y t h e page number Make i t i n t o a MM$ p t r . and r e t u r n M M $ - p t r . i n R 0 . S e t e l e m e n t i n D T S $ S _ . . . t o DTS $ K_STARBURST_D0NE. S e t e l e m e n t i n D T S $ V _ . . . t o DTS $ K_STARBURST_DONE. C l e a r t h e P C v a l u e , t o be t i d y . A d v a n c e . t h e S T I L L _ B U S Y p t r . i n t h e r i n g f o r t h e h o s t t o s e e . C l e a r c a r r y f o r s u c c e s s and e x i t . S e t c a r r y f o r f a i l u r e a n d e x i t . DTSFRK i s t h e DTS$F0RK_PR0CESS p r o c e d u r e . T h i s p r o c e d u r e c r e a t e s a f o r k p r o c e s s a t PIRQ=5 i f f e l e m e n t s a r e f o u n d o n t h e o u t p u t r i n g - b u f f e r \" q u e u e \" t h a t have been c o m p l e t e d b y t h e 75 h o s t . T h i s p r o c e d u r e i s ONLY c a l l e d b y t h e c l o c k i n t e r r u p t h a n d l e r r o u t i n e IHS$HANDLE 100 a t I P L = 6 . D T S F R K : : m o v mov cmp bne b i s 5 $ : mov c l c r t s 1 0 $ : t s t b e q mov s e c r t s r 5 , - ( s p ) D . S B , r 5 D . V ( r 5 ) , # D $ V D N E 10$ #20000,@#F$PIRQ ( s p ) + , r 5 pc D . N I T M 5$ ( s p ) + , r 5 p c Save R 5 . Ge t t h e DTS$STILL_BUSY p t r . . See i f t h i s e l emen t o f t h e DTS$V_RING_BUFFER i s c o m p l e t e . I f n o t c o m p l e t e t h e n b r a n c h . E l s e some a r e c o m p l e t e so r e q u e s t a f o r k p r o c . R e s t o r e R 5 . C l e a r c a r r y f o r s u c c e s s ( i e a f o r k p r o c . ) and r e t u r n . See i f t h e r e a r e a n y e l e m e n t s o n t h e queue . I f none t h e n r e t u r n s u c c e s s f u l l y . E l s e r e s t o r e R 5 . S e t c a r r y f o r f a i l u r e ( i e . some l e f t ) and r e t u r n . . page . t i t l e E I S $ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * EXTERNAL COMMAND SERVICES * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * E I S $ i s t h e E x t e r n a l C o m m a n d - h a n d l i n g S e r v i c e s module f o r t h e FLOSY o p e r a t i n g s y s t e m . P r o c e d u r e s i n t h e modu le a r e a l l c a l l e d by t h e IHS$HANDLE_360 p r o c e d u r e i n r e s p o n s e t o a n i n t e r r u p t t h r o u g h v e c t o r - 3 6 0 c a u s e d by t h e h o s t s e n d i n g an A ( 1 ) F ( 2 5 ) command t o t h e STARBURST. The h o s t r e q u e s t i s s t o r e d i n t h e FEP$COMMAND_BUFFER d a t a s t r u c t u r e and t h e r e p l y f r o m t h e E I S $ p r o c e d u r e s i s r e t u r n e d i n t h e F E P $ R E P L Y _ B U F F E R . The module c o m p r i s e s t h e f o l l o w i n g p r o c e d u r e s : - EALLOC t o a l l o c a t e a s i n g l e p r o c e s s s l o t . - ESTRTP t o s t a r t a p r o c e s s . - EBEGRN t o b e g i n a r u n f o r a p r o c e s s . \" - EFLUSH t o f l u s h t h e c u r r e n t 0 / P b u f f e r . - EUSCMD t o e x e c u t e a u s e r - r e q u e s t e d p r o c e d u r e . - EPAUSE t o p a u s e a r u n f o r a p r o c e s s . - ECONT t o c o n t i n u e a r u n f o r a p r o c e s s . - EENDRN t o end a r u n f o r a p r o c e s s . - ESTOPP t o s t o p a r u n f o r a p r o c e s s . - EGETST t o r e t u r n t h e s t a t u s o f FLOSY o r a p r o c e s . - ESETTM t o s e t t h e FLOSY t i m e . - ESETRN t o s e t t h e n e x t r u n number f o r a p r o c e s . - ESETEV t o s e t t h e number o f e v e n t s f o r a p r o c e s . - ESETS t o s e t t h e n e x t SETUP v a l u e f o r a p r o c e s . - ESETC t o s e t t h e n e x t CONDITION v a l u e f o r a p r o c e s . - ESETEN t o s e t t h e n e x t e x p t . number v a l u e f o r a p r o c e s . * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 1 EALLOC i s t h e EIS$ALLOCATE_PROC_SLOT p r o c e d u r e . T h i s p r o c e d u r e a l l o c a t e s a p r o c e s s s l o t t o a DA p r o c e s s i f room r e m a i n s i n t h e P C B . T h i s p r o c e d u r e w o r k s i n d e p e n d a n t l y o f t h e C B . P I D r e q u e s t i n g t h e s e r v i c e . The p r o c e d u r e : 76 - a l l o c a t e a p h y s i c a l page f o r t h e p r o c e s s ' s d e d i c a t e d 0 / P b u f f e r . - a l l o c a t e a p h y s i c a l page f o r t h e e x p e c t e d D A - p r o c e s s c o d e , - p a r t i a l l b u i l d s a new PCB f o r t h e p r o c e s s - r e t u r n s t h e p h y s i c a l b l o c k number o f t h e c o d e page t o h o s t - s e t s t h e p r o c e s s t a t e t o ALLOCATED. 10$: 20$ : E A L L O C : : m o v c l r c l r mov cmp b h i s c l r mov cmp b e q add sob b r , s p l j s r s p l b c s mov s p l j s r s p l b c s mov mov mov i n c mov mov mov mov s p l mov j s r s p l j s r 30$: r 5 , - ( s p ) R B . P I D R B . L E N #CNMPS,RB.CV F . N P S , # F $ N P 99$ r 5 # F $ N P , r 0 P C B . S T ( r 5 ) , # F $ U N A L 20$ # 2 , r 5 r 0 , 1 0 $ 99$ pc ,MGETPG 4 20$ r 0 , P C B . B F ( r 5 ) 5 pc ,MGETPG 4 30$ r 0 , P C B . C D ( r 5 ) C B . D A T , P C B . G N ( r 5 ) # F $ A L 0 C , P C B . S T ( r 5 ) F . N P S #CSUCES,RB.CV r 5 , R B . P I D # 1 , R B . L E N r 0 , R B . D A T 9 9 $ : mov c l c r t s mov r 5 , F . L P R C P C M A P P R C p c , U F N C P ( s p ) + , r 5 p c ( s p ) + , r 5 Save R 5 . C l e a r t h e r e p l y PID and l e n g t h o f d a t a r e t u r n e d i n c a s e o f e r r o r . S e t 'No more p r o c e s s s l o t s ' cond c o d e . See i f t h e r e i s room f o r one more DA p r o c e s s . I f no more s l o t s t h e n jump t o e x i t . S e t s t a r t - o f - s c a n - P I D i n t o R 5 . S e t l o o p c o u n t e r . See whe the r t h e s l o t i s UNALLOCATED. I f i f i t i s t h e n l e a v e t h e l o o p . E l s e a d v a n c e t h e s c a n - P l D by two and l o o p t o c o n t i n u e s e a r c h i n g f o r a f r e e s l o t . E x i t i f t h e s c a n f o u n d no s l o t s u n a l l o c a t e d . S e t I P L t o MM$ s y n c h . R e q u e s t a page f o r 0 / P b u f f e r . R e s e t I P L t o o r i g i n a l v a l u e . I f one n o t a v a i l t h e n l o o p . S t o r e a d d r f o r 0 / P b u f f e r i n t o P C B . S e t I P L t o MM$ s y n c h . R e q u e s t a page f o r code p a g e . R e s e t I P L t o o r i g i n a l v a l u e . I f one n o t a v a i l t h e n l o o p . S t o r e a d d r f o r c o d e i n t o P C B . S t o r e t h e VAX GROUP number . F i n a l l y s e t p r o c e s s s t a t e t o ALLOCATED. I n c r e m e n t t h e number o f p r o c e s s s l o t s a l l o c a t e d S e t ' S u c e s s f u l ' c o n d code i n r e p l y b u f f e r t o t h e h o s t . R e t u r n t h e a l l o c a t e d P I D . S e t t h e l e n g t h o f d a t a r e t u r n e d t o 1 w o r d . R e t u r n p h y s b l o c k # o f t h e c o d e page a l l o c a t e d . S e t I P L t o MM$ s y n c h v a l u e . S e t a new c u r r e n t - D A - p r o c e s s P I D . Map i t s c o d e - and O / P - b u f f e r pages i n t o k e r n a l V A . R e s e t t h e I P L . Z e r o t h e c o d e - p a g e a l l o c a t e d t o a l l o w EIS$START_PROCESS t o c h e c k t h a t code & d a t a has been l o a d e d . DO NOT FORMAT THE NEW BUFFER - THIS IS DONE AT EIS$START_PROCESS T I M E . R e s t o r e R 5 . C l e a r c a r r y f o r s u c c e s s and E X I T . R e s t o r e R 5 . 77 sec r t s p c ; S e t c a r r y f o r f a i l u r e ; and E X I T . 2 ESTRTP i s t h e EIS$START_PROCESS p r o c e d u r e . The p r o c e d u r e s t a r t s t h e p r o c e s s i n t h e s ense t h a t t h e p r o c e s s de d e t a i l s a r e made f u l l y a v a i l a b l e t o t h e o p e r a t i n g s y s t e m by way o f c o m p l e t i n g t h e PCB d a t a s t r u c t u r e . T h i s p r o c e d u r e o n l y w o r k s when t h e i n i t i a l s t a t e i s ALLOCATED. E S T R T P : : m o v C B . P I D , R B . P I D ; R e t u r n t h e PID f o r w h i c h t h e s e r v i c e was p e r f o r m e d . c l r R B . L E N , R e t u r n z e r o l e n g t h d a t a . mov #CBDPID,RB.CV S e t ' B a d P I D ' c o n d c o d e . mov C B . P I D , r 0 , Ge t t h e P ID o f t h e p a r t i t i o n r e q u e s t i n g s e r v i c e . b e q 30$ I f i t s FLOSY t h e n e r r o r e x i t . mov #CBDST,RB.CV , S e t ' B a d S t a t e ' c o n d c o d e . cmp # F $ A L O C , P C B . S T ( r 0 ) , See i f t h e s t a t e i s ALLOCATED. b e q 10$ , I f i t i s t h e n jump t o c o n t i n u e . b r 30$ None ma tch so e r r o r e x i t . 1 0 $ : cmp r 0 , F . L P R C See i f t h e c u r r e n t DA p r o c e s s ma tches t h e one s e r v i c e i s r e q u e s t e d f o r . b e q 20$ I f i t i s t h e n jump o v e r m a p p i n g i t i n , t o k e r n a l V A . s p l 5 \u00E2\u0080\u00A2Set I P L t o MM$ s y n c h v a l u e . mov r 0 , F . L P R C \u00E2\u0080\u00A2Set a new c u r r e n t - D A - p r o c e s s P I D . j s r p c , M A P P R C [Map i t s c o d e - and O / P - b u f f e r pages i n t o k e r n a l V A . s p l 4 [Rese t t h e I P L . 2 0 $ : j s r p c , U T P T B L ; T e s t t h e f o r m a t o f t h e p e r - p r o c e s s t a b l e s . b c s 30$ \u00E2\u0080\u00A2 I f i n e r r o r t h e n e r r o r e x i t . j s r p c , U F N B F [Format t h e new 0 / P b u f f e r b e f o r e u s e . [AS THIS BUFFER BELONGS TO NO A C Q . RUN [THE F I E L D S O H . E N , RN & CS ARE LEFT ZERO [ IN THE NEWBUFFER SYSTEM-EVENT. mov #URSBOR,r0 [Get t h e BOR mask i n R 0 . j s r p c , U S B F S [Se t t h e RECORD.STATUS b i t i n t h e 0 / P [ b u f f e r . mov # U S T R T P , r l [Get 'START_PROCESS ' e v e n t t y p e i n R l . i j s r pc ,UWSYEV [ W r i t e a s y s t e m - e v e n t t o t h e c u r r e n t ; 0 / P b u f f e r . mov #CNST,RB.CV [Se t 'No MAIN p r o g r a m d e f i n e d ' . mov #UHSTRT,r0 [Get t h e MAIN s u b r o u t i n e # t o e x e c u t e i n R0 j s r p c , U C D A P [ C a l l t h e DA p r o c e s s ' s p r o c e d u r e . [ E v e n t TYPE=0 i s r e s e r v e d f o r M A I N . b c s 40$ [ E x i t i n e r r o r mov F . L P R C , r 0 [Get t h e c u r r e n t DA p r o c e s s P I D . mov # F $ S T R T , P C B . S T ( r 0 ) [Se t t h e p r o c e s s s t a t e t o STARTED. mov #CSUCES,RB.CV [Se t ' S u c c e s s ' c o n d code i n r e p l y b u f f e r . mov #URSEOR,r0 [Get t h e EOR mask i n R 0 . j s r p c , U S B F S [Se t t h e RECORD.STATUS b i t i n t h e 0 / P IOT b u f f e r . O u t p u t t h e c u r r e n t 0 / P b u f f e r . We do n o t need t h e new 0 / P b u f f e r f o r m a t e d - t h i s i s done a t EIS$BEGINRUN t i m e 78 3 0 $ : 4 0 $ : c l c r t s s ec r t s mov j s r mov j s r IOT sec r t s p c p c #URSMP,r0 p c , U S B F S #URSEOR,r0 p c , U S B F S p c - b u t IOT does i t anyway . C l e a r c a r r y f o r s u c c e s s and r e t u r n . S e t c a r r y f o r f a i l u r e and r e t u r n . Ge t t h e ' M i s s i n g s u b r o u t i n e ' mask i n RO. S e t t h e RECORD.STATUS b i t i n t h e 0 / P b u f f e r . Ge t t h e EOR mask i n RO. S e t t h e RECORD.STATUS b i t i n t h e 0 / P b u f f e r . O u t p u t t h e c u r r e n t 0 / P b u f f e r . We do n o t need t h e new 0 / P b u f f e r f o r m t e d - t h i s i s done a t EIS$BEGINRUN t i m e - b u t IOT does i t anyway . S e t c a r r y f o r f a i l u r e and r e t u r n . 3 EBEGRN i s t h e EIS$BEGIN_RUN p r o c e d u r e . The p r o c e d u r e b e g i n s a r u n o f t h e DA p r o c e s s i n t h e s ens e t h a t i t : - w r i t e s a \" b e g i n r u n e v e n f ' i n t o t h e 0 / P b u f f e r , - c a l l s t h e BEGIN_RUN p r o c e d u r e i n t h e DA p r o c e s s , - t h e PCB i s u p d a t e d t o show t h e s t a t e as RUNNING, The e v e n t i s p l a c e d i n t o t h e c u r r e n t o u t p u t b u f f e r and a l l p t r . s s e t p r o p e r l y b o t h f o r t h e e v e n t - s t r u c t u r e and t h e b u f f e r s t r u c t u r e . T h i s p r o c e d u r e o n l y works when t h e i n i t i a l s t a t e i s ENABLED. EBEGRN: :mov C B . P I D , R B . P I D , R e t u r n t h e PID f o r w h i c h t h e s e r v i c e was p e r f o r m e d . c l r R B . L E N , R e t u r n z e r o l e n g t h d a t a . mov #CBDPID,RB.CV S e t ' B a d P I D ' c o n d c o d e . mov C B . P I D , r O Ge t t h e P ID o f t h e p a r t i t i o n r e q u e s t i n g s e r v i c e . b e q 30$ , I f i t s FLOSY t h e n e r r o r e x i t . mov #CBDST,RB.CV S e t ' B a d S t a t e ' c o n d c o d e . cmp # F $ S T R T , P C B . S T ( r 0 ) I f t h e s t a t e i s n o t STARTED. b e q 10$ I f i t i s t h e n jump t o c o n t i n u e cmp # F $ E N D , P C B . S T ( r 0 ) I f t h e s t a t e i s n o t ENDED. b e q 10$ I f i t i s t h e n jump t o c o n t i n u e b r 30$ \u00E2\u0080\u00A2None ma tch so e r r o r e x i t . 1 0 $ : cmp r 0 , F . L P R C See i f t h e c u r r e n t DA p r o c e s s ma tches t h e one s e r v i c e i s r e q u e s t e d f o r . b e q 20$ I f i t i s t h e n jump o v e r mapp ing i t i n ; t o k e r n a l V A . s p l 5 \u00E2\u0080\u00A2Se t I P L t o MM$ s y n c h v a l u e . mov r 0 , F . L P R C \u00E2\u0080\u00A2Se t a new c u r r e n t - D A - p r o c e s s P I D . j s r P C M A P P R C r Map i t s c o d e - and O / P - b u f f e r pages i n \u00E2\u0080\u00A2 t o k e r n a l V A . s p l 4 \u00E2\u0080\u00A2Rese t t h e I P L . 2 0 $ : mov F . L P R C , r 0 ;Get t h e c u r r e n t DA p r o c e s s P I D . mov # l , P C B . N A ( r 0 ) \u00E2\u0080\u00A2 C l e a r t h e 2 - w o r d # o f e v e n t s . c l r P C B . N B ( r O ) t s t P C B . N R ( r O ) ;See i f a r u n number s eq change i s r e q d . b e q 23$ ; I f no t h e n jump mov P C B . N R ( r O ) , P C B . C R ( r 0 ) ; S e t t h e new r u n number . 79 c l r P C B . N R ( r O ) ; Z e r o i t so we c a n d e t e c t a n o t h e r ; change r e q u e s t b r 25$ ;Jump t o c o n t i n u e add # l , P C B . C R ( r O ) ; I n c . t h e r u n number by 1 f o r t h e n e x t r u n . t s t P C B . C R ( r O ) ;See i f i t has r o l l e d o v e r t o z e r o . b e q 23$ ; I f y e s t h e n add 1 a g a i n as z e r o i s n o t ; a l l o w e d . 2 5 $ : mov P C B . N C ( r O ) , P C B . C C ( r O ) ; S e t n e x t CONDITION, mov P C B . N S ( r 0 ) , P C B . C S ( r 0 ) ; S e t n e x t SETUP. c l r P C B . B C ( r O ) ; C l e a r # o f 0 / P b u f f e r o u t p u t t h i s r u n . j s r p c , U F N B F ; Format t h e new O / P b u f f e r b e f o r e u s e . mov #URSBOR,rO ; Ge t t h e BOR mask i n RO. j s r p c , U S B F S , S e t t h e RECORD.STATUS b i t i n t h e 0 / P b u f f e r . mov # U B E G R N , r l , Ge t ' B E G I N _ R U N ' e v e n t t y p e i n R l . j s r pc ,UWSYEV , W r i t e a s y s t e m - e v e n t t o t h e c u r r e n t 0 / P b u f f e r . mov #CBADGL,RB.CV S e t ' B a d B G L ' c o n d i t i o n c o d e . j s r p c , U E N B G L E n a b l e t h e D A - p r o c e s s ' s BGL i n t e r r u p t h a n d l e r s . b c s 30$ E r r o r e x i t i f t a b l e e r r o r s . mov #CBDTIM,RB.CV S e t ' B a d t i m e r s e t t i n g ' c o n d i t i o n c o d e . j s r pc ,UENTMR E n a b l e t h e D A - p r o c e s s ' s t i m e r i n t e r r u p t h a n d l e r s . b c s 30$ E r r o r e x i t i f s e t u p e r r o r s . mov #CNBR,RB.CV S e t ' N o BEGIN_RUN p r o c e d u r e d e f i n e d ' . mov #UHBEGR,r0 Ge t t h e BEGINRUN sub # t o e x e c u t e i n RO. j s r p c , U C D A P \u00E2\u0080\u00A2 C a l l t h e DA p r o c e s s ' s p r o c e d u r e . b c s 40$ \u00E2\u0080\u00A2 E x i t i n e r r o r . Do n o t s e t EOR b i t i n t h e 0 / P b u f f e r as EIS$ST0P_PR0CESS ; w i l l be needed t o s t o p t h i s p r o c e s s j s r pc ,SENDMD ; E n a b l e i n t e r r u p t s by t h e S C I module mov F . L P R C , r 0 ;Get t h e c u r r e n t DA p r o c e s s P I D . mov # F $ R U N , P C B . S T ( r 0 ) ;Se t t h e p r o c e s s s t a t e t o RUNNING. mov #CSUCES,RB.CV fSe t ' S u c c e s s ' c o n d c o d e i n r e p l y b u f f e r . c l c ; C l e a r c a r r y f o r s u c c e s s r t s p c ; and r e t u r n . sec ; S e t c a r r y f o r f a i l u r e r t s p c ; and r e t u r n . mov #URSMP,rO ;Get t h e ' M i s s i n g s u b r o u t i n e ' mask i n RO. j s r p c , U S B F S ; S e t t h e RECORD.STATUS b i t i n t h e 0 / P ; b u f f e r . sec ; S e t c a r r y f o r f a i l u r e r t s p c ; and r e t u r n . 4 EFLUSH i s t h e EIS$FLUSH_BUFFER p r o c e d u r e . The p r o c e d u r e f l u s h e s t h e c u r r e n t 0 / P b u f f e r f o r t h e g i v e n DA p r o c e s s t o t h e d a t a s t r e a m . T h i s p r o c e d u r e o n l y works when t h e i n t i a l s t a t e i s RUNNING o r PAUSED. E F L U S H : :mov C B . P I D , R B . . P I D j R e t u r n t h e PID f o r w h i c h t h e s e r v i c e ; was p e r f o r m e d , c l r R B . L E N ; R e t u r n z e r o l e n g t h d a t a , mov #CBDPID,RB.CV ; S e t ' B a d P I D ' cond c o d e , mov C B . P I D , r 0 ; G e t t h e PID o f t h e p a r t i t i o n r e q u e s t i n g 80 10$: b e q 30$ mov #CBDST,RB.CV cmp # F $ R U N , P C B . S T ( r O ) b e q 10$ cmp # F $ P A U S , P C B . S T ( r 0 ) b e q 10$ b r 30$ cmp r 0 , F . L P R C 20$: 30$ : b e q s p l mov j s r s p l IOT mov j s r mov c l c r t s sec r t s 20$ r O , F . L P R C p c , M A P P R C 4 #UHNEWB,rO p c , U C D A P #CSUCES,RB.CV p c p c s e r v i c e . I f i t s FLOSY t h e n e r r o r e x i t . S e t ' B a d S t a t e ' c o n d c o d e . See i f s t a t e i s RUNNING I f i t i s t h e n jump t o c o n t i n u e See i f s t a t e i s PAUSED I f i t i s t h e n jump t o c o n t i n u e None ma tch so e r r o r e x i t . See i f t h e c u r r e n t DA p r o c e s s matches t h e one s e r v i c e i s r e q u e s t e d f o r . I f i t i s t h e n jump o v e r mapp ing i t i n t o k e r n a l V A . S e t I P L t o MM$ s y n c h v a l u e . S e t a new c u r r e n t - D A - p r o c e s s P I D . Map i t s c o d e - and O / P - b u f f e r pages i n t o k e r n a l V A . R e s e t t h e I P L . F l u s h t h e b u f f e r and g e t a new f o r m a t t e d o n e . Ge t the\"NEWBUFFER\"sub # i n R 0 . C a l l t h e DA p r o c e s s ' s p r o c e d u r e . I t i s n o t a n e r r o r n o t t o h a v e t h i s p r o c e d u r e so we do n o t need t o ' t e s t c a r r y ' on r e t u r n . S e t ' S u c c e s s ' c o n d c o d e i n r e p l y b u f f e r . C l e a r c a r r y f o r s u c c e s s and r e t u r n . S e t c a r r y f o r f a i l u r e and r e t u r n . 5 EUSCMD i s t h e EIS$USER_COMMAND p r o c e d u r e . The p r o c e d u r e ' d o e s ' a command i n t h e s ens e t h a t i t : - w r i t e s an\"do-command e v e n f ' i n t o t h e 0 / P b u f f e r , - c a l l s t h e a p p r o p r i a t e h a n d l e r p r o c e d u r e i n t h e DA p r o c e s s , The e v e n t i s p l a c e d i n t o t h e c u r r e n t o u t p u t b u f f e r and a l l p t r . s s e t p r o p e r l y b o t h f o r t h e e v e n t - s t r u c t u r e and t h e b u f f e r s t r u c t u r e . T h i s p r o c e d u r e o n l y w o r k s when t h e i n i t i a l s t a t e i s RUNNING o r PAUSED. EUSCMD: :mov C B . P I D , R B . P I D , R e t u r n t h e PID f o r w h i c h t h e s e r v i c e was p e r f o r m e d . c l r R B . L E N , R e t u r n z e r o l e n g t h d a t a . mov #CBDPID,RB.CV S e t ' B a d P I D ' c o n d c o d e . mov C B . P I D , r 0 , Ge t t h e PID o f t h e p a r t i t i o n r e q u e s t i n g s e r v i c e . b e q 30$ , I f i t s FLOSY t h e n e r r o r e x i t . mov #CBDST,RB.CV S e t ' B a d S t a t e ' c o n d c o d e . cmp # F $ R U N , P C B . S T ( r 0 ) See i f s t a t e i s RUNNING b e q 10$ I f i t i s t h e n jump t o c o n t i n u e cmp # F $ P A U S , P C B . S T ( r 0 ) See i f s t a t e i s PAUSED b e q 10$ I f i t i s t h e n jump t o c o n t i n u e b r 30$ None match so e r r o r e x i t . 1 0 $ : cmp r 0 , F . L P R C See i f t h e c u r r e n t DA p r o c e s s matches t h e one s e r v i c e i s r e q u e s t e d f o r . b e q 20$ \u00E2\u0080\u00A2 I f i t i s t h e n jump o v e r mapp ing i t r i n t o k e r n a l V A . s p l 5 \u00E2\u0080\u00A2Se t I P L t o MM$ s y n c h v a l u e . 81 mov r O , F . L P R C , S e t a new c u r r e n t - D A - p r o c e s s P I D . j s r p c , M A P P R C ;Map i t s c o d e - and O / P - b u f f e r pages i n t o k e r n a l V A . s p l 4 R e s e t t h e I P L . mov F . L P R C , r O , Ge t t h e c u r r e n t DA p r o c e s s P I D . a d d # l , P C B . N A ( r O ) I n c 2 - w o r d # o f e v e n t s adc P C B . N B ( r O ) mov #UUSCMD,r l Ge t 'USER COMMAND' e v e n t t y p e i n R l . j s r pc ,UWSYEV W r i t e a s y s t e m - e v e n t t o t h e c u r r e n t O / P b u f f e r . mov #CNOPRD,RB.CV S e t 'No s u c h p r o c e d u r e ' c o n d i t i o n c o d e . mov C B . D A T , r O \u00E2\u0080\u00A2Get t h e p r o c e d u r e # t o e x e c u t e i n RO. j s r p c , U C D A P ; C a l l t h e DA p r o c e s s ' s p r o c e d u r e . b c s 30$ \u00E2\u0080\u00A2 E x i t i n e r r o r mov #CSUCES,RB.CV \u00E2\u0080\u00A2Set ' S u c c e s s ' cond c o d e i n r e p l y b u f f e r c l c \u00E2\u0080\u00A2 C l e a r c a r r y f o r s u c c e s s r t s p c ; a n d r e t u r n . sec ; S e t c a r r y f o r f a i l u r e r t s p c ; and r e t u r n . 6 EPAUSE i s t h e EIS$PAUSE_RUN p r o c e d u r e . The p r o c e d u r e p a u s e s a r u n o f t h e DA p r o c e s s i n t h e s e n s e t h a : - w r i t e s an\"pause r u n e v e n t \" i n t o t h e 0 / P b u f f e r , - c a l l s t h e PAUSE p r o c e d u r e i n t h e DA p r o c e s s , - t h e PCB i s u p d a t e d t o show t h e s t a t e as PAUSED, The e v e n t i s p l a c e d i n t o t h e c u r r e n t o u t p u t b u f f e r a n d a l l p t s e t p r o p e r l y b o t h f o r t h e e v e n t - s t r u c t u r e and t h e b u f f e r s t r u e . T h i s p r o c e d u r e o n l y works when t h e i n i t i a l s t a t e i s RUNNING. E P A U S E : :mov C B . P I D , R B . P I D , R e t u r n t h e PID f o r w h i c h t h e s e r v i c e ; was p e r f o r m d . c l r R B . L E N R e t u r n z e r o l e n g t h d a t a . mov #CBDPID,RB.CV S e t ' B a d P I D ' c o n d c o d e . mov C B . P I D , r 0 Ge t t h e P I D o f t h e p a r t i t i o n r e q u e s t i n g s e r v i c e . b e q 30$ I f i t s FLOSY t h e n e r r o r e x i t . mov #CBDST,RB.CV S e t ' B a d S t a t e ' c o n d c o d e . cmp # F $ R U N , P C B . S T ( r 0 ) See i f t h e s t a t e i s RUNNING. b e q 10$ I f i t i s t h e n jump t o c o n t i n u e . b r 30$ None ma tch so e r r o r e x i t . 1 0 $ : cmp r 0 , F . L P R C See i f t h e c u r r e n t DA p r o c e s s matches t h e one s e r v i c e i s r e q u e s t e d f o r . b e q 20$ I f i t i s t h e n jump o v e r mapp ing i t i n t o k e r n a l V A . s p l 5 S e t I P L t o MM$ s y n c h v a l u e . mov r 0 , F . L P R C S e t a new c u r r e n t - D A - p r o c e s s P I D . j s r P C M A P P R C \u00E2\u0080\u00A2Map i t s c o d e - and O / P - b u f f e r pages i n t o k e r n a l V A . s p l 4 R e s e t t h e I P L . 2 0 $ : mov F . L P R C , r 0 Ge t t h e c u r r e n t DA p r o c e s s P I D . add # l , P C B . N A ( r 0 ) I n c 2 - w o r d # o f e v e n t s adc P C B . N B ( r O ) mov # U P A U S E , r l ;Get ' P A U S E ' e v e n t t y p e i n R l . j s r pc ,UWSYEV \u00E2\u0080\u00A2 W r i t e a s y s t e m - e v e n t t o t h e c u r r e n t 82 mov j s r Dsr mov c l r j s r b c c EMT 2 2 $ : j s r o t h e r s . mov c l r j s r b c c EMT c o n t i n u e . . 24$: 30$; mov mov mov c l c r t s sec r t s #UHPAUS,rO p c , U C D A P pc,SDSDMD F . L P R C , r O P C B . B ( r O ) p c , S D S B G L 22$ CBADGL pc,SENDMD F . L P R C , r O P C B . T ( r O ) pc ,TDSTMR 24$ CBDTIM F . L P R C , r O # F $ P A U S , P C B . S T ( r O ) #CSUCES,RB.CV p c p c 0 / P b u f f e r . Ge t t h e PAUSE sub # t o e x e c u t e i n RO. C a l l t h e DA p r o c e s s ' s p r o c e d u r e . I t i s n o t an e r r o r n o t t o have t h i s r o u t i n e so no c a r r y t e s t . D i s a b l e t h e SCI i n t e r r u p t . Ge t t h e C u r r e n t DA p r o c e s s PID I N RO. Z e r o t h e # o f e n a b l e s B G L s . D i s a b l e a l l B . G L i n t e r r u p t s . I f s u c c e s s t h e n jump o n . E l s e s i g n a l 'BAD B G L ' t h e n c o n t i n u e . . . . E n a b l e S C I i n t e r r u p t s , i f r e q u i r e d f o r ; G e t t h e C u r r e n t DA p r o c e s s PID I N RO. ; Z e r o t h e # o f e n a b l e s t i m e r s . ; D i s a b l e a l l t i m e r i n t e r r u p t s . ; I f s u c c e s s t h e n jump o n . ; E l s e s i g n a l ' B a d t i m e r s e t t i n g ' t h e n ; G e t t h e c u r r e n t DA p r o c e s s P I D . ; S e t t h e p r o c e s s s t a t e t o PAUSED. ; S e t ' S u c c e s s ' c o n d c o d e i n r e p l y b u f f e r , ; C l e a r c a r r y f o r s u c c e s s ; and r e t u r n . ; S e t c a r r y f o r f a i l u r e ; and r e t u r n . 7 ECONT i s t h e EIS$C0NTINUE_RUN p r o c e d u r e . The p r o c e d u r e c o n t i n u e s a r u n o f t h e DA p r o c e s s i n t h e s e n s e t h a t i t : - w r i t e s a n \" c o n t i n u e r u n e v e n t \" i n t o t h e 0 / P b u f f e r , - c a l l s t h e CONTINUE p r o c e d u r e i n t h e DA p r o c e s s , - t h e PCB i s u p d a t e d t o show t h e s t a t e a s RUNNING The e v e n t i s p l a c e d i n t o t h e c u r r e n t o u t p u t b u f f e r and a l l p t r . s s e t p r o p e r l y b o t h f o r t h e e v e n t - s t r u c t u r e and t h e b u f f e r s t r u c t u r e . T h i s p r o c e d u r e o n l y works when t h e i n i t i a l s t a t e i s PAUSED. E C O N T : : mov C B . P I D , R B . P I D R e t u r n t h e PID f o r w h i c h t h e s e r v i c e ; was p e r f o r m d . c l r R B . L E N R e t u r n z e r o l e n g t h d a t a . mov #CBDPID,RB.CV , S e t ' B a d P I D ' c o n d c o d e . mov C B . P I D , r O Get t h e P ID o f t h e p a r t i t i o n r e q u e s t i n g s e r v i c e . b e q 30$ I f i t s FLOSY t h e n e r r o r e x i t . mov #CBDST,RB.CV S e t ' B a d S t a t e ' cond c o d e . cmp # F $ P A U S , P C B . S T ( r O ) See i f t h e s t a t e i s PAUSED. b e q 10$ I f i t i s t h e n jump t o c o n t i n u e . b r 30$ None m a t c h so e r r o r e x i t . 1 0 $ : cmp r 0 , F . L P R C See i f t h e c u r r e n t DA p r o c e s s ma tches t h e one s e r v i c e i s r e q u e s t e d f o r . b e q 20$ I f i t i s t h e n jump o v e r mapp ing i t i n t o k e r n a l V A . s p l 5 S e t I P L t o MM$ s y n c h v a l u e . mov r 0 , F . L P R C \u00E2\u0080\u00A2Set a new c u r r e n t - D A - p r o c e s s P I D . j s r p c , M A P P R C ;Map i t s c o d e - and O / P - b u f f e r p a g e s i n t o k e r n a l V A . 2 0 $ : s p l mov add adc mov j s r mov j s r h a n d l e r s . 3 0 $ : 4 0 $ : b c s mov j s r b c s mov mov j s r b c s 3 s r mov mov mov c l c r t s sec r t s mov j s r s ec r t s F . L P R C , r 0 # 1 , P C B . N A ( r O ) P C B . N B ( r O ) # U C O N T , r l P C U W S Y E V #CBADGL,RB.CV p c , U E N B G L 30$ . #CBDTIM,RB.CV pc,UENTMR 30$ #CNC,RB.CV #UHCONT,rO p c , U C D A P 40$ pc,SENDMD F . L P R C , r O # F $ R U N , P C B . S T ( r O ) #CSUCES,RB.CV p c p c #URSMP,rO p c , U S B F S p c ; R e s e t t h e I P L . ; G e t t h e c u r r e n t DA p r o c e s s P I D . ; I n c 2 - w o r d # o f e v e n t s ; G e t 'CONTINUE' e v e n t t y p e i n R l . ; W r i t e a s y s t e m - e v e n t t o t h e c u r r e n t ; 0 / P b u f f e r . ; S e t ' B a d B G L ' c o n d i t i o n c o d e . ; E n a b l e t h e D A - p r o c e s s ' s BGL i n t e r r u p t E r r o r e x i t i f t a b l e e r r o r s . S e t ' B a d t i m e r s e t t i n g ' c o n d i t i o n c o d e . E n a b l e t h e D A - p r o c e s s ' s t i m e r i n t e r r u p t h a n d l e r s . E r r o r e x i t i f s e t u p e r r o r s . S e t 'No CONTINUE p r o c e d u r e d e f i n e d ' Ge t t h e CONTINUE sub # t o e x e c u t e i n R 0 . C a l l t h e DA p r o c e s s ' s p r o c e d u r e . E x i t i n e r r o r . Do n o t s e t EOR b i t i n t h e 0 / P b u f f e r a s EIS$STOP_PROCESS w i l l be needed t o s t o p t h i s p r o c e s s E n a b l e i n t e r r u p t s b y t h e S C I modu le Ge t t h e c u r r e n t DA p r o c e s s P I D . S e t t h e p r o c e s s s t a t e t o RUNNING. S e t ' S u c c e s s ' c o n d c o d e i n r e p l y b u f f e r . C l e a r c a r r y f o r s u c c e s s and r e t u r n . S e t c a r r y f o r f a i l u r e and r e t u r n . G e t t h e ' M i s s i n g s u b r o u t i n e ' mask i n R 0 . S e t t h e RECORD.STATUS b i t i n t h e O / P b u f f e r S e t c a r r y f o r f a i l u r e and r e t u r n . EENDRN i s t h e EIS$END_RUN p r o c e d u r e . The p r o c e d u r e ends a r u n o f t h e DA p r o c e s s i n t h e s ense t h a t i t : - w r i t e s a n \" e n d r u n e v e n t \" i n t o t h e O / P b u f f e r , - c a l l s t h e END_RUN p r o c e d u r e i n t h e DA p r o c e s s , - t h e PCB i s u p d a t e d t o show t h e s t a t e a s ENDED, The e v e n t i s p l a c e d i n t o t h e c u r r e n t o u t p u t b u f f e r and a l l p t r . s s e t p r o p e r l y b o t h f o r t h e e v e n t - s t r u c t u r e and t h e b u f f e r s t r u c t u r T h i s p r o c e d u r e o n l y w o r k s when t h e i n i t i a l s t a t e i s RUNNING. EENDRN::mov C B . P I D , R B . P I D ; R e t u r n t h e PID f o r w h i c h t h e s e r v i c e ; was p e r f o r m d . c l r R B . L E N ; R e t u r n z e r o l e n g t h d a t a . mov #CBDPID,RB.CV ; S e t ' B a d P I D ' c o n d c o d e . mov C B . P I D , r 0 ; G e t t h e P ID o f t h e p a r t i t i o n r e q u e s t i n g ; s e r v i c e . beq 30$ ; I f i t s FLOSY t h e n e r r o r e x i t . mov #CBDST,RB.CV ; S e t ' B a d S t a t e ' c o n d c o d e . cmp # F $ R U N , P C B . S T ( r 0 ) ; S e e i f t h e s t a t e i s RUNNING. b e q 10$ ; I f i t i s t h e n jump t o c o n t i n u e . cmp # F $ P A U S , P C B . S T ( r 0 ) ;See i f t h e s t a t e i s PAUSED. b e q 10$ ; I f i t i s t h e n jump t o c o n t i n u e . 84 b r 30$ [None m a t c h so e r r o r e x i t . 1 0 $ : cmp r 0 , F . L P R C ; S ee i f t h e c u r r e n t DA p r o c e s s ma tches ; t h e one s e r v i c e i s r e q u e s t e d f o r . b e q 20$ ; I f i t i s t h e n jump o v e r m a p p i n g i t ; i n t o k e r n a l V A . s p l 5 ; S e t I P L t o MM$ s y n c h v a l u e , mov r O , F . L P R C ; S e t a new c u r r e n t - D A - p r o c e s s P I D . j s r p c , M A P P R C ;Map i t s c o d e - and O / P - b u f f e r pages [ i n t o k e r n a l V A . s p l 4 ; R e s e t t h e I P L . 2 0 $ : mov F . L P R C , r O ; G e t t h e c u r r e n t DA p r o c e s s P I D . add # 1 , P C B . N A ( r O ) ; I n c 2 - w o r d # o f e v e n t s a d c P C B . N B ( r O ) mov #UENDRN, r l ; G e t 'ENDRUN' e v e n t t y p e i n R l . j s r pc ,UWSYEV ; W r i t e a s y s t e m - e v e n t t o t h e c u r r e n t ; 0 / P b u f f e r . j s r pc,SDSDMD [ D i s a b l e t h e SCI i n t e r r u p t . mov F . L P R C , r O [Get t h e C u r r e n t DA p r o c e s s P ID I N RO. c l r P C B . B ( r O ) ; Z e r o t h e # o f e n a b l e s B G L s . j s r p c , S D S B G L [ D i s a b l e a l l B . G L i n t e r r u p t s . b c c 22$ ; I f s u c c e s s t h e n jump o n . EMT CBADGL [ E l s e s i g n a l 'BAD B G L ' t h e n c o n t i n u e . . . . 2 2 $ : j s r pc,SENDMD [ E n a b l e SCI i n t e r r u p t s , i f r e q u i r e d . mov F . L P R C , r O [Get t h e C u r r e n t DA p r o c e s s P ID IN RO. c l r P C B . T ( r O ) [ Z e r o t h e # o f e n a b l e s t i m e r s . j s r pc ,TDSTMR [ D i s a b l e a l l t i m e r i n t e r r u p t s . b c c 24$ ; I f s u c c e s s t h e n jump o n . EMT CBDTIM [ E l s e s i g n a l ' B a d t i m e r s e t t i n g ' t h e n c o n t i n u e . . 2 4 $ : mov #CNER,RB.CV [ S e t 'No ENDRUN p r o c e d u r e d e f i n e d ' . mov #UHENDR,rO [Get t h e ENDRUN sub # t o e x e c u t e i n RO. j s r p c , U C D A P ; C a l l t h e DA p r o c e s s ' s p r o c e d u r e . b c s 40$ ; E x i t i n e r r o r . Do n o t s e t EOR b i t i n ; t h e 0 / P b u f f e r a s EIS$STOP_PROCESS ; w i l l be needed t o s t o p t h i s p r o c e s s . mov F . L P R C , r 0 [Ge t t h e c u r r e n t DA p r o c e s s P I D . mov # F $ E N D , P C B . S T ( r 0 ) [ S e t t h e p r o c e s s s t a t e t o ENDED. mov #CSUCES,RB.CV ; S e t ' S u c c e s s ' c o n d code i n r e p l y b u f f e r . mov #URSEOR,r0 ; G e t t h e EOR mask i n R 0 . j s r p c , U S B F S [ S e t t h e RECORD.STATUS b i t i n t h e O / P b u f f e r . IOT [ O u t p u t t h e c u r r e n t 0 / P b u f f e r . We do n o t n e e d ; t h e new 0 / P b u f f e r f o r m a t e d - t h i s i s done a t ;EIS$BEGINRUN t i m e - b u t IOT does i t anyway . c l c [ C l e a r c a r r y f o r s u c c e s s r t s p c ; and r e t u r n . 3 0 $ : s ec [ S e t c a r r y f o r f a i l u r e r t s p c ; and r e t u r n . 4 0 $ : mov #URSMP,r0 ; G e t t h e ' M i s s i n g s u b r o u t i n e ' mask i n R 0 . j s r p c , U S B F S [ S e t t h e RECORD.STATUS b i t i n t h e ; 0 / P b u f f e r . s ec [ S e t c a r r y f o r f a i l u r e r t s p c ; and r e t u r n . 10 ESTOPP i s t h e EIS$STOP_PROCESS p r o c e d u r e . 85 The p r o c e d u r e s t o p s t h e p r o c e s s i n t h e s ens e t h a t t h e p r o c e s s d e t s a r e d e l e t e d f rom t h e o p e r a t i n g s y s t e m b y way o f e r a z i n g t h e PCB d a t a s t r u c t u r e , r e m o v i n g t i m e r r e q u e s t s , r e m o v i n g BGL r e q u e s t s and f l u s h i n g t h e c u r r e n t 0 / P b u f f e r . T h i s p r o c e d u r e w o r k s r e g a r d l e s s t h e i n i t i a l s t a t e . ESTOPP: :mov c l r mov mov beq mov cmp b e q cmp b e q s p l mov j s r s p l 20$ : C B . P I D , R B . P I D R B . L E N #CBDPID,RB.CV C B . P I D , r O 30$ #CALUNA,RB.CV # F $ U N A L , P C B . S T ( r 0 ) 30$ r 0 , F . L P R C 20$ r 0 , F . L P R C pc ,MAPPRC 4 ; R e t u r n t h e PID f o r w h i c h t h e s e r v i c e ; was p e r f o r m d . R e t u r n z e r o l e n g t h d a t a . S e t ' B a d P I D ' c o n d c o d e . Ge t t h e P ID o f t h e p a r t i t i o n r e q u e s t i n g s e r v i c e . I f i t s FLOSY t h e n e r r o r e x i t . S e t ' P r o c e s s i s a l r e a d y UNALLOCATED' c o n d c o d e . See i f s t a t e i s a l r e a d y UNALLOCATED. I f i t i s e r r o r e x i t . See i f t h e c u r r e n t DA p r o c e s s matches t h e one s e r v i c e i s r e q u e s t e d f o r . I f i t i s t h e n jump o v e r mapp ing i t i n t o k e r n a l V A . S e t I P L t o MM$ s y n c h v a l u e . S e t a new c u r r e n t - D A - p r o c e s s P I D . Map i t s c o d e - and O / P - b u f f e r pages i n t o k e r n a l V A . R e s e t t h e I P L . ;MAKE THE PROCESS LOOK L I K E IT ENDED NORMALLY. j s r mov c l r j s r j s r mov c l r j s r mov j s r IOT pc,SDSDMD F . L P R C , r O P C B . B ( r O ) p c , S D S B G L pc,SENDMD F . L P R C , r O P C B . T ( r O ) pc ,TDSTMR #URSEOR,r0 p c , U S B F S D i s a b l e t h e SCI i n t e r r u p t . Ge t t h e C u r r e n t DA p r o c e s s P ID I N RO. C l e a r t h e # o f a c t i v e BGLs f o r t h e p r o c e s s . D i s a b l e a l l B . G L i n t e r r u p t s . E n a b l e SCI i n t e r r u p t s , i f r e q u i r e d . Ge t t h e C u r r e n t DA p r o c e s s P ID I N RO. C l e a r t h e # o f a c t i v e t i m e r s f o r t h e p r o c e s s . D i s a b l e a l l t i m e r i n t e r r u p t s . Ge t t h e EOR mask i n RO. S e t t h e RECORD.STATUS b i t i n t h e O / P b u f f e r . O u t p u t t h e c u r r e n t O / P b u f f e r . We do n o t need t h e new O / P b u f f e r f o r m t e d - t h i s i s done a t EIS$BEGINRUN - b u t IOT does i t a n y w a y . ;Do a n o r m a l p r o c e s s d e a l l o c a t i o n . mov F . L P R C , r O \u00E2\u0080\u00A2Get t h e c u r r e n t DA p r o c e s s P I D . mov P C B . C D ( r 0 ) , r 0 ;Get b l o c k # o f code page i n RO s p l 5 ;Se t I P L t o MM$ s y n c h v a l u e . j s r pc ,MPUTPG and r e t u r n i t t o t h e p o o l . s p l 4 ; R e s e t t h e I P L . mov F . L P R C , r O ;Get t h e c u r r e n t DA p r o c e s s P I D . mov P C B . B F ( r 0 ) , r 0 ;Get b l o c k # o f t h e 0 / P b u f f e r page i n RO s p l 5 \u00E2\u0080\u00A2Se t I P L t o MM$ s y n c h v a l u e . j s r pc ,MPUTPG ; and r e t u r n i t t o t h e p o o l . s p l 4 ; R e s e t t h e I P L . mov F . L P R C , r O ;Get t h e c u r r e n t DA p r o c e s s P I D . ;CHECK EVERY D / S IS INIT L I K E IN F L I N I . c l r P C B . B C ( r O ) } c l e a r BUFFER COUNT, 86 30$: c l r P C B . B F ( r O ) ; c l e a r 0 / P b u f f e r page mem p t r . , c l r P C B . C C ( r O ) ; c l e a r t h e c u r r e n t e x p t - c o n d i t i o n v a l u e , c l r P C B . C D ( r O ) ; c l e a r c o d e page memory p t r . , c l r P C B . E N ( r O ) ; c l e a r t h e EXPERIMENT-NUMBER, c l r P C B . G N ( r O ) ; c l e a r t h e VAX-GROUP-NUMBER, c l r P C B . N C ( r O ) ; c l e a r t h e n e x t - r u n e x p t - C O N D l T I O N v a l u e , c l r P C B . N L ( r O ) ; c l r P C B . N H ( r O ) , c l r P C B . N A ( r O ) , c l e a r t h e # o f e v e n t s a c q u i r e d ( l o w o r d e r c l r P C B . N B ( r O ) , and t h e h i g h o r d e r . mov # l , P C B . N R ( r O ) , s e t n e x t - r u n r u n number 1 ( Z e r o n o t a l l o w e d ) , c l r P C B . N S ( r O ) , c l e a r n e x t s e t u p c l r P C B . C R ( r O ) , c l e a r t h e c u r r e n t r u n number c l r P C B . C S ( r O ) c l e a r t h e c u r r e n t s e t u p mov # F $ U N A L , P C B . S T ( r O ) S e t s t a t e t o ' U N A L L O C A T E D ' , c l r P C B . B ( r O ) C l e a r t h e # o f e n a b l e s B G L s . c l r P C B . T ( r O ) C l e a r t h e # o f e n a b l e s t i m e r s . c l r P C B . L l ( r O ) c l e a r t h e p r o c e s s l o a d t i m e . c l r P C B . L 2 ( r O ) c l r P C B . L 3 ( r O ) c l r P C B . L 4 ( r O ) c l r P C B . L 5 ( r O ) c l r P C B . L 6 ( r O ) c l r P C B . B l ( r O ) \u00E2\u0080\u00A2 c l e a r t h e p r o c e s s BEGINRUN t i m e . c l r P C B . B 2 ( r O ) c l r P C B . B 3 ( r O ) c l r P C B . B 4 ( r O ) c l r P C B . B 5 ( r O ) c l r P C B . B 6 ( r O ) d e c F . N P S ^Decrease t h e number o f a l l o c a t e d s l o t s . c l r F . L P R C ^ F i n a l l y , c l e a r t h e c u r r e n t p r o c e s s number . mov #CSUCES,RB.CV ; S e t ' S u c c e s s ' c o n d code i n r e p l y b u f f e r . c l c ; C l e a r c a r r y f o r s u c c e s s r t s p c ; and r e t u r n . s ec ; S e t c a r r y f o r f a i l u r e r t s p c ; and r e t u r n . 11 EGETST i s t h e EIS$GET_STATUS p r o c e d u r e . The p r o c e d u r e r e t u r n s t h e s t a t u s o f a DA p r o c e s s t o t h e h o s t v i a t h e FEP$REPLY_BLOCK d a t a s t r u c t u r e . The p r o c e d u r e a l s o r e t u r n s t h e o p e r a t i n g s y s t e m s t a t u s t o t h e h o s t v i a t h e F E P $ R E P L Y _ BLOCK d a t a s t r u c t u r e . T h i s p r o c e d u r e w o r k s any t i m e a f t e r t h e o p e r a t i n g s y s t e m has b e e n l o a d e d . E G E T S T : : m o v mov mov mov mov mov mov C B . P I D , R B . P I D C B . P I D , r O # R B . D A T , r l #CSUCES,RB.CV #48. , R B . L E N # F $ V E R S , ( r l ) + # F $ N P , ( r l ) + S e t t h e P ID f o r w h i c h s t a t u s was r e t u r n e d . Ge t t h e P ID o f t h e DA p r o c e s s t o r e t u r n t h e s t a t u s o f . Ge t s t a r t a d d r o f r e p l y d a t a r e g i o n . S e t ' S u c c e s s ' c o n d i t i o n c o d e . Se t t h e l e n g t h o f s t a t u s d a t a r e t u r n e d ( i n w o r d s ) . RETURN PURE FLOSY STATUS. F L O S Y ' s c u r r e n t v e r s i o n number . Max number o f DA p r o c e s s 87 mov # F $ N P C , ( r l ) + Max number o f D A - p r o c e s s p r o c e d u r e s mov F . N P S , ( r l ) + ; number o f a l l o c a t e d DA p r o c e s s s l o t s . mov D . N I T M , ( r l ) + ; number o f e l e m e n t s a w a i t i n g o u t p u t t o V A X . mov # F $ N T , ( r l ) + ; Max number o f t i m e r s mov T . N A C T , ( r l ) + ; number o f a c t i v e t i m e r s mov T . N F R E , ( r l ) + ; number o f f r e e t i m e r s l o t s mov #M.END,r2 ; Ge t a d d r e s s o f memory a l l o c a t i o n s t a c k , sub M . S P , r 2 ; s u b t r a c t t h e c u r r e n t s t a c k p i o n t e r , a s r r 2 ; d i v i d e i t b y two ( i e b y t e s t o w o r d s ) mov r 2 , ( r l ) + ; and s t o r e t h e number o f f r e e memory p a g e s . RETURN DA PROCESS STATUS. mov P C B . B F ( r O ) , ( r l ) + mov P C B . C C ( r O ) , ( r l ) + mov P C B . C D ( r O ) , ( r l ) + mov P C B . E N ( r O ) , ( r l ) + mov P C B . G N ( r O ) , ( r l ) + mov P C B . N C ( r O ) , ( r l ) + mov # 0 . , ( r l ) + ; Was C u r r e n t # e v e n t s mov # 0 . , ( r l ) + d i t t o mov P C B . N L ( r O ) , ( r l ) + mov P C B . N H ( r O ) , ( r l ) + mov P C B . N R ( r O ) , ( r l ) + mov P C B . N S ( r O ) , ( r l ) + mov P C B . C R ( r O ) , ( r l ) + mov P C B . C S ( r O ) , ( r l ) + mov P C B . S T ( r O ) , ( r l ) + mov P C B . N A ( r O ) , ( r l ) + mov P C B . N B ( r O ) , ( r l ) + mov P C B . B C ( r O ) , ( r l ) + mov T . B T O D , ( r l ) + ; B a s e t i m e , i n VAX f o r m a t mov T . B T O D + 2 , ( r l ) + mov T . B T 0 D + 4 , ( r l ) + mov T . B T 0 D + 6 , ( r l ) + mov T . C L K L , ( r l ) + ;FLOSY t i m e i n .1 sec u n i t s mov T . C L K H , ( r l ) + mov P C B . B ( r O ) , ( r l ) + ;# a c t i v e B G L s . mov P C B . T ( r O ) , ( r l ) + ;# a c t i v e t i m e r s . mov S . N A C T , ( r l ) + ; T o t a l # a c t i v e B G L s . mov P C B . L l ( r O ) , ( r l ) + ; P r o c e s s l o a d t i m e . mov P C B . L 2 ( r O ) , ( r l ) + mov P C B . L 3 ( r O ) , ( r l ) + mov P C B . L 4 ( r O ) , ( r l ) + mov P C B . L 5 ( r O ) , ( r l ) + \u00E2\u0080\u00A2 mov P C B . L 6 ( r O ) , ( r l ) + mov P C B . B l ( r O ) , ( r l ) + ; P r o c e s s BEGINRUN t i m e . mov P C B . B 2 ( r O ) , ( r l ) + mov P C B . B 3 ( r O ) , ( r l ) + mov P C B . B 4 ( r O ) , ( r l ) + mov P C B . B 5 ( r O ) , ( r l ) + mov P C B . B 6 ( r O ) , ( r l ) + c l c ; C l e a r c a r r y f o r s u c c e s s r t s p c ; and r e t u r n . 12 ESETTM i s t h e EIS$SET_TIME p r o c e d u r e . The p r o c e d u r e s e t s t h e v a l u e o f t h e t i m e - o f - d a y c l o c k t o t h e v a l u e 88 p a s s e d by t h e h o s t i n t h e FEP$COMMAND_BLOCK. T h i s p r o c e d u r e w o r k s any t i m e a f t e r t h e o p e r a t i n g s y s t e m has been s t a r t e d . ESETTM: :mov C B . P I D , R B . P I D , S e t t h e P ID f o r w h i c h t h e s e r v i c e was d o n e . c l r R B . L E N S e t no d a t a r e t u r n e d . mov #CBDTIM,RB.CV Se t ' B a d t i m e r s e t t i n g ' c o n d i t i o n v a l u e . cmp # 4 , C B . L E N See i f command has t h e r i g h t amount o f d a t a . bne 30$ I f n o t t h e n e x i t . mcv # C B . D A T , r 0 Ge t s o u r c e a d d r o f t h e new t i m e - o f - d a y . j s r p c , T S E T T M S e t t h e FLOSY t i m e - o f - d a y c l o c k . mov #CSUCES,RB.CV S e t ' S u c c e s s ' c o n d i t i o n c o d e . c l c \u00E2\u0080\u00A2 C l e a r c a r r y f o r s u c c e s s r t s p c \u00E2\u0080\u00A2 and r e t u r n . 3 0 $ : sec ' S e t c a r r y f o r f a i l u r e r t s p c , and r e t u r n . 13 ESETRN i s t h e EIS$SET_RUN_NUMBER p r o c e d u r e . The p r o c e d u r e s e t s t h e v a l u e o f t h e n e x t - r u n r u n number t o t h e v a l u e p a s s e d b y t h e h o s t i n t h e FEP$COMMAND_BLOCK. T h i s p r o c e d u r e a l w a y s w o r k s . ESETRN: :mov C B . P I D , R B . P I D ; R e t u r n t h e P ID f o r w h i c h s e r v i c e was p e r f o r m e d . c l r R B . L E N R e t u r n z e r o l e n g t h d a t a . mov #CBDPID,RB.CV , S e t ' B a d P I D ' c o n d c o d e . mov C B . P I D , r 0 , Ge t t h e P ID o f t h e p r o c e s s t o s e t r u n # f o r . b e q 30$ , I f i t s FLOSY t h e n e r r o r e x i t . mov \u00E2\u0080\u00A2 #CBDRN,RB.CV S e t \"Bad RUN NUMBER' c o n d i t i o n v a l u e . t s t C B . D A T See i f s e t t i n g i s z e r o . b e q 30$ I f i t i s z e r o t h e n e r r o r e x i t . mov C B . D A T , P C B . N R ( r 0 ) S e t t h e n e x t - r u n r u n number . mov #CSUCES,RB.CV S e t ' S u c c e s s ' c o n d c o d e . c l c C l e a r c a r r y f o r s u c c e s s r t s p c and r e t u r n . 3 0 $ : s ec ;Se t c a r r y f o r f a i l u r e r t s PC \u00E2\u0080\u00A2 a n d . r e t u r n . 14 SETEV i s t h e EIS$SET_EVENTS p r o c e d u r e . t h i s p r o c e d u r e s e t s t h e v a l u e o f t h e n e x t - r u n n u m b e r - o f - e v e n t s t o r u n f o r t o t h e v a l u e p a s s e d b y t h e h o s t i n t h e FEP$COMMAND_BLOCK. T h i s p r o c e d u r e a l w a y s w o r k s . E S E T E V : : m o v c l r mov mov f o r . b e q mov t s t C B . P I D , R B . P I D R B . L E N #CBDPID,RB.CV C B . P I D , r 0 30$ #CBDEV,RB.CV C B . D A T ; R e t u r n t h e PID f o r w h i c h s e r v i c e was ; p e r f o r m e d . ; R e t u r n z e r o l e n g t h d a t a . ; S e t ' B a d P I D ' c o n d c o d e . ; G e t t h e . P I D o f t h e p r o c e s s t o s e t new d a t a ; I f i t s FLOSY t h e n e r r o r e x i t . ; S e t ' B a d NUMBER EVENTS' c o n d i t i o n v a l u e . ;See i f s e t t i n g i s z e r o . 89 bne 10$ t s t CB.DAT+2 b e q 30$ 1 0 $ : mov C B . D A T , P C B . N L ( r O ) mov C B . D A T + 2 , P C B . N H ( r O ) mov #CSUCES,RB.CV c l c r t s p c 3 0 $ : s ec r t s p c I f i t i s n o t z e r o t h e n jump t o c o n t i n u e OK. E l s e see i f h i g h o r d e r word i s a l s o z e r o I f i t i s t h e n e r r o r e x i t . Ge t t h e n e x t - r u n l i m i t - n u m b e r - o f - e v e n t s l o w - o r d e r . and t h e n e x t - r u n l i m i t - n u m b e r - o f - e v e n t s h i g h - o r d e r . S e t ' S u c c e s s ' c o n d c o d e . C l e a r c a r r y f o r s u c c e s s and r e t u r n . S e t c a r r y f o r f a i l u r e and r e t u r n . 15 ESETS i s t h e EIS$SET_SETUP p r o c e d u r e . The p r o c e d u r e s e t s t h e v a l u e o f t h e n e x t - r u n SETUP v a l u e t o t h e v a l u e p a s s e d by t h e h o s t i n t h e FEP$COMMAND_BLOCK. T h i s p r o c e d u r e a l w a y s w o r k s . E S E T S : : mov C B . P I D , R B . P I D , R e t u r n t h e PID f o r w h i c h s e r v i c e was p e r f o r m e d . c l r R B . L E N R e t u r n z e r o l e n g t h d a t a . mov #CBDPID,RB.CV S e t ' B a d P I D ' c o n d c o d e . mov C B . P I D , r 0 Ge t t h e P ID o f t h e p r o c e s s t o s e t d a t a f o r . b e q 30$ I f i t s FLOSY t h e n e r r o r e x i t . mov #CBDS,RB.CV S e t ' B a d SETUP ' c o n d i t i o n v a l u e . t s t CB.DAT See i f s e t t i n g i s z e r o . b e q 30$ I f i t i s z e r o t h e n e r r o r e x i t . mov C B . D A T , P C B . N S ( r O ) ;Se t t h e n e x t - r u n SETUP v a l u e . mov #CSUCES,RB.CV ;Set ' S u c c e s s ' c o n d c o d e . c l c ; C l e a r c a r r y f o r s u c c e s s r t s p c ; and r e t u r n . 3 0 $ : s ec ; S e t c a r r y f o r f a i l u r e r t s p c ; and r e t u r n . 16 ESETC i s t h e EIS$SET_CONDITION p r o c e d u r e . The p r o c e d u r e s e t s t h e v a l u e o f t h e n e x t - r u n CONDIITON v a l u e t o t h e v a l u e p a s s e d by t h e h o s t i n t h e FEP$COMMAND_BLOCK.' T h i s p r o c e d u r e a l w a y s w o r k s . E S E T C : : mov C B . P I D , R B . P I D , R e t u r n t h e P ID f o r w h i c h s e r v i c e was p e r f o r m e d . c l r R B . L E N R e t u r n z e r o l e n g t h d a t a . mov #CBDPID,RB.CV S e t ' B a d P I D ' c o n d c o d e . mov C B . P I D , r 0 , Ge t t h e P ID o f t h e p r o c e s s t o s e t d a t a f o r . b e q 30$ I f i t s FLOSY t h e n e r r o r e x i t . mov #CBDC,RB.CV S e t ' B a d CONDITION' c o n d i t i o n v a l u e . t s t CB.DAT See i f s e t t i n g i s z e r o . b e q 30$ I f i t i s z e r o t h e n e r r o r e x i t . mov C B . D A T , P C B . N C ( r O ) S e t t h e n e x t - r u n CONDITION v a l u e . mov #CSUCES,RB.CV S e t ' S u c c e s s ' c o n d c o d e . c l c C l e a r c a r r y f o r s u c c e s s r t s p c and r e t u r n . 3 0 $ : s ec S e t c a r r y f o r f a i l u r e r t s p c ; and r e t u r n . 90 18 ESETEN i s t h e EIS$SET_EXPT_NUMBER p r o c e d u r e . The p r o c e d u r e s e t s t h e v a l u e o f t h e e x p e r i m e n t number t o t h e v a l u e p a s s e d by t h e h o s t i n t h e FEP$COMMAND_BLOCK. T h i s p r o c e d u r e w o r k s any t i m e a f t e r t h e o p e r a t i n g s y s t e m has been s t a r t e d . E S E T E N : :mov C B . P I D , R B . P I D , S e t t h e P ID f o r w h i c h t h e s e r v i c e was d o n e . c l r R B . L E N , S e t no d a t a r e t u r n e d . mov #CBDPID,RB.CV , S e t ' B a d P I D ' c o n d c o d e . mov C B . P I D , r O , Ge t t h e P I D o f t h e p r o c e s s t o s e t e x p t # f o r . t h e b e q 30$ I f i t s FLOSY t h e n e r r o r e x i t . mov #CBDEN,RB.CV ( S e t ' B a d EXPT NUMBER' c o n d i t i o n v a l u e . t s t C B . D A T See i f s e t t i n g i s z e r o . beq 30$ I f i t i s z e r o t h e n e r r o r e x i t . mov C B . D A T , P C B . E N ( r O ) S e t t h a t p r o c e s s ' s e x p t number . mov #CSUCES,RB.CV S e t ' S u c c e s s ' c o n d i t i o n c o d e . c l c C l e a r c a r r y f o r s u c c e s s r t s p c and r e t u r n . 3 0 $ : sec ' S e t c a r r y f o r f a i l u r e r t s p c \u00E2\u0080\u00A2 and r e t u r n . \u00E2\u0080\u00A2 page . t i t l e MM$ ******************************************** * * * * * * * * * * * * * * * * * - M E M O R Y MANAGEMENT MODULE * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * MM$ i s t h e memory management modu le f o r t h e FLOSY o p e r a t i n g s y s t e m . The module c o m p r i s e s t h e f o l l o w i n g p r o c e d u r e s : - MMINI t o i n i t i a l i z e t h e modu le a n d memory management. - MAPPRC t o map a DA p r o c e s s ' s c o d e and 0 / P b u f f e r i n t o u s e r - and k e r n a l - V A s p a c e s . - MAPPB t o map a DA p r o c e s s ' s 0 / P b u f f e r i n t o u s e r - and k e r n a l -VA s p a c e . - MGETPG t o a l l o c a t e a p h y s i c a l page f r o m t h e ' f r e e ' p o o l - MPUTPG t o r e t u r n a p h y s i c a l page t o t h e ' f r e e ' p o o l * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * MM$ r e g i s t e r d e f i n i t i o n s i n t h e I / O p a g e . M$MMR0 ==:177572 ; A d d r e s s o f t h e mem man r e g i s t e r 0 . M$MMR1 ==:177574 ; A d d r e s s o f t h e mem man r e g i s t e r 1. M$MMR2 ==:177576 ; A d d r e s s o f t h e mem man r e g i s t e r 2 . M$MMR3 ==:172516 ; A d d r e s s o f t h e mem man r e g i s t e r 3 . UPDRO ==:177600 ; A d d r e s s e s o f t h e U s e r Page D e s c r i p t o r r e g s . UPDR1 ==:177602 UPDR2 ==:177604 UPDR3 ==:177606 UPDR4 ==:177610 UPDR5 ==:177612 UPDR6 ==:177614 UPDR7 ==:177616 UPARO ==:177640 ; A d d r e s s e s o f t h e U s e r page a d d r e s s r e g s . 91 UPAR1 ==:177642 UPAR2 ==:177644 UPAR3 ==:177646 UPAR4 ==:177650 UPAR5 ==:177652 UPAR6 ==:177654 UPAR7 ==:177656 KPDRO ==:172300 ; A d d r e s s e s o f t h e K e r n a l page d e s c r i p t o r r e g s . KPDR1 ==:172302 KPDR2 ==:172304 KPDR3 ==:172306 KPDR4 ==:172310 KPDR5 ==:172312 KPDR6 ==:172314 KPDR7 ==:172316 KPARO ==:172340 ; A d d r e s e s o f t h e K e r n a l page a d d r e s s r e g s . KPAR1 ==: 172342 KPAR2 ==:172344 KPAR3 ==:172346 KPAR4 ==:172350 KPAR5 ==:172352 KPAR6 ==:172354 KPAR7 ==:172356 MM$ - Memory Management s y m b o l i c d e f i n i t i o n s M$MPON ==:000001 M$MP22 ==:000020 M$RW ==:177406 M$READ M$NRES M$VAP0 ==:177402 ==:177400 ==:000000 p a g e . M$VAP1 ==:020000 M$VAP2 ==:040000 M$VAP3 ==:060000 M$VAP4 ==:100000 M$VAP5 ==:120000 M$VAP6 ==:140000 M$VAP7 ==:160000 ; P h y s i c a l a d d r e s s symbo l ; i s 8 K b y t e s l o n g a l i g n e d V a l u e t o use o n MMR0 t o t u r n o n m a p p i n g . V a l u e t o use o n MMR3 e n a b l i n g 2 2 - b i t mapp ing V a l u e t h a t s e t s a PDR t o : - b y p a s s c a c h e , - f u l l 8Kb l e n g t h p a g e , - up e x p a n s i o n d i r e c t i o n and - R/W a c c e s s mode. V a l u e as a b o v e b u t f o r r e a d - o n l y a c c e s s . V a l u e a s a b o v e b u t f o r n o n - r e s i d e n t a c c e s s . V i r t u a l a d d r e s s o f t h e s t a r t o f t h e f i r s t e t c . numbered 0 t o 5 1 1 . M$P0 M$P1 M$P2 M$P3 M$P4 M$P5 M$P6 M$P7 M$P8 \u00E2\u0080\u00A2\u00E2\u0080\u00A2: 000000 \u00E2\u0080\u00A2\u00E2\u0080\u00A2: 000200 : :000400 \u00E2\u0080\u00A2: 000600 : :001000 : :001200 ^:001400 = : 001600 = : 002000 s i e b l o c k #*s o f t h e p h y s i c a l p a g e s , where a page on an 8 K b y t e b o u n d a r y . T h e r e a r e 512 p h y s i c a l pages ;Page 0 s t a r t s a t p h y s i c a l a d d r e s s 00 000 000 ;page 1 s t a r t s a t 00 020 000 i e b l o c k 020 000 ; e t c . 92 M$P9 M$P10 M$P11 M$P12 M$P13 M$P14 M$P15 :002200 :002400 :002600 :003000 :003200 :003400 :003600 ST ARBURST. M$P511 ==:177600 ;PAGE 15 i s t h e l a s t one a v a i l a b l e i n a 128Kb No t y e t n e e d e d . ; I / 0 page add r i s 17 760 000 i e b l o c k 177 600 MMINI i s t h e M M $ I N I T I A L I Z E p r o c e d u r e . T h i s p r o c e d u r e i n i t i a l i z e s t h e MMU r e g i s t e r s t o t h o s e f i x e d v a l u e s e x p e c t e d b y FLOSY b e f o r e e n a b l i n g a d d r e s s m a p p i n g i n t o 2 2 - b i t p h y s i c a l a d d r e s s e s . I n a d d i t i o n t h i s p r o c e d u r e i n i t i a l i z e s t h e d a t a s t r u c t u r e (MM$BUFFER_P00L) t h a t k e e p s t r a c k o f a p o o l o f p h y s i c a l memory pages f o r u s e as DA p r o c e s s code pages o r 0 / P b u f f e r s . M M I N I : I n i t i a l i z e memory management u n i t . c l r @#M$MMR0 , MMR1 & MMR2 do n o t n e e d i n t i a l i z i n g . c l r @#M$MMR3 S e t u p k e r n a l v i r t u a l a d d r e s s s p a c e , page 0 i s f o r F L O S Y . mov #M$P0,@#KPAR0 , l o a d k e r n PAR 0 w i t h phy page 0 a d d r . mov #M$RW,\u00C2\u00A7#KPDR0 l o a d k e r n PDR 0 w i t h R/W a c c e s s , page 1 i s n o n - r e s i d e n t . c l r @#KPAR1 , c l e a r k e r n PAR 1. mov #M$NRES,@#KPDR1 l o a d k e r n PDR 1 w i t h NR a c c e s s , page 2 i s u s e d t o map DA 0 / P b u f f . mov #M$RW,@#KPDR2 , l o a d k e r n PDR 2 w i t h R/W a c c e s s , page 3 i s n o n - r e s i d e n t . c l r @#KPAR3 c l e a r k e r n PAR 3 . mov #M$NRES,@#KPDR3 l o a d k e r n PDR 3 w i t h NR a c c e s s . page 4 i s u s e d t o map DA p r o c . c o d e . mov #M$RW,@#KPDR4 l o a d k e r n PDR 4 w i t h R/W a c c e s s , page 5 i s n o n - r e s i d e n t . c l r @#KPAR*r c l e a r k e r n PAR 5 . mov #M$NRES,@#KPDR5 l o a d k e r n PDR 5 w i t h NR a c c e s s . ; page 6 i s n o n - r e s i d e n t . c l r @#KPAR6 c l e a r k e r n PAR 6 . mov #M$NRES,@#KPDR6 l o a d k e r n PDR 6 w i t h NR a c c e s s . Page 7 i s mapped t o t h e I / O p a g e . mov #M$P511,@#KPAR7 L o a d k e r n PAR 7 w i t h i / o page a d d r . mov #M$RW,@#KPDR7 l o a d k e r n PDR 7 w i t h R/W a c c e s s . S e t u p u s e r v i r t u a l a d d r e s s s p a c e . page 0 i s r e s e r v e d f o r an 0 / P b u f f e r . mov #M$RW,@#UPDR0 l o a d u s e r PDR 0 w i t h R/W a c c e s s , page 1 i s n o n - r e s i d e n t . c l r @#UPAR1 c l e a r u s e r PAR 1. mov #M$NRES,@#UPDR1 l o a d u s e r PDR 1 w i t h NR a c c e s s , page 2 i s n o n - r e s i d e n t . c l r @#UPAR2 c l e a r u s e r PAR 2 . mov #M$NRES,@#UPDR2 l o a d u s e r PDR 2 w i t h NR a c c e s s , page 3 i s n o n - r e s i d e n t . c l r @#UPAR3 c l e a r u s e r PAR 3 . 93 10$: mov #M$NRES,@#UPDR3 mov #M$RW,@#UPDR4 c l r @#UPAR5 mov #M$NRES,@#UPDR5 mov #M$P0,@#UPAR6 mov #M$READ,\u00C2\u00A7#UPDR6 mov #M$P511,@#UPAR7 mov #M$RW,@#UPDR7 b i s #M$MP22,@#M$MMR3 b i s #M$MP0N,@ #M$MMR0 mov # M . P 0 0 L , M . S P mov # - l , M . E N D c l r rO mov # M . P 0 0 L , r l add # M $ P l , r O mov r 0 , ( r l ) + cmp r0 ,#M$P15 b i t 10$ c l c r t s p c l o a d u s e r PDR 3 w i t h NR a c c e s s . page 4 i s r e s e r v e d f o r DA c o d e , l o a d u s e r PDR 4 w i t h R/W a c c e s s . page 5 i s n o n - r e s i d e n t , c l e a r u s e r PAR 5 . l o a d u s e r PDR 5 w i t h NR a c c e s s . page 6 i s mapped t o FLOSY R T L . l o a d u s e r PAR 6 w i t h FLOSY a d d r . l o a d u s e r PDR 6 w i t h R - o n l y a c c e s s . Page 7 i s mapped t o t h e I / O p a g e , l o a d u s e r PAR 7 w i t h I / P page a d d r . l o a d u s e r PDR 7 w i t h R/W a c c e s s . E n a b l e 2 2 - b i t m a p p i n g . T u r n on memory m a p p i n g . I n i t i a l i z e t h e MM$ d a t a s t r u c t u r e MM$BUFFER_P00L c a l l e d MPOOL. PAGE 0 IS PRE-ALLOCATED TO F L O S Y . Use rO t o c o n t a i n t h e b l o c k p h y s a d d r s S t a r t f i l l i n g d a t a s t r u c t u r e a t MPOOL E v e r y p h y s p a g e add r i s sep b y 20000 r e a l a d d r e s s I o c s = 2 0 0 ( o c t ) 6 4 - b y t e b l k s S t o r e b l o c k p h y s a d d r . o n t o s t a c k Check f o r l a s t add r p u s h e d (Page 15) ; C l e a r c a r r y f o r s u c c e s s ; and r e t u r n . ; * * A FUTURE DEVEL MIGHT BE TO TEST THE ;EXISTANCE OF THE PHYSICAL MEMORY** MAPPRC i s t h e MM$MAP_PROCESS p r o c e d u r e . T h i s p r o c e d u r e maps a code page and O / P b u f f e r p h y s i c a l page i n t o t h e c o r r e c t VA pages i n b o t h k e r n a l and u s e r VA s p a c e s . MAPPRC: :mov mov mov mov mov mov mov c l c r t s F . L P R C r O P C B . C D ( r 0 ) , r l P C B . B F ( r 0 ) , r 0 r0,@#UPAR0 r0,@#KPAR2 r l ,@#UPAR4 r l ,@#KPAR4 p c ; G e t t h e c u r r e n t - D A - p r o c e s s P I D . ; G e t t h e DA p r o c e s s c o d e - p a g e i n R l . ;Ge t t h e DA p r o c e s s O / P - b u f f e r page i n R 0 . ;Map R0 i n t o u s e r VA page 0 , ; and a l s o k e r n a l VA page 2 . ;Map R l i n t o u s e r VA page 4 , ; and a l s o k e r n a l VA page 4 . ; C l e a r c a r r y f o r s u c c e s s and ; r e t u r n . MAPPB i s t h e MM$MAP_PROCESSBUFFER p r o c e d u r e . T h i s p r o c e d u r e maps a PHYSICAL 0 / P b u f f e r page i n t o t h e c o r r e c t VA pages i n b o t h k e r n a l and u s e r VA s p a c e s . R0 - The b u f f e r page number M A P P B : : mov r0,@#UPAR0 ;Map R0 i n t o u s e r VA page 0 , mov r0,@#KPAR2 ; and a l s o k e r n a l VA page 2 . c l c ; C l e a r c a r r y f o r s u c c e s s and r t s p c ; r e t u r n . MGETPG i s t h e MM$GET_PAGE p r o c e d u r e The p r o c e d u r e pops an e n t r y o f f t h e s t a c k o f a v a i l a b l e p h y s i c a l pages a n d r e t u r n s i t i n R 0 . The e n t r y i s t h e p h y s i c a l - b l o c k # o f t h e p h y s i c a l 94 page b e i n g a l l o c a t e d . The p r o c e d u r e r e t u r n s C a r r y - C l e a r f o r s u c c e s s . The g e n e r a l r e g i s t e r s a r e u s e d as f o l l o w s : R0> B l o c k # o f a l l o c a t e d page MGETPG::mov M . S P , r l ; G e t a d d r e s s o f b o t t o m o f s t a c k f rom memory. t s t ( r l ) ;See i f i t i s p o i n t i n g t o end o f t h e s t a c k . ;NOTE: The e n d - o f - s t a c k i s i n d i c a t e d by a word o f - 1 ! ! ! b i t 10$ ; I f y e s t h e n jump on mov ( r l ) + , r 0 ; e l s e pop s t a c k i t e m t o RO f o r o / p and mov r l , M . S P ; s t o r e s t a c k p t r . i n memory c l c ; c l e a r c a r r y b i t f o r ' s u c c e s s ' r t s p c ; a n d r e t u r n 1 0 $ : sec ; s e t c a r r y b i t f o r ' s t a c k empty ' e r r o r r t s p c ; a n d r e t u r n MPUTPG i s t h e MM$PUT_PAGE p r o c e d u r e The p r o c e d u r e pushes an i t e m r e t u r n e d i n RO o n t o t h e s t a c k o f a v a i l a b l e p h y s i c a l p a g e s . The r e g i s t e r s a r e u s e d as f o l l o w s : R0> B l o c k # o f t h e page b e i n g r e t u r n e d MPUTPG: :mov mov mov c l c r t s M . S P , r l r 0 , - ( r l ) r l , M . S P p c ; G e t a d d r e s s o f b o t t o m o f s t a c k ; p u s h i t e m o n t o s t a c k ; s t o r e s t a c k p t r . ; C l e a r c a r r y f o r s u c c e s s . .page . t i t l e SCI$ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * SYSTEM CRATE MODULE * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * SCI i s t h e S y s t e m C r a t e P e r i p h e r a l h a n d l e r M o d u l e f o r t h e FLOSSY o p e r a t i n g s y s t e m . I t c o m p r i s e s t h e f o l l o w i n g p r o c e d u r e s : - S C I I N I t o i n i t i a l i z e t h e SCI p e r i p h e r a l and m o d u l e s d a t a s t r u c t u r e s . - SACDMD t o a c c e p t t h e SCI i n t e r r u p t and r e t u r n t h e h a n d l e r I D . - SENDMD t o remove I & e n a b l e e v e r y c r a t e & b r a n c h demand. - SENI t o e n a b l e t h e SCI i n t e r f a c e i n t e r r u p t c a p a b i l i t y . - SDSDMD t o t o d i s a b l e t h e SCI i n t e r r u p t c a p a b i l i t y ONLY. - SENBGL t o a l l o c a t e ( i e e n a b l e ) a s i n g l e BGL f o r a p r o c e s s . - SDSBGL t o d e a l l o c a t e ( i e d i s a b l e ) a e v e r y BGL f o r a p r o c e s s . * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * S C I I N I i s t h e S C I $ I N I T I A L I Z E p r o c e d u r e . T h i s p r o c e d u r e i n i t i a l i z e s t h e S y s t e m C r a t e I n t e r f a c e (CES 2180) p e r i p h e r a l r e g i s t e r s and t h e BGL r e s e r v a t i o n d a t a s t r u c t u r e s . The IVG s h o u l d be s e t up t o b e : - IVG PRESENT - IVG PASSIVE - Bank one i e . f i e l d 1 = AF f i e l d 2 = AN - No f r o n t p a n e l i n t e r r u p t 95 - 64 m i c r o s e c o n d s GGL c y c l e . S$FLD0 ==: 160000 S t a r t o f a d d r e s s f i e l d 0 . S$FLD1 ==: 162000 S t a r t o f a d d r e s s f i e l d 1 . S$FLD2 ==: 164000 S t a r t o f a d d r e s s f i e l d 2 . S$CSR ==: 166010 C o n t r o l and s t a t u s r e g i s t e r . S$DBH ==: 166012 D a t a b u f f e r h i g h r e g i s t e r . S$IHR ==: 166014 I n t e r r u p t h a n d l i n g r e g i s t e r . S$GGL ==: 166016 G r a n t g r a d e d LAM r e g i s t e r . S$Q ==: 100000 ;Q b i t o f C S R . S$X ==: 000200 \u00E2\u0080\u00A2X b i t o f C S R . S$B0 ==\u00E2\u0080\u00A2 0 S$C0 ==: 0 S$N11 ==< 1 1 . S$N30 == 3 0 . S$IVG == + + S$N11 S$ECC == + + S$N30 S$A9 == 9 . S$A10 == 1 0 . S$A11 == 1 1 . S$F9 == 9 . S$F10 == 1 0 . S$F17 == 1 7 . S$F24 == : 2 4 . S$F26 == 2 6 . S$F27 == 2 7 . A9F24 == : S$FLD1 + + A10F9 == . S$FLD1 + + A10F17 == : S$FLD1 + + A10F26 == : S$FLD1 + + A11F10 == : S$FLD1 + + A11F26 == : S$FLD1 + + ; I V G . ; E C C . DO NOT I N I T . SYSTEM CRATE OR BRANCH CAMAC HARDWARE. THE HOST SHOULD HAVE I D E N T I F I E D THE BRANCH/CRATE CONFIGURATION AND HAVE DONE THE FOLLOWING: - Z i n e v e r y c r a t e - Remove I i n e v e r y c r a t e - E n a b l e B r a n c h Demands f o r e v e r y b r a n c h - E n a b l e t h e S y s t e m C r a t e Demand S C I I N I : : c l r c l r mov mov t s t b i t bne h a l t 1 $ : t s t b i t bne h a l t 2 $ : t s t b i t bne h a l t \u00C2\u00A7#S$IHR @#S$CSR #32000,@#S$DBH #S$ECC,@#S$CSR \u00C2\u00A7 # A 1 1 F 1 0 #S$X,@#S$CSR 1$ @#A9F24 #S$X,@#S$CSR 2$ @#A10F26 #S$X,@#S$CSR 3$ C l e a r t h e IHR r e g i s t e r ( d i s a b l i n g i n t e r r u p t s ) . C l e a r t h e CSR r e g i s t e r . S e t IVG ' P R E S E N T ' & ' P A S S I V E ' & 'BANK 1 ' . SETUP THE C R A T E . THE VAX MAY TAKE THIS OVER. S e t BCN=Exec c r a t e c o n t r o l l e r C l e a r WATCHDOG f l a g . See i f X = l I f X = l t h e n b r a n c h t o T0D0 CHANGE A L L HALTS Remove S y s t e m C r a t e I , See i f X = l I f X = l t h e n b r a n c h t o TODO CHANGE A L L HALTS E n a b l e S y s t e m C r a t e Demands. See i f X = l I f X = l t h e n b r a n c h t o c o n t i n u e TODO CHANGE A L L HALTS TO S I G N A L S . 96 c o n t i n u e TO S I G N A L S . c o n t i n u e TO S I G N A L S . SETUP THE I V G . 3 $ : mov #S$IVG,@#S$CSR ; S e t BCN=IVG l o c a t i o n . t s t @#A10F9 ; Do t h e ' i n i t I V G ' command b i t #S$X,@#S$CSR j See i f X = l bne 4$ i I f X = l t h e n b r a n c h t o c o n t i n u e h a l t TOD0 CHANGE A L L HALTS TO S I G N A L S . 4 $ : mov # 2 5 5 . , r 3 ; S e t # o f TRAP a d d r e s s = 2 5 5 . 5 $ : mov r3,@#A10F17 ; R e s e t t h e n e x t TRAP s t o r e . b i t #S$X,@#S$CSR See i f X = l bne 10$ , I f X = l t h e n c o n t i n u e h a l t 1 0 $ : sob r 3 , 5 $ ; L o o p a g a i n i f more TRAP s t o r e s t o r e s e t mov r3,@#A10F17 R e s e t t h e z e r o e t h TRAP s t o r e . b i t #S$X,@#S$CSR See i f X = l bne 60$ I f X = l t h e n c o n t i n u e h a l t 6 0 $ : t s t \u00C2\u00A7#A11F26 E n a b l e GGL c y c l e s f o r t h e I V G . b i t #S$X,@#S$CSR See i f X = l bne 70$ I f X = l t h e n c o n t i n u e h a l t 7 0 $ : t s t @#A10F26 \u00E2\u0080\u00A2 E n a b l e i n t e r r u p t g e n e r a t i o n by I V G . b i t #S$X,@#S$CSR See i f X = l bne 80$ ; I f X = l t h e n c o n t i n u e h a l t \u00E2\u0080\u00A2DO NOT ENABLE THE INTERFACE INTERRUPTS r AS THIS IS DONE AT BEGINRUN T I M E . 8 0 $ : c l r S .NACT f C l e a r t h e number o f a c t i v e B G L ' s . ; C l e a r S . P N d a t a s t r u c t u r e . mov # 2 5 6 . , r 0 ;Se t t h e l e n g t h o f t h e d a t a s t r u c t u r e . c l r r l ; C l e a r p t r . i n t o t h e d a t a s t r u c t u r e . 9 0 $ : c l r S . P N ( r l ) ; Z e r o t h e n e x t e l e m e n t . a d d # 2 , r l ; I n c r e a s e t h e p t r . b y 2 b y t e s sob r 0 , 9 0 $ ; and l o o p i f n o t f i n i s h e d . c l c ; C l e a r c a r r y f o r s u c c e s s . r t s p c ; and r e t u r n . SACDMD i s t h e SCI$ACCEPT_DEMAND p r o c e d u r e . T h i s p r o c e d u r e a c c e p t s t h e i n t e r r u p t and r e t u r n s t h e p r o c e d u r e - I D o f t h e p r o c e d u r e h a n d l i n g t h e CAMAC modu le r e q u e s t i n g s e r v i c e . The S y s t e m C r a t e p e r i p h e r a l i n t e r r u p t s a r e d i s a b l e d as t h e i n t e r r u p t i s f i e l d e d a t IPL=4 - t h e same as t h e h a r d w a r e i n t e r r u p t p r i o r i t y o f t h e S y s t e m C r a t e p e r i p h e r a l - d o u b l y p r e v e n t i n g a s e c o n d Sys t em C r a t e p e r i p h e r a l i n t e r r u p t . The r e g i s t e r s a r e u sed as f o l l o w s : OUT R0 I f B . G L u n a l l o c a t e d t h e n e r r o r e x i t . C l e a r c a r r y f o r s u c c e s s and E X I T . S e t c a r r y f o r f a i l u r e and e x i t . SENDMD i s t h e SCI$ENABLE_DEMANDS p r o c e d u r e . T h i s p r o c e d u r e e n a b l e s S y s t e m C r a t e p e r i p h e r a l i n t e r r u p t s i f f n e e d e d , t h a t i s , one o r more e l e m e n t s o f S . P N i s n o n - z e r o - b y s e t t i n g t h e ' e n a b l e demands ' b i t i n t h e p e r i p h e r a l s IHR r e g i s t e r . I n a d d i t i o n S y s t e m C r a t e Demands and B r a n c h Demands a r e e n a b l e d , I i s removed and Branch-Demands (BD) i s e n a b l e d i n t h e C r a t e C o n t r o l l e r o f e v e r y c r a t e . SENDMD: :mov # 2 5 6 . , r 0 S e t up t h e c o u n t e r o v e r S . P N . 1 0 $ : mov r 0 , r l Copy t h e c o u n t e r . a s l r l Make i t i n t o a p t r . . t s t S . P N ( r l ) See i f t h e n e x t e l e m e n t i s n o n - z e r o bne 20$ I f i t i s t h e n c o m p l e t e t h e s c a n sob r 0 , 1 0 $ E l s e l o o p t o c o n t i n u e . sec \u00E2\u0080\u00A2Set c a r r y f o r f a i l u r e (= n o t e n a b l e d ) r t s pc and r e t u r n . \u00E2\u0080\u00A2The SCI module i s r e q u i r e d . 2 0 $ : mov #S$ECC,@#S$CSR \u00E2\u0080\u00A2Set BCN = E x e c C r a t e C o n t r o l l e r (N=30) . t s t b @#A9F24 (Remove S y s t e m C r a t e I . bne 30$ (Jump i f X = l . HALT ( E l s e h a l t f o r now 3 0 $ : t s t b @#A11F10 ( C l e a r E x e c C r a t e w a t c h d o g t i m e r f l a g . bne 40$ (Jump i f X = l . HALT ; E l s e h a l t f o r now 4 0 $ : t s t b @#A10F26 ; E n a b l e S y s t e m C r a t e Demands ( S C D ' s ) . bne 50$ ;Jump i f X = l . HALT ( E l s e h a l t f o r now 5 0 $ : ;TODO. NOW ENABLE DEMANDS I N EVERY CRATE,REMOVE I AND E N A B . BR DMDS b i s #1,@#S$IHR (Se t t h e 'demands e n a b l e d ' b i t . c l c ( C l e a r c a r r y f o r s u c c e s s . r t s pc ; and r e t u r n . SENI i s t h e SCI$ENABLE_INTERFACE p r o c e d u r e . T h i s p r o c e d u r e e n a b l e s Sys t em C r a t e p e r i p h e r a l i n t e r r u p t s b y c l e a r i n g t h e T R A P - s t o r e e n t r y c o r r e s p o n d i n g t o t h e BGL t h a t c a u s e d t h e l a s t SCI i n t e r r u p t , t h u s a l l o w i n g t h e i V G - s e c t i o n o f t h e SCI modu le t o s t a r t d o i n g G - c y c l e s on r e c e i p t o f a b r a n c h - o r S y s t e m - C r a t e demand, and s e t t i n g t h e ' e n a b l e demands ' b i t i n t h e SCI p e r i p h e r a l ' s IHR r e g i s t e r . S E N I : 5 $ : mov mov b i t bne h a l t b i s #S$IVG,@#S$CSR ; S e t BCN=IVG m o d u l e . S.BGL,@#A10F17 ; R e s e t t h e TRAP s t o r e o f t h e l a s t ; i n t e r r u p t i n g B G L . ;See i f X = l ; I f X = l t h e n b r a n c h t o c o n t i n u e ;T0D0 CHANGE A L L HALTS TO S I G N A L S . ; S e t t h e 'demands e n a b l e d ' b i t 98 #S$X,@#S$CSR 5$ #1,@#S$IHR c l c r t s p c ; C l e a r c a r r y f o r s u c c e s s ; and r e t u r n . SDSDMD i s t h e SCI$DISABLE_DEMANDS p r o c e d u r e . T h i s p r o c e d u r e d i s a b l e s S y s t e m C r a t e p e r i p h e r a l i n t e r r u p t s b y c l e a r i n g t h e ' e n a b l e demands ' b i t i n t h e p e r i p h e r a l s IHR r e g i s t e r . S D S D M D : : b i c #1,@#S$IHR ; C l e a r t h e \"demand e n a b l e ' b i t c l c ; C l e a r c a r r y f o r s u c c e s s r t s p c ; and r e t u r n . SENBGL i s t h e SCI$ENABLE_BGL p r o c e d u r e . T h i s p r o c e d u r e a l l o c a t e s and a s i n g l e B . G L f o r t h e e x c l u s i v e use o f a DA p r o c e s s by p l a c i n g t h e \" o w n i n g \" p r o c e d u r e - I D i n t o t h e BGL a l l o c a t i o n d a t a b a s e . The r e g i s t e r s a r e u sed as f o l l o w s i n t h i s p r o c e d u r e : R0> DA p r o c e s s P I D . R l > t h e B . G L t o a l l o c a t e ( c o d e d as B . G L * 2 i n a w o r d ) . i R2> P r o c e d u r e number , i n i n t e r n a l f o r m a t ( i e b y t e o f f s e t ) . SENBGL: : b i c #177400, rO ; Remove a n y t h i n g i n t h e h i g h o r d e r b y t e o f PID cmp rO,#2*F$NP , See i f t h e PID i s t o o l a r g e . b h i 99$ , I f t o o l a r g e t h e n e r r o r e x i t . b i c #177400 , r2 Remove a n y t h i n g i n t h e h i g h o r d e r b y t e o f p r o c e d u r e . cmp r2 ,#2*F$NPC , See i f t h e p r o c e d u r e # i s t o o l a r g e . b h i 99$ I f t o o l a r g e t h e n e r r o r e x i t . swab r 2 \u00E2\u0080\u00A2Move t h e p r o c e d u r e - * i n t o t h e h i g h o r d e r b y t e b i s r 2 , r 0 Combine them i n t o a p r o c e d u r e - I D i e . < p r o c e d u r e - # , P I D > . b i c # 1 7 7 0 0 1 , r l C l e a r b i t s t h a t s h o u l d be c l e a r i n B G L . t s t S . P N ( r l ) \u00E2\u0080\u00A2 I f B . G L a l r e a d y r e s e r v e d ( i e . n o n z e r o ) bne 99$ \u00E2\u0080\u00A2 t h e n E X I T mov r 0 , S . P N ( r l ) \u00E2\u0080\u00A2 E l s e a l l o c a t e t h e B . G L t o t h e p r o c d - I D . i n c S .NACT ;Count t h e t o t a l # o f a c t i v e B G L s . c l c ; C l e a r c a r r y f o r s u c c e s s r t s p c ; and r e t u r n . 9 9 $ : s ec ; S e t c a r r y f o r f a i l u r e r t s p c ; and r e t u r n . SDSBGL i s t h e S C I $ D I S A B L E _ B G L S p r o c e d u r e . T h i s p r o c e d u r e u n a l l o c a t e s e v e r y B . G L a l l o c a t e d t o a DA p r o c e s s by r e m o v i n g them f rom t h e a l l o c a t i o n d a t a b a s e . The r e g i s t e r s a r e u sed as f o l l o w s : I N R0> The DA p r o c e s s P I D . S D S : b i c # 1 7 7 4 0 0 , r 0 ;Remove a n y t h i n g i n t h e h i g h o r d e r ; \u00E2\u0080\u00A2 b y t e o f P ID cmp rO,#2*F$NP j S e e i f t h e PID i s t o o l a r g e . 99 b h i 99$ I f t o o l a r g e t h e n e r r o r e x i t . mov # 5 1 0 . , r l , S e t t h e i n i t i a l p t r . v a l u e . 1 0 $ : mov S . P N ( r l ) , r 2 , Ge t n e x t e l e m e n t o f r e s e r v . d a t a b a s e . b i c #177400 , r2 , Remove p r o c e d u r e - * o f p r o c e d u r e - I D . cmp r 0 , r 2 , See i f t h e \" o w n e r \" m a t c h e s . bne 20$ I f n o t t h e n jump. c l r S . P N ( r l ) E l s e c l r d a t a s t r . e n t r y t o u n a l l o c . i t d e c S .NACT D e c r e a s e t h e t o t a l # o f a c t i v e B G L s . 2 0 $ : sub # 2 , r l D e c r e a s e t h e p t r . by 2 b p l 10$ and l o o p t o c o n t i n u e . c l c C l e a r c a r r y f o r s u c c e s s r t s p c and r e t u r n . 9 9 $ : sec S e t c a r r y f o r f a i l u r e r t s p c ; and r e t u r n . .page . t i t l e TS$ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * TIMER SERVICES MODULE * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * TS i s t h e T i m e r P e r i p h e r a l h a n d l e r M o d u l e f o r t h e FLOSY o p e r a t i n g s y s t e m . The modu le h i d e s t h e d e t a i l s o f t i m e r s u p p o r t p r o c e s s i n g and t h e r e q u i r e d d a t a s t r u c t u r e s f rom t h e m a i n body o f F L O S Y . A l l a c c e s s e s \u00E2\u0080\u00A2 t o t h e s e d a t a s t r u c t u r e s s h o u l d be t h r o u g h t h e s e o r new TS$ p r o c e d u r e s . The module c o m p r i s e s t h e f o l l o w i n g p r o c e d u r e s : - T S I N I t o i n i t i a l i z e t h e TS$ d a t a s t r u c t u r e s . - TSTICK t o h a n d l e t h e c l o c k i n t e r r u p t s - TSFRK t o s c h e d u l e a t i m e r h a n d l e r . ' - TSETTM t o s e t t h e FLOSY t i m e - TGETTM t o r e t u r n t h e v a l u e o f t h e c u r r e n t FLOSY t i m e - TENTMR t o a l l o c a t e and e n a b l e a s i n g l e t i m e r - TDSTMR t o d e a l l o c a t e and d i s a b l e a s i n g l e t i m e r - TACTO a c c e p t s t h e t i m e r t i m e o u t and r e q u e u e s t h e t i m e r - TINSAQ t o i n s e r t a t i m e r e l e m e n t o n t o t h e a c t i v e queue - TREMAQ t o remove a t i m e r e l e m e n t f rom t h e a c t i v e queue - TDEQAQ t o remove t h e f i r s t t i m e r e l e m e n t f rom t h e a c t i v e queue - TINSFQ t o i n s e r t a t i m e r e l e m e n t o n t o t h e f r e e queue - TREMFQ t o remove a t i m e r e l emen t f rom t h e f r e e queue * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * T S I N I i s t h e T S $ I N I T I A L I Z E p r o c e d u r e . T S I N I : : c l r T . C L K H C l e a r t h e d e l t a t o d c l o c k . c l r T . C L K L mov # 4 , r 0 L e n g t h o f b a s e t i m e - o f - d a y . c l r r l P o i n t e r i n t o t h e v e c t o r . 1 0 $ : c l r T . B T O D ( r l ) C l e a r n e x t e n t r y i n T . B T O D . add # 2 , r l I n c r e m e n t p t r . i n t o v e c t o r by 2 sob r 0 , 1 0 $ and l o o p b a c k i f n o t c o m p l e t e . mov # 6 , T . C N T ' S e t t h e c o u n t - d o w n - t i m e r . c l r T . N A C T S e t t h e number on ' a c t i v e ' Q t o z e r o mov #F$NT,T .NFRE \u00E2\u0080\u00A2 and t h e number on ' f r e e ' Q t o a l l o f t h e e l e m e n t s . 100 c l r T . U F L G ; U s e r - t i m e r a c t i v e - f l a g . c l r T.UTMR J C u r r e n t u s e r - t i m e r c o u n t - d o w n - t i m e r . mov #T$HEAD,rO , Ge t i n d e x o f ' a c t i v e ' t i m e r Q ' h e a d ' mov # T $ T A I L , r l , and t h e ' t a i l ' . j s r p c , t i n i , S e t u p empty ' a c t i v e ' t i m e r Q mov #T$HFRE,rO , Ge t i n d e x o f ' f r e e ' t i m e r Q ' h e a d ' mov # T $ T F R E , r l , and t h e ' t a i l . ' j s r p c , t i n i , S e t u p empty ' f r e e ' t i m e r Q Enqueue a l l t i m e r s o n t o ' f r e e * t i m e r Q . c l r r 5 S e t v e c t o r p t r . . c l r T . A B D T ( r 5 ) \u00E2\u0080\u00A2 C l e a r t h e t i m e r i n t e r v a l . c l r T . D E L T ( r 5 ) C l e a r t h e t i m e r d e l t a - t i n t e r v a l . c l r T . P N ( r 5 ) C l e a r t h e t i m e r h a n d l i n g p r o c e d u r e number mov r 5 , r 0 ' S e t i n d e x o f t i m e r t o enqueue . j s r p c , T I N S F Q and enqueue t h e e l e m e n t o n t o t h e Q. add #2 , r5 \u00E2\u0080\u00A2 Inc remen t t h e p t r . i n t o t h e v e c t o r by 2 . cmp r5,#T$NTMR \u00E2\u0080\u00A2 I f n o t f i n i s h e d b i o 20$ t h e n l o o p b a c k t o c o n t i n u e . c l c \u00E2\u0080\u00A2 C l e a r c a r r y f o r s u c c e s s . r t s p c ; S e t u p an empty Q ' s head & t a i l e l e m e n t s . mov # - l , T . P R E V ( r O ) (Se t h e a d ' s b / w p t r . mov r l , T . N E X T ( r 0 ) ( and i t f / w p t r . . c l r T . A B D T ( r O ) ( C l e a r t h e t i m e r i n t e r v a l . c l r T . D E L T ( r O ) ; C l e a r t h e d e l t a - t i n t e r v a l . c l r T . P N ( r O ) ( C l e a r t h e t i m e r h a n d l e r p r o c e d u r e number . mov # - l , T . N E X T ( r l ) (Se t t a i l ' s f / w p t r . mov r O . T . P R E V ( r l ) ; and i t s b / w p t r . . c l r T . A B D T ( r l ) ( C l e a r t h e t i m e r i n t e r v a l . c l r T . D E L T ( r l ) ( C l e a r t h e d e l t a - t i n t e r v a l . c l r T . P N ( r l ) ( C l e a r t h e t i m e r h a n d l e r p r o c e d u r e number . r t s p c ; and r e t u r n . S T I C K i s t h e TS$HANDLE_TICK p r o c e d u r e . T h i s p r o c e d u r e h a n d l e s t h e h a r d w a r e p r i o r i t y 5 r e a l t i m e c l o c k i n t e r r u p t s ' t i c k s ' ) f o r t h e TS$ m o d u l e . The c l o c k i s p r e s c a l e d f rom 60Hz t o 10Hz f o r a c t i v a t i n g t h e DA p r o c e s s ' s t i m e r p r o c e d u r e s . T S T I C K : 1 0 $ : d e c b e q c l c r t s mov sec r t s T . C N T 10$ p c # 6 , T . C N T p c ;Dec t h e p r e s c a l e r c o u n t e r a t 6 0 H z . ; I f z e r o t h e n jump t o c o n t i n u e . ; C l e a r c a r r y t o i n d i c a t e n o t ; quantum end ; R e t u r n . ( R e s e t t h e t i m e r p r e s c a l e r . ( S e t c a r r y t o i n d i c a t e quantum end ; and r e t u r n . TSFRK i s t h e TS$F0RK p r o c e d u r e . T h i s p r o c e d u r e c a u s e s a f o r k p r o c e s s t o s t a r t a t PIRQ=4 i f and o n l y i f a u s e r t i m e r c o m p l e t e s . T S F R K : add adc t s t # 1 , T . C L K L T . C L K H T . U F L G I n c r e m e n t F L O S Y ' s 10Hz r e a l - t i m e t i m e - o f - d a y d e l t a - c l o c k . I f t h e r e a r e no u s e r t i m e r s s e t 101 5$: 10$; b e q t s t b e q d e c b h i b i s c l c r t s sec r t s 10$ T.UTMR 5$ T.UTMR 10$ #10000,@#F$PIRQ p c p c t h e n jump o u t . See i f z e r o - d u r a t i o n t i m e r i s n e x t I f t i m e r has f i n i s h e d jump t o s e t P I R Q . I f c u r r e n t t i m e r n o t c o m p l e t e ( s t i l l p o s i t i v e ) t h e n jump o u t . S e t p r i o = 4 i n t e r r u p t i n t h e PIRQ r e g t o i n d i c a t e t h e u s e r t i m e r has c o m p l e t e d . S e t c a r r y f o r s u c c e s s and e x i t . S e t c a r r y f o r f a i l u r e - no t i m e r c o m p l e t e and e x i t . TSETTM i s t h e TS$SET_TIME p r o c e d u r e . T h i s p r o c e d u r e s e t s t h e b a s e v a l u e o f t h e FLOSY t i m e - o f - d a y c l o c k . T h i s i s i n VAX f o r m a t (8 b y t e ) and i s s u p p l i m e n t e d by a l o c a l d e l t a - t i m e - o f -day c l o c k t h a t ' t i c k s ' a t 1 0 H z . The c l o c k may be r e a d b y c a l l i n g TGETTM. The r e g i s t e r s a r e u sed as f o l l o w s i n t h i s p r o c e d u r e : R0> P o i n t e r t o new t i m e - o f - d a y t o be s e t , TSETTM: :mov mov 10$: mov sob c l r c l r c l c r t s # 4 , r l # T . B T O D , r 2 ( r 0 ) + , ( r 2 ) + r l , 1 0 $ T . C L K L T . C L K H p c S e t l o o p c o u n t e r f o r 4 word t r a n s f e r . S e t p t r . t o b a s e - t i m e - o f - d a y s t o r e . S t o r e t h e c o n s t a n t p a r t o f t h e s t o r e d - t i m e . Move n e x t word i n t o s t o r a g e and l o o p i f n o t f i n i s h e d . C l e a r t h e v a r y i n g p a r t o f t h e s t o r e d t i m e . C l e a r t h e l o w o r d e r c l o c k c o u n t e r f i r s t , i n c a s e t h e c l o c k t i c k s be tween t h e s e i n s t r u c t i o n s and an o v e r -f l o w o c c u r s i n t o t h e h i g h o r d e r w o r d , t h e n t h e h i g h o r d e r . C l e a r c a r r y f o r s u c c e s s and r e t u r n . TGETTM i s t h e TS$GET_TIME p r o c e d u r e . T h i s p r o c e d u r e r e t u r n s t h e f u l l 1 2 - b y t e v a l u e o f t h e t i m e - o f - d a y c l o c k . ; The c l o c k may be s e t b y c a l l i n g TSETTM. The r e g i s t e r s a r e u s e d a s f o l l o w s i n t h i s p r o c e d u r e : R0> P o i n t e r t o s t o r e o f t h e new s e t t i n g , TGETTM::mov mov 10$: 20$ : mov sob mov mov cmp # 4 , r l # T . B T 0 D , r 2 ( r 2 ) + , ( r 0 ) + r l , 1 0 $ T . C L K L , ( r 0 ) + T . C L K H , ( r O ) T . C L K L , - ( r O ) S e t l o o p c o u n t . S e t p t r . t o b a s e - t i m e - o f - d a y s t o r e . Move t h e c o n s t a n t p a r t o f t h e s t o r e d - t i m e . Move n e x t word i n t o s t o r a g e and l o o p i f n o t f i n i s h e d . Move t h e v a r y i n g p a r t o f t h e s t o r e d - t i m e . Move t h e l o w o r d e r word o f t h e r e a l t i m e c l o c k and t h e h i g h o r d e r w o r d . See i f l o w o r d e r t i m e c h a n g e d a f t e r we moved i t 102 bne c l c r t s 20$ pc ; I f i t d i d t h e n t h e c l o c k has t i c k e d ; so go b a c k ; and g e t them b o t h a g a i n . ; C l e a r c a r r y f o r s u c c e s s ; and r e t u r n . TENTMR i s t h e TS$ENABLE_TIMER p r o c e d u r e . T h i s p r o c e d u r e a l l o c a t e s a s i n g l e t i m e r f o r a DA p r o c e s s b y c r e a t i n g an e n t r y on t h e ' a c t i v e ' t i m e r Q . The e l e m e n t a l l o c a t e d i s o b t a i n e d f r o m t h e ' f r e e ' t i m e r Q . The r e g i s t e r s a r e u s e d a s f o l l o w s i n t h i s p r o c e d u r e : IN R0> DA p r o c e s s P I D . R l > I n t e r v a l f o r t h e new t i m e r i n 0 . 1 sec u n i t s . R2> P r o c e d u r e number , i n i n t e r n a l f o r m a t ( i e . b y t e o f f s e t ) 98$: mov r 5 , - ( s p ) ; Save R 5 , mov r 4 , - ( s p ) j Save R 4 . b i c #177400, rO ; Remove a n y t h i n g i n h i g h o r d e r b y t e o f P I D . b i c #177400 , r2 Remove a n y t h i n g i n h i g h o r d e r b y t e o f i n t e r v a l . swab r 2 , Move t h e p r o c e d u r e - * i n t o t h e h i g h o r d e r b y t e . b i s r 2 , r 0 Combine them i n t o < p r o c e d u r e - # , PID> mov r 0 , r 5 S t o r e t h e < . . > p r o c e d u r e number i n R 5 . mov r l , r 4 S t o r e t i m e r i n t e r v a l i n R 4 . t s t T . N F R E I f t h e ' f r e e ' t i m e r Q empty b e q 98$ t h e n e r r o r E X I T . j s r pc ,TREMFQ Remove e l e m e n t f rom ' f r e e ' Q i n t o R 0 . b c s 98$ I f ' f r e e ' Q empty t h e n e r r o r E X I T . d e c T . N F R E ' D e c r e a s e t h e # on t h e ' f r e e * Q mov r 5 , T . P N ( r O ) ' S e t t i m e r ' s p r o c e d u r e # i n ' f r e e ' TID=R0 mov r 4 , T . A B D T ( r O ) ' Se t t i m e r ' s i n t e r v a l . mov r 4 , T . D E L T ( r 0 ) S e t t i m e r ' s d e l t a - t i n t e r v a l . 'Ge t t i m e r i n d e x f rom TREMFQ c a l l i n R 0 . j s r p c , T I N S A Q (Enqueue t i m e r o n t o ' a c t i v e ' Q . b c s 98$ ; l f TID was a ' h e a d ' o r ' t a i l * e r r o r E X I T . i n c T .NACT ; E l s e i n c t h e # on ' a c t i v e ' tmr Q. mov ( s p ) + , r 4 ( R e s t o r e R 4 . mov ( s p ) + , r 5 ( R e s t o r e R5 c l c ( C l e a r c a r r y f o r s u c c e s s . r t s pc ; and r e t u r n . mov ( s p ) + , r 4 ( R e s t o r e R 4 . mov ( s p ) + , r 5 ( R e s t o r e R5 s ec (Set c a r r y f o r f a i l u r e . r t s p c ; and r e t u r n . TDSTMR i s t h e TS$DISABLE TIMERS p r o c e d u r e . ; T h i s p r o c e d u r e d i s a b l e s a l l t i m e r s f o r a DA p r o c e s s b y r e m o v i n g them ; f r o m t h e ' a c t i v e ' t i m e r Q and p l a c i n g them o n t o t h e ' f r e e ' t i m e r Q . 103 The r e g i s t e r s a r e u s e d as f o l l o w s i n t h i s p r o c e d u r e : IN R0> The DA p r o c e s s PID t o d i s a b l e . TDSTMR: :mov r 5 , - ( s p ) , Save R 5 , mov r 0 , r 5 , S t o r e t h e PID i n R 5 . t s t T . N A C T I f t h e ' a c t i v e ' t i m e r Q empty beq 99$ t h e n E X I T s u c c e s s f u l l y . 1 0 $ : mov r 5 , r 0 Get DA p r o c e s s PID i n RO. j s r pc ,TREMAQ Remove one o f i t s t i m e r s f rom t h e ' a c t i v e ' Q . b c s 99$ I f no more DA p r o c e s s e n t r i e s t h e n E X I T , s u c e s s f u l l y . dec T .NACT E l s e d e e r , t h e # on ' a c t i v e ' tmr Q c l r T . P N ( r O ) f C l e a r t i m e r ' s p r o c e d u r e # i n ' f r e e ' TID=R0 c l r T . A B D T ( r O ) ; C l e a r t i m e r ' s t r u e i n t e r v a l . c l r T . D E L T ( r O ) ' C l e a r t i m e r ' s d e l t a - t i n t e r v a l . ;Got t i m e r i n d e x i n RO t h a t was d e Q e d . j s r P C T I N S F Q \u00E2\u0080\u00A2Enqueue i t o h t o ' f r e e ' Q . b c s 98$ ; I f f a i l u r e e r r o r E X I T . i n c T . N F R E F i n e r t h e # on t h e ' f r e e ' Q b r 10$ ; and l o o p b a c k f o r a n y more Q e l e m e n t s . 9 8 $ : mov ( s p ) + , r 5 f R e s t o r e R5 sec ; S e t c a r r y f o r f a i l u r e . r t s p c ; and r e t u r n . 9 9 $ : mov ( s p ) + , r 5 ^ R e s t o r e R5 c l c ; C l e a r c a r r y f o r s u c c e s s . r t s p c ; and r e t u r n . TACTO i s t h e TS$ACCEPT_TIMEOUT p r o c e d u r e . The p r o c e d u r e removes t h e f i r s t e l e m e n t f rom t h e ' a c t i v e ' t i m e r - Q, t h a t must h a v e c o m p l e t e d , and r e q u e u e s i t t o make i t a p e r i o d i c t i m e r . The g e n e r a l r e g i s t e r s a r e u s e d a s f o l l o w s i n t h e p r o c e d u r e : OUT RO - DA p r o c e d u r e ID t h a t h a n d l e s t h i s t i m e r . TACTO: mov j s r b c s d e c mov Dsr b c s i n c mov mov c l c r t s r 5 , - ( s p ) pc ,TDEQAQ 98$ T .NACT T . P N ( r 0 ) , r 5 p c , T I N S A Q 98$ T .NACT r 5 , r 0 ( s p ) + , r 5 p c Save R 5 . Dequeue n e x t c o m p l e t e d t i m e r TID i n t o RO. I f Q empty t h e n e r r o r E X I T . E l s e d e e r , t h e # on ' a c t i v e ' tmr Q Get p r o c e d u r e - I D o f t h e p r o c e d u r e t h a t h a n d l e s t h i s t i m e r t o r e t u r n f r o m t h i s p r o c e d u r GOT T I D o f a t i m e r t o EnQ i n RO. EnQ t i m e r b a c k o n t o ' a c t i v e ' tmr Q . I f T I D was a ' h e a d ' o r ' t a i l ' t h e n e r r o r E X I T . I n c r t h e # on t h e ' a c t i v e ' Q S e t p r o c e d u r e number i n t o RO as a r e t u r n v a l u e R e s t o r e R 5 . C l e a r c a r r y f o r s u c c e s s and E X I T . 104 98$: mov sec r t s ( s p ) + , r 5 p c R e s t o r e R 5 . S e t c a r r y f o r f a i l u r e and E X I T . TINSAQ i s t h e TS$$INSERT_IN_ACTIVE_QUEUE p r o c e d u r e . T h i s p r o c e d u r e i n s e r t s a t i m e r e l emen t i n t o t h e ' a c t i v e ' t i m e r d e l t a Q. The t i m e r i s i n s e r t e d a t t h e a p p r o p r i a t e p l a c e d e p e n d i n g o n i t s v a l u e o f d e l t a - t i m e r e l a t i v e t o t h e t i m e r s a l r e a d y o n t h e Q. The r e g i s t e r s a r e u s e d as f o l l o w s i n t h i s p r o c e d u r e : IN R0> T i m e r ID (TID) t o enqueue . T I N S A Q : : c m p b h i s mov mov mov mov mov mov mov cmp b h i s mov 5 $ : 10$: 20$: rO,#T$NTMR 98$ r 3 , - ( s p ) r 4 , - ( s p ) T . A B D T ( r O ) , r 2 r 2 , T . D E L T ( r O ) # T $ H E A D , r l r l , r 4 T . N E X T ( r l ) , r 3 r3,#T$NTMR 10$ . U T M R , T . D E L T ( r 3 ) 98$: cmp T . D E L T ( r 3 ) , r 2 b h i 10$ sub T . D E L T ( r 3 ) , r 2 mov r 3 , r 4 mov T . N E X T ( r 3 ) , r 3 cmp r3,#T$NTMR b l o 5$ mov r 2 , T . D E L T ( r O ) mov r 3 , T . N E X T ( r O ) mov r 4 , T . P R E V ( r O ) mov r O , T . N E X T ( r 4 ) mov r O , T . P R E V ( r 3 ) cmp r3,#T$NTMR b h i s 20$ sub r 2 , T . D E L T ( r 3 ) mov T . N E X T ( r l ) , r l mov T . D E L T ( r l ) , T . U T M R mov # 1 , T . U F L G mov ( s p ) + , r 4 mov ( s p ) + , r 3 c l c r t s p c sec r t s p c I f TID o f new t i m e r e l e m e n t i s a ' h e a d ' o r ' t a i l ' t h e n e r r o r E X I T . Save R 3 . Save R 4 . Ge t new t i m e r ' s d u r a t i o n i n t o R 2 . R e s e t t i m e r s d e l t a - t i m e . S e t i n d e x t o head o f ' a c t i v e ' t i m e r Q i n t o R l . Use R4 as p r e v i o u s e l emen t p t r . . Use R3 as c u r r e n t e l emen t p t r . . See i f n e x t e l emen t i s t h e ' t a i l ' . I f a c t i v e Q empty t h e n jump t o c o n t i n u e . A d j u s t f i r s t d e l t a - t i m e r o n Q b e f o r e a d d i n g new t i m e r . See what t h e n e x t t i m e r s d e l t a - t i m e i s . I f g r e a t e r t h e n jump t o i n s e r t T I D i n Q. E L s e s u b t r a c t i t s v a l u e as we go by i t . Save R3 a d v a n c e i n t h e Q See i f n e x t e l emen t i s t h e ' t a i l ' . I f n o t t h e n l o o p a g a i n . I n s e r t e l e m e n t R0 i n t o Q a f t e r R4 & b e f o r e R 3 . I n s e r t m o d i f i e d d e l t a - t i n t o Q . See i f R3 i s t h e Q ' t a i l ' . I f i t i s t h e n jump. E l s e a d j u s t n e x t Q e l e m . f o r i n s e r t e d d e l t a - t . Ge t p t r . t o f i r s t Q e l e m e n t . R e l o a d c o u n t - d o w n - t i m e r . E n a b l e t i m e r s . R e s t o r e R 4 . R e s t o r e R 3 . C l e a r c a r r y f o r s u c c e s s and r e t u r n . . S e t c a r r y f o r f a i l u r e . and r e t u r n . TREMAQ i s t h e TS$REMOVE_FROM_ACTIVE_QUEUE p r o c e d u r e . 105 T h i s p r o c e d u r e removes t h e f i r s t t i m e r e l e m e n t b e l o n g i n g t o a g i v e n DA p r o c e s s f rom t h e ' a c t i v e ' t i m e r d e l t a Q . The r e g i s t e r s a r e u s e d a s f o l l o w s i n t h i s p r o c e d u r e . I N R0> PID o f DA p r o c e s s r e q u e s t i n g t h e r e m o v a l o f a t i m e r . OUT RO T i m e r ID (TID) t o enque . T I N S F Q : : c m p r0,#T$NTMR I f TID o f t i m e r e l e m e n t t o enq i s a b h i s 98$ ' h e a d ' o r ' t a i l ' t h e n e r r o r E X I T . mov # T $ T F R E , r l Ge t t h e ' t a i l ' o f t h e ' f r e e ' t i m e r Q . mov r l , T . N E X T ( r 0 ) S e t f / w i n d e x t o t a i l i n new t m r . mov T . P R E V ( r l ) , r 2 Get t a i l s ' p r e v ' i n d e x . mov r 2 , T . P R E V ( r O ) S e t b /w i n d e x i n new t m r . mov r O , T . N E X T ( r 2 ) S t o r e f / w i n d e x t o new t i m e r e l e m e n t . mov r O , T . P R E V ( r l ) s t o r e same i n t a i l e l e m e n t . c l c , C l e a r c a r r y f o r s u c c e s s r t s p c and r e t u r n . 9 8 $ : s ec S e t c a r r y f o r f a i l u r e , c a n n o t enQ a r t s p c ' h ' o r ' t ' and r e t u r n . TREMFQ i s t h e TS$REMOVE_FROM_FREE_QUEUE p r o c e d u r e . T h i s p r o c e d u r e dequeues a t i m e r e l emen t f r o m t h e ' h e a d ' o f t h e f r e e t i m e r Q . The r e g i s t e r s a r e u sed as f o l l o w s i n t h i s p r o c e d u r e : 107 ; OUT RO P r o c e d u r e # i n i n t e r n a l r e p r e s e n t a t i o n i e as a n o f f s e t i n t o a jump t a b l e o f p r o c e d u r e - s t a r t a d d r e s s e s . UCDAP: 10$: mov r 5 , - ( s p ) ; Save R 5 . b i c # l , r O ; E n s u r e b i t 0 i s z e r o , a s i t s h o u l d b e . cmp rO,#F$NPC , Compare r e q u e s t e d p r o c # w i t h t h e max a v a i l a b l e b h i s u n o p r c I f t o o b i g ( 0 . . F $ N P C - 1 ) t h e n e r r o r e x i t . t s t P . T B L ( r O ) See i f a v a l i d u s e r - V A i s p r e s e n t . b e q u n o p r c I f z e r o e x i t i n e r r o r . mov P . L E N S ( r O ) , r l Ge t 'max l e n g t h ' o f t h i s e v e n t f rom mapped p r o c e s s - c o d e r e s i d e n t t a b l e . mov @#O.LEN,r2 Get c u r r e n t RECORD.LENGTH f r o m t h e mapped u s e r s c u r r e n t 0 / P b u f f e r . add r l , r 2 Form ' R E C O R D . L E N G T H - a f t e r - e v e n t ' . cmp r2 ,#UMAXRL \u00E2\u0080\u00A2See i f b u f f e r w o u l d o v e r f l o w b i o s 10$ ; I f i t w o u l d n o t t h e n jump t h e o u t p u t IOT [Output c u r r e n t DA p r o c e s s ' s 0 / P b u f f e r t o h o s t & be g i v e n a new f o r m a t t e d one mov r 0 , r 5 \u00E2\u0080\u00A2Save t h e p r o c e d u r e number d u r i n g t h e C A L L . mov #UHNEWB,r0 [Get the\"NEWBUFFER\"sub # i n R O . j s r p c , U C D A P \u00E2\u0080\u00A2 C a l l t h e DA p r o c e s s ' s p r o c e d u r e R E C U R S I V E L Y ! ! \u00E2\u0080\u00A2 I t i s n o t an e r r o r n o t t o h a v e t h i s r o u t i n e \u00E2\u0080\u00A2 so no c a r r y t e s t i s r e q d . mov r 5 , r 0 \u00E2\u0080\u00A2 R e s t o r e t h e p r o c e d u r e number a f t e r t h e C A L L . [FORMAT S T A R T - O F - N E X T - E V E N T IN O / P BUFFER. mov F . L P R C , r l [Get t h e PID o f t h e c u r r e n t D A - p r o c e s s i n R l . mov # 0 . L E N , r 2 [Get t h e K e r n a l VA o f c u r r e n t O / P b u f f e r i n R 2 , 109 a d d c l r mov b i s mov mov mov mov p r o t o c o l . mov ( r 2 ) , r 2 ( r 2 ) + P . T Y P E ( r O ) , ( r 2 ) # 1 0 0 0 0 0 , ( r 2 ) + P C B . N A ( r l ) , ( r 2 ) + P C B . N B ( r l ) , ( r 2 ) + Form a d d r e s s o f n e x t f r e e e n t r y word i n O / P b u f f e r . S t o r e a z e r o E V E N T . L E N G T H . Ge t t h e E V E N T . T Y P E f r o m t h e p r o c e s s t a b l e s . S t o r e t h e EVENT.CLASS=128 b i t s . S t o r e t h e l o w EVENT.NUMBER_EVENT S t o r e t h e h i g h EVENT.NUMBER EVENT ;SETUP STACK FOR CALL-DOWN TO THE USER PROCEDURE mov mov a d d mov mov b i s m t p i m t p i m t p i r t i u r t n : mov c l c r t s u n o p r c : mov sec r t s @#F$PS , - ( sp ) # u r t n , - ( s p ) # 1 4 4 2 0 0 , - ( s p ) # P . E N T R Y , - ( s p ) O . L E N , - ( s p ) # 8 . , ( s p ) # P . S T K B , - ( s p ) r 0 , - ( s p ) #034000,@#F$PS r 5 sp rO Push t h e c u r r e n t PS o n t o t h e s t a c k . Push my r e t u r n PC o n t o t h e s t a c k a s p a r t o f t h e r e t u r n - f r o m - D A - p r o c e s s - v i a - B P T Push t h e u s e r - V A P S ' ' o n t o my s t a c k i t i s : c u r r e n t mode = u s e r p r e v mode = k e r n a l r e g i s t e r s e t = 1 p r i o r i t y = 4 c o n d i t i o n code = a l l z e r o . Push u s e r - V A P C ' o f D A - p r o c e s s e n t r y p o i n t . SETUP\"ACTUAL-PARAMETERS\"OF T H E \" C A L L \" . C a l c u l a t e u s e r - V A o f n e x t f r e e b y t e i n 0 / P b u f f e r . . f o r p a s s i n g t o t h e D A - p r o c e s s as R 0 ' . Save t h e v a l u e f o r u s e r S P . Save t h e p r o c e d u r e - * t o c a l l f o r R 5 ' . S w i t c h t o p r e v mode = USER and r e g s e t = 1 R 5 ' = P r o c e d u r e - * t o c a l l i n DA p r o c e s s . u s e r - S P = u s e r - V A o f a r e a a l l o t t e d . R 0 ' = P o i n t e r t o n e x t f r e e b y t e i n O / P b u f f e r . ' C A L L ' THE DA PROCESS 'S PROCEDURE BY DOING AN \" R T I \" . THIS POPS THE TOP 2 WORDS OFF THE STACK AS THE NEW PS & PC i n USER-VA . [RETURN HERE FROM DA PROCESS, BY A ' B P T ' ; WHICH SETS REGISTER SET 0 . ( s p ) + , r 5 [ R e s t o r e R 5 . ; C l e a r c a r r y f o r s u c c e s s p c ; and r e t u r n . ( s p ) + , r 5 ; R e s t o r e R 5 . ; S e t c a r r y f o r f a i l u r e p c ; and r e t u r n . INSTRUCTION UFNBF i s t h e UPS $ FORMAT_NEW_BUFFER p r o c e d u r e . T h i s p r o c e d u r e f o r m a t s a new 0 / P b u f f e r f o r t h e c u r r e n t DA p r o c e s s . U F N B F : : mov mov mov c l r mov mov F . L P R C , r 0 #20,@#O.LEN #401,@#O.CT @#0.STAT #12,@#0H.LEN #401,@#OH.CT [Get c u r r e n t P ID i n R 0 . [ I n i t i a l i z e t h e RECORD l e v e l s t r u c t u r e . [Se t RECORD.LENGTH t o 2 0 ( o c t ) 1 6 ( d e c i m a l ) . [Se t RECORD.CLASS=1 & RECORD.TYPE=1 . [ C l e a r RECORD.STATUS. [ I n i t i a l i z e t h e RECORD.HEADER l e v e l s t r u c t u r e . ; S e t HEADER.LENGTH t o 1 2 ( o c t ) l O ( d e c i m a l ) . [ S e t HEADER.CLASS=1 & H E A D E R . T Y P E = 1 . 110 mov PCB.EN(R0) ,@#OH.EN S e t HEADER.EXPERIMENT_NUMBER. mov PCB.CR(R0) ,@#OH.RN , S e t t h e HEADER.RUN_NUMBER. mov P C B . C C ( r O ) , r l Ge t t h e c u r r e n t e x p t - c o n d i t i o n v a l u e , swab r l swap t h e b y t e s t o p u t i t i n t h e MSB, b i s P C B . C S ( r O ) , r l Merge i n t h e c u r r e n t e x p t - s e t u p v a l u e mov r l , @ # O H . C S S e t t h e HEADER.CONDITION S> H E A D E R . S E T U P . c l c , C l e a r c a r r y f o r s u c c e s s r t s pc ; and r e t u r n . UFNCP i s t h e UPS$FORMAT_NEW_CODE_PAGE p r o c e d u r e . T h i s p r o c e d u r e f o r m a t s ( z e r o e s ) a new c o d e page f o r t h e c u r r e n t DA p r o c e s s . U F N C P : : mov # P . T B L , rO Get t h e s t a r t a d d r e s s o f t h e code page i n RO. mov #4096 . , r l Se t t h e c o u n t - d o w n c o u n t e r t o t h e # o f words on a code p a g e . 1 0 $ : c l r ( r 0 ) + C l e a r t h e n e x t word o n t h e code page sob r l , 1 0 $ and l o o p a r o u n d i f t h e r e a r e more t o c l c ( C l e a r c a r r y f o r s u c c e s s r t s p c ; and r e t u r n . USBFS i s t h e UPS$SET_BUFFER_STATUS p r o c e d u r e . T h i s p r o c e d u r e s e t s a s t a t u s b i t i n t h e c u r r e n t DA p r o c e s s ' s 0 / P b u f f e r s t a t u s w o r d . The g e n e r a l r e g i s t e r s a r e u s e d as f o l l o w s : IN R0> S t a t u s mask c o n t a i n i n g t h e b i t s t o be s e t . U S B F S : : b i s c l c r t s r0 ,@#0 .STAT p c S e t t h e b i t s i n t h e RO mask i n t o RECORD.STATUS. C l e a r c a r r y f o r s u c c e s s and r e t u r n . UWSYEV i s t h e UPS$WRITE_SYSTEM EVENT p r o c e d u r e . T h i s p r o c e d u r e w r i t e s an e v e n t t o t h e c u r r e n t DA p r o c e s s ' s 0 / f f e r . The g e n e r a l r e g i s t e r s a r e u s e d as f o l l o w s : I N R l > E v e n t T Y P E , t h e CLASS i s a l w a y s 1 2 8 . UWSYEV::mov F . L P R C , r 0 Ge t t h e c u r r e n t P ID i n RO. mov # 2 0 . , U . L E N , S e t t h e e v e n t l e n g t h . mov # 1 2 8 . , r 2 , Ge t t h e s y s t e m - e v e n t e v e n t CLASS i n R2 swab r 2 and move i t up t o t h e msb . b i c # 1 7 7 4 0 0 , r l Get t h e e v e n t TYPE i n R l . b i s r l , r 2 Form t h e combined C L A S S / T Y P E w o r d . mov r 2 , U . C T S e t t h e e v e n t C L A S S / T Y P E . mov P C B . N A ( r O ) , U . E N L S e t t h e l o w o r d e r EVENT_NUMBER. mov P C B . N B ( r O ) , U . E N H S e t t h e h i g h o r d e r EVENT_NUMBER. mov # U D . T M l , r O Get t h e l o c a t i o n t o p u t t h e t i m e i n R l . j s r p c , T G E T T M Have t h e 6 - w o r d t i m e moved t h e r e . mov # U S E L , r l Ge t 'max l e n g t h ' o f t h i s s y s t e m - e v e n t . mov @ # 0 . L E N , r 2 Get c u r r e n t RECORD.LENGTH f r o m t h e mapped u s e r s c u r r e n t 0 / P b u f f e r . add r l , r 2 Form ' R E C O R D . L E N G T H - a f t e r - e v e n t ' . cmp r2 ,#UMAXRL \u00E2\u0080\u00A2See i f b u f f e r w o u l d o v e r f l o w 111 10$: 20$: b i o s IOT mov j s r mov add mov mov mov sob add c l c r t s 10$ #UHNEWB,r0 p c , U C D A P #OPBUF,r0 O . L E N , r O # U S E L / 2 , r l # U . S Y E V , r 2 ( r 2 ) + , ( r 0 ) + r l , 2 0 $ # U S E L , 0 . L E N pc I f i t w o u l d n o t t h e n jump t h e o u t p u t Ou tpu t c u r r e n t DA p r o c e s s ' s O / P b u f f e r t o h o s t & be g i v e n a new f o r m a t t e d one Get the\"NEWBUFFER\"sub # i n RO. C a l l t h e DA p r o c e s s ' s p r o c e d u r e . I t i s n o t an e r r o r n o t t o have one o f t h e s e so no c a r r y t e s t . Get d e s t i n a t i o n a d d r e s s o f t h e O / P b u f f e r Add on ' n e x t - f r e e - b y t e ' o f f s e t . S e t u p l o o p c o u n t e r ( i n w o r d s ) , f o r t h e e n t i r e s y s t e m - e v e n t . Ge t s o u r c e a d d r e s s o f e v e n t . Move t h e n e x t w o r d i n t o t h e O / P b u f f e r and l o o p a r o u n d i f t r a n s f e r n o t c o m p l e t e . I n c r e a s e t h e s t o r e d - d a t a b y t e l e n g t h by t h e l e n g t h o f a s y s t e m - e v e n t . C l e a r c a r r y f o r s u c c e s s and r e t u r n . UTPTBL i s t h e UPS$TEST_PROCESS_TABLE p r o c e d u r e . T h i s p r o c e d u r e t e s t s t h e p e r - p r o c e s s t a b l e s o f t h e c u r r e n t DA p r o c e s s t o see w h e t h e r t h e y have t h e c o r r e c t b a s i c s t r u c t u r e . U T P T B L : : t s t @#P.TBL ; See whe the r MAIN i s d e f i n e d . bne 22$ ; I f d e f i n e d jump t o c o n t i n u e . EMT CNST , S i g n a l 'No MAIN p r o g r a m d e f i n e d ' . b r 30$ J E r r o r e x i t . 2 2 $ : t s t @#P.TBL+2 ; See whe the r BEGINRUN i s d e f i n e d . bne 24$ I f d e f i n e d jump t o c o n t i n u e . EMT CNBR , S i g n a l 'No BEGINRUN p r o c e d u r e d e f i n e d ' . b r 30$ j E r r o r e x i t . 2 4 $ : t s t @#P.TBL+4 , See whe the r ENDRUN i s d e f i n e d . bne 25$ I f d e f i n e d jump t o c o n t i n u e . EMT CNER S i g n a l 'No ENDRUN p r o c e d u r e d e f i n e d ' . b r 30$ , E r r o r e x i t . 2 5 $ : t s t @#P.TBL+6 , See whe the r PAUSE i s d e f i n e d . b e q 26$ I f n o t d e f i n e d jump t o c o n t i n u e . E l s e i f i t does e x i s t t h e n CONTINUE must s o . . . t s t @#P.TBL+8. See w h e t h e r CONTINUE i s d e f i n e d . bne 26$ I f d e f i n e d jump t o c o n t i n u e . EMT CNC S i g n a l 'No CONTINUE p r o c e d u r e d e f i n e d ' . b r 30$ E r r o r e x i t . 2 6 $ : mov # - 2 , r 0 S e t t h e l o o p l i m i t o v e r t h e D A -- p r o c e s s t a b l e s . 2 7 $ : add # 2 , r 0 Move t h e t a b l e p t r . f o r w a r d b y 2 . cmp r 0 , # 2 * F $ N P C ;See i f t h e end o f t h e t a b l e i s r e a c h e d . b h i s 28$ I f i t has t h e n jump t o c o n t i n u e . \u00E2\u0080\u00A2START LOOP. mov P . T B L , r l ;Get a p r o c e d u r e V A . b e q 28$ ; I f t h e p r o c e d u r e i s n o t d e f i n e d t h e n end t e s t s . b i t # l , r l ;See i f t h e p r o c e d u r e VA i s o d d . beq 40$ [ B r a n c h t o c o n t i n u e i f z e r o . 3 9 $ : EMT CBDPVA ; S i g n a l \" B a d p r o c e d u r e V A \" . 112 b r 30$ ; E r r o r e x i t . 4 0 $ : cmp r l , # P . S T K B | See i f t h e p r o c e d u r e VA i s a f t e r t h e s t a c k a r e a . b i o s 39$ | Jump i f n o t . cmp r l , # M $ V A P 5 ; See i f t h e p r o c e d u r e VA i s b e f o r e page 5 e n d . b h i s 39$ Jump i f n o t . mov P . L E N S ( r O ) , r l ; Ge t t h e e v e n t l e n g t h . b i t # l , r l See i f t h e e v e n t l e n g t h i s o d d . beq 42$ Jump i f n o t . 4 1 $ : EMT CBDIDL E l s e s i g n a l ' B a d i n s e r t e d d a t a l e n g t h ' , b r 30$ E r r o r e x i t . 4 2 $ : cmp r l , # U M A X E L , See i f t h e r e q u i r e d e v e n t l e n g t h i s t o o l o n g . b h i 41$ I f l e n g t h i s OK t h e n c o n t i n u e . mov P . B G L ( r O ) , r l Ge t t h e e v e n t BGL p a t t e r n . b i t # l , r l See i f t h e BGL i s odd b e q 44$ B r a n c h i f n o t 4 3 $ : EMT CBADGL S i g n a l \" B a d BGL P a t t e r n \" . b r 30$ \u00E2\u0080\u00A2 E r r o r e x i t . 4 4 $ : cmp r l , # 1 0 0 0 ;See i f t h e BGL p a t t e r n i s t h e r i g h t v a l u e s . b h i s 43$ [ B r a n c h i f i t i s n o t . mov P . T Y P E , r l [Get t h e e v e n t t y p e . cmp r l , # 2 5 5 . [See i f i t e x c e e d s 2 5 5 . b i o s 45$ [ B r a n c h i f i t i s n o t . EMT CBDET [ S i g n a l \" B a d e v e n t t y p e \" . b r 30$ [ E r r o r e x i t . 4 5 $ : [Any more t e s t s . b r 27$ [Loop t o t e s t t h e n e x t p r o c e d u r e . 3 0 $ : s ec [Se t c a r r y f o r f a i l u r e r t s p c ; and r e t u r n . 2 8 $ : c l c [ C l e a r c a r r y f o r s u c c e s s r t s p c [ and r e t u r n . UENBGL i s t h e UPS$ENABLE_BGLS p r o c e d u r e . T h i s p r o c e d u r e e n a b l e s a l l B G L ' s so t h a t a p r o c e d u r e i n a DA p r o c e s s c a n r e c e i v e c o n t r o l on t h e o c c u r a n c e o f any one o f t h e m . UENBGL: :mov r 3 , - ( s p ) , Save R 3 . mov r 4 , - ( s p ) , Save R 4 . mov r 5 , - ( s p ) Save R 5 . c l r r 3 , C l e a r t h e # - o f - B G L s - e n a b l e d c o u n t e r . mov F . L P R C , r 0 , Ge t t h e c u r r e n t P I D i n R 0 . mov r 0 , r 5 Save t h e PID f o r c a l l s t o SENBGL. mov # - 2 . , r 4 S e t t h e i n i t i a l l o o p c o u n t e r . 1 0 $ : add # 2 , r 4 Move t h e l o o p c o u n t e r f o r w a r d 2 b y t e s . cmp r 4 , # 2 * F $ N P C , See i f l o o p has c o m p l e t e d . b e q 30$ , I f i t has t h e n e x i t s u c c e s s f u l l y . mov P . B G L ( r 4 ) , r l See i f t h e r e i s a n e n t r y i n t h e n e x t e l e m e n t . beq 10$ I f n o t t h e n l o o p t o t e s t n e x t e l e m e n t . t s t P . T B L ( r 4 ) See i f h a n d l e r p r o c e d u r e i s d e f i n e d f o r e l e m e n t . beq 10$ I f none t h e n l o o p t o t e s t n e x t e l e m e n t mov r 5 , r 0 Get t h e P ID i n R 0 . Got t h e BGL i n R l . 113 40$: 30$: mov r 4 , r 2 , Ge t t h e p r o c e d u r e number i n R2 j s r p c , S E N B G L , E n a b l e t h e s i n g l e BGL f o r t h i s D A - p r o c e s s b c s 40$ , l o o p , i f e n a b l i n g s u c c e d e d , t o n e x t e l e m . t e s t i n c r 3 Coun t t h e s u c c e s f u l l e n a b l e s b r 10$ and l o o p a r o u n d . mov ( s p ) + , r 5 R e s t o r e R 5 . mov ( s p ) + , r 4 R e s t o r e R 4 . mov ( s p ) + , r 3 R e s t o r e R 3 . sec S e t c a r r y f o r f a i l u r e r t s p c ( and r e t u r n . j s r P C S E N D M D ( E n a b l e SCI i n t e r r u p t s . mov r 3 , P C B . B ( r 5 ) Save t h e # - o f - B G L s - e n a b l e d . mov ( s p ) + , r 5 ( R e s t o r e R 5 . mov ( s p ) + , r 4 ( R e s t o r e R 4 . mov ( s p ) + , r 3 ( R e s t o r e R 3 . c l c ( C l e a r c a r r y f o r s u c c e s s r t s pc ; and r e t u r n . UENTMR i s t h e UPS$ENABLE_TIMERS p r o c e d u r e . T h i s p r o c e d u r e e n a b l e s a l l t i m e r s so t h a t a p r o c e d u r e i n a DA p r o c e s s c a n r e c e i v e c o n t r o l on t h e o c c u r a n c e o f t h e c o m p l e t i o n o f a n y one o f them UENTMR::mov r 3 , - ( s p ) ; Save R 3 . mov r 4 , - ( s p ) ; Save R 4 . mov r 5 , - ( s p ) , Save R 5 . c l r r 3 , C l e a r t h e # - o f - t i m e r s - e n a b l e d mov F . L P R C , r 0 , Ge t t h e c u r r e n t P ID i n R 0 . mov r 0 , r 5 Save t h e PID f o r c a l l s t o TENTMR. mov # - 2 . , r 4 , S e t t h e i n i t i a l l o o p c o u n t e r . 1 0 $ : add #2 , r4 Move t h e l o o p c o u n t e r f o r w a r d 2 b y t e s . cmp r 4 , # 2 * F $ N P C See i f l o o p has c o m p l e t e d . b e q 30$ I f i t has t h e n e x i t s u c c e s s f u l l y . mov P . T I M R ( r 4 ) , r l \u00E2\u0080\u00A2See i f t h e r e i s a n e n t r y i n t h e n e x t ( e l e m e n t . b e q 10$ \u00E2\u0080\u00A2 I f n o t t h e n l o o p t o t e s t n e x t e l e m e n t . t s t P . T B L ( r 4 ) See i f h a n d l e r p r o c e d u r e i s d e f i n e d ( f o r e l e m e n t . b e q 10$ ; I f none t h e n l o o p t o t e s t n e x t e l e m e n t . mov r 5 , r 0 (Get t h e P ID i n R 0 . (Got t h e d e l t e - t i n R l . mov r 4 , r 2 (Get t h e p r o c e d u r e number i n R 2 . j s r pc ,TENTMR ( E n a b l e t h e s i n g l e t i m e r f o r t h i s ; D A - p r o c e s s b c s 40$ ( e x i t i f e n a b l i n g f a i l e d . i n c r 3 (Count t h e number o f s u c c e s f u l l e n a b l e s b r 10$ ( and l o o p a r o u n d . 4 0 $ : mov ( s p ) + , r 5 ( R e s t o r e R 5 . mov ( s p ) + , r 4 ( R e s t o r e R 4 . mov ( s p ) + , r 3 ( R e s t o r e R 3 . sec (Se t c a r r y f o r f a i l u r e r t s p c ( and r e t u r n . 3 0 $ : mov r 3 , P C B . T ( r 5 ) (Save t h e # o f t i m e r s e n a b l e d . mov ( s p ) + , r 5 ( R e s t o r e R 5 . mov ( s p ) + , r 4 ( R e s t o r e R 4 . mov ( s p ) + , r 3 ( R e s t o r e R 3 . 114 c l c [ C l e a r c a r r y f o r s u c c e s s r t s p c ; and r e t u r n . \u00E2\u0080\u00A2 page \u00E2\u0080\u00A2 t i t l e KERNVA K e r n a l v i r t u a l page 1 i s n o n - r e s i d e n t . K e r n a l v i r t u a l page 2 maps t h e 0 / P BUFFER o f t h e c u r r e n t DA p r o c e s s . OPBUF O . L E N O.CT O.STAT O H . L E N OH.CT OH. EN OH.RN OH.CS M$VAP2 OPBUF OPBUF+2 OPBUF+4 OPBUF+6 OPBUF+8. OPBUF+10. OPBUF+12. OPBUF+14, D e f i n e s t a r t - o f - O / P - b u f f e r - a d d r e s s s y m b o l . The O/P b u f f e r i s 8Kb l o n g and i s mapped i n t o K e r n a l VA page 2 when n e e d e d . I n i t i a l i z e t h e RECORD l e v e l s t r u t u r e . S e t RECORD.LENGTH t o 2 0 ( o c t ) 1 6 ( d e c i m a l ) . S e t RECORD.CLASS=1 & RECORD.TYPE=1. C l e a r RECORD.STATUS. I n i t i a l i z e t h e RECORD.HEADER l e v e l s t r u c t u r e . S e t HEADER.LENGTH t o 1 2 ( o c t ) l O ( d e c i m a l ) . S e t HEADER.CLASS=1 & HEADER.TYPE=1 . S e t HEADER.EXPERIMENT_NUMBER. S e t t h e HEADER.RUN_NUMBER. S e t t h e HEADER.CONDITION & H E A D E R . S E T U P . \u00E2\u0080\u00A2 page K e r n a l v i r t u a l page 3 i s n o n - r e s i d e n t . K e r n a l v i r t u a l page 4 maps t h e CODE o f t h e c u r r e n t DA p r o c e s s . P . T B L P . LENS P . BGL P . T I M R ==: P . T Y P E ==: M$VAP4 P.TBL+<2*F$NPC> P.LENS+<2*F$NPC> P.BGL+<2*F$NPC> P.TIMR+<2*F$NPC> Map t o a t a b l e , one w o r d p e r e n t r y , o f t h e u s e r VA s p a c e a d d r e s s e s o f t h e a p p r o p r i a t e DA p r o c e d u r e . A n o n - z e r o e n t r y i m p l i e s t h e p r o c e d u r e i s p r e s e n t and e n t r i e s a r e t h e n a l l o w e d i n some o f t h e t a b l e s b e l o w . Map t o a t a b l e , one word p e r e n t r y , o f e v e n t l e n g t h s o f t h e a p p r o p r i a t e . DA p r o c e d u r e . Map t o a t a b l e , one word p e r e n t r y , o f t h e B . G L w h i c h i n v o k e s t h e a p p r o p DA p r o c e d u r e . An e n t r y h e r e p r e c l u d e s one i n t h e P . T I M R t a b l e . Map t o a t a b l e , one word p e r e n t r y , o f t h e t i m e r v a l u e , i n t e n t h s o f a s e c o n d , f o r t h i s p r o c e d u r e . A n e n t r y h e r e p r e c l u d e s an e n t r y i n t h e P . B G L t a b l e . Map t o a t a b l e , one word p e r e n t r y , o f t h e 115 P . S T K T P . S T K B P .ENTRY P.CMMN ; P . V A R S ; P . L B L S ; P . C O D E P.TYPE+<2*F$NPC> P.STKT+200 P . S T K B P . S T K B P . S T K B P . S T K B P . S T K B e v e n t t y p e ( 1 . . 1 2 7 ) o f t h e h a n d l e r p r o c e d u r e . THE DA PROCESS \" M A I N \" STARTS HERE IN THE ORDER: - S t a c k - COMMON s t o r a g e - V a r i a b l e s s t o r a g e - L a b e l s jump t a b l e - E x e c u t a b l e c o d e - READ/WRITE I / O b u f f e r . Top o f D A - p r o c e s s s t a c k . B o t t o m o f D A - p r o c e s s s t a c k . THE ENTRY POINT INTO U S E R - V A . . page K e r n a l v i r t u a l page 5 i s non r e s i d e n t . K e r n a l v i r t u a l page 6 i s non r e s i d e n t . K e r n a l v i r t u a l page 7 maps t h e I / O p a g e . END OF KERNAL (FLOSY) VIRTUAL ADDRESS SPACE .END FLOSY 116 "@en . "Thesis/Dissertation"@en . "10.14288/1.0051900"@en . "eng"@en . "Computer Science"@en . "Vancouver : University of British Columbia Library"@en . "University of British Columbia"@en . "For non-commercial purposes only, such as research, private study and education. Additional conditions apply, see Terms of Use https://open.library.ubc.ca/terms_of_use."@en . "Graduate"@en . "Flosy : a nonpreemptive FEP operating system"@en . "Text"@en . "http://hdl.handle.net/2429/26209"@en .