PROJECT: MAC REPLACEMENT PROJECT DOC. TYPE: DESIGN SPECIFICATION SUBJECT: FAST ACCESS OF LARGE DATA AREAS OUTSIDE THE TASK IMAGE TITLE: ACCESSING UNMAPPED REGIONS GROUP: RSX-11M SYSTEM EXTENSIONS AUTHOR: D.B.CURTIS DOC NO.: 34.2 DATE: 15-FEB-79 20:45 FILE: largary.RNO MODIFIED: 18 JUL 79 23:09 PAGE 2 1.0 OBJECTIVES This document describes a method of accessing regions without being mapped to them. This method allows better utilization of the tasks virtual address space. The method is suitable for accessing very large (greater than 4K word) areas. The method is easy to modify. Other documents describe additional functionality. The document is separated into the following major sections: 1. discussion -- an overview of the method and a discussion of its merits and deficiencies. 2. detailed plan -- a design for the implementation. 2.0 DISCUSSION This section overviews the method and its limitations. It has the following sub-sections: 1. overview of the method 2. merits of the method 3. deficiencies of the method 2.1 Overview of the Method This method is an easy way of supplementing the executive services. One supplementary service allows reasonably rapid access to very large shared areas. The need for this service appears in the RSXMULTI project where the 4K word dynamic area is restrictive, and in the MAC REPLACEMENT PROJECT which needs a very large resident data area. Typically, this would be satisfied by using the PLAS directives to map into the shared data area. There are advantages and disadvantages to both methods and these are described in section 2.2 and 2.3. The method used places code into the system pool and attaches the illegal instruction trap vector to this code. This is done by a separate task. Once done, all other tasks may use the facility. PAGE 3 Another task removes the code and returns the system to its original state. Typically, the facility would be loaded and the system saved, thus, providing the facility at system startup. The initial implementation of the facility provides the following: 1. transfer a word (on the task's stack) to a specified location in the region's area. 2. transfer a word from a specified location in a region to the task's stack. 3. transfer a block of words from the task's area to the region. 4. transfer a block of words from the region to the task area. 5. set a value into a block of locations in the region. The user is able to specify the region to access. The number of words that can be transferred is a maximum of 2048 words. This is because the facility runs in the system state and therefore task switching is disabled and this could cause unreasonable response to real time events. 2.2 Merits of the Method This method has the following advantages over the PLAS method. 1. allows the complete addressing space of a task to be used. There no longer is the need to truncate the virtual space of the task by 4K words. 2. in the case of very large commons with large tasks there is no special code to map to and from different areas in the common. 3. any dynamic region in the system can be accessed without need of special privilege. 4. as mapping is not done, it adds another level of memory resident overlays to the task. 5. As an illegal instruction is used, microcoded PDP-11s could implement the instruction to increase efficiency. PAGE 4 2.3 Deficiencies of the Method This method has the following disadvantages with respect to the PLAS method. 1. each access to a particular word of the region takes much longer. In the PLAS method, an entire chunk of the memory is directly accessible by the task. In the illegal instruction method, every access to a word has significant overhead. This disadvantage is overcome only with very large arrays with random accesses or by copying large blocks of memory to the task for access and then back to the shared area when done (paging of data). For MULTI, it may be reasonable to copy blocks of dynamic into some smaller array for processing and to restore the processed data. NOTE There may be ways to speed up this access. These may be implemented later. One method is to keep the names of the checked regions around in the system pool to speed the access protection checks. This would speed the accesses to a given area but slow the access to new areas. Other optimizations can be implemented as the need becomes understood. 2. there is no I/O access to the region. 3.0 DETAILED PLAN This section provides a detailed plan of the implementation. There are the following subsections: 1. Initial Conditions 2. Usage (calling sequences) 3. system constraints 4. ISF -- InStall Function 5. RMF -- ReMove Function PAGE 5 3.1 Initial Conditions The task that wants access to a region, must first attach to that region. This way, the system may check the task/region privileges and refuse the task access if the privileges are not compatible. The system returns a region ID and this ID is used to access the region. Write attempts to the region are checked for privilege. Read | attempts are not checked. NOTE | The first version does not make the | above mentioned privilege checks. If | needed, they will be added. 3.2 Usage (calling sequences) | The instruction that starts the system function is: | 210 The arguments of the instruction are on the stack. There are the following types. 1. TYPE 0 -- transfer word to user 2. TYPE 1 -- transfer word from user 3. TYPE 2 -- transfer block of words to user 4. TYPE 3 -- transfer block of words from user 5. TYPE 4 -- set a block of area to user specified value PAGE 6 Each of these types have the following information on the stack at the time of the 210 instruction execution. This information is required for each type. Each type may have other information placed on the stack along with the required information. | | 10(SP) INDEX HIGH PART | 6(SP) INDEX LOW PART | 4(SP) REGION ID WORD OBTAINED FROM ATTACH REGION | 2(SP) RAD50 REPRESENTATION OF "ILL" | (SP) TYPE | Where the INDEX is a 24-bit byte index into the region. | For type 0: | no more needed information | For type 1: | 12(SP) VALUE TO BE STORED IN THE REGION | For type 2: | 14(SP) NUMBER OF BYTES TO TRANSFER | 12(SP) VIRTUAL ADDRESS TO TRANSFER TO | For type 3: | 14(SP) NUMBER OF BYTES TO TRANSFER | 12(SP) VIRTUAL ADDRESS TO TRANSFER FROM | For type 4: | 14(SP) NUMBER OF BYTES TO SET | 12(SP) VALUE TO SET INTO AREA | All cases except type 0 finish the operation with the stack cleared. | Type 0 returns the value obtained from the area on the stack. Carry | clear implies operation completed successfully. Carry set implies an | error, the stack is not cleared. The instruction may produce an | illegal instruction trap if the arguments are out of order. 3.3 System Constraints The following is a list of implemention constraints. | 1. real illegal instructions must still work PAGE 7 | 2. 210 with incorrect type is treated as an illegal instruction. 3. XDT causes the illegal instruction trap to be reset every time XDT executes. This requires the appropriate table in the XDT code to be ZAPed to allow this to run. It is possible that the ISF and RMF tasks would do this dynamically. 4. Only attached regions may be accessed ( this does not require an APR ). 5. access outside the region causes an error. 6. adding new functions is made easy. The following is a list of optimizations. 1. may be able to use the kernal or user data space to access the shared area. This must be able to be conditionalized out as it is not compatible with M-PLUS. 3.4 ISF - InStall Function This task is responsible for loading the specialized code into the system pool. It also links the illegal instruction interrupt vector | to this code. Some constraints are: 1. If the function is already installed, the ISF task will error out. 2. if XDT is part of the system, ISF will adjust XDT to not remap over the illegal instruction interrupt vector. 3. some optimizations may be initialized at this time. 3.5 RMF - ReMove Function This task removes the function added by ISF. It is responsible for removing all traces of the function from the system. PAGE 8 4.0 GLOSSARY 1. PLAS - Program Logic Address Space Name for the standard DEC method of mapping memory. Used in both the RSX and RT systems. 2. M-PLUS - Large version of M. A not yet released version of RSX-11M that is to run on 22 bit machines.