A method and apparatus for segregation of virtual address space in a computer system is provided. An embodiment of the invention provides compatibility of an emulated processor architecture with a native processor architecture. address space for the emulated processor architecture is provided and segregated from other address space, such as address space designated for use by a native processor, where the native processor is the processor actually present in a computer system. An embodiment of the invention provides separate exception handlers to handle translation lookaside buffer (TLB) misses for each address space. An embodiment of the invention provides an address space tag associated with a virtual address to designate the address space to which that virtual address pertains.
|
1. A method for performing a memory access operation in a computer system, comprising the steps of:
executing a memory access instruction, the memory instruction comprising a first virtual address and a first address space tag; using a translation lookaside buffer structure to match the first address space tag and the first virtual address to produce a first physical address; generating a first exception if the first virtual address and first address space tag does not match an entry in the translation lookaside buffer; processing the first exception using a first exception handler; generating a second virtual address in a second address space derived from the first virtual address in the first address space that did not match an entry in the translation lookaside buffer structure; and attempting to read a page table entry using the second virtual address in the second address space.
14. A memory access apparatus comprising:
a memory device for storing a page table entry; a translation lookaside buffer structure capable of storing the page table entry; a processor for executing a first memory access instruction, the first memory access instruction comprising a first virtual address and a first address space tag, the first address space tag designating address space to which the first virtual address pertains, the processor coupled to the memory device and to the translation lookaside buffer structure, wherein the processor executing the first memory access instruction specifies attempts to match the first address space and the first virtual address to provide a physical address representing a location in the memory device; and when the translation lookaside buffer is unsuccessful in attempting to provide the physical address, the processor calls a first exception handler, and the first exception handler generates a second virtual address in a second address space derived from the first virtual address in the first address space, and the translation lookaside buffer structure is used to attempt to match the second address space and the second virtual address and to read a page table entry from the memory device to provide a physical address representing a location in the memory device.
2. The method of
using the translation lookaside buffer structure to match the first address space tag and the first virtual address to produce the first physical address if an entry exists in the translation lookaside buffer structure for the first address space tag and the first virtual address.
3. The method of
generating the first exception if the entry does not exist in the translation lookaside buffer structure for the first address space tag and the first virtual address, wherein the first exception is unique to the first address space, such that a different exception is generated for a different address space.
4. The method of
5. The method of
if the second virtual address in the second address space matches a second translation lookaside buffer entry, reading the page table entry from a memory device and placing the page table entry in the translation lookaside buffer structure so as to map the first virtual address in the first address space to the page table entry.
6. The method of
successfully accessing the first virtual address in the first address space using the page table entry in the translation lookaside buffer structure.
7. The method of
if the second virtual address in the second address space misses in the translation lookaside buffer structure, generating a second exception; generating, using a second exception handler different that the first exception handler, a third virtual address in a third address space derived from the second virtual address in the second address space that missed in the translation lookaside buffer structure; and attempting to read the page table entry using the third virtual address in the third address space.
8. The method of
attempting to read the page table entry using the third virtual address in the third address space without reference to the translation lookaside buffer structure.
9. The method of
reading the page table entry from the memory device and placing the page table entry in the translation lookaside buffer structure so as to map the second virtual address from the second address space to the page table entry.
10. The method of
successfully reading the page table entry using the second address from the second address space; reading the page table entry from the memory device and placing the page table entry in the translation lookaside buffer structure so as to map the first virtual address in the first address space to the page table entry; and successfully accessing the first virtual address in the first address space using the page table entry in the translation lookaside buffer structure.
11. The method of
obtaining from the memory access instruction the virtual address, the memory access instruction explicitly denoting the address space specific to the memory access instruction.
12. The method of
determining, based on the address space, whether to use to the translation lookaside buffer structure to match the address space and the virtual address to produce the physical address or to bypass use of the translation lookaside buffer structure.
13. The method of
if the first address space is a protected address space, generating an exception if the memory access instruction is not a privileged operating system instruction.
15. The memory access apparatus of
16. The memory access apparatus of
17. The memory access apparatus of
18. The memory access apparatus of
19. The memory access apparatus of
20. The memory access apparatus of
21. The memory access apparatus of
22. The memory access apparatus of
23. The memory access apparatus of
|
The invention relates generally to memory management in a computer system and more specifically to a method and apparatus for performing a memory access operation in a computer system.
In a computer system, instructions and data are stored in a memory device until they are needed. The memory device is organized according to an addressing scheme to allow the instructions and data to be located by specifying an address. However, while the memory device is organized into a plurality of physical addresses, it is often useful for a processor to consider the instructions and data to be organized according to a different addressing scheme, denoted by virtual addresses. The virtual addresses may be converted to physical addresses to allow the instructions and data to be accessed in the memory device.
A translation lookaside buffer (TLB) structure may be used to provide a cache for translation of virtual addresses to physical addresses. The TLB structure includes a plurality of page directories that contain page directory entries and a plurality of page tables that contain page table entries. The page directory entries serve as pointers to the plurality of page tables and the page table entries serve as pointers to pages of data in the memory device.
While a TLB structure is useful for caching virtual address-to-physical address translations, it is not readily compatible with a computer architecture that provides for the emulation of an emulated processor using a native processor. The native processor is the processor actually present in the system, while the emulated processor is a processor whose performance characteristics simulated by the native processor. The emulation allows execution on the native processor of software programmed to be executed on a processor of the same type as the emulated processor. However, software programmed to be executed on a processor of the same type as the emulated processor is subject to the constraints and conditions associated with that type of processor. For example, the emulated processor architecture may already use all of its address space thereby causing incompatibility with certain bookkeeping techniques commonly used with prior art TLBs. Thus, a method and apparatus is needed to allow efficient memory accesses given the constraints imposed by an emulated processor architecture.
The invention provides a method and apparatus for segregation of virtual address space in a computer system. An embodiment of the invention provides compatibility of an emulated processor architecture with a native processor architecture. Address space for the emulated processor architecture is provided and segregated from other address space, such as address space designated for use by a native processor, where the native processor is the processor actually present in a computer system. An embodiment of the invention provides separate exception handlers to handle translation lookaside buffer (TLB) misses for each address space. An embodiment of the invention provides an address space tag associated with a virtual address to designate the address space to which that virtual address pertains.
An embodiment of the invention is useful in a computer that does load or store instructions or executes instruction code fetches where the resulting memory access has a virtual address. An address space for the memory access may be implicitly or explicitly provided. A TLB structure matches the address space and virtual address to produce a physical address or, if no entry is present, an exception. By providing an address space tied to a memory access instruction and the TLB structure that matches it, this embodiment of the invention provides advantages not heretofore realized.
Optionally, memory accesses for one or more address spaces may bypass the TLB structure. Thus, use of the TLB structure may be made dependent upon the address space specified for the memory access.
In accordance with an embodiment of the invention, each address space may generate its own unique exception (i.e., each address space may have its own exception handler). Thus, a different mechanism is provided to handle exceptions for each address space.
Optionally, one or more address spaces may be protected so that instructions that are not privileged operating system instructions cause an exception. Thus, intentional or accidental memory accesses to an improper memory space are prevented and handled by an exception handler.
An embodiment of the invention provides for the emulation of a traditional page table structure (e.g., that of an x86 processor architecture) some or all of the above-described features and software exception handlers. As an example, a first address space may be used to emulate a full (e.g., 32-bit) traditional address space mapped by page tables where accesses to a first address in the first address space that miss in the TLB structure jump to a first software exception handler.
The first software exception handler generates a second address in a second address space derived from the first address in the first address space that missed (i.e., could not be found) in the TLB structure and attempts to read a page table entry from the second address in the second address space. In attempting to read a page table entry from the second address in the second address space, one of two things may occur. One possibility is that the second address in the second address space matches a translation lookaside buffer structure entry. If so, a page table entry is read from memory and placed in the TLB structure mapping the first address from the first address space to the page table entry. A second possibility is that the second address in the second address space doesn't match the TLB structure entry and the processor jumps to a second software exception handler.
In the latter case, the second software exception handler generates a third address in a third address space derived from the second address in the second address space that missed in the TLB structure and attempts to read a page table entry from the third address in the third address space. The attempt to read the page table entry from the third address in the third address space does not require reference to the TLB structure (i.e., the TLB structure is bypassed).
From the third address in the third address space, a page table entry is read from a memory device and placed in the TLB structure, mapping the second address from the second address space to the page table entry.
After a page table entry is read from memory and placed in the TLB structure mapping the first address from the first address space to the page table entry in accordance with the first possibility discussed above, then the access to the first address in the first address space is tried again and succeeds.
After a page table entry is read from a memory device and placed in the TLB structure mapping the second address from the second address space to the page table entry in accordance with the second possibility discussed above, then the access to the second address in the second address space is tried again and succeeds. Then a page table entry is read from memory and placed in the TLB structure, mapping the first address from the first address space to the page table entry. Then the access to the first address space is tried again and succeeds.
If, in step 204, a TLB miss occurs (i.e., no matching TLB is found in the TLB structure), the process continues in step 206. In step 206, the processor generates an exception and executes a first exception handler. In step 207, a page table entry address is created identifying a second virtual address in a second address space. In step 208, a memory access operation begins based on the second virtual address and the second address space. In step 209, the TLB structure is checked to determine if a TLB entry exists that matches the second virtual address and the second address space to produce a physical address in the memory device. If a TLB entry exists, the process continues in step 210. In step 210, the page table entry identified by the page table entry address generated in step 207 is loaded from the memory device. In step 211, the page table entry is placed in the TLB structure to map the first virtual address and the first address space to the physical address of the location in the memory device, and the process returns to step 203. After step 203, since the TLB entry is then present in the TLB structure, the process will continue to step 205 from step 204, and the data will be successfully obtained from the memory device.
If, in step 209, a TLB miss occurs, the process continues in step 212. In step 212, the processor generates an exception and executes a second exception handler. In step 213, a page directory entry address is generated identifying a third virtual address and a third address space. In step 214, the memory device is accessed based on the third virtual address and the third address space. The TLB structure need not be consulted for this memory access. In step 215, the page directory entry specified according to step 213 is loaded from the memory device. In step 216, the page directory entry is placed in the TLB structure to map the second virtual address and the second address space to the physical address of the location in the memory device, and the process returns to step 208. After step 208, since the TLB entry is then present in the TLB structure, the process will continue to step 210 from step 209, and the page table entry will be successfully loaded from the memory device.
Address space 302 is designated as emulator-mapped address space. This address space may be used to implement memory space for software executed by the native processor to control emulation of the emulated processor. This address space may be mapped using a page directory entry. According to one embodiment of the invention, different exception handlers are used to handle exceptions in address space 302 and address space 303.
Address space 301 is designated as purely physically-mapped address space. The TLB structure need not be used for memory accesses to this address space. Thus, the TLB need not map virtual addresses to this address space.
Additionally, other address space may be defined, with segregation provided between it and existing address spaces. For example, page table entry address space may be defined to allow page tables to be virtually contiguous (i.e., contiguous within the page table entry address space). A separate exception handler may be provided to map virtual addresses within the page table entry address space.
Page directory 701 begins at address AAAA. Applying the first part of the virtual address, denoted as 0x048, as an offset within page directory 701 yields an address AAAA+0x048 containing value BBBB. Value BBBB identifies the beginning of page table 703. Applying four times the second part of the virtual address (i.e., the second part of the virtual address shifted to the left twice), denoted as 4·0x345, as an offset within page table 703 yields address BBBB+4·0x345 containing value CCCC. Value CCCC identifies the beginning of page 705. Applying the third part of the virtual address, denoted as 0x678, as an offset within page 705 yields address CCCC+0x678 containing data 706. Data 706 is the data stored at the physical address in the memory device that corresponds to the virtual address 0x12345678. Thus, the TLB structure provides caching of virtual address-to-physical address translations.
Thus, a method and apparatus for segregation of virtual address space in a computer system capable of providing compatibility of an emulated processor architecture with a native processor architecture has been provided.
Patent | Priority | Assignee | Title |
10216629, | Jun 22 2013 | Microsoft Technology Licensing, LLC | Log-structured storage for data access |
6674441, | Jul 26 2000 | ATI Technologies ULC | Method and apparatus for improving performance of an accelerated graphics port (AGP) device |
7124237, | Oct 03 2002 | Seagate Technology LLC | Virtual machine emulation in the memory space of a programmable processor |
8140819, | Jul 01 2005 | Thomson Licensing | Method and apparatus for managing memory accesses in an AV decoder |
Patent | Priority | Assignee | Title |
4004278, | Mar 19 1973 | Hitachi, Ltd. | System for switching multiple virtual spaces |
4145738, | Jun 08 1976 | Fujitsu Limited | Plural virtual address space processing system |
4785392, | Oct 14 1986 | Amdahl Corporation | Addressing multiple storage spaces |
5123101, | Nov 12 1986 | Xerox Corporation | Multiple address space mapping technique for shared memory wherein a processor operates a fault handling routine upon a translator miss |
5129071, | Apr 06 1988 | Hitachi, Ltd. | Address translation apparatus in virtual machine system using a space identifier field for discriminating DATOFF (dynamic address translation off) virtual machines |
5230045, | Nov 12 1986 | Xerox Corporation | Multiple address space system including address translator for receiving virtual addresses from bus and providing real addresses on the bus |
5815686, | Sep 12 1996 | SAMSUNG ELECTRONICS CO , LTD | Method and apparatus for address space translation using a TLB |
5930833, | Apr 19 1994 | Hitachi, Ltd. | Logical cache memory storing logical and physical address information for resolving synonym problems |
5953520, | Sep 22 1997 | International Business Machines Corporation | Address translation buffer for data processing system emulation mode |
6069638, | Jun 25 1997 | Round Rock Research, LLC | System for accelerated graphics port address remapping interface to main memory |
6092172, | Oct 16 1996 | ADVANCED PROCESSOR TECHNOLOGIES LLC | Data processor and data processing system having two translation lookaside buffers |
6138226, | Apr 19 1994 | Hitachi Ltd. | Logical cache memory storing logical and physical address information for resolving synonym problems |
6189074, | Mar 19 1997 | GLOBALFOUNDRIES Inc | Mechanism for storing system level attributes in a translation lookaside buffer |
Executed on | Assignor | Assignee | Conveyance | Frame | Reel | Doc |
Oct 14 1999 | CAMPBELL, PAUL | ATI International, Srl | ASSIGNMENT OF ASSIGNORS INTEREST SEE DOCUMENT FOR DETAILS | 010338 | /0269 | |
Oct 25 1999 | ATI International SRL | (assignment on the face of the patent) | / | |||
Nov 18 2009 | ATI International SRL | ATI Technologies ULC | ASSIGNMENT OF ASSIGNORS INTEREST SEE DOCUMENT FOR DETAILS | 023574 | /0593 |
Date | Maintenance Fee Events |
Oct 14 2005 | M1551: Payment of Maintenance Fee, 4th Year, Large Entity. |
Sep 28 2009 | M1552: Payment of Maintenance Fee, 8th Year, Large Entity. |
Oct 09 2013 | M1553: Payment of Maintenance Fee, 12th Year, Large Entity. |
Date | Maintenance Schedule |
May 07 2005 | 4 years fee payment window open |
Nov 07 2005 | 6 months grace period start (w surcharge) |
May 07 2006 | patent expiry (for year 4) |
May 07 2008 | 2 years to revive unintentionally abandoned end. (for year 4) |
May 07 2009 | 8 years fee payment window open |
Nov 07 2009 | 6 months grace period start (w surcharge) |
May 07 2010 | patent expiry (for year 8) |
May 07 2012 | 2 years to revive unintentionally abandoned end. (for year 8) |
May 07 2013 | 12 years fee payment window open |
Nov 07 2013 | 6 months grace period start (w surcharge) |
May 07 2014 | patent expiry (for year 12) |
May 07 2016 | 2 years to revive unintentionally abandoned end. (for year 12) |