Address translation in data processing devices
By introducing the address label conversion circuit into the address conversion circuit of the data processing system, selecting the conversion method according to the virtual address, and converting the virtual label part into the physical label part, the problem of limited utilization of the virtual address bit space is solved and the memory system is realized. More flexible and secure access control.
Patent Information
- Application Number
- CN201980006980.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Priority Date
- 2018-01-31
- Filing Date
- 2019-01-23
- Publication Date
- 2024-09-27
- Estimated Expiration
- 2039-01-23
AI Technical Summary
In the conversion of virtual address to physical address, existing data processing systems have difficulty in effectively utilizing the leading bit space of the virtual address, resulting in limited coding, and lack of a method to use these bit spaces to transmit additional information to enhance the control and control of the memory system. protection mechanism.
By introducing an address label conversion circuit into the address translation circuit, the conversion method is selected according to the virtual address, the virtual label part is converted into a physical label part, and these label parts are used to transmit additional information for memory access control and protection, including matching all or A comparison that matches one condition.
It realizes the effective use of the bit space of the virtual address during the virtual address translation process, enhances the control and protection mechanism of the memory system, and allows the transmission of additional information to improve the security and flexibility of memory access.
Smart Images

Figure CN111527480B_ABST
Abstract
Description
Technical Field
[0001] This technology relates to the field of data processing. Background Art
[0002] A data processing system may employ two addressing systems, a virtual address system and a physical address system. Virtual addresses are addresses used by software executed by the data processing apparatus, while physical addresses are addresses used by memory storage hardware, such as external RAM. The data processing apparatus may provide an address translation capability to allow translation between these two memory addressing systems, and in particular to allow executing software to access memory storage locations in hardware without having to use the physical address system used by the hardware. In other words, the translation of virtual addresses to physical addresses may be transparent to software running on the CPU, because memory access requests (e.g., loads and stores) are issued using virtual addresses, and (when appropriate for memory access) data is returned from the memory system, without the software needing to be aware that an address translation has occurred and that the data has been accessed at a physical address different from the virtual address. Summary of the invention
[0003] At least some examples provide a device comprising: an address translation circuit, the address translation circuit being used to perform a translation of a virtual address to a physical address, the virtual address comprising a virtual tag portion and a virtual address portion, the physical address comprising a physical tag portion and a physical address portion, the address translation circuit comprising: an address tag translation circuit, the address tag translation circuit being used to perform a translation of the virtual tag portion to a physical tag portion, wherein the address translation circuit selects a translation to be performed by the address tag translation circuit based on the virtual address.
[0004] At least some examples provide a method comprising: selecting a translation to be performed on a virtual address and converting it to a physical address, the virtual address comprising a virtual tag portion and a virtual address portion, the physical address comprising a physical tag portion and a physical address portion, wherein the selection of the translation depends on the virtual address; and performing the translation to convert the virtual tag portion to a physical tag portion.
[0005] At least some examples provide a computer program for controlling a host data processing device to provide an instruction execution environment, the instruction execution environment being used for executing instructions of a target program code, the computer program comprising: an address translation program logic for performing a conversion of a virtual address to a physical address, the virtual address comprising a virtual tag portion and a virtual address portion, the physical address comprising a physical tag portion and a physical address portion, the address translation program logic comprising: an address tag translation program logic for performing a conversion of the virtual tag portion to the physical tag portion, wherein the address translation program logic selects a conversion to be performed by an address tag translation circuit based on the virtual address.
[0006] The storage medium may store the above-mentioned computer program. The storage medium may be a non-transitory storage medium. BRIEF DESCRIPTION OF THE DRAWINGS
[0007] The present technology will be further described, by way of example only, with reference to embodiments of the present technology, as shown in the accompanying drawings, which should be read in conjunction with the following description, in which:
[0008] Figure 1 An example of a data processing apparatus is schematically shown;
[0009] Figure 2 An example of a tag-protected memory access operation is shown, the operation including checking whether an address tag matches a protection tag;
[0010] Figure 3 is a flow chart illustrating a method of performing tag-protected memory access operations;
[0011] Figure 4 schematically illustrates a virtual address space in which one portion is reserved for use by the kernel and another portion is reserved for user space;
[0012] Figure 5 An example of a data processing device is schematically shown, the data processing device including an address conversion circuit and an address label conversion circuit;
[0013] Figure 6 schematically illustrates some components of a data processing apparatus in an example, which gives more details of the conversion of a virtual tag part into a physical tag part;
[0014] Figure 7 Schematically shows an example Figure 6 some components of a data processing device;
[0015] Figure 8 is a flow chart illustrating a method of converting a virtual label portion into a physical label portion; and
[0016] Fig. 9 An example of a simulator supporting address translation logic is shown. DETAILED DESCRIPTION
[0017] In one example, there is a device comprising: an address conversion circuit, the address conversion circuit being used to perform conversion from a virtual address to a physical address, the virtual address comprising a virtual tag portion and a virtual address portion, the physical address comprising a physical tag portion and a physical address portion, the address conversion circuit comprising: an address tag conversion circuit, the address tag conversion circuit being used to perform conversion from the virtual tag portion to the physical tag portion, wherein the address conversion circuit selects the conversion to be performed by the address tag conversion circuit based on the virtual address.
[0018] Virtual addresses to be translated into physical addresses may be defined in a virtual address space having a larger bit width than is strictly necessary to define a unique virtual address for use by a processor core. For example, in a contemporary architecture (configured to use a 64-bit address space for its instruction set), a processor core may be limited to using, for example, the lower 48 bits of a 64-bit address space, with the bits above that reserved in some way. This approach may be advantageous because, for example, user space and kernel space may each have their own defined virtual address regions that do not overlap. For example, in a system where user space and kernel space each have their own defined 39-bit address space (each providing 2 39 =512GB virtual addresses), one approach is to label these sets of user and kernel virtual addresses by a leading bit set, so that, for example, all user virtual addresses have 25 leading zeros, and all kernel virtual addresses have 25 leading zeros. For example, these may be set to a sign extension of the most significant "real" address bits (so that the spare portion is set to all zeros or all ones). Checking the leading bit portion of the virtual address used by the user or kernel can provide verification that allowed memory accesses are being made, as well as trapping illegal accesses.
[0019] However, in the case where the leading bit portion of the virtual address (at least most of it) is therefore essentially unused, this provides an opportunity to use this bit space for other purposes. However, this means that the encoding used in the upper part of the virtual address can be affected by the way the virtual address space is used. In the example of a virtual address space with a portion reserved for user space and a portion reserved for kernel space mentioned above, in the case where the leading portion of the bits of the virtual address (set to all 0s or all 1s) indicates whether a given address is reserved for user space or for kernel space, the default bit encoding of this upper part of the virtual address therefore differs for user space and kernel space.
[0020] Furthermore, in situations where this upper portion of the virtual address space is largely unused, it may be advantageous to utilize this bit space to enable software to signal additional information to a memory system. In this context, a device is provided that includes an address translation circuit for translating a virtual address into a physical address, the address translation circuit distinguishing between a virtual tag portion and a virtual address portion of a received virtual address when performing the translation, and the address translation circuit translates the virtual address into a physical address that includes a physical tag portion and a physical address portion. In other words, the virtual address portion is translated into a physical address portion to indicate a specific memory address that the software needs to access, but another portion of the virtual address (i.e., the virtual tag portion) is translated separately into a physical tag portion and this physical tag portion can then convey other information to the memory address system. Furthermore, when performing this translation of the virtual tag portion into the physical tag portion, the device of the present technology takes the content of the virtual address into account when deciding what type of translation to perform by the address tag translation circuit. In other words, different translations may be used depending on some characteristics of the virtual address.
[0021] This reliance on the virtual address for the translation to be performed by the address tag translation circuitry can be configured in a variety of ways, but in some examples, the translation performed by the address tag translation circuitry is based on the most significant bit of the virtual address portion. It will be appreciated that the meaning of the most significant bit of the virtual address portion may vary depending on the particular implementation, and indeed may depend on the choice as to the location of the boundary between the virtual tag portion and the virtual address portion in the virtual address.
[0022] The method whereby the selected transformation relies on the most significant bit of the virtual address portion can take various forms, but in some examples, when the most significant bit of the virtual address portion has a first value, the selected transformation performed by the address tag transformation circuitry generates a physical tag portion that matches the virtual tag portion, and when the most significant bit has a second value, the selected transformation performed by the address tag transformation circuitry modifies the virtual tag portion to generate the physical tag portion. Thus, when the most significant bit has a first value, the address tag transformation circuitry does not modify the virtual tag portion to generate the physical tag portion. However, when the most significant bit has a second value, modification of the virtual tag portion is performed to generate the physical tag portion.
[0023] As described above, the meaning of the most significant bit of the virtual address portion can vary. However, in some examples, the device is arranged to allocate virtual addresses as exclusive to kernel-owned processes and user-owned processes, and the value of the most significant bit of the virtual address portion indicates whether the virtual address has been allocated to a kernel-owned process or a user-owned process. For example, this can be part of a system as described above, in which two different and non-overlapping parts of the full virtual address space are allocated to kernel processes and user-owned processes respectively, wherein, by default, the device is arranged (for example) to fill the upper half of the virtual address with a set of consecutive 1s for kernel space addresses, and to fill this same part with a set of consecutive 0s for user space addresses. In the context of the present technology, this means that the address translation circuitry can be configured to not apply any translation to the virtual tag portion when it is identified that the virtual tag portion forms part of a virtual address that has been allocated as part of user space, and to apply translation to the virtual tag portion when it is identified that the virtual address has been allocated in kernel space. In cases where the virtual tag portion does not form part of the true address itself, but instead may be used to convey other information to the memory system (which may be associated with a specific memory address or may be conveyed to the memory system as a more general command or signal), this method therefore enables the generation of the physical tag portion to take into account whether the address belongs to a kernel-owned process or a user-owned process.
[0024] This dependency may be configured in different ways, but in some examples, the selected translation performed by the address tag translation circuitry includes inverting at least a portion of the virtual tag portion to generate the physical tag portion. For example, when configured for addressing within the device, a configuration may be used such that, by default, the virtual tag portion is populated with a set of consecutive ones for kernel owned addresses and a set of consecutive zeros for user owned addresses. Thus, when at least a portion of the virtual tag portion is used to communicate information to a memory address system, this inversion of at least a portion of the virtual tag portion enables the encoding of the information presented to the memory address system to be the same regardless of whether the virtual address belongs to a kernel owned process or a user owned process.
[0025] In other examples, the selected translation performed by the address tag translation circuitry may include incrementing at least a portion of the virtual tag portion to generate the physical tag portion. For example, this may be applicable in a configuration where addresses in a virtual address space are assigned to different processes such that some addresses are assigned at the lowest possible values in the address space while other addresses are assigned to other processes at the very top of the address space. For example, in the user space / kernel space division of the virtual address space described above, addresses including a full set (e.g., 64 bits) of zeros may be assigned to user space, while addresses having a full set of ones may be assigned to kernel space. If the highest possible address (all ones) is incremented, the value will wrap around (there is a modulo 2 64 possible addresses) to give a consecutive sequence of 64 zeros. Note, however, that this conversion only applies to the virtual tag portion, so in this example, a group of consecutive ones in the virtual tag portion will be converted to a group of consecutive zeros in the physical tag portion. This group of consecutive ones in the virtual address portion is still a group of consecutive ones in the physical address portion.
[0026] In some examples, the apparatus further includes a memory system for receiving the physical address and accessing a memory location identified by the physical address portion, wherein when a predetermined portion of the physical tag portion has a predetermined value, the memory system performs a predetermined memory operation in response to receiving the physical address. Thus, the physical tag portion (and, by extension, the virtual tag portion) can be used to cause the memory system to perform a predetermined memory operation. This provides a useful control mechanism for the processor core regarding the memory system.
[0027] The predetermined memory operation may take a variety of forms depending on system requirements and specific implementations, but in some examples, the predetermined memory operation is a protection tag comparison of the physical tag portion relative to a protection tag value associated with the memory location, and the memory system indicates an error condition in response to the physical tag portion and the protection tag value not satisfying a match condition. Thus, in such an apparatus, a protection tag is provided that is stored in a memory system associated with a memory location specified by a physical address portion, and the requirement that the physical tag portion and the protection tag value satisfy a match condition enables control to be exerted on access to the memory location. The error condition indicating that the match condition is not satisfied may be used in a variety of ways. For example, the error condition may be used to prevent access to the memory location, but this is not the only way the error condition may be used, and in other examples, the error condition may simply be signaled to another portion of the apparatus (e.g., back to a processor core) to indicate that the match condition is not satisfied, but access is still allowed to continue. Thus, the comparison between the physical tag portion and the protection tag value may be used to control whether a memory access is allowed to succeed, or whether a subsequent operation may succeed, or simply report but allow memory access to continue as usual.
[0028] In such configurations where the memory system is configured to perform this protection tag check, at least a portion of the physical tag portion may be used in order to control the particular manner in which the protection tag comparison is to be performed. In some examples, when a predetermined portion of the physical tag portion has a predetermined value, the match condition is a match-all condition such that any protection tag value will satisfy the match condition. Thus, in effect, this will disable signaling of an error condition because any protection tag value will satisfy the match condition, so an error condition will not be generated.
[0029] In some examples, when the predetermined portion of the physical tag portion does not have the predetermined value, the match condition is a match-one condition such that the predetermined portion of the physical tag portion and the protection tag value must be the same to satisfy the match condition. Thus, conversely, if the predetermined portion of the physical tag portion does not have the "match all" value described above, the predetermined portion of the physical tag portion may be explicitly required to satisfy the match condition. Thus, the predetermined portion of the physical tag portion may be used to specify a particular value that the protection tag value must have in order to satisfy the match condition. This may be used, for example, by the system to classify memory addresses, such as according to the particular processes that have been assigned those memory addresses, such that only the processes that have been assigned a particular memory address may access that memory address without triggering an error condition.
[0030] The predetermined portion of the physical tag portion may be defined in a variety of ways, but in some examples, the predetermined portion of the physical tag portion is a predetermined set of bits of the physical tag portion. The predetermined set of bits may be defined in a variety of ways, but the predetermined set of bits may be, for example, a set of four bits (for just one illustrative example), such that 16 different permutations may be defined, such as reserving one bit as the "match all" value described above, and the remainder may be used solely as a "match one" value, thereby allowing 15 different memory address classifications to be defined in the system. In general, any number of bits of the physical tag portion may be used in this manner, correspondingly allowing larger or smaller sets of classifications to be defined.
[0031] In the case where it is understood that the above-mentioned "match all" value and the set of "match one" values have different effects on the memory system, the address tag conversion circuit can be configured to force the generation of a predetermined portion of the physical tag portion with a predetermined value in various situations. For example, in some examples, the address tag conversion circuit generates a physical tag portion in response to a predetermined bit of the virtual tag portion having a predetermined value, regardless of the value of other predetermined bits of the virtual tag portion, so that the predetermined portion of the physical tag portion has a predetermined value. In this way, the predetermined bit of the virtual tag portion is thus used as a control bit to force the memory system to perform a "match all" comparison.
[0032] The predetermined portion of the physical tag portion that triggers a match all comparison to be performed may be defined in a variety of ways, but in some embodiments, the predetermined portion of the physical tag portion is a predetermined bit of the physical tag portion. Thus, the signal as to whether to perform a match all comparison may be communicated to the memory system via only a single bit of the physical tag portion (other bits of the physical tag portion may be reserved to communicate other information to the memory system).
[0033] The protection tag comparison between the physical tag portion and the protection tag value can be configured in a variety of ways, but in some examples, the protection tag comparison is a comparison of: a less-than-all portion of the physical tag portion and the protection tag value associated with the memory location.
[0034] Furthermore, the predetermined value of the predetermined portion of the physical tag portion may be defined in a variety of ways, but in some examples, the virtual tag portion includes at least one bit included in the physical address, and the memory system controls the overwriting of a protection tag associated with the memory location in response to the at least one bit when a write access is made to the memory location. Thus, the process defining the bits of the virtual tag portion may use this at least one bit to communicate to the memory system how to make a write access to the memory location, and in this example, controls the overwriting of the protection tag associated with the memory location when a write access is made. In principle, when a write access is made to the memory location, it is not necessary to update the protection tag associated with the memory location, because if the process accessing the memory location follows the defined protection tag assignment, the protection tag associated with the memory location should not generally change, however, controlling the overwriting of the protection tag provides an additional level of verification by forcing the protection tag value to be overwritten when a write access is made, correctly allowing the process performing the write access to do so.
[0035] In some examples, there is a method comprising: selecting a translation to be performed, the translation being performed on a virtual address and converting it to a physical address, the virtual address comprising a virtual tag portion and a virtual address portion, the physical address comprising a physical tag portion and a physical address portion, wherein the selection of the translation depends on the virtual address; and performing the translation to convert the virtual tag portion into a physical tag portion.
[0036] In some examples, there is a computer program that includes: an address translation program logic that performs a translation of a virtual address to a physical address, the virtual address including a virtual tag portion and a virtual address portion, the physical address including a physical tag portion and a physical address portion, the address translation program logic including: an address tag translation program logic that performs a translation of the virtual tag portion to the physical tag portion, wherein the address translation program logic selects a translation to be performed by the address tag translation circuit based on the virtual address.
[0037] In some examples, there is a storage medium storing the above-mentioned computer program, wherein the storage medium may be a non-transitory storage medium.
[0038] Some specific embodiments will now be described with reference to the accompanying drawings.
[0039] Figure 1An example of a data processing apparatus 2 is schematically shown. It should be understood that this is merely a generalized representation of a subset of the components of the apparatus, and that the apparatus may include many other components that are not shown. The apparatus 2 includes a processing circuit 4 for performing data processing in response to instructions decoded by an instruction decoder 6. The instruction decoder 6 decodes instructions retrieved from an instruction cache 8 to generate a control signal 10, which is used to control the processing circuit 4 to perform the corresponding processing operation represented by the instruction. The processing circuit 4 may include one or more execution units, which are used to perform operations on values stored in registers 14 to generate result values to be written back to the registers. For example, the execution unit may include an arithmetic / logic unit (ALU), a floating point unit, and / or a vector processing unit, wherein the arithmetic / logic unit (ALU) is used to perform arithmetic operations or logical operations, the floating point unit is used to perform operations using floating point operands, and the vector processing unit is used to perform vector operations on operands including multiple independent data elements. The processing circuit also includes a memory access circuit (e.g., including a load / store unit) 15, which is used to control data transfer between the register 14 and the memory system. In this example, the memory system includes an instruction cache 8, a level 1 (L1) data cache 16, a level 2 (L2) cache 17 shared between data and instructions, and a main memory 18. It should be understood that other cache hierarchies are also possible (this is just an example). A memory management unit (MMU) 20 is provided to provide address translation functions to support memory accesses triggered by the load / store unit 15. The MMU has a translation lookaside buffer (TLB) 22, which is used to cache a subset of entries from the page tables stored in the memory systems 16, 17, and 18. Each page table entry can provide an address translation mapping for the corresponding address page, and can specify access control parameters, such as specifying whether the page is a read-only area or has read and write access rights, or specifying which permission level can access the page's access rights.
[0040] Figure 2 The concept of tag protected memory access is schematically illustrated. The physical address space used to refer to memory locations within a memory system can be logically divided into a plurality of blocks 30, each block 30 including a certain number of addressable locations. For convenience, Figure 2In the example of , each block 30 includes four memory locations, but its block size may also be used. Each block 30 is associated with a corresponding protection tag 32. The protection tags associated with a certain number of blocks 30 may be collected together and stored in different architecturally accessible memory locations 34 within the physical address space, or in additional storage locations provided in the main memory 18 that are not architecturally accessible (not mapped to the same physical address space). In some cases, it may be preferable to use separate non-architecturally accessible storage to avoid occupying space in the data cache 16, cache 17 to cache protection tag values, which may affect the performance of conventional code and may make consistency management more complicated. An additional tag cache 19 may be provided in the microarchitecture, the tag cache 19 being used to cache tag values from non-architecturally accessible memory for faster access than having to access the tags from the main memory 18. The specific mapping of the tag storage location 34 to each block 30 may be controlled by the load / store unit 15 and may be hardwired or programmable. Although in Figure 2 In the embodiment of the present invention, each tag 32 is associated with a block of physical addresses, but it is also possible to provide protection tags 32 associated with virtual memory locations in the virtual memory address space, but this may require some additional address translation on each memory access. Therefore, by associating protection tags 32 with physical memory locations, this can improve performance. In general, for a particular microarchitecture implementation, how exactly the protection tags 32 are associated with the corresponding block 30 of the physical address space is a choice. In general, all that is required is that the protection tags 32 associated with a given block of memory can be accessed and compared.
[0041] Thus, when a tag-protected memory access is required, the address tag 40 (which is associated with the target address 42 identifying the addressed location 44 to be accessed) can be compared with the protection tag 32 (which is associated with the block of memory locations 30 including the addressed location 44). Figure 2 In the example, the target address 42 points to a location B1 in memory (in Figure 2 Thus, the protection tag B associated with the block of location B including location B1 is compared with the address tag 40 associated with the target address 42. Figure 2As shown at the top of , the address label 4 can be determined as a function of the selected bits of the target address itself. Specifically, the address label can be determined from bits within the portion of the target address that are not used to indicate a specific memory location, which is to be selected as the addressing location 44. For example, in some architectures, the top portion of the bits of the target address can always have a fixed value, such as a sign extension (all 0s or all 1s), so the address can be labeled with the address label 40 by overwriting these unused bits with an arbitrary label value. For example, a specific address label value can be selected by a programmer or compiler. The address label and protection label 32 can be a relatively small number of bits, such as 4 bits, and therefore do not need to occupy a large amount of space in the memory and in the target address. Providing a 4-bit label space, i.e., 16 possible label values, is generally sufficient to detect many common types of memory access errors.
[0042] Thus, when a tag-protected memory access is performed, a comparison is made between the address tag 40 and the protection tag 32 associated with the block 30 that includes the addressed location 44, and a determination is made as to whether they match. Figure 1 In the exemplary configuration of , the comparison may be performed anywhere between the load / store unit 15 and the physical memory 18 (and may in fact be distributed along that path). However, in this example, for simplicity, the comparison is described as being performed by the load / store unit 15. The load / store unit 15 generates a match indication indicating whether the address tag 40 and the protection tag 32 match. For example, this match indication may be an error signal 60 generated (if there is a mismatch between the address tag 40 and the protection tag 32), or may be an indication in a status placement register indicating whether there was a match, or may be an entry added to an error report to indicate the address where the error was detected and / or the instruction address of the instruction that triggered the error.
[0043] Figure 3 FIG. 1 shows a flow chart for handling tag-protected memory access. The instruction that triggers the memory access may specify an address tag and a target address. Figure 2As shown, in some cases, the address tag can actually be derived from a subset of the bits of the target address itself, but in other examples, it can be specified in a separate register. At step 50, an instruction is encountered that triggers a tag-protected memory access. In response, at step 52, the memory access circuit 15 triggers a memory access to the addressing location 44 identified by the target address. And, at step 54, the memory access circuit 15 obtains the protection tag 32, which is stored in the memory system associated with the block 30 of memory locations, and the block 30 of memory locations includes the addressing location 44 identified by the target address. At step 56, the memory access circuit 15 compares the address tag 40 with the protection tag 32 obtained at step 54. At step 58, the memory access circuit 15 generates an indication of whether a match is detected between the protection tag and the address tag (e.g., any type of match / mismatch reporting indication described above). The specific indication used to report any mismatch may vary depending on the implementation.
[0044] Figure 4 A representation of a virtual address space 60 that may be used in an exemplary embodiment is schematically shown. The figure shows the full range of virtual addresses that may be specified in this 64-bit address space, with an upper portion 62 indicated as reserved for kernel use and a lower portion 64 indicated as reserved for user space. Thus, virtual addresses in kernel space have a leading (most significant) set of contiguous 1s, while virtual addresses in user space have a corresponding set of contiguous leading 0s. As further shown in the figure, the modulo 2 64 This virtual address space is referenced in such a way that the lowest address (0x00...00) and the highest address (0xFF...FF) that can be defined in this space are "adjacent" to each other because virtual addresses that increment references above 0xFF...FF addresses wrap around to the lowest defined address 0x00...00.
[0045] As described above, virtual addresses used within the processor core (ie, for example, within the processing circuit 4) are converted into physical addresses used in the hardware of the memory system. Figure 5Exemplary circuitry provided to support this translation is schematically illustrated. The illustrated apparatus 70 includes a tag translation circuit 72, an address translation circuit 74, and a control circuit 76. The control circuit 76 controls the operation of the tag translation circuit 72 and the address translation circuit 74. When necessary, the control circuit 76 also references entries in a page table 78, which stores defined translations between virtual addresses and physical addresses. Thus, a virtual address 80 received by the apparatus 70 is translated into a physical address 82, which is then further passed to a memory system 84 to access the associated physical address as required. The virtual address 80 is processed in two parts, a virtual address portion 86 and a virtual tag portion 88. In the example illustrated, the virtual address is 64 bits, with bits [55:0] forming the virtual address portion and bits [63:56] forming the virtual tag portion. Note that if, for example, bits [63:60] of a 64-bit address are not used at all in a particular implementation, then Figure 5 The most significant bit representing the virtual tag portion may alternatively be considered as bit
[59] . Thus, the virtual address portion is received by address translation circuitry 74 in device 70 and, under control of control circuitry 76, the virtual address is converted to a corresponding physical address in a manner familiar to those skilled in the art. However, in addition, virtual tag portion 88 is received by tag translation circuitry 72 of device 70 and this circuitry may convert the virtual tag portion to a physical tag portion 92. Figure 6 , Figure 7 and Figure 8 More details of the conversion of virtual tags to physical tags are described.
[0046] Figure 6 An example of a circuit provided for converting a virtual tag portion into a physical tag portion is schematically shown in more detail. Figure 5In the example of FIG. 8 , the virtual address 80 is shown as including a virtual tag portion (including bits [63:56]) and a virtual address portion (including bits [55:0]). In the virtual tag portion, bits may have different uses, and as shown, the lowest four bits of the virtual tag portion ([59:56]) labeled "t" form the virtual tag portion that is subject to conversion. The remaining bits of the virtual tag portion above this ([63:60]) are used for different functions (described in more detail below). The tag conversion circuit 72 receives the set of bits "t" of the virtual tag portion, and the tag conversion circuit 72 provides two possible paths for this set of bits. Under the control of the control circuit 76, the settings of the multiplexers 94, 96 determine which of these paths will be followed. Essentially, this is either a direct path via the tag conversion circuit or a path via the configurable conversion circuit 98. In the example shown, the control circuit 76 makes the conversion selection based on the most significant bit of the virtual address portion (bit
[55] ). Thus, when this bit is set, the path through the switching circuit 98 is selected, and when this bit is not set, the direct path through the tag switching circuit 72 is selected. Figure 6 The right side is represented by a logic statement: if VA
[55] =1PA[t]=t-bar else PA[t]=t. In other words, when bit 55 is set, t is inverted, otherwise t is passed unmodified. However, inversion is not the only transformation that can be performed, and the transformation performed by the transformation circuit 98 may vary depending on the configuration setting 100. In another example, the transformation may be an increase in the value represented by the portion t, and other transformations are equivalently contemplated. The manner in which the device operates may also be affected by other bits in the virtual tag portion. For example, Figure 6 As shown, the control circuit 76 also receives another bit (labeled m). Here is an example of generating a physical address for use in a memory system, which includes tag-protected memory access under the control of a protection tag control circuit (e.g., as described above with reference to Figure 2 and Figure 3 As described above), an additional bit "m" may be used to exert control over the manner in which tag-protected memory accesses are performed. Figure 6 In the example shown, the "m" bit determines that a set of four bits 102 generated by the tag conversion circuit 72 is used by the memory system to define a "match_all" or "match_one" condition. In other words, depending on the setting of this m bit, a tag-protected memory access will require a match between the physical address tag of bits 102 and the protection tag stored associated with the relevant memory address (in the match_one condition), or will allow substantially any set of address tag bits to satisfy a match (in the match_all condition).
[0047] Generally, the remainder of the virtual tag portion may be considered "spare" (as indicated in the figure), but in some examples, one or more bits of this spare portion (e.g., indicated as "c" in the figure) may additionally be used to provide one or more additional control bits that are settable in the virtual tag portion and may be transmitted to the memory system and / or affect configuration settings of the device. Thus, as shown in the figure (as an alternative option indicated by dashed lines), these spare bits may determine the configuration setting 100 and may also provide, for example, two additional bits 106 that are transmitted to the memory system as additional control bits. Finally, note that the protection tag control circuit 104 is generally configured such that when a particular bit combination of the bit set 102 (in the physical tag) is received, a "match_all" condition is set. In the example shown, this is when all bits are set. Figure 6 This is also shown in the logic statement at the bottom right: if PA[t] = 0xF match_all else match_one. Recall that virtual addresses can be allocated in a system where a portion of the available virtual address space is reserved for user space and another portion is reserved for kernel space (e.g. Figure 4 ), and recalling that this provides a default meaning for the upper portion of a full (e.g., 64-bit) virtual address, the translation performed by translation circuitry 72 (controlled by the most significant bit (bit
[55] ) of the virtual address portion) can therefore provide the same predetermined "match_all" bit condition (0xF in this example) to the memory control system regardless of whether the virtual address has been allocated to kernel space or to user space. In other exemplary configurations, a five-bit physical tag may be used, with one bit dedicated to indicating whether a "match_all" or "match_one" comparison should be performed, and the other four bits used to perform the comparison (if "match_one" is configured).
[0048] Figure 7 yes Figure 6 , there is shown a variation of the control of the conversion circuit 98 by the control circuit 76. The control circuit 76 receives a specific bit (denoted as "OV" - override) of the virtual tag portion, which can be used to force the conversion circuit 98 to generate a specific bit (or bit combination) in the physical tag portion. For example, this can be used to force a match_all comparison. However, in principle, the forced bit (or bit combination) in the physical tag portion generated by the conversion circuit 98 can serve any purpose, whether as part of a tag-protected memory access or in association with another memory operation, and the override bit (OV) in the virtual tag portion can be used to trigger this operation.
[0049] In one example, a method is employed in which at most one of the virtual tag encodings is selected based on the most significant bit of the virtual address portion, which is defined as a "match_all" physical tag encoding. Whether to perform this "match_all" comparison can also be configured based on other contexts. For example, all user tags can be configured as "match_one", user tag "0" can be configured as "match_all", all kernel tags can be configured as "match_one", and kernel tag "1111" can be configured as "match_all".
[0050] Figure 8 is a flow chart representing a series of steps performed in one example. At step 120, a new virtual address to be translated is received. At step 122, it is determined whether there is a particular configuration to be applied to the translation circuitry (e.g., via spare bits in the virtual tag portion), and when so, the application occurs at step 124. At step 126, a translation to be applied to the virtual tag portion is determined based on the virtual address portion of the virtual address (e.g., based on its most significant bits). Then, at step 128, the selected translation is applied to a portion of the virtual tag portion (to generate a corresponding physical tag portion). At step 130, it is determined whether bit "m" is 1, which determines whether a match_all comparison will be performed (step 132) or whether a match_one comparison will be performed (step 134). Finally, at step 136, it is determined whether the generated set of bits in the tag portion of the physical address corresponds to a predetermined special value, which in this example is a set of consecutive 1s (0xF). When it corresponds to a predetermined special value, the flow proceeds to step 140, where this triggers a special operation in the memory system, and when it is not the case, the flow proceeds through step 138, where a "normal" tag-protected memory access is performed according to the check as match_all or match_one determined in step 130. The flow then returns to step 120.
[0051] Fig. 9A usable simulator implementation method is shown. Although the embodiments described above implement the present invention in terms of the apparatus and method for operating the specific processing hardware supporting the technology involved, an instruction execution environment can also be provided according to the embodiments described herein performed by the use of a computer program. Such computer programs are generally referred to as simulators as long as they provide a software-based implementation of the hardware architecture. Various simulator computer programs include emulators, virtual machines, models, and binary converters (including dynamic binary converters). Typically, the simulator implementation can be run on the main processor 230, optionally running a host operating system 220, supporting the simulator program 210. In some arrangements, there may be multiple simulation layers between the hardware and the provided instruction execution environment, and / or multiple different instruction execution environments provided on the same host processor. Historically, powerful processors have been required to provide simulator implementations that execute at reasonable speeds, but in some cases, this approach may be reasonable, such as when it is desired to run the native program code of another processor for compatibility or reuse reasons. For example, a simulator implementation may provide an instruction execution environment with additional functions that are not supported by the host processor hardware, or provide an instruction execution environment that is generally associated with different hardware architectures. An overview of simulation is given in "Some Efficient Architecture Simulation Techniques" by Robert Bedichek, 1990 Winter USENIX Conference, pp. 53-63.
[0052] To the extent that embodiments have been previously described with reference to specific hardware constructs or features, in simulated embodiments, equivalent functionality may be provided by suitable software constructs or features. For example, specific circuits may be implemented as computer program logic in simulated embodiments. Similarly, memory hardware (such as registers or caches) may be implemented as software data structures in simulated embodiments. Where one or more hardware components referenced in the foregoing embodiments are present in an arrangement on host hardware (e.g., host processor 230), some simulated embodiments may utilize host hardware where appropriate.
[0053] The simulator program 210 may be stored on a computer-readable storage medium 212 (which may be a non-transitory medium) and provides a program interface (instruction execution environment) (which may include an application, an operating system, and a hypervisor) to the target program code 200, which is the same as the application programming interface of the hardware architecture modeled by the simulator program 210. Therefore, the simulator program 210 can be used to execute program instructions of the target program code 200 from the instruction execution environment, so that the host computer 230, which is actually free of the hardware features of the above-mentioned device 2 and in particular the label conversion circuit 72, can emulate these features. For example, the simulator program 210 may include address conversion logic 214 for converting a virtual address to a physical address, and may particularly include address conversion logic 216 for converting a virtual address label portion to a physical address label portion. Therefore, the simulator program 210 may also include memory access program logic, which is used to perform a comparison of the protection tag and the address tag, and report whether any mismatch between the protection tag and the address tag has been detected. In addition, the simulator program 110 may include label setting program logic, which includes instructions for setting the protection tag in a manner corresponding to the manner in which the hardware embodiment sets the tag.
[0054] Briefly, an apparatus includes an address translation circuit, the address translation circuit is used to perform a conversion of a virtual address to a physical address, the virtual address includes a virtual tag portion and a virtual address portion, the physical address includes a physical tag portion and a physical address portion. The address translation circuit includes an address tag translation circuit, the address tag translation circuit performs a conversion of the virtual tag portion to the physical tag portion, and the conversion to be performed by the address tag translation circuit is selected based on the virtual address.
[0055] In this application, the term "configured to..." is used to indicate that an element of a device has a configuration that can perform a defined operation. In this context, "configuration" refers to the arrangement or manner in which hardware or software are interconnected. For example, a device may have dedicated hardware that provides the defined operation, or a processor or other processing device (such as the processing component discussed above) that is programmed to perform the function. "Configured to" does not mean that the device elements need to be changed in any way to provide the defined operation.
[0056] Although illustrative embodiments of the present technology have been described in detail herein with reference to the accompanying drawings, it should be understood that the present technology is not limited to those precise embodiments and that various changes, additions and modifications may be made herein by those skilled in the art without departing from the scope and spirit of the present technology as defined by the appended claims. For example, various combinations of the features of the appended claims may be implemented together with the features of the independent claims without departing from the scope of the present technology.
Claims
1. A memory management device, comprising: An address conversion circuit, the address conversion circuit is used to perform a conversion from a virtual address to a physical address, the virtual address includes a virtual tag part and a virtual address part, the physical address includes a physical tag part and a physical address part, and the address conversion circuit includes: an address label conversion circuit, the address label conversion circuit being used to perform conversion of the virtual label portion to the physical label portion, wherein the address translation circuit selects the translation to be performed by the address label translation circuit based on the virtual address portion, The virtual tag portion and the virtual address portion are non-overlapping portions of the virtual address.
2. The device according to claim 1, wherein: The translation performed by the address tag translation circuitry depends on a most significant bit of the virtual address portion.
3. The device according to claim 2, wherein: When the most significant bit of the virtual address portion has a first value, the selected conversion performed by the address tag conversion circuitry generates the physical tag portion that matches the virtual tag portion, and Wherein, when the most significant bit has a second value, the selected conversion performed by the address tag conversion circuit modifies the virtual tag portion to generate the physical tag portion.
4. The device according to claim 2 or 3, wherein: The apparatus is arranged to allocate a virtual address for exclusive use by one of a kernel owned process and a user owned process, and the value of the most significant bit of the virtual address portion indicates whether the virtual address has been allocated to a kernel owned process or a user owned process.
5. The device according to any one of claims 1 to 3, wherein: The selected conversion performed by the address tag conversion circuit includes inverting at least a portion of the virtual tag portion to generate the physical tag portion.
6. The device according to any one of claims 1 to 3, wherein: The selected conversion performed by the address tag conversion circuit includes incrementing at least a portion of the virtual tag portion to generate the physical tag portion.
7. The apparatus of any one of claims 1 to 3, further comprising a memory system for receiving the physical address and accessing a memory location identified by the physical address portion, wherein: The memory system performs a predetermined memory operation in response to receipt of the physical address when a predetermined portion of the physical tag portion has a predetermined value.
8. The device according to claim 7, wherein: The predetermined memory operation is a protection tag comparison of the physical tag portion relative to a protection tag value associated with the memory location, and the memory system indicates an error condition in response to the physical tag portion and the protection tag value not satisfying a match condition.
9. The device according to claim 8, wherein: When a predetermined portion of the physical tag portion has a predetermined value, the match condition is a match all condition such that any protection tag value will satisfy the match condition.
10. The device according to claim 9, wherein: When the predetermined portion of the physical tag portion does not have the predetermined value, the match condition is a match one condition such that the predetermined portion of the physical tag portion and the protection tag value must be the same to satisfy the match condition.
11. The device according to claim 9, wherein: The predetermined portion of the physical tag portion is a predetermined set of bits of the physical tag portion.
12. The device according to claim 9, wherein: The address label conversion circuit generates the physical label portion such that the predetermined portion of the physical label portion has a predetermined value in response to a predetermined bit of the virtual label portion having the predetermined value regardless of values of other predetermined bits of the virtual label portion.
13. The device according to claim 9, wherein: The predetermined portion of the physical label portion is a predetermined position of the physical label portion.
14. The device according to claim 8, wherein: The protection tag comparison is a comparison of: a less-than-all portion of the physical tag portion and the protection tag value associated with the memory location.
15. The device according to claim 9, wherein: All bits of the predetermined value of the predetermined portion of the physical tag portion have the same bit value.
16. The device according to claim 8, wherein The virtual tag portion includes at least one bit included in the physical address, and the memory system controls copying of the protection tag associated with the memory location in response to the at least one bit when a write access is made to the memory location.
17. A memory management method, comprising: selecting a translation to be performed, wherein the translation is performed on a virtual address and converts it to a physical address, the virtual address comprising a virtual tag portion and a virtual address portion, the physical address comprising a physical tag portion and a physical address portion, wherein the selection of the translation is dependent on the virtual address portion; and performing the conversion to convert the virtual label portion into the physical label portion, The virtual tag portion and the virtual address portion are non-overlapping portions of the virtual address.
18. A computer program product comprising a computer program for controlling a host data processing device to provide an instruction execution environment for executing instructions of a target program code, the computer program comprising: An address translation program logic, the address translation program logic being used to perform a translation of a virtual address to a physical address, the virtual address comprising a virtual tag portion and a virtual address portion, the physical address comprising a physical tag portion and a physical address portion, the address translation program logic comprising: address label conversion program logic for performing conversion of the virtual label portion to the physical label portion, wherein the address translation program logic selects the translation to be performed by the address tag translation circuit based on the virtual address portion, The virtual tag portion and the virtual address portion are non-overlapping portions of the virtual address.
