Abstract:
A storage-protection-check circuit includes a storage key corresponding to the unit area of a storage region, the storage key being stored in a key storage. The value of the access request key having an access request corresponding to the storage region is checked. When the access request key has a specified value, the storage region is accessed without reading the storage key out of the key storage.

Description:
This is a continuation of co-pending application Ser. No. 075,258 filed on July 16, 1987 now abandoned, which is a continuation of copending application, Ser. No. 533,988, filed on Sept. 20, 1983 now abandoned. 
    
    
     BACKGROUND OF THE INVENTION 
     The present invention relates to a method for checking storage protection in a system providing a storage-protection key in each unit area. 
     The criteria in a method for checking storage-protection are well known, for instance as described in &#34;IBM System/370 Principles of Operation&#34; (GA 22-7000-6 File No. 370-01). That is, a main storage device is divided into a plurality of pages as a unit of storage protection, for example, into two-kilobyte blocks, and storage keys having eight bits are written into a key storage. The storage keys have the following construction: 
     
         ______________________________________0     1        2     3      4   5      6   7______________________________________A                     F     R      C   S______________________________________ 
    
     In the above construction, A denotes an access control bit, F denotes a read protection bit, R denotes a reference bit, C denotes a change bit, and S denotes a write protection bit. A central processing unit or a channel provides a protection key. The central processing unit provides a protection key in program-status words (PSW) and a storage key in translation look aside buffers (TLB). The channel reads the channel-address words (CAW) and maintains the protection key written into the CAW. The following table gives a summary of the protecting action. 
     
                       TABLE______________________________________ConditionBit position instorage key Is access to main storage possible ?Bit 7 (S)  Bit 4 (F)           Key relation                      Read     Store______________________________________0      0        coincident possible possible  0        incoincident                      possible impossible  1        coincident possible possible  1        incoincident                      impossible                               impossible1      0        coincident possible impossible  0        incoincident                      possible impossible  1        coincident possible impossible  1        incoincident                      impossible                               impossible______________________________________ 
    
     In the table, &#34;coincident&#34; indicates that the protection key is equal to the upper four bits or that the value of the protection key is zero. &#34;Possible&#34; indicates that access is possible and &#34;not possible&#34; indicates that access is not possible. That is, when information is read out of the main storage, the information cannot be used in the program, and when information is written into the main storage, the position of the storage is not changed. The write signal transmitted to the main storage is accepted when the storage key and the protection key coincide and the write protection bit of the storage key is zero. The read signal transmitted from the main storage is accepted when the storage key and the protection key coincide or the write protection bit of the storage key is zero. 
     However, in such conventional criteria, the time during which the next key memory access request is awaited becomes long and the key memory cannot be efficiently accessed. 
     SUMMARY OF THE INVENTION 
     An object of the present invention is to provide a method for checking memory protection by which memory protection of an access request to the main storage can be rapidly checked. 
     The above-mentioned object can be achieved by providing a method for checking storage protection in a system in which a storage key corresponding to a unit area of a storage region is provided in each unit area and the storage key is stored in a key storage, comprising pre-checking the value of the key to which access is requested following an access request to the storage region and when the value is a specified value, immediately effecting access to the storage region without reading the storage key out of the key storage. 
     Further, the above-mentioned object can be achieved by providing a storage-protection-check circuit comprising: an access control circuit which receives an access request from a channel; a main storage control circuit and a storage-protection key control circuit which are controlled by the access control circuit; a main storage which is controlled by the main storage control circuit; a key storage which is controlled by the storage-protection key control circuit; and a storage-protection-check circuit which receives an access request key from the channel, a key storage check signal from the storage-protection key control circuit, and a storage key from the key storage and outputs a main storage access admission signal to the access control circuit, the storage-protection-check circuit comprising a zero check circuit which receives the access request, a coincidence check circuit which receives the access request and the storage key from the key storage, a first AND circuit which receives the output of the zero check circuit and a key storage access request from the access control circuit, a second AND circuit which receives via a NOT circuit the output of the zero check circuit and the key storage access request and outputs a key storage access admission signal to the storage-protection key control circuit, a third AND circuit which receives the output of the coincidence check circuit and the key storage check signal from the storage-protection key control circuit, and an OR circuit which receives the outputs of the first AND circuit and the second AND circuit and outputs the main storage access admission signal to the access control circuit. 
     Further features and advantages of the present invention will be apparent from the ensuing description, with reference to the accompanying drawings, to which, however, the scope of the invention is in no way limited. 
    
    
     BRIEF DESCRIPTION OF THE DRAWINGS 
     FIG. 1 is a block diagram illustrating one example of a conventional storage-protection-check circuit. 
     FIG. 2 is a flow chart illustrating the operation of the circuit shown in FIG. 1. 
     FIG. 3 is a block diagram illustrating one embodiment of the storage-protection-check circuit according to the present invention. 
     FIG. 4 is a flow chart illustrating the operation of the circuit shown in FIG. 3. 
    
    
     DESCRIPTION OF THE PREFERRED EMBODIMENTS 
     FIG. 1 shows a conventional storage-protection-check circuit. In the figure, 1 denotes an access control circuit, 2 denotes a main storage control circuit, 3 denotes a storage-protection key control circuit, 4 denotes a storage-protection-check circuit, 5 denotes a main storage, 6 denotes a key storage, 10 denotes an access request, 11 denotes an access request key, 12 denotes a main storage access request, 13 denotes a key storage access request, 20 denotes a line which transmits main storage access information, 30 denotes a line which transmits key storage access information, 31 denotes a key storage check signal, 40 denotes a main storage access admission signal, 42 denotes a zero check signal, 43 denotes a coincidence signal, Z denotes a zero check circuit, M denotes a coincidence check circuit, 0 denotes an OR circuit, and A denotes an AND circuit. 
     The access control circuit 1 analyzes the access request and controls the main storage control circuit 2 and the storage-protection key control circuit 3 in accordance with the result of analysis The main storage control circuit 2 controls the main storage 5, and the storage-protection key control circuit 3 controls the key storage 6. The storage-protection-check circuit 4 includes the zero check circuit Z, the coincidence check circuit M, the OR circuit 0, and the AND circuit A. The zero check circuit Z determines whether or not the access request key 11 is zero, and the coincidence check circuit M determines whether or not the access request key 11 and the storage key 60 read from the key storage 6 are coincident. The access request key 11 includes both key information and read/write information. When the zero check signal 42 is logic &#34;1&#34; or the coincidence signal 43 is logic &#34;1&#34;, the OR circuit O outputs logic &#34;1&#34;. When the key storage check signal 31 becomes logic &#34;1&#34; and the OR circuit &#34;O&#34; outputs logic &#34;1&#34;, the main storage access admission signal 40 becomes logic &#34;1&#34;. The key storage check signal 31 is output at a suitable time when data is read out of the key storage 6. 
     When the channel accesses the main storage via a block barrier of pages, the channel sends an access request having a key check to the access control circuit 1. Further, since the central processing unit reads the storage key into the TLB before receiving this access request, the central processing unit checks whether a request for main storage access is possible or not. When the access control circuit 1 receives the access request having a key check, the access control circuit 1 sends the key storage access request 13 to the storage-protection key control circuit 3. When the storage-projection key control circuit 3 receives the key storage access request 13, it sends the key storage access information 30 to the key storage 6. The key storage access information 30 includes a read/write signal indicating read or write and key storage address information. In this case, the read/write signal indicates read. The storage key 60 which is read out of the key storage 6 is sent to the coincidence check circuit M in the storage-protection-check circuit 4. If the zero check signal 42 or the coincidence signal 43 is logic &#34;1&#34; when the storage-protection key control circuit 3 sends the key storage check signal 31, the value of which is logic &#34;1&#34;, the main storage access admission signal 40 becomes logic &#34;1&#34;. When the main storage access admission signal 40 becomes logic &#34;1&#34;, the access control circuit 1 sends the main storage access request 12 to the main storage control circuit 2. When the main storage control circuit 2 receives the main storage access request 12, the main storage control circuit 2 sends the main storage access information 20 to the main storage 5. The main storage 5 effects read/write in accordance with the main storage access information 20. 
     FIG. 2 is a flow chart illustrating the operation of the circuit shown in FIG. 1. In the circuit, it is checked whether or not an access request from the channel (block 51) has a key storage (block 52). If it has a key storage, the key storage is read (block 53), and it is checked in block 54 whether or not the access request key is zero. If the access request key is not zero, it is checked in block 55 whether or not the read key is coincident with the access request. If the read key is coincident with the access request, the main storage is accessed in block 56 and the result of access is sent to the channel in block 57. If the read key is not coincident with the access request, a key check is impossible. 
     When the access request key has a specified value, main storage access is possible regardless of the data read out of the key storage. However, in the conventional system shown in FIG. 1, even if the access request key has a specified value, the main memory access admission signal may be logic &#34;1&#34; when the storage check signal becomes logic &#34;1&#34;. In such a conventional system, the time during which the next key memory access request is awaited becomes long and the key memory cannot be efficiently accessed. 
     Next, the invention is explained with reference to FIG. 3, which illustrates one embodiment of the present invention. In FIG. 3, A 1  to A 3  denote AND circuits, N denotes a NOT circuit, and 41 denotes a key storage access admission signal. The other elements in FIG. 3 are the same as the elements in FIG. 1 and are represented by the same reference numerals as in FIG. 1. The storage-protection-check circuit 4 shown in FIG. 3 includes a zero check circuit Z, a coincidence check circuit M, the NOT circuit N, the AND circuits A 1  to A 3 , and an OR circuit 0. The AND circuit A 1  receives a zero check signal 42 and a key storage access request 13, and the AND circuit A 3  receives a coincidence signal 43 and a key storage check signal 31. The outputs of the AND circuits A 1  and A 3  are supplied to the input of the OR circuit O, and the output of the OR circuit O is used as a main storage access admission signal 40. The AND circuit A 2  receives the key storage access request 13 and an inverted signal of the zero check signal 42. The output of the AND circuit A 2  becomes the key storage access admission signal 41. 
     Next, the operation of the embodiment shown in FIG. 3 is explained. When the channel accesses, via the block barrier, a main storage 5, the channel sends an access request 10 having a key check and an access request key 11 to an access control circuit 1. When the access control circuit 1 receives the access request 10 having a key check, the access control circuit 1 sends the key storage access request 13 to the AND circuits A 1  and A 2 . On the other hand, the access request key 11 is supplied to the zero check circuit Z. If the zero check signal 42 is logic &#34;1&#34; when the key storage access request 13 is sent to the AND circuits A 1  and A 2 , the main storage access admission signal 40 becomes logic &#34;1&#34;. When the main storage access admission signal 40 becomes logic &#34;1&#34;, the access control circuit 1 controls so as to carry out main storage access. If the zero check signal 42 is logic &#34;0&#34; when the key storage access request 13 is sent to the AND circuits A 1  and A 2  , the key storage access admission signal 41 is sent to a storage-protection key control circuit 3. When the storage-protection key control circuit 3 receives the key storage access admission signal 41, the circuit 3 sends key storage access information 30 to a key storage 6. A storage key 60, which is read out of the key storage 6, is supplied to the coincidence check circuit M in the storage-protection-check circuit 4. When the storage-protection key control circuit 3 turns the key storage check signal 31 on, the coincidence signal 43 is sent via the AND circuit A 3  and the OR circuit O to the access control circuit 1 so that the main storage access admission signal 40 is sent to the access control circuit 1. When the main storage access admission signal 40 is logic &#34;1&#34;, the access control circuit 1 controls so as to carry out main storage access. 
     FIG. 4 is a flow chart illustrating the operation of the circuit shown in FIG. 3. In FIG. 4, blocks 51a to 59a correspond to blocks 51 to 59 in FIG. 2. The feature of FIG. 4 differs from that of FIG. 2 in that the order of blocks 53a and 54a is reversed. That is, the value of the access request key having an access request is checked in block 54a, and when the value of the access request key is zero, the main storage is accessed in block 56a. 
     As should be clear from the above explanation, according to the present invention, if the access request key has a specified value, the main storage can be accessed without accessing the key storage. Therefore, accessing of the key storage can be efficiently carried out.