This application claims the benefit of Taiwan application Serial No. 107102114, filed Jan. 19, 2018, the subject matter of which is incorporated herein by reference.
The invention relates to a memory control device and a memory control method, and more particularly to a memory control device and a method control method associated with permission control.
With the progressing technologies, various constantly innovating electronic products have become available. Many electronic products are equipped with various function circuits to realize various functions. Under the consideration of information security, a system needs to control operation permissions of function circuits.
Conventionally, a memory is divided into two regions, one of which is assigned with full access permission (readable and writable), and the other is assigned with partial access permission (only readable or only writable). Each function circuit is configured to correspond to one of the regions, for example, a decoding circuit corresponds to the memory region with a full access permission, and a network access circuit corresponds to the memory region which permits only write operations.
However, merely dividing a memory into two regions does not enable a system to appropriately plan the use of the memory, for example, the memory cannot be flexibly utilized under the premise of also attending to security.
The invention is directed to a memory control device and a memory control method, which configure a memory into multiple domains according to the number of function circuits, with the function circuits respectively corresponding to the domains. Each function circuit has a corresponding operation permission for operating each domain. Thus, each function circuit is enabled to flexibly plan the corresponding domain without being restrained to a planning means of two regions as that in the prior art.
According to an aspect of the present invention, a memory control method is provided. The memory control method includes: receiving a physical address of a memory from a function circuit; searching a lookup table according to the physical address to determine a range identifier; searching a permission lookup table according to a device identifier corresponding to the function circuit and the range identifier to determine an operation permission of the function circuit for operating the physical address of the memory.
According to another aspect of the present invention, a memory control device is provided. The memory control device includes a range processing circuit and a permission processing circuit. The range processing circuit receives a physical address of a memory from a function circuit, and searches a range lookup table according to the physical address to obtain a range identifier. The permission processing circuit searches a permission lookup table according to a device identifier corresponding to the function circuit and the range identifier to determine an operation permission of the function circuit for operating the physical address of the memory.
According to another aspect of the present invention, a memory control method is provided. The memory control method includes: receiving a physical address of a memory from a function circuit, which is a processor; receiving a secure environment indication signal from the function circuit; determining whether the function circuit is in a secure environment mode according to the secure environment indication signal; if the function circuit is in the secure environment mode, the function circuit directly operating the physical address of the memory; if the function circuit is not in the secure environment mode, determining an operation permission of the function circuit for operating the physical address of the memory, and the function circuit operating the physical address of the memory according to the operation permission.
According to yet another aspect of the present invention, a memory control device is provided. The memory control device includes a secure environment determining circuit and a permission processing circuit. The secure environment determining circuit receives a physical address from a function circuit, and receives a secure environment indication signal from the function circuit, wherein the function circuit is a processor. The secure environment determining circuit determines whether the function circuit is in a secure environment mode according to the secure environment indication signal. If the function circuit is in the secure environment mode, the function circuit directly operates the physical address of the memory. If the function circuit is not in the secure environment mode, the permission processing circuit determines an operation permission of the function circuit for operating the physical address of the memory, and the function circuit then operates the physical address of the memory according to the operation permission.
The above and other aspects of the invention will become better understood with regard to the following detailed description of the preferred but non-limiting embodiments. The following description is made with reference to the accompanying drawings.
As shown in
In step S130, the range processing circuit 130 searches a range lookup table LUT3 according to the physical address PA to obtain a range identifier RID. The range lookup table LUT3 may be stored in the memory 900 or be stored in another storage device. Table-1 shows an example of the range lookup table LUT3. The range identifier RID corresponds to a continuous range from a starting address to an ending address in the memory 900. The range processing circuit 130 searches the range lookup table LUT3 to learn between which starting address and which ending address the physical address PA is located, and can correspondingly find the range identifier RID.
In step S140, the permission processing circuit 140 searches a permission lookup table LUT4 according to the range identifier RID and a device identifier DID provided by the function circuit 800 to determine an operation permission of the function circuit 800 for operating the physical address PA. The permission lookup table LUT4 may be stored in the memory 900 or be stored in another storage device. Table-2 shows an example of the permission lookup table LUT4. In one embodiment, the operation permission may be represented by two codes (e.g., two bits). For example, the first code represents a write permission (“0” representing non-writable and “1” representing writable), and the second code represents a read permission (“0” representing non-readable and “1” representing readable). For example, “00” represents non-writable and non-readable, “01” represents non-writable but readable, “10” represents writable but non-readable, and “11” represents writable and readable.
In step S150, the memory control device 100 operates the memory 900 according to the operation permission. With the above embodiments, the system can flexibly plan the domain DM in the memory 900 corresponding to each function circuit 800, and then find the corresponding operation permission from the range lookup table LUT3 and the permission lookup table LUT4. Thus, the planning of the memory 900 becomes more flexible.
The range processing circuit 230 includes a range indexer 231 and a range inquirer 232. Operation details of the components are given with reference to a flowchart below.
In step S232, the range inquirer 232 searches a range lookup table LUT3′ according to the range index RIX to obtain the range identifier RID.
Different function circuits have different device identifiers DID. After the range identifier RID is identified, in step S140, the permission processing circuit 140 searches the permission lookup table LUT4 according to the device identifier DID and the range identifier RID to determine the operation permission of the function circuit 800 for operating the physical address PA.
Similarly, in step S150, the memory control device 200 can operate the memory 900 according to the operation permission. With the above embodiment, each function circuit 800 is able to flexibly plan multiple non-consecutive pages to form one domain DM in the memory 900, and then find the corresponding operation permission by searching the range lookup table LUT3′ and the permission lookup table LUT4. Thus, the planning of the memory 900 becomes more flexible. However, taking a 4G memory 900 for instance, approximately 1048576 pages are included, i.e., 1048576 range indices RIX need to be recorded. Assuming that the memory 900 is to be divided into 16 domains DM, each range identifier RID requires at least four bits. In the above situation, the memory space needed by the range lookup table LUT3′ is enormous.
The screening circuit 320 includes a classification indexer 321 and a permission inquirer 322. Operation details of the components are given with reference to a flowchart below.
In step S322, the permission inquirer 322 searches the screening lookup table LUT2 according to the classification index GIX to find to which one of the full access permission and the partial access permission the physical address PA corresponds.
If the physical address PA corresponds to a partial access permission, the physical address PA is transmitted to the range processing circuit 230 to continue the permission analysis. Step S230 is performed after the physical address PA is transmitted to the range processing circuit 230. Step S230 is identical to that described previously, and is not repeated herein.
If the physical address PA corresponds to a full access permission, the function circuit 800 is directly allowed to operate, e.g., read or write, the memory 900 according to the physical address PA. Thus, the screening step (step S320) performed for permission processing is able to select the physical address PA having a full access permission, and the subsequent step S234 and step S240 of permission analysis on these physical addresses can be skipped, thus reducing the processing time. With the embodiment in
In step S470, the secure environment determining circuit 450 determines whether the function circuit 800′ is in a secure environment according to the secure environment indication signal SI.
If the function circuit 800′ is in a secure environment mode, step S480 is performed. If the function circuit 800′ is not in a secure environment mode, step S130 is performed. The details of the process after step S130 are identical to those described previously, and are not repeated herein.
In step S480, the function circuit 800′ can directly operate the physical address PA of the memory 900. Thus, when the function circuit 800′ is in a secure environment mode, the function circuit 800′ is allowed with a full access permission to the memory 900.
While the invention has been described by way of example and in terms of the preferred embodiments, it is to be understood that the invention is not limited thereto. On the contrary, it is intended to cover various modifications and similar arrangements and procedures, and the scope of the appended claims therefore should be accorded the broadest interpretation so as to encompass all such modifications and similar arrangements and procedures.
Number | Date | Country | Kind |
---|---|---|---|
107102114 | Jan 2018 | TW | national |