US20040015675A1 - SMC detection and reverse translation in a translation lookaside buffer - Google Patents

SMC detection and reverse translation in a translation lookaside buffer Download PDF

Info

Publication number
US20040015675A1
US20040015675A1 US10/618,168 US61816803A US2004015675A1 US 20040015675 A1 US20040015675 A1 US 20040015675A1 US 61816803 A US61816803 A US 61816803A US 2004015675 A1 US2004015675 A1 US 2004015675A1
Authority
US
United States
Prior art keywords
cache
memory
page
instruction
stored
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Abandoned
Application number
US10/618,168
Inventor
Alan Kyker
Chan Lee
Vihang Pandya
Roshan Fernando
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Individual
Original Assignee
Individual
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Individual filed Critical Individual
Priority to US10/618,168 priority Critical patent/US20040015675A1/en
Publication of US20040015675A1 publication Critical patent/US20040015675A1/en
Abandoned legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/30Arrangements for executing machine instructions, e.g. instruction decode
    • G06F9/38Concurrent instruction execution, e.g. pipeline, look ahead
    • G06F9/3802Instruction prefetching
    • G06F9/3812Instruction prefetching with instruction modification, e.g. store into instruction stream
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/08Addressing or allocation; Relocation in hierarchically structured memory systems, e.g. virtual memory systems
    • G06F12/0802Addressing of a memory level in which the access to the desired data or data block requires associative addressing means, e.g. caches
    • G06F12/0806Multiuser, multiprocessor or multiprocessing cache systems
    • G06F12/0815Cache consistency protocols
    • G06F12/0831Cache consistency protocols using a bus scheme, e.g. with bus monitoring or watching means
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/08Addressing or allocation; Relocation in hierarchically structured memory systems, e.g. virtual memory systems
    • G06F12/0802Addressing of a memory level in which the access to the desired data or data block requires associative addressing means, e.g. caches
    • G06F12/0875Addressing of a memory level in which the access to the desired data or data block requires associative addressing means, e.g. caches with dedicated cache, e.g. instruction or stack
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/08Addressing or allocation; Relocation in hierarchically structured memory systems, e.g. virtual memory systems
    • G06F12/10Address translation
    • G06F12/1027Address translation using associative or pseudo-associative address translation means, e.g. translation look-aside buffer [TLB]

Definitions

  • the present invention relates generally to software backward compatibility in advanced microprocessor hardware, and specifically to cache coherency and self modifying code detection using an instruction translation lookaside buffer.
  • a Data Store that modifies the next instruction which is to be executed by the computer may require that the modification become effective before the next instruction can be executed.
  • the code modification may be the result of the computer system copying a new program into the physical memory that previously contained another program.
  • multiple agents may be responsible for updating memory.
  • each processor can perform stores to memory which could modify instructions to be executed by any or all processors in the system.
  • Direct Memory Access (DMA) agents such as disk controllers, can also perform stores to memory and thereby modify code.
  • self modifying code all forms of code modification of previously stored instructions within memory of a computer system during program execution, regardless of whether it includes a single processor, a multi processor, or a DMA agent, are referred to as self modifying code (SMC).
  • SMC self modifying code
  • the definition of self modifying code as used herein includes the more common references to self modifying code and cross modifying code.
  • An instruction cache memory is a fast memory of relatively small size used to store a large number of instructions from program memory. Typically, an instruction cache has between 32 to 128 byte cache lines in which to store instructions.
  • Program memory more commonly referred to simply as memory, is usually a semiconductor memory such as dynamic random access memory or DRAM.
  • DRAM dynamic random access memory
  • cache coherency or pipeline coherency where the instruction cache or pipeline becomes incoherent (or stale) as compared with program memory after self modifying code occurs. This is in contrast to the problem of memory coherency where the cache is updated and memory is stale or incoherent.
  • IP Next Instruction process
  • ILB instruction translation lookaside buffer
  • the ITLB 112 includes page table entries of linear to physical address translations into memory 104 .
  • page table entries represent the most recently used pages of memory 104 which point to a page of memory in the instruction cache 114 .
  • Instructions are fetched over the memory bus 124 by the memory controller 115 from memory 104 for storage into the instruction cache 114 .
  • the instruction cache 114 is physically addressed.
  • a physical address is the lowest level of address translation and points to an actual physical location associated with physical hardware.
  • a linear address is an address associated with a program or other information that does not directly point into a memory, cache memory or other physical hardware.
  • a linear address is linear relative to the program or other information. Copies of instructions within memory 104 are stored within the instruction cache 114 .
  • Instructions are taken from the instruction cache 114 , decoded by the instruction decoder 116 and input into an instruction pipeline within the out of order core execution unit 118 .
  • an instruction is retired by the retirement unit 120 .
  • the retirement unit 120 processes instructions in program order after they have completed execution. Retirement processing includes checking for excepting conditions (such as an occurrence of self modifying code) and committing changes to architectural state. That is, the out of order core execution unit 118 executes instructions which can be completely undone before being output by the microprocessor if some excepting condition has occurred which the retirement unit has recognized.
  • Icache inclusion means that the instruction bytes for any instruction in the instruction pipeline are guaranteed to stay in the instruction cache 114 until the instruction is no longer stored within the instruction pipeline, i.e. retired. In this case, if cache coherency is maintained then pipeline coherency is maintained by the Icache inclusion.
  • the present invention includes a method, apparatus and system as described in the claims.
  • a microprocessor includes an execution unit and a translation lookaside buffer (TLB).
  • the execution unit triggers a snoop operation in the TLB if a store into memory is executed.
  • the TLB includes a content addressable memory (CAM).
  • CAM content addressable memory
  • the TLB receives a physical address indicating the location where the execution of the store occurs in the memory.
  • the TLB ordinarily stores page translations between a linear page address and a physical page address pointing to a page of memory having contents stored within a cache or a pipeline.
  • the TLB includes a CAM input port to compare the physical address received by the TLB with the physical page addresses stored within the TLB.
  • FIG. 1 illustrates a block diagram of a prior art microprocessor coupled to memory.
  • FIG. 2 illustrates a block diagram of a typical computer in which the present invention is utilized.
  • FIG. 3A illustrates a block diagram of a typical central processing unit in which the present invention is utilized.
  • FIG. 3B illustrates a block diagram of a multiprocessor central processing unit in which the present invention is utilized.
  • FIG. 4A illustrates a block diagram of microprocessors in a multiprocessor system coupled to a memory, the microprocessors including a first embodiment of the present invention.
  • FIG. 4B illustrates a block diagram of microprocessors in a multiprocessor system coupled to a memory, the microprocessors including a second embodiment of the present invention.
  • FIG. 4C illustrates a block diagram of microprocessors in a multiprocessor system coupled to a memory, the microprocessors including a third embodiment of the present invention.
  • FIG. 5A is a table of instructions illustrating an exemplary program for storage in a trace instruction cache.
  • FIG. 5B is a block diagram illustrating a first cache line or head line of a trace of instructions stored within a trace instruction cache.
  • FIG. 5C is a block diagram illustrating a trace instruction cache storing an exemplary trace of instructions.
  • FIG. 5D is a block diagram illustrating a second cache line of a trace of instructions stored within a trace instruction cache.
  • FIG. 6 is a block diagram illustrating the instruction translation lookaside buffer (ITLB) and snoop logic of the present invention.
  • the computer 200 includes a central processing unit (CPU) 201 , input/output devices (I/O) 202 such as keyboard, modem, printer, external storage devices and the like and monitoring devices (M) 203 such as a CRT or graphics display.
  • the monitoring devices (M) 203 provide computer information in a human intelligible format such as visual or audio formats.
  • FIG. 3A a block diagram of a typical central processing unit 201 in which the present invention is utilized is illustrated.
  • the central processing unit 201 includes an advanced microprocessor 301 including the present invention, a disk storage device 303 , and a memory 104 ′ for storing program instructions coupled together.
  • the prime notation used herein with reference designators indicates blocks having similar functionality with the same reference number; however, the block may be slightly altered to provide support for the advanced microprocessors of the present invention.
  • memory 104 ′ may be considerably larger that memory 104 due to wider data bit width and address space provided by the advanced microprocessor 301 .
  • Disk storage device 303 may be a floppy disk, zip disk, DVD disk, hard disk, rewritable optical disk, flash memory or other non-volatile storage device.
  • the microprocessor 301 and the disk storage device 303 can both read and write information into memory 104 ′ over the memory bus 304 .
  • both the microprocessor 301 and the disk storage device 303 can alter memory locations within memory 104 ′ during program execution.
  • the disk storage device 303 includes a disk controller with direct memory access which can perform stores into memory and thereby modify code. Because the controller can directly access the memory it is an example of a Direct Memory Access (DMA) agent.
  • DMA Direct Memory Access
  • Other devices having direct access to store information into memory are also DMA agents.
  • Memory 104 ′ is typically dynamic random access memory (DRAM) but may be other types of rewritable storage. Memory may also be referred to herein as program memory because it is utilized to store program instructions.
  • DRAM dynamic random access memory
  • Memory may also be referred to herein as program memory because it is utilized to store program instructions.
  • the microprocessor 301 Upon initial execution of a program stored in the disk storage device 303 or stored in some other source such as I/O devices 202 , the microprocessor 301 reads program instructions stored in the disk storage device 303 or other source and writes them into memory 104 ′. One or more pages or fractions thereof of the program instructions stored within memory 104 ′ are read (i.e. “fetched”) by the microprocessor 301 for storage into an instruction cache (not shown in FIG. 3). Some of the program instructions stored in the instruction cache may be read into an instruction pipeline (not shown) for execution by the microprocessor 301 .
  • FIG. 3B a block diagram of a multiprocessor central processing unit 201 ′ in which the present invention is utilized is illustrated.
  • the central processing unit 201 ′ includes multiple (N) advanced microprocessors 301 including the present invention labeled as microprocessors 301 through 301 ′′; the disk storage device 303 ; and memory 104 ′ coupled together as illustrated in FIG. 3B.
  • the N microprocessors 301 through 301 ′′ and the disk storage device 303 can both read and write information into memory 104 ′ over the memory bus 304 ′. That is memory 104 ′ is shared by the N multiple processors 301 through 301 ′′.
  • any one of the N microprocessors 301 through 301 ′′ or the disk storage device 303 can alter memory locations within memory 104 ′ during program execution.
  • the disk storage device 303 includes a disk controller with direct memory access which can perform stores into memory and thereby modify code. Because the controller can directly access the memory it is an example of a Direct Memory Access (DMA) agent. Other devices having direct access to store information into memory are also DMA agents.
  • DMA Direct Memory Access
  • Other devices having direct access to store information into memory are also DMA agents.
  • the present invention in each of the microprocessors 301 through 301 ′′ maintains cache coherency and pipeline coherency in a shared memory multi-processor system.
  • Microprocessor 301 A includes a next instruction processor 110 ′, an instruction translation lookaside buffer 412 , an instruction cache 414 A, a memory controller 415 , an instruction decoder 116 ′, an out of order core execution unit 118 ′, and a retirement unit 120 ′.
  • instructions can be stored in instruction storage elements (registers, buffers, etc.) from the ITLB 412 to the retirement unit 120 ′.
  • instruction storage elements within the instruction decoder 116 ′, out of order core execution unit 118 ′, the retirement unit 120 ′, and other instruction storage elements are considered to be the instruction pipeline of the microprocessor.
  • the instruction pipeline needs to be coherent (pipeline coherency) as does the instruction cache (cache coherency).
  • the instruction decoder 116 ′ accepts an instruction or operand at its input, decodes it, and performs the necessary instruction processing needed to form it into a micro-operand (UOP) which is understandable and can be executed by the out or order core execution unit 118 ′.
  • UOP micro-operand
  • the instructions or operands are INTEL X86 instructions which are backward compatible with software and decoded into UOPs which can be executed by the advanced execution unit 118 ′.
  • the instruction cache 414 A is a physically addressable instruction cache containing physical addresses which could be used for snoops.
  • snoops for determining cache coherency and pipeline coherency are preferably performed using the instruction translation lookaside buffer (ITLB) 412 instead of the physically addressable instruction cache 414 A in order to avoid complications of arbitration or dual porting of the instruction cache.
  • ITLB instruction translation lookaside buffer
  • the instruction cache 414 A may include instructions that can be used by the out of order core execution unit 118 ′ to execute some function or process. If the function or process requires an instruction not within the instruction cache 414 A, a miss has occurred and the instruction needs to be fetched from memory 104 ′. Memory controller 415 ordinarily interfaces to the instruction cache 414 A in order to store instructions therein. In the case of a miss, memory controller 415 fetches the desired instruction from memory 104 ′ and provides it to the instruction cache 414 A.
  • Memory controller 415 additionally monitors the memory bus 304 ′ to detect when a store has occurred into the memory 104 ′ and reads the physical address of the store. In this manner when some external device such as a DMA agent (disk storage device 303 ) or a different microprocessor, such as 301 A′′, alters a memory location within memory 104 ′, the memory controller 415 triggers a snoop. In the preferred embodiment, the memory controller 415 communicates to the out of order core execution unit 118 ′ that a store into memory has occurred in conjunction with the physical address in order to trigger the snoop.
  • DMA agent disk storage device 303
  • a different microprocessor such as 301 A′′
  • the out of order core execution unit 118 ′ processes this information and causes the ITLB 412 to perform a snoop using the physical address read from the bus.
  • the memory controller 415 may directly communicate to the ITLB 412 to execute a snoop with the physical address of the store.
  • Each microprocessor 301 through 301 ′′ of the multiprocessor system 201 ′ operate in this fashion to determine if a snoop need be triggered due to some externality. If the out of order core execution unit 118 ′ itself performs a store into memory 104 ′, it directly informs the ITLB 412 to perform a snoop and passes the physical address of the store.
  • the instruction translation lookaside buffer (ITLB) 412 contains page table address translations from linear to physical addresses into memory 104 ′. These page table address translations maintain an inclusion with all instructions in the instruction cache and the instruction pipeline. Inclusion meaning that any byte that went into making any instruction has its original translation within the ITLB 412 .
  • the ITLB 412 accepts an input linear address and returns a physical address associated with the location of instructions within memory 104 ′. Because the ITLB 412 has the physical page addresses and inclusion is provided, it can be used to perform snoops for SMC detection and maintain cache coherency and pipeline coherency.
  • the ITLB 412 is additionally formed as a content-addressable memory on the physical addresses and includes an additional input comparison port (referred to as a snoop port or reverse translation port) to perform content addressing of the physical addresses stored therein.
  • a snoop port or reverse translation port
  • the ITLB performs a comparison with all the physical page addresses located within the ITLB 412 to determine whether a store into memory has addressed a page which may be stored in the instruction cache 414 A.
  • a store occurred into memory within a page of instructions that may be stored within an instruction cache and the cache and the instruction pipeline may be incoherent with memory.
  • Searching the content addressable memory within the ITLB 412 using the physical address as a key is a fast way to provide SMC detection and determine possible cache incoherency.
  • This process, of providing a physical address to determine if a match exists with a physical address stored within the ITLB, is referred to as a reverse translation.
  • the ITLB 412 having the CAM to provide this comparison of physical addresses may also be referred to as a reverse translation lookaside buffer.
  • the ITLB 412 furthermore provides inclusion for both the instruction pipeline as well as the instruction cache. Inclusion provided by the ITLB may be referred to as ITLB inclusion. Inclusion provided by the ITLB means that instruction bytes for any instruction in the instruction pipeline or the instruction cache are guaranteed to have their original page translation stay within the ITLB 412 until the associated instructions are no longer stored within the instruction pipeline, (i.e. retired) and are no longer stored in the instruction cache.
  • ITLB inclusion each page translation includes an INUSE bit upon which an INUSE state algorithm is used to set or clear the INUSE bit. The following INUSE state algorithm is used to provide ITLB inclusion. For each instruction fetch that requires a page translation, the ITLB entry used to perform the translation is marked INUSE using the INUSE bit.
  • any non-INUSE page translation entry can be selected for replacement since only entries with the INUSE bit set can have instructions in the pipeline.
  • the INUSE inclusion algorithm provides:
  • Each element has an INUSE state (the INUSE bit).
  • FIG. 4B a second embodiment of the present invention is illustrated.
  • a block diagram of n microprocessors 301 B through 301 B′′ in a multiprocessor system are illustrated coupled to the memory 104 ′. Elements of microprocessor 301 B, are contained in the other microprocessors of the multiprocessor system.
  • the physically addressed instruction cache 414 A is replaced with a linearly addressed instruction cache 414 B.
  • Other elements of the second embodiment being similar to the first embodiment are functionally equivalent. Because the instruction cache 414 B contains no physical addresses, the snoops performed to maintain cache and pipeline coherency need to be performed by the instruction translation lookaside buffer (ITLB) 412 which contains physical addresses.
  • ITLB instruction translation lookaside buffer
  • the next IP 110 ′ provides a linear address to both the linear address instruction cache 414 B and the ITLB 412 .
  • Memory controller 415 detects external stores into memory. Upon detecting an external store into memory, the memory controller 415 communicates to the out of order core execution unit 118 ′ that a store into memory has occurred in conjunction with the physical address in order to trigger the snoop. Upon the out of order core execution unit 118 ′ receiving the signal from the memory controller 415 that a store into memory 104 ′ occurred with the physical address, a snoop is triggered and the out of order core execution unit 118 ′ provides the physical address to the ITLB 412 . If the out of order core execution unit 118 ′ itself performs a store into memory 104 ′, it directly informs the ITLB 412 to perform a snoop and passes the physical address of the store.
  • Microprocessor 301 C includes the next IP 110 ′, the ITLB 412 , the instruction decoder 116 ′, a trace instruction cache 414 C, a trace next instruction processor (IP) 416 , the memory controller 415 ′, the out of order core execution unit 118 ′ and the retirement unit 120 ′.
  • IP trace next instruction processor
  • the instruction storage elements within the instruction decoder 116 ′, the trace cache 414 C, out of order core execution unit 118 ′, the retirement unit 120 ′, and other instruction storage elements are considered to be the instruction pipeline of the microprocessor. Because the advanced microprocessor 301 C employs a trace instruction cache 414 C which differs from other instruction caches, prior art SMC detection methods can not be used.
  • the trace instruction cache 414 C can store multiple sequences or traces of instructions for different programs in order to provide higher bandwidth and lower latency. In a trace instruction cache, only the first instruction of a series of instructions for a program (a “trace”) has an address associated with it. A sequence of related instructions stored within the trace instruction cache are oftentimes referred to as a “trace” of instructions. The other instructions that follow the first instruction are simply stored within the trace cache without an associated external address.
  • An advantage to using a trace instruction cache 414 C is that latency is further reduced over that of a linear addressed cache 414 B and bandwidth is increased.
  • Instructions are stored in UOP form in the trace instruction cache 414 C after being decoded by the instruction decoder 116 ′.
  • Memory controller 415 ′ interfaces to the ITLB 412 and the instruction decoder 116 ′ in order to store instructions in their UOP form into the trace instruction cache 414 C.
  • memory controller 415 ′ fetches the desired instruction from memory 104 ′ and provides it to the instruction decoder 116 ′.
  • Memory controller 415 ′ otherwise functions as memory controller 415 previously described and monitors the memory bus 304 ′ to detect when a store has occurred into the memory 104 ′ in order to trigger a snoop using the physical address of the store. If the out of order core execution unit 118 ′ itself performs a store into memory 104 ′, it directly informs the ITLB 412 to perform a snoop and passes the physical address of the store.
  • a trace instruction cache In a trace instruction cache, only the first instruction has a linear address associated with it. For this reason, a trace instruction cache is referred to as being linearly addressed as opposed to physically addressed. Because only the first instruction is linearly addressable and subsequent instructions are not externally addressable, a trace cache is also referred to as being sparsely addressable.
  • the trace instruction cache 414 C is linearly addressed only to the first instruction of a trace. Subsequent instructions within a trace are addressed by the control flow of the trace instruction cache 414 C and are not externally addressable. Because the trace instruction cache is linearly and sparsely addressed, snoops that perform physical address comparisons when triggered by stores into memory are not usable because of the lack of physical addresses in the trace instruction cache. Additionally because the trace instruction cache is only linearly addressed by the first instruction in a trace of instructions, subsequent instructions are not externally addressable to perform comparisons. Thus, a trace instruction cache is not suited for performing SMC detection.
  • Memory controller 415 detects external stores into memory. Upon detecting an external store into memory, the memory controller 415 communicates to the out of order core execution unit 118 ′ that a store into memory has occurred in conjunction with the physical address in order to trigger the snoop. Upon the out of order core execution unit 118 ′ receiving the signal from the memory controller 415 that a store into memory 104 ′ is being executed, a snoop is triggered where the physical address of the memory location where the store occurred is provided to the ITLB 412 to perform comparisons with physical addresses contained therein.
  • the out of order core execution unit 118 ′ itself performs a store into memory 104 ′, it directly informs the ITLB 412 to perform a snoop and passes the physical address of the store. If it is determined that the physical address of the store into memory is located on a page which has a page translation stored within the ITLB 412 , it is possible that an SMC has occurred for a decoded instruction which was stored within the trace instruction cache 414 C and/or instruction pipeline. In this case, an SMC hit signal is provided to the out of order core execution unit 118 ′ indicating a possible cache incoherency condition. This causes the trace instruction cache 414 C and the instruction pipeline within the out of order core execution unit 118 ′ to be flushed by invalidating instructions(instructions ignored or disregarded and overwritten).
  • Cache line 501 is referred to as the headline because it's the first cache line L1 of a trace.
  • the first cache line or the headline 501 is the only cache line addressable within a trace of instructions.
  • FIG. 5B the cache line is illustrated broken up into eight portions.
  • the first portion of the headline 501 is the linear address of the first instruction in a trace within the trace instruction cache 414 C.
  • the middle portions of each cache line in the preferred embodiment are six UOPs.
  • UOPs in the preferred embodiment are X86 instructions decoded for execution by the out of order core execution unit 118 ′.
  • the last portion of the each cache line within the trace cache is a next line pointer indicating where in the trace cache to find the next cache line or indicating the end of a trace.
  • the address 555 hexadecimal indicating the address of the first instruction of the example program.
  • the ADD instruction, the first instruction of the program (I 1 ) is stored in the second portion of the headline 501 illustrated in FIG. 5B.
  • the next instruction in sequence after the first instruction, the second instruction of the program (I 2 ), is at address 557 hex and is a JMP 777 hex instruction which is stored in the third portion of the headline 501 .
  • the next instruction sequence after the second instruction, the third instruction of the program (I 3 ), is an ADD instruction having the program address 777 hex and is stored in the fourth portion of the headline 501 .
  • the next instruction in sequence after the third instruction, the fourth instruction of the program (I 4 ), is a SUB instruction having a program address of 779 hex and is stored in the fifth portion of the headline 501 .
  • the next instruction in sequence after the fourth instruction, the fifth instruction of the program (I 50 , is a JMP 555 hex instruction having a program address of 77 A which is stored in the sixth portion of the headline 501 .
  • the next instruction in sequence after the fifth instruction, the sixth instruction of the program (I 6 ), is a repeat of the ADD instruction having the program address 555 which is stored in the seventh portion of the headline 501 .
  • the next portion of the headline 501 , the eighth portion, is a next line pointer.
  • the next line pointer referred to as the NL 1 , points to the second cache line L2 within the trace instruction cache 414 C if the trace continues into a second cache line.
  • FIG. 5C a block diagram of the trace instruction cache 414 C is illustrated storing an exemplary program.
  • the headline 501 is illustrated as being linearly addressable by a starting linear address.
  • the address of NL 1 points to the location of the second cache line L2 502 within the trace instruction cache 414 C.
  • the address of the next line pointer NL 2 of the cache line L2 502 points to the location of the third cache line L3 503 within the trace instruction cache 414 C.
  • the third cache line L3 503 being the last cache line of the example trace has its next line pointer NL 3 set to indicate the end of the trace.
  • FIG. 5D a block diagram of the second cache line L2 502 is illustrated. Because the second cache line L2 502 is not linearly addressable, the first portion of its cache line, the address portion, is set to an invalid condition because it cannot be accessed externally. The second through seventh portions of the cache line L2 502 hold the instructions I 7 through I 12 . The eighth portion of the cache line L2 502 is a next line pointer NL 2 to point to the third cache line in the trace. In this manner, the trace instruction cache 414 C stores programs of decoded instructions for execution by the out of order core execution unit 118 ′. Because no physical addresses are stored within the trace instruction cache 414 C, the ITLB 412 containing physical addresses is utilized in order to perform snoops to detect SMC conditions and determine if the cache is coherent.
  • a valid bit Associated with each cache line within the trace instruction cache is a valid bit to indicate validity or staleness of the instructions within the cache line.
  • the valid bit is set or cleared as the case may be to indicate an invalid cache line so that the instructions are disregarded or ignored within the cache and the pipeline.
  • the ITLB 412 includes a content addressable memory (CAM).
  • a content addressable memory may also be referred to as an associative memory or a distributed logic memory.
  • the CAM is a dual port content addressable memory.
  • a dual port content addressable memory is preferable because it can perform two comparisons concurrently. One comparison can be made using a linear address on the linear addresses therein in order to translate it into a physical address in order to fetch instructions from an instruction cache. Another comparison (also referred to as a snoop) can be made using a physical address in order to provide SMC detection.
  • the content addressable memory performs comparisons using the physical address of a store into the memory 104 ′ to determine if it is associated with instructions stored within an instruction cache. If a match is found, a store occurred into memory 104 ′ within a page of instructions that may be stored within an instruction cache. In this case, the instruction cache and the instruction pipeline may be incoherent with memory. Because the granularity of the ITLB 412 is only to a page address, it is not absolute that an instruction within memory associated with an instruction stored within the instruction cache was altered, only that it was probably altered and the instruction cache is probably incoherent.
  • the content addressable memory indicating a match may be sufficient to indicate an SMC condition and that the instruction cache and instruction pipeline need to be flushed (disregarded and rewritten with newly fetched instructions from memory).
  • the content addressable memory of the ITLB so far described will only provide page granular snoops for stores such that any store into memory which is related to a page in the ITLB will cause an SMC hit.
  • a page size may be defined as addressing a large amount of locations in memory 104 ′.
  • code instructions
  • data it is common for both instructions (“code”) and data to be located within the same page of memory. Providing only page granular snooping, can cause excessive SMC hits which are false when accessing data from the same page of instructions stored into cache memory. If the page is so large, false hits may also occur for instructions not stored in the instruction cache. In order to reduce the number of false hits, the present invention provides that a page of memory can be split into smaller blocks.
  • Each of the smaller blocks of memory within a page are associated with data bits referred to as FINE HIT bits.
  • the FINE HIT bits can be stored with each line within the ITLB indicating a finer granularity than a page.
  • the page size is 4K or 4096 addresses into memory 104 ′.
  • the FINE HIT bits for simplicity are selected in the preferred embodiment to provide a granularity of 1K or 1024 addresses within a 4K page of memory. While this is the size utilized in the preferred embodiment, other granularities may be utilized.
  • the ITLB 412 includes four FINE HIT bits with each line of translation contained therein, each being associated with a 1K block of addresses within a 4K page.
  • the FINE HIT bits are originally set by instruction fetches from memory.
  • an instruction fetch occurs which misses the instruction cache (i.e. the desired instruction is not located within the instruction cache)
  • an access to memory 104 ′ occurs and uses the ITLB 412 to perform a linear to physical address translation.
  • the ITLB sets one of the fine hit bit which is associated with the block (or “quadrant”) or blocks within the page that instructions are fetched from. This indicates within which block of a page of memory are instructions accessed and stored into an instruction cache.
  • the ITLB 412 and associated snoop logic illustrated in FIG. 6 only indicate an SMC hit if a physical match has occurred and the corresponding fine hit bit is set matching the accessed block of the page.
  • the snoop logic illustrated in FIG. 6 includes a 2-to-4 decoder 602 , OR gates 603 - 606 to perform a bitwise OR vector function, AND gates 610 - 613 to provide an AND vector operation, and an OR gate 616 to generate a SMC HIT or MISS signal indicating the possibility of an SMC condition. While this snoop logic provides for a granularity of 1k within a 4k page, other page sizes and other granularities may be selected as well known to those skilled in the art.
  • a linear address is provided to the ITLB, translated into a physical address if it is present within the ITLB, and then provided to memory to read into a page of memory locations.
  • the ITLB ordinarily a single port content addressable memory with a single comparison port input, accepts the linear address and outputs a physical address if there is a match with the linear address.
  • the ITLB is modified to include the capability of making comparisons with the physical addresses stored therein.
  • the ITLB 412 includes a physical address input port to compare physical addresses contained therein which indicates a page hit for physical page addresses stored therein.
  • ITLB 412 includes fine hit bits 0 through 3 indicating which 1K block within a page may be hit.
  • instruction fetch which stores the linear page address, LA[31:12] in FIG. 6, and the physical page address, PA[35;12] in FIG. 6, for a translation operation.
  • the linear address bits 11 and 10 within a page, LA[11:10] set the FINE HIT bits 0 through 3 , FHB[3:0], for each stored physical address.
  • a two to four decoder 602 converts the two linear address bits 10 and 11 , LA[11:10], into the four FINE HIT bits 0 through 3 , FHB[3:0], which are stored with each associated physical address in the ITLB 412 .
  • the physical address (PA) of the store into memory is provided by the out of order core execution unit 118 ′.
  • the ITLB 412 uses the page address bits of the physical address, PA[35:12] in FIG. 6, to determine if a physical page address match occurs therein.
  • the FINE HIT bits associated with the matched physical address are output from the ITLB 412 to OR gates 603 - 606 of the snoop logic.
  • One or more entries within the ITLB 412 may be matched and generate one or more sets of FINE HIT bit outputs. If during a snoop the physical page address provided to the ITLB 412 does not provide a match with a physical page address stored therein, then none of the fine hit bits are provided out to the OR gates 603 through 606 , such that, all inputs to the OR gates 603 - 606 are all zero, the outputs of all AND gates 610 - 613 are zero, and the output of the OR gate 616 (the “HIT/MISS” signal) is zero.
  • the zero output indicates that an SMC did not occur for instructions stored within the instruction cache such that coherency still exists between the instruction cache and the memory.
  • the FINE HIT bits, FHB[3:0] associated with the matching physical addresses are output to the OR gates 603 - 606 . If no FINE HIT bit of the matched physical addresses are set to one, then all outputs from the OR gates 603 - 606 are zero and the outputs from the AND gates 610 - 613 are all zero such that a logical zero is output from OR gate 616 on the HIT/MISS signal line indicating an SMC MISS or no occurrence of an SMC condition.
  • the output from one or more of the OR gates 603 - 606 is set to a logical one which is provided as an input to one or more of the AND gates 610 - 613 .
  • the physical address bits 10 and 11 , PA[11:10] are input to the 2 to 4 decoder 608 .
  • the 2 to 4 decoder 608 generates at its output the 1k block addressed within a 4k page.
  • Each respective output from the 2-4 decoder 608 representing a 1k block is provided to each respective input of AND gates 610 - 613 to determine if an address match has occurred within certain blocks of a page.
  • AND gate 610 can represent a lower 1k block within a page while AND gate 613 can represent an upper 1k block within a page.
  • both inputs into one of the AND gates 610 - 613 are set to a logical one, indicating that a fine hit bit set to a logical one matches with a block address within the given page as generated by the 2 to 4 decoder 608 , one of the outputs of the AND gates 610 through 613 goes to a logical one causing the output of the OR gate 616 to generate a logical high or one on the HIT/MISS signal line indicating an SMC HIT or the occurrence of an SMC condition.
  • the SMC HIT signal is provided to the out of order core execution unit 118 ′, indicating that the instruction cache may have an SMC condition (an incoherent cache) and require flushing the instruction cache and the instruction pipeline.
  • INUSE bits are provided for each line of physical address stored within the ITLB 412 . Instruction inclusion guarantees that every instruction in the trace instruction cache 414 C and the instruction pipeline has its original translation in the ITLB 412 . By providing this inclusion, the ITLB 412 will contain the physical address (to a page granularity) of every instruction in the trace instruction cache 414 C and instruction pipeline.
  • the present invention has many advantages over the prior art.
  • One advantage of the present invention where snoops are performed using the ITLB is that a snoop port need not be included into an instruction cache to perform SMC detection and thus the instruction cache can be made simpler with a smaller footprint.
  • Another advantage of the present invention is that the instruction cache need not be physically addressed such that latency of the instruction pipeline can be reduced.
  • Still another advantage of the present invention is that latency can be further reduced and bandwidth by using a trace instruction cache.
  • the ITLB has been described as including a dual port CAM to perform linear and physical address comparisons but a single port CAM can be used that can be multiplexed to perform comparisons on either the linear or physical addresses stored therein.
  • the present invention has been described with reference to one cache, it may be applied to multiple caches providing multiple cache levels; and it also may be applied to complex microprocessors and CPUs having deep instruction pipelines. Additionally, the present invention has been described in detail as being applied to maintain cache and pipeline coherency by providing SMC detection and recovery, it can also be applied to maintain memory coherency in shared memory multi-processor systems. As a last example, it is possible to implement the present invention or some of its features in hardware, firmware, software or a combination where the software is provided in a processor readable storage medium such as magnetic, optical, or semiconductor storage.

Abstract

Self modifying code is detected using a translation lookaside buffer in order to provide cache coherency. The translation lookaside buffer has physical page addresses stored therein over which snoops can be performed using the physical memory address of a store into memory. The translation lookaside buffer includes a content addressable memory which not only provides page translation but provides content addressability based on the physical page addresses stored therein. If a match occurs during a snoop using the translation lookaside buffer, it is possible that an SMC occurred within the page of locations stored in memory associated with the matched physical page addresses. To provide finer granularity than a page of addresses, FINE HIT bits are included with each entry in the cache associating information in the cache to portions of a page within memory. Snoop logic performs the comparison of the FINE HIT bits with the respective lower order bits of the physical address to determine if a self modifying code condition has occurred within the portion of memory that may be stored in the cache.

Description

    BACKGROUND OF THE INVENTION
  • 1. Field of the Invention [0001]
  • The present invention relates generally to software backward compatibility in advanced microprocessor hardware, and specifically to cache coherency and self modifying code detection using an instruction translation lookaside buffer. [0002]
  • 2. Background Information [0003]
  • When a new computer is introduced it is oftentimes desirable to operate older application or operating system software in conjunction with new hardware designs. Previously dynamic memory was relatively expensive so older computer systems, upon which older application and operating system software would execute, had limited sizes available. Thus the older software applications and operating systems would use techniques to maximize the use of the available memory space in memory. Additionally, most computers share a common memory space for storing both Instructions and Data. This shared memory space allows Data Stores into memory to modify previously stored Instructions which are generally referred to as code. Under strict timing requirements, this code modification can occur actively when a program is being executed. This occurrence of the program itself modifying an instruction within program memory is commonly referred to as self modifying code. In some cases, a Data Store that modifies the next instruction which is to be executed by the computer may require that the modification become effective before the next instruction can be executed. In other cases, the code modification may be the result of the computer system copying a new program into the physical memory that previously contained another program. In modern computer systems, multiple agents may be responsible for updating memory. In Multi Processor systems, each processor can perform stores to memory which could modify instructions to be executed by any or all processors in the system. Direct Memory Access (DMA) agents, such as disk controllers, can also perform stores to memory and thereby modify code. These code modifications are commonly referred to as cross modifying code. Hereinafter, all forms of code modification of previously stored instructions within memory of a computer system during program execution, regardless of whether it includes a single processor, a multi processor, or a DMA agent, are referred to as self modifying code (SMC). The definition of self modifying code as used herein includes the more common references to self modifying code and cross modifying code. [0004]
  • In order to speed up program execution, cache memory was introduced into computers and microprocessors. An instruction cache memory is a fast memory of relatively small size used to store a large number of instructions from program memory. Typically, an instruction cache has between 32 to 128 byte cache lines in which to store instructions. Program memory, more commonly referred to simply as memory, is usually a semiconductor memory such as dynamic random access memory or DRAM. In a computer without an instruction pipeline or instruction cache memory to store instructions mirroring a portion of the program memory, self modifying code posed no significant problem. With the introduction of instruction pipelines and cache memory into computers and their microprocessors, self modifying code poses a problem. To avoid executing an old instruction stored within an instruction pipeline or an instruction cache memory, it is necessary to detect a self modifying code condition which updates program memory. This problem can be referred to as cache coherency or pipeline coherency where the instruction cache or pipeline becomes incoherent (or stale) as compared with program memory after self modifying code occurs. This is in contrast to the problem of memory coherency where the cache is updated and memory is stale or incoherent. [0005]
  • In previous microprocessors manufactured by Intel Corporation, such as the Intel 80486 processor family, instructions from program memory were stored within an instruction pipeline to be executed “In-Order”. In these “In-Order” processors, SMC detection was performed by comparing the physical address of all stores to program memory against the address of all instructions stored within the instruction pipeline. This comparison was relatively easy because the number of instructions in the instruction pipeline was typically limited to four or five instructions. If there was an address match, it indicated that a memory location was modified, an instruction was invalid in the instruction pipeline and that the present instruction pipeline should be flushed (that is disregarded or ignored) and new instructions fetched from program memory to overwrite the flushed instructions. This comparison of addresses is generally referred to as a snoop. With a deeper instruction pipeline, snoops require additional hardware because of the additional instructions having additional addresses requiring comparison. [0006]
  • In another previous microprocessor manufactured by Intel Corporation, such as the Intel P[0007] 6 of Pentium™ II processor family, instructions from program memory were stored within an instruction cache memory for execution by an “Out of Order” core execution unit. “Out of Order” instruction execution is preferable in order to provide more parallelism in instruction processing. Referring now to FIG. 1, a block diagram of a prior art microprocessor 101 coupled to memory 104 is illustrated. The Next Instruction process (IP) 110, also referred to as an instruction sequencer, is a state machine and branch prediction unit that builds the flow of execution of the microprocessor 101. To support page table virtual memory accesses, the microprocessor 101 includes an instruction translation lookaside buffer (ITLB) 112. The ITLB 112 includes page table entries of linear to physical address translations into memory 104. Usually the page table entries represent the most recently used pages of memory 104 which point to a page of memory in the instruction cache 114. Instructions are fetched over the memory bus 124 by the memory controller 115 from memory 104 for storage into the instruction cache 114. In the prior art, the instruction cache 114 is physically addressed. A physical address is the lowest level of address translation and points to an actual physical location associated with physical hardware. In contrast, a linear address is an address associated with a program or other information that does not directly point into a memory, cache memory or other physical hardware. A linear address is linear relative to the program or other information. Copies of instructions within memory 104 are stored within the instruction cache 114. Instructions are taken from the instruction cache 114, decoded by the instruction decoder 116 and input into an instruction pipeline within the out of order core execution unit 118. Upon completion by the out of order core execution unit 118, an instruction is retired by the retirement unit 120. The retirement unit 120 processes instructions in program order after they have completed execution. Retirement processing includes checking for excepting conditions (such as an occurrence of self modifying code) and committing changes to architectural state. That is, the out of order core execution unit 118 executes instructions which can be completely undone before being output by the microprocessor if some excepting condition has occurred which the retirement unit has recognized.
  • In “Out-Of-Order” processors, such as [0008] microprocessor 101, the number of instructions in the instruction pipeline are so great that it is impractical to compare all instructions in the pipeline of the microprocessor 101 with all modifications of program memory to be certain no changes have occurred. To do so would require too much hardware. In the prior art microprocessor 101, this problem was solved by having all store instructions executed by the out of order execution unit 118, which would execute a store instruction into the memory 104 or into a data cache within the execution unit 118, trigger a snoop of the instruction cache (the “Icache”) 114. Additionally, instruction cache inclusion was provided to assure coherency of the instruction pipeline. Icache inclusion means that the instruction bytes for any instruction in the instruction pipeline are guaranteed to stay in the instruction cache 114 until the instruction is no longer stored within the instruction pipeline, i.e. retired. In this case, if cache coherency is maintained then pipeline coherency is maintained by the Icache inclusion.
  • Recall that the instruction cache [0009] 114 in the prior art microprocessor 101 is physically addressed. Therefore snoops, triggered by store instructions into memory 104, can perform SMC detection by comparing the physical address of all instructions stored within the instruction cache 114 with the address of all instructions stored within the associated page or pages of memory 104. If there is an address match, it indicates that a memory location was modified. In the case of an address match, indicating an SMC condition, the instruction cache 114 and instruction pipeline are flushed by the retirement unit 120 and new instructions are fetched from memory 104 for storage into the instruction cache 114. The new instructions within the instruction cache 114 are then decoded by the instruction decoder 116 and input into the instruction pipeline within the out-of-order core execution unit 118.
  • SUMMARY OF THE INVENTION
  • The present invention includes a method, apparatus and system as described in the claims. [0010]
  • Briefly in one embodiment, a microprocessor includes an execution unit and a translation lookaside buffer (TLB). The execution unit triggers a snoop operation in the TLB if a store into memory is executed. The TLB includes a content addressable memory (CAM). For the snoop operation, the TLB receives a physical address indicating the location where the execution of the store occurs in the memory. The TLB ordinarily stores page translations between a linear page address and a physical page address pointing to a page of memory having contents stored within a cache or a pipeline. To support snoop operations, the TLB includes a CAM input port to compare the physical address received by the TLB with the physical page addresses stored within the TLB. [0011]
  • Other embodiments are shown, described and claimed herein. [0012]
  • BRIEF DESCRIPTION OF THE DRAWINGS
  • FIG. 1 illustrates a block diagram of a prior art microprocessor coupled to memory. [0013]
  • FIG. 2 illustrates a block diagram of a typical computer in which the present invention is utilized. [0014]
  • FIG. 3A illustrates a block diagram of a typical central processing unit in which the present invention is utilized. [0015]
  • FIG. 3B illustrates a block diagram of a multiprocessor central processing unit in which the present invention is utilized. [0016]
  • FIG. 4A illustrates a block diagram of microprocessors in a multiprocessor system coupled to a memory, the microprocessors including a first embodiment of the present invention. [0017]
  • FIG. 4B illustrates a block diagram of microprocessors in a multiprocessor system coupled to a memory, the microprocessors including a second embodiment of the present invention. [0018]
  • FIG. 4C illustrates a block diagram of microprocessors in a multiprocessor system coupled to a memory, the microprocessors including a third embodiment of the present invention. [0019]
  • FIG. 5A is a table of instructions illustrating an exemplary program for storage in a trace instruction cache. [0020]
  • FIG. 5B is a block diagram illustrating a first cache line or head line of a trace of instructions stored within a trace instruction cache. [0021]
  • FIG. 5C is a block diagram illustrating a trace instruction cache storing an exemplary trace of instructions. [0022]
  • FIG. 5D is a block diagram illustrating a second cache line of a trace of instructions stored within a trace instruction cache. [0023]
  • FIG. 6 is a block diagram illustrating the instruction translation lookaside buffer (ITLB) and snoop logic of the present invention. [0024]
  • DETAILED DESCRIPTION
  • In the following detailed description of the present invention, numerous specific details are set forth in order to provide a thorough understanding of the present invention. However, it will be obvious to one skilled in the art that the present invention may be practiced without these specific details. In other instances well known methods, procedures, components, and circuits have not been described in detail so as not to unnecessarily obscure aspects of the present invention. [0025]
  • Referring now to FIG. 2, a block diagram of a [0026] typical computer 200 in which the present invention is utilized is illustrated. The computer 200 includes a central processing unit (CPU) 201, input/output devices (I/O) 202 such as keyboard, modem, printer, external storage devices and the like and monitoring devices (M) 203 such as a CRT or graphics display. The monitoring devices (M) 203 provide computer information in a human intelligible format such as visual or audio formats.
  • Referring now to FIG. 3A, a block diagram of a typical [0027] central processing unit 201 in which the present invention is utilized is illustrated. The central processing unit 201 includes an advanced microprocessor 301 including the present invention, a disk storage device 303, and a memory 104′ for storing program instructions coupled together. The prime notation used herein with reference designators indicates blocks having similar functionality with the same reference number; however, the block may be slightly altered to provide support for the advanced microprocessors of the present invention. For example, memory 104′ may be considerably larger that memory 104 due to wider data bit width and address space provided by the advanced microprocessor 301. Disk storage device 303 may be a floppy disk, zip disk, DVD disk, hard disk, rewritable optical disk, flash memory or other non-volatile storage device. The microprocessor 301 and the disk storage device 303 can both read and write information into memory 104′ over the memory bus 304. Thus, both the microprocessor 301 and the disk storage device 303 can alter memory locations within memory 104′ during program execution. In order for the disk storage device 303 to do this directly, it includes a disk controller with direct memory access which can perform stores into memory and thereby modify code. Because the controller can directly access the memory it is an example of a Direct Memory Access (DMA) agent. Other devices having direct access to store information into memory are also DMA agents. Memory 104′ is typically dynamic random access memory (DRAM) but may be other types of rewritable storage. Memory may also be referred to herein as program memory because it is utilized to store program instructions. Upon initial execution of a program stored in the disk storage device 303 or stored in some other source such as I/O devices 202, the microprocessor 301 reads program instructions stored in the disk storage device 303 or other source and writes them into memory 104′. One or more pages or fractions thereof of the program instructions stored within memory 104′ are read (i.e. “fetched”) by the microprocessor 301 for storage into an instruction cache (not shown in FIG. 3). Some of the program instructions stored in the instruction cache may be read into an instruction pipeline (not shown) for execution by the microprocessor 301.
  • Referring now to FIG. 3B, a block diagram of a multiprocessor [0028] central processing unit 201′ in which the present invention is utilized is illustrated. The central processing unit 201′ includes multiple (N) advanced microprocessors 301 including the present invention labeled as microprocessors 301 through 301″; the disk storage device 303; and memory 104′ coupled together as illustrated in FIG. 3B. The N microprocessors 301 through 301″ and the disk storage device 303 can both read and write information into memory 104′ over the memory bus 304′. That is memory 104′ is shared by the N multiple processors 301 through 301″. Any one of the N microprocessors 301 through 301″ or the disk storage device 303 can alter memory locations within memory 104′ during program execution. In order for the disk storage device 303 to do this directly, it includes a disk controller with direct memory access which can perform stores into memory and thereby modify code. Because the controller can directly access the memory it is an example of a Direct Memory Access (DMA) agent. Other devices having direct access to store information into memory are also DMA agents. The present invention in each of the microprocessors 301 through 301″ maintains cache coherency and pipeline coherency in a shared memory multi-processor system.
  • Referring now to FIG. 4A, a block diagram of [0029] n microprocessors 301A through 301A″ in a multiprocessor system, including a first embodiment of the present invention, are illustrated coupled to the memory 104′. Microprocessor 301A, as well as the other microprocessors of the multiprocessor system, includes a next instruction processor 110′, an instruction translation lookaside buffer 412, an instruction cache 414A, a memory controller 415, an instruction decoder 116′, an out of order core execution unit 118′, and a retirement unit 120′. In the microprocessor 301, instructions can be stored in instruction storage elements (registers, buffers, etc.) from the ITLB 412 to the retirement unit 120′. These instruction storage elements within the instruction decoder 116′, out of order core execution unit 118′, the retirement unit 120′, and other instruction storage elements are considered to be the instruction pipeline of the microprocessor. The instruction pipeline needs to be coherent (pipeline coherency) as does the instruction cache (cache coherency). Generally, the instruction decoder 116′ accepts an instruction or operand at its input, decodes it, and performs the necessary instruction processing needed to form it into a micro-operand (UOP) which is understandable and can be executed by the out or order core execution unit 118′. In the preferred embodiment, the instructions or operands are INTEL X86 instructions which are backward compatible with software and decoded into UOPs which can be executed by the advanced execution unit 118′.
  • In a first embodiment, the [0030] instruction cache 414A is a physically addressable instruction cache containing physical addresses which could be used for snoops. However, in this case snoops for determining cache coherency and pipeline coherency are preferably performed using the instruction translation lookaside buffer (ITLB) 412 instead of the physically addressable instruction cache 414A in order to avoid complications of arbitration or dual porting of the instruction cache.
  • The [0031] instruction cache 414A may include instructions that can be used by the out of order core execution unit 118′ to execute some function or process. If the function or process requires an instruction not within the instruction cache 414A, a miss has occurred and the instruction needs to be fetched from memory 104′. Memory controller 415 ordinarily interfaces to the instruction cache 414A in order to store instructions therein. In the case of a miss, memory controller 415 fetches the desired instruction from memory 104′ and provides it to the instruction cache 414A.
  • [0032] Memory controller 415 additionally monitors the memory bus 304′ to detect when a store has occurred into the memory 104′ and reads the physical address of the store. In this manner when some external device such as a DMA agent (disk storage device 303) or a different microprocessor, such as 301A″, alters a memory location within memory 104′, the memory controller 415 triggers a snoop. In the preferred embodiment, the memory controller 415 communicates to the out of order core execution unit 118′ that a store into memory has occurred in conjunction with the physical address in order to trigger the snoop. The out of order core execution unit 118′ processes this information and causes the ITLB 412 to perform a snoop using the physical address read from the bus. In other embodiments the memory controller 415 may directly communicate to the ITLB 412 to execute a snoop with the physical address of the store. Each microprocessor 301 through 301″ of the multiprocessor system 201′ operate in this fashion to determine if a snoop need be triggered due to some externality. If the out of order core execution unit 118′ itself performs a store into memory 104′, it directly informs the ITLB 412 to perform a snoop and passes the physical address of the store.
  • The instruction translation lookaside buffer (ITLB) [0033] 412 contains page table address translations from linear to physical addresses into memory 104′. These page table address translations maintain an inclusion with all instructions in the instruction cache and the instruction pipeline. Inclusion meaning that any byte that went into making any instruction has its original translation within the ITLB 412. Generally, the ITLB 412 accepts an input linear address and returns a physical address associated with the location of instructions within memory 104′. Because the ITLB 412 has the physical page addresses and inclusion is provided, it can be used to perform snoops for SMC detection and maintain cache coherency and pipeline coherency. Because snoops for SMC detection are physical and the ITLB 412 ordinarily accepts as an input a linear address to translate into a physical address, the ITLB 412 is additionally formed as a content-addressable memory on the physical addresses and includes an additional input comparison port (referred to as a snoop port or reverse translation port) to perform content addressing of the physical addresses stored therein. When a snoop is triggered, the physical address of the store into memory is provided to the snoop port and the ITLB performs a comparison with all the physical page addresses located within the ITLB 412 to determine whether a store into memory has addressed a page which may be stored in the instruction cache 414A. If a match is found, a store occurred into memory within a page of instructions that may be stored within an instruction cache and the cache and the instruction pipeline may be incoherent with memory. Searching the content addressable memory within the ITLB 412 using the physical address as a key is a fast way to provide SMC detection and determine possible cache incoherency. This process, of providing a physical address to determine if a match exists with a physical address stored within the ITLB, is referred to as a reverse translation. The ITLB 412 having the CAM to provide this comparison of physical addresses may also be referred to as a reverse translation lookaside buffer. By moving SMC detection to the ITLB in the present invention, a snoop port need not be included into the instruction cache and thus the instruction cache can be considerably simpler with smaller physical dimensions while providing the same number of bytes of storage locations.
  • The [0034] ITLB 412 furthermore provides inclusion for both the instruction pipeline as well as the instruction cache. Inclusion provided by the ITLB may be referred to as ITLB inclusion. Inclusion provided by the ITLB means that instruction bytes for any instruction in the instruction pipeline or the instruction cache are guaranteed to have their original page translation stay within the ITLB 412 until the associated instructions are no longer stored within the instruction pipeline, (i.e. retired) and are no longer stored in the instruction cache. For the ITLB 412 to provide inclusion, each page translation includes an INUSE bit upon which an INUSE state algorithm is used to set or clear the INUSE bit. The following INUSE state algorithm is used to provide ITLB inclusion. For each instruction fetch that requires a page translation, the ITLB entry used to perform the translation is marked INUSE using the INUSE bit. Since all instruction bytes in the instruction cache and instruction pipeline must have been originally fetched using the ITLB, and as long as no page translations are replaced that are marked INUSE, each instruction byte in the instruction cache and instruction pipeline will be guarded by the INUSE bit entries. Replacement means writing over a page translation with a new page translation.
  • As time goes by, more and more entries will get marked INUSE. Unless something is done to clear the INUSE bits, eventually all entries will be marked INUSE and no new entries can be allocated. When this happens, the microprocessor must be drained of all instructions (i.e. all executed to completion) and the instruction cache flushed (i.e. all cache lines invalidated). Once the processor is drained and the instruction cache flushed, all the INUSE bits in the ITLB can be reset indicating non-INUSE of the page translation. In addition, the INUSE bits can be reset any time the instruction pipeline is drained and the instruction cache is flushed for another reason (such as a process switch). In an alternate embodiment, selective invalidation of cache lines can be performed when a page translation with a set INUSE bit entry is replaced. [0035]
  • When an miss occurs in the ITLB, that is no page translation exist within the ITLB, any non-INUSE page translation entry can be selected for replacement since only entries with the INUSE bit set can have instructions in the pipeline. [0036]
  • Generally, the INUSE inclusion algorithm provides: [0037]
  • 1. Each element has an INUSE state (the INUSE bit). [0038]
  • 2. When an element is used, it is marked INUSE. [0039]
  • 3. All INUSE bits can be cleared when it is known that all elements are not INUSE. [0040]
  • 4. No element which is marked INUSE can be replaced. [0041]
  • Any element that is not INUSE can be replaced. [0042]
  • Referring now to FIG. 4B, a second embodiment of the present invention is illustrated. In FIG. 4B, a block diagram of [0043] n microprocessors 301B through 301B″ in a multiprocessor system, are illustrated coupled to the memory 104′. Elements of microprocessor 301B, are contained in the other microprocessors of the multiprocessor system. In FIG. 4B, the physically addressed instruction cache 414A is replaced with a linearly addressed instruction cache 414B. Other elements of the second embodiment being similar to the first embodiment are functionally equivalent. Because the instruction cache 414B contains no physical addresses, the snoops performed to maintain cache and pipeline coherency need to be performed by the instruction translation lookaside buffer (ITLB) 412 which contains physical addresses. In this second embodiment, the next IP 110′ provides a linear address to both the linear address instruction cache 414B and the ITLB 412. Memory controller 415 detects external stores into memory. Upon detecting an external store into memory, the memory controller 415 communicates to the out of order core execution unit 118′ that a store into memory has occurred in conjunction with the physical address in order to trigger the snoop. Upon the out of order core execution unit 118′ receiving the signal from the memory controller 415 that a store into memory 104′ occurred with the physical address, a snoop is triggered and the out of order core execution unit 118′ provides the physical address to the ITLB 412. If the out of order core execution unit 118′ itself performs a store into memory 104′, it directly informs the ITLB 412 to perform a snoop and passes the physical address of the store.
  • If it is determined by the [0044] ITLB 412 that the physical address of the store into memory is associated with a page translation contained therein, an SMC hit is signaled to the out of order core execution unit 118′ signaling that an instruction was possibly altered on a page stored within the instruction cache and/or the instruction pipeline. An advantage of the linear addressed instruction cache 414B is that latency of the instruction pipeline can be reduced.
  • Referring now to FIG. 4C, a block diagram of [0045] n microprocessors 301C through 301C″ in a multiprocessor system, including a third and preferred embodiment of the present invention, are illustrated coupled to memory 104′. Microprocessor 301C, as well as the other microprocessors of the multiprocessor system, includes the next IP 110′, the ITLB 412, the instruction decoder 116′, a trace instruction cache 414C, a trace next instruction processor (IP) 416, the memory controller 415′, the out of order core execution unit 118′ and the retirement unit 120′. The instruction storage elements within the instruction decoder 116′, the trace cache 414C, out of order core execution unit 118′, the retirement unit 120′, and other instruction storage elements are considered to be the instruction pipeline of the microprocessor. Because the advanced microprocessor 301C employs a trace instruction cache 414C which differs from other instruction caches, prior art SMC detection methods can not be used. The trace instruction cache 414C can store multiple sequences or traces of instructions for different programs in order to provide higher bandwidth and lower latency. In a trace instruction cache, only the first instruction of a series of instructions for a program (a “trace”) has an address associated with it. A sequence of related instructions stored within the trace instruction cache are oftentimes referred to as a “trace” of instructions. The other instructions that follow the first instruction are simply stored within the trace cache without an associated external address. An advantage to using a trace instruction cache 414C, is that latency is further reduced over that of a linear addressed cache 414B and bandwidth is increased.
  • Instructions are stored in UOP form in the [0046] trace instruction cache 414C after being decoded by the instruction decoder 116′. Memory controller 415′ interfaces to the ITLB 412 and the instruction decoder 116′ in order to store instructions in their UOP form into the trace instruction cache 414C. In the case of a miss, memory controller 415′ fetches the desired instruction from memory 104′ and provides it to the instruction decoder 116′. Memory controller 415′ otherwise functions as memory controller 415 previously described and monitors the memory bus 304′ to detect when a store has occurred into the memory 104′ in order to trigger a snoop using the physical address of the store. If the out of order core execution unit 118′ itself performs a store into memory 104′, it directly informs the ITLB 412 to perform a snoop and passes the physical address of the store.
  • In a trace instruction cache, only the first instruction has a linear address associated with it. For this reason, a trace instruction cache is referred to as being linearly addressed as opposed to physically addressed. Because only the first instruction is linearly addressable and subsequent instructions are not externally addressable, a trace cache is also referred to as being sparsely addressable. The [0047] trace instruction cache 414C is linearly addressed only to the first instruction of a trace. Subsequent instructions within a trace are addressed by the control flow of the trace instruction cache 414C and are not externally addressable. Because the trace instruction cache is linearly and sparsely addressed, snoops that perform physical address comparisons when triggered by stores into memory are not usable because of the lack of physical addresses in the trace instruction cache. Additionally because the trace instruction cache is only linearly addressed by the first instruction in a trace of instructions, subsequent instructions are not externally addressable to perform comparisons. Thus, a trace instruction cache is not suited for performing SMC detection.
  • Because no physical addresses are employed within the [0048] trace instruction cache 414C, it is necessary to snoop using the physical addresses within the ITLB 412 to detect self-modifying code. Memory controller 415 detects external stores into memory. Upon detecting an external store into memory, the memory controller 415 communicates to the out of order core execution unit 118′ that a store into memory has occurred in conjunction with the physical address in order to trigger the snoop. Upon the out of order core execution unit 118′ receiving the signal from the memory controller 415 that a store into memory 104′ is being executed, a snoop is triggered where the physical address of the memory location where the store occurred is provided to the ITLB 412 to perform comparisons with physical addresses contained therein. If the out of order core execution unit 118′ itself performs a store into memory 104′, it directly informs the ITLB 412 to perform a snoop and passes the physical address of the store. If it is determined that the physical address of the store into memory is located on a page which has a page translation stored within the ITLB 412, it is possible that an SMC has occurred for a decoded instruction which was stored within the trace instruction cache 414C and/or instruction pipeline. In this case, an SMC hit signal is provided to the out of order core execution unit 118′ indicating a possible cache incoherency condition. This causes the trace instruction cache 414C and the instruction pipeline within the out of order core execution unit 118′ to be flushed by invalidating instructions(instructions ignored or disregarded and overwritten).
  • The functionality of the [0049] trace cache 414C is now described. Referring now to FIG. 5A, an exemplary program is illustrated to describe the functionality of the trace instruction cache 414C. Referring now to FIG. 5B, a cache line 501 is illustrated. Cache line 501 is referred to as the headline because it's the first cache line L1 of a trace. The first cache line or the headline 501 is the only cache line addressable within a trace of instructions. In FIG. 5B the cache line is illustrated broken up into eight portions. The first portion of the headline 501 is the linear address of the first instruction in a trace within the trace instruction cache 414C. The middle portions of each cache line in the preferred embodiment are six UOPs. UOPs in the preferred embodiment are X86 instructions decoded for execution by the out of order core execution unit 118′. The last portion of the each cache line within the trace cache is a next line pointer indicating where in the trace cache to find the next cache line or indicating the end of a trace. Referring to the example of FIG. 5A and FIG. 5B, in the first portion of the headline 501 is the address 555 hexadecimal indicating the address of the first instruction of the example program. The ADD instruction, the first instruction of the program (I1), is stored in the second portion of the headline 501 illustrated in FIG. 5B. The next instruction in sequence after the first instruction, the second instruction of the program (I2), is at address 557 hex and is a JMP 777 hex instruction which is stored in the third portion of the headline 501. The next instruction sequence after the second instruction, the third instruction of the program (I3), is an ADD instruction having the program address 777 hex and is stored in the fourth portion of the headline 501. The next instruction in sequence after the third instruction, the fourth instruction of the program (I4), is a SUB instruction having a program address of 779 hex and is stored in the fifth portion of the headline 501. The next instruction in sequence after the fourth instruction, the fifth instruction of the program (I50, is a JMP 555 hex instruction having a program address of 77A which is stored in the sixth portion of the headline 501. The next instruction in sequence after the fifth instruction, the sixth instruction of the program (I6), is a repeat of the ADD instruction having the program address 555 which is stored in the seventh portion of the headline 501. The next portion of the headline 501, the eighth portion, is a next line pointer. In the headline 501, the next line pointer, referred to as the NL1, points to the second cache line L2 within the trace instruction cache 414C if the trace continues into a second cache line. Cache lines after the headline in the trace cache are not externally addressable. If the trace does not continue beyond the headline or other cache line, the next line pointer within the given final cache line of the trace indicates an end condition of the trace. Referring now to FIG. 5C a block diagram of the trace instruction cache 414C is illustrated storing an exemplary program. The headline 501 is illustrated as being linearly addressable by a starting linear address. The address of NL1 points to the location of the second cache line L2 502 within the trace instruction cache 414C. The address of the next line pointer NL2 of the cache line L2 502 points to the location of the third cache line L3 503 within the trace instruction cache 414C. The third cache line L3 503 being the last cache line of the example trace has its next line pointer NL3 set to indicate the end of the trace. Referring now to FIG. 5D, a block diagram of the second cache line L2 502 is illustrated. Because the second cache line L2 502 is not linearly addressable, the first portion of its cache line, the address portion, is set to an invalid condition because it cannot be accessed externally. The second through seventh portions of the cache line L2 502 hold the instructions I7 through I12. The eighth portion of the cache line L2 502 is a next line pointer NL2 to point to the third cache line in the trace. In this manner, the trace instruction cache 414C stores programs of decoded instructions for execution by the out of order core execution unit 118′. Because no physical addresses are stored within the trace instruction cache 414C, the ITLB 412 containing physical addresses is utilized in order to perform snoops to detect SMC conditions and determine if the cache is coherent.
  • Associated with each cache line within the trace instruction cache is a valid bit to indicate validity or staleness of the instructions within the cache line. In the case that cache is incoherent, the valid bit is set or cleared as the case may be to indicate an invalid cache line so that the instructions are disregarded or ignored within the cache and the pipeline. [0050]
  • Referring now to FIG. 6, a block diagram of the [0051] ITLB 412 with snoop logic is illustrated. The ITLB 412 includes a content addressable memory (CAM). A content addressable memory may also be referred to as an associative memory or a distributed logic memory. In the preferred embodiment the CAM is a dual port content addressable memory. A dual port content addressable memory is preferable because it can perform two comparisons concurrently. One comparison can be made using a linear address on the linear addresses therein in order to translate it into a physical address in order to fetch instructions from an instruction cache. Another comparison (also referred to as a snoop) can be made using a physical address in order to provide SMC detection. In performing snoops with the ITLB 412 (referred to as “snooping”), the content addressable memory performs comparisons using the physical address of a store into the memory 104′ to determine if it is associated with instructions stored within an instruction cache. If a match is found, a store occurred into memory 104′ within a page of instructions that may be stored within an instruction cache. In this case, the instruction cache and the instruction pipeline may be incoherent with memory. Because the granularity of the ITLB 412 is only to a page address, it is not absolute that an instruction within memory associated with an instruction stored within the instruction cache was altered, only that it was probably altered and the instruction cache is probably incoherent. Depending upon the size of a page utilized by the microprocessor, the content addressable memory indicating a match may be sufficient to indicate an SMC condition and that the instruction cache and instruction pipeline need to be flushed (disregarded and rewritten with newly fetched instructions from memory).
  • The content addressable memory of the ITLB so far described will only provide page granular snoops for stores such that any store into memory which is related to a page in the ITLB will cause an SMC hit. However, a page size may be defined as addressing a large amount of locations in [0052] memory 104′. Additionally, it is common for both instructions (“code”) and data to be located within the same page of memory. Providing only page granular snooping, can cause excessive SMC hits which are false when accessing data from the same page of instructions stored into cache memory. If the page is so large, false hits may also occur for instructions not stored in the instruction cache. In order to reduce the number of false hits, the present invention provides that a page of memory can be split into smaller blocks. Each of the smaller blocks of memory within a page are associated with data bits referred to as FINE HIT bits. The FINE HIT bits can be stored with each line within the ITLB indicating a finer granularity than a page. In the preferred embodiment, the page size is 4K or 4096 addresses into memory 104′. The FINE HIT bits for simplicity are selected in the preferred embodiment to provide a granularity of 1K or 1024 addresses within a 4K page of memory. While this is the size utilized in the preferred embodiment, other granularities may be utilized. In the preferred embodiment, the ITLB 412 includes four FINE HIT bits with each line of translation contained therein, each being associated with a 1K block of addresses within a 4K page. The FINE HIT bits are originally set by instruction fetches from memory. When an instruction fetch occurs which misses the instruction cache (i.e. the desired instruction is not located within the instruction cache), an access to memory 104′ occurs and uses the ITLB 412 to perform a linear to physical address translation. When performing this translation for each instruction fetch, the ITLB sets one of the fine hit bit which is associated with the block (or “quadrant”) or blocks within the page that instructions are fetched from. This indicates within which block of a page of memory are instructions accessed and stored into an instruction cache. Thus, when a snoop is triggered and the ITLB matches or hits a physical address stored therein, the ITLB and the associated snoop logic illustrated in FIG. 6 first check to see if the fine hit bit associated with the 1K block is set before indicating to the out of order execution unit 118′ that an SMC hit has occurred. The ITLB 412 and associated snoop logic illustrated in FIG. 6 only indicate an SMC hit if a physical match has occurred and the corresponding fine hit bit is set matching the accessed block of the page. The snoop logic illustrated in FIG. 6 includes a 2-to-4 decoder 602, OR gates 603-606 to perform a bitwise OR vector function, AND gates 610-613 to provide an AND vector operation, and an OR gate 616 to generate a SMC HIT or MISS signal indicating the possibility of an SMC condition. While this snoop logic provides for a granularity of 1k within a 4k page, other page sizes and other granularities may be selected as well known to those skilled in the art.
  • Under an address translation operation, a linear address is provided to the ITLB, translated into a physical address if it is present within the ITLB, and then provided to memory to read into a page of memory locations. In order to perform the translation operation, the ITLB ordinarily a single port content addressable memory with a single comparison port input, accepts the linear address and outputs a physical address if there is a match with the linear address. In order to provide a snoop operation, the ITLB is modified to include the capability of making comparisons with the physical addresses stored therein. In this case, the [0053] ITLB 412 includes a physical address input port to compare physical addresses contained therein which indicates a page hit for physical page addresses stored therein. Additionally, ITLB 412 includes fine hit bits 0 through 3 indicating which 1K block within a page may be hit. Upon an instruction fetch which stores the linear page address, LA[31:12] in FIG. 6, and the physical page address, PA[35;12] in FIG. 6, for a translation operation. During the translation operation, the linear address bits 11 and 10 within a page, LA[11:10], set the FINE HIT bits 0 through 3, FHB[3:0], for each stored physical address. In order to do this, a two to four decoder 602 converts the two linear address bits 10 and 11, LA[11:10], into the four FINE HIT bits 0 through 3, FHB[3:0], which are stored with each associated physical address in the ITLB 412. Upon performing a snoop, the physical address (PA) of the store into memory is provided by the out of order core execution unit 118′. The ITLB 412 uses the page address bits of the physical address, PA[35:12] in FIG. 6, to determine if a physical page address match occurs therein. If a physical page address match occurs, the FINE HIT bits associated with the matched physical address are output from the ITLB 412 to OR gates 603-606 of the snoop logic. One or more entries within the ITLB 412 may be matched and generate one or more sets of FINE HIT bit outputs. If during a snoop the physical page address provided to the ITLB 412 does not provide a match with a physical page address stored therein, then none of the fine hit bits are provided out to the OR gates 603 through 606, such that, all inputs to the OR gates 603-606 are all zero, the outputs of all AND gates 610-613 are zero, and the output of the OR gate 616 (the “HIT/MISS” signal) is zero. The zero output indicates that an SMC did not occur for instructions stored within the instruction cache such that coherency still exists between the instruction cache and the memory. In the case that the physical page address during the snoop matches a physical address contained within the ITLB 412, the FINE HIT bits, FHB[3:0], associated with the matching physical addresses are output to the OR gates 603-606. If no FINE HIT bit of the matched physical addresses are set to one, then all outputs from the OR gates 603-606 are zero and the outputs from the AND gates 610-613 are all zero such that a logical zero is output from OR gate 616 on the HIT/MISS signal line indicating an SMC MISS or no occurrence of an SMC condition. Assuming that one or more of the FINE HIT bits matching a physical address are set to a logical one and output to one or more of the OR gates 603-606, the output from one or more of the OR gates 603-606 is set to a logical one which is provided as an input to one or more of the AND gates 610-613. To determine further granularity of the physical snoop, the physical address bits 10 and 11, PA[11:10] are input to the 2 to 4 decoder 608. The 2 to 4 decoder 608 generates at its output the 1k block addressed within a 4k page. Each respective output from the 2-4 decoder 608 representing a 1k block is provided to each respective input of AND gates 610-613 to determine if an address match has occurred within certain blocks of a page. For example, AND gate 610 can represent a lower 1k block within a page while AND gate 613 can represent an upper 1k block within a page. If both inputs into one of the AND gates 610-613 are set to a logical one, indicating that a fine hit bit set to a logical one matches with a block address within the given page as generated by the 2 to 4 decoder 608, one of the outputs of the AND gates 610 through 613 goes to a logical one causing the output of the OR gate 616 to generate a logical high or one on the HIT/MISS signal line indicating an SMC HIT or the occurrence of an SMC condition. The SMC HIT signal is provided to the out of order core execution unit 118′, indicating that the instruction cache may have an SMC condition (an incoherent cache) and require flushing the instruction cache and the instruction pipeline.
  • In order to provide instruction inclusion for the [0054] trace instruction cache 414C and the instruction pipeline of the microprocessor 301, INUSE bits (not shown) are provided for each line of physical address stored within the ITLB 412. Instruction inclusion guarantees that every instruction in the trace instruction cache 414C and the instruction pipeline has its original translation in the ITLB 412. By providing this inclusion, the ITLB 412 will contain the physical address (to a page granularity) of every instruction in the trace instruction cache 414C and instruction pipeline.
  • The present invention has many advantages over the prior art. One advantage of the present invention where snoops are performed using the ITLB is that a snoop port need not be included into an instruction cache to perform SMC detection and thus the instruction cache can be made simpler with a smaller footprint. Another advantage of the present invention is that the instruction cache need not be physically addressed such that latency of the instruction pipeline can be reduced. Still another advantage of the present invention is that latency can be further reduced and bandwidth by using a trace instruction cache. [0055]
  • While certain exemplary embodiments have been described and shown in the accompanying drawings, it is to be understood that such embodiments are merely illustrative of and not restrictive on the broad invention, and that this invention not be limited to the specific constructions and arrangements shown and described, since various other modifications may occur to those ordinarily skilled in the art. For example, the present invention has been described herein with reference to instructions in an instruction translation lookaside buffer (ITLB) and an instruction cache, but it is equally applicable for cache coherency between memory and a cache storing data where a translation lookaside buffer is used. Additionally, the ITLB has been described as including a dual port CAM to perform linear and physical address comparisons but a single port CAM can be used that can be multiplexed to perform comparisons on either the linear or physical addresses stored therein. Furthermore, the present invention has been described with reference to one cache, it may be applied to multiple caches providing multiple cache levels; and it also may be applied to complex microprocessors and CPUs having deep instruction pipelines. Additionally, the present invention has been described in detail as being applied to maintain cache and pipeline coherency by providing SMC detection and recovery, it can also be applied to maintain memory coherency in shared memory multi-processor systems. As a last example, it is possible to implement the present invention or some of its features in hardware, firmware, software or a combination where the software is provided in a processor readable storage medium such as magnetic, optical, or semiconductor storage. [0056]

Claims (30)

What is claimed is:
1. A microprocessor including:
an execution unit to trigger a snoop if a store into a memory occurs; and
a translation lookaside buffer (TLB) having a content addressable memory (CAM) and receiving a physical address indicating the location where the store occurred in the memory, the TLB to store page translations between a linear page address and a physical page address pointing to a page of the memory having contents stored within a cache, the TLB including a CAM input port responsive to the snoop to compare the physical address received by the TLB with the physical page address stored therein.
2. The microprocessor of claim 1 wherein if it is determined that the physical address received by the TLB matches a physical page address stored within the TLB, indicating that information was modified within the memory correlating to information potentially located within the cache, information within the cache is invalidated.
3. The microprocessor of claim 2 wherein information within the cache is invalidated by setting a bit in the cache to indicate invalid information in a cache line and disregarding the information within the cache.
4. The microprocessor of claim 1 wherein if it is determined that the physical address received by the TLB matches a physical page address stored within the TLB, indicating that information was modified within the memory correlating to information potentially located within the cache or a pipeline, and the microprocessor provides inclusion for the cache and the pipeline such that information within the cache and the pipeline are invalidated.
5. The microprocessor of claim 4 wherein information within the cache and a pipeline are invalidated by setting a bit in the cache to indicate invalid information in a cache line and disregarding the information within the cache and the pipeline.
6. The microprocessor of claim 4 wherein the TLB maintains original page translations for all bytes of information within the cache and pipeline to provide inclusion.
7. The microprocessor of claim 1 wherein the TLB includes data bits providing an indication as to what portion of a page in memory has its contents stored in the cache, and the microprocessor further includes snoop logic coupled to the TLB, the snoop logic to provide further comparison of the data bits with the physical address received by the TLB after a store into memory, the comparison provided by the snoop logic indicating if information was modified within a portion of a page of memory correlating to information potentially located within the cache.
8. The microprocessor of claim 7 wherein the data bits providing an indication as to what portion of a page in memory has its contents stored in the cache are the FINE HIT bits.
9. The microprocessor of claim 7 wherein if it is determined that the physical address received by the TLB matches a physical page address stored within the TLB and the snoop logic indicates that the physical address matches the portion of memory associated with the data bits, indicating that information was modified within a portion of memory correlating to information located within the cache, information within the cache and a pipeline are invalidated.
10. The microprocessor of claim 9 wherein information within the cache and a pipeline are invalidated by setting a bit in the cache to indicate invalid information and disregarding the information within the cache and the pipeline.
11. The microprocessor of claim 9 wherein the data bits providing an indication as to what portion of a page in memory has its contents stored in the cache are the FINE HIT bits.
12. The microprocessor of claim 1 wherein the cache is a trace instruction cache and the information stored therein is instructions and the TLB is an instruction translation lookaside buffer (ITLB).
13. A method of self modifying code detection for cache coherency, comprising:
storing page table translations, the stored page table translations including linear page addresses associated with physical page addresses into a physically addressable memory for information stored into a cache memory;
providing a physical memory address of a store into the physically addressable memory; and
comparing the provided physical memory address to the physical page memory addresses included in the stored page table translations to determine if the physically addressable memory has been updated by self modifying code.
14. The method of claim 13 wherein the comparing generates a match between the provided physical memory address and one or more of the physical page memory addresses included in the stored page table translations indicating the potential occurrence of self modifying code and cache incoherency.
15. The method of claim 14 further comprising:
invalidating the instructions within the cache memory and an instruction pipeline for execution and fetching new instructions from the physically addressable memory to overwrite the invalidated instructions after the comparing generates a match indicating the potential occurrence of self modifying code and cache incoherency.
16. The method of claim 13 further comprising:
setting data bits associated with each stored page table translation indicating what portion of a page in physically addressable memory has its information stored into the cache memory.
17. The method of claim 16 further comprising:
comparing the provided physical memory address to the data bits associated with the stored page table translations to determine if the physically addressable memory has been updated by self modifying code within portions of pages in physically addressable memory.
18. The method of claim 13 further comprising:
maintaining original stored page table translations for all bytes of information within the cache memory and an instruction pipeline.
19. A computer including:
a memory; and
at least one microprocessor, the at least one microprocessor including,
an instruction cache to store instructions for execution,
an execution unit coupled to the instruction cache to execute the instructions stored therein, the execution unit to trigger a snoop if a store into the memory is executed, and
an instruction translation lookaside buffer (ITLB) having a content addressable memory (CAM) and receiving a physical address indicating the location where the execution of the store occurred in the memory, the ITLB to store page translations between a linear page address and a physical page address pointing to a page of the memory having contents stored within the instruction cache, the ITLB including a CAM input port responsive to the snoop to compare the physical address received by the TLB with the physical page address stored therein.
20. The computer of claim 19 wherein if it is determined that the physical address received by the TLB matches a physical page address stored within the ITLB, indicating that an instruction was modified within the memory correlating to an instruction located within the instruction cache, instructions within the instruction cache and an instruction pipeline within the execution unit are invalidated.
21. The computer of claim 20 wherein the ITLB includes data bits providing an indication as to what portion of a page in memory has its contents stored in the instruction cache, and the microprocessor further includes snoop logic coupled to the ITLB, the snoop logic to provide further comparison of the data bits with the physical address received by the TLB after a store into the memory, the comparison provided by the snoop logic indicating if an instruction was modified within a portion of a page of the memory correlating to an instruction located within the instruction cache.
22. The computer of claim 19 wherein the instruction cache is a trace instruction cache.
23. A method of detecting cache incoherency in a computer comprising:
providing a physical address associated with a store into memory;
comparing the physical address associated with the store into memory with a plurality of physical page addresses indicating from what pages in a memory information was stored into a cache;
generating a self modifying code hit signal indicating a possibility of cache incoherency; and
invalidating the information stored into the cache upon generation of the self modifying code hit signal.
24. The method of claim 23 wherein the plurality of physical page addresses are stored within an instruction translation lookaside buffer.
25. The method of claim 23 further comprising:
invalidating the information stored into an instruction pipeline from the cache upon generation of the self modifying code hit signal.
26. The method of claim 23 further comprising:
fetching instructions from memory to rewrite the information into the cache to obtain cache coherency.
27. A microprocessor including:
a memory controller to trigger a snoop if a store into a memory occurs; and
a translation lookaside buffer (TLB) having a content addressable memory (CAM) and receiving a physical address indicating the location where the store occurred in the memory, the TLB to store page translations between a linear page address and a physical page address pointing to a page of the memory having contents stored within a cache, the TLB including a CAM input port responsive to the snoop to compare the physical address received by the TLB with the physical page address stored therein.
28. The microprocessor of claim 27 wherein if it is determined that the physical address received by the TLB matches a physical page address stored within the TLB, indicating that information was modified within the memory correlating to information potentially located within the cache or a pipeline, and the microprocessor provides inclusion for the cache and the pipeline such that information within the cache and the pipeline are invalidated.
29. The microprocessor of claim 27 wherein the TLB includes data bits providing an indication as to what portion of a page in memory has its contents stored in the cache, and the microprocessor further includes snoop logic coupled to the TLB, the snoop logic to provide further comparison of the data bits with the physical address received by the TLB after a store into memory, the comparison provided by the snoop logic indicating if information was modified within a portion of a page of memory correlating to information potentially located within the cache.
30. The microprocessor of claim 27 wherein the cache is a trace instruction cache and the information stored therein is instructions and the TLB is an instruction translation lookaside buffer (ITLB).
US10/618,168 1999-12-20 2003-07-11 SMC detection and reverse translation in a translation lookaside buffer Abandoned US20040015675A1 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
US10/618,168 US20040015675A1 (en) 1999-12-20 2003-07-11 SMC detection and reverse translation in a translation lookaside buffer

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
US09/466,687 US6594734B1 (en) 1999-12-20 1999-12-20 Method and apparatus for self modifying code detection using a translation lookaside buffer
US10/618,168 US20040015675A1 (en) 1999-12-20 2003-07-11 SMC detection and reverse translation in a translation lookaside buffer

Related Parent Applications (1)

Application Number Title Priority Date Filing Date
US09/466,687 Continuation US6594734B1 (en) 1999-12-20 1999-12-20 Method and apparatus for self modifying code detection using a translation lookaside buffer

Publications (1)

Publication Number Publication Date
US20040015675A1 true US20040015675A1 (en) 2004-01-22

Family

ID=23852722

Family Applications (2)

Application Number Title Priority Date Filing Date
US09/466,687 Expired - Lifetime US6594734B1 (en) 1999-12-20 1999-12-20 Method and apparatus for self modifying code detection using a translation lookaside buffer
US10/618,168 Abandoned US20040015675A1 (en) 1999-12-20 2003-07-11 SMC detection and reverse translation in a translation lookaside buffer

Family Applications Before (1)

Application Number Title Priority Date Filing Date
US09/466,687 Expired - Lifetime US6594734B1 (en) 1999-12-20 1999-12-20 Method and apparatus for self modifying code detection using a translation lookaside buffer

Country Status (1)

Country Link
US (2) US6594734B1 (en)

Cited By (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040068618A1 (en) * 2002-09-19 2004-04-08 Ip-First, Llc Store-induced instruction coherency mechanism
US20050193175A1 (en) * 2004-02-26 2005-09-01 Morrow Michael W. Low power semi-trace instruction cache
US20060085599A1 (en) * 2004-10-19 2006-04-20 Woffinden Gary A Processing of self-modifying code in multi-address-space and multi-processor systems
US7268785B1 (en) * 2002-12-19 2007-09-11 Nvidia Corporation System and method for interfacing graphics program modules
US7346758B1 (en) * 2005-05-10 2008-03-18 Advanced Micro Devices, Inc. System and method for trace messaging
US20100287355A1 (en) * 2009-05-05 2010-11-11 International Business Machines Corporation Dynamic Translation in the Presence of Intermixed Code and Data
WO2013032437A1 (en) * 2011-08-29 2013-03-07 Intel Corporation Programmably partitioning caches
US20140189659A1 (en) * 2012-12-27 2014-07-03 Nirajan L. Cooray Handling of binary translated self modifying code and cross modifying code
US10635465B2 (en) 2015-03-28 2020-04-28 Intel Corporation Apparatuses and methods to prevent execution of a modified instruction

Families Citing this family (22)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6658552B1 (en) * 1998-10-23 2003-12-02 Micron Technology, Inc. Processing system with separate general purpose execution unit and data string manipulation unit
US6594734B1 (en) * 1999-12-20 2003-07-15 Intel Corporation Method and apparatus for self modifying code detection using a translation lookaside buffer
US7360028B1 (en) * 2000-05-05 2008-04-15 Sun Microsystems, Inc. Explicit store-to-instruction-space instruction for self-modifying code and ensuring memory coherence between instruction cache and shared memory using a no-snoop protocol
US7757065B1 (en) * 2000-11-09 2010-07-13 Intel Corporation Instruction segment recording scheme
US20030093775A1 (en) * 2001-11-14 2003-05-15 Ronald Hilton Processing of self-modifying code under emulation
US8117392B2 (en) * 2003-10-22 2012-02-14 Intel Corporation Method and apparatus for efficient ordered stores over an interconnection network
US20050091459A1 (en) * 2003-10-23 2005-04-28 Nhon Quach Flexible mechanism for enforcing coherency among caching structures
US20070005907A1 (en) * 2005-06-29 2007-01-04 Intel Corporation Reduction of snoop accesses
US7797747B1 (en) * 2006-02-21 2010-09-14 Symantec Corporation Detection of malicious code in non-paged pool unused pages
US8266413B2 (en) * 2006-03-14 2012-09-11 The Board Of Trustees Of The University Of Illinois Processor architecture for multipass processing of instructions downstream of a stalled instruction
JP4388557B2 (en) * 2007-01-11 2009-12-24 株式会社日立製作所 Image processing system
US8099560B2 (en) * 2008-08-29 2012-01-17 Freescale Semiconductor, Inc. Synchronization mechanism for use with a snoop queue
US8131947B2 (en) * 2008-08-29 2012-03-06 Freescale Semiconductor, Inc. Cache snoop limiting within a multiple master data processing system
US8327082B2 (en) * 2008-08-29 2012-12-04 Freescale Semiconductor, Inc. Snoop request arbitration in a data processing system
US8131948B2 (en) * 2008-08-29 2012-03-06 Freescale Semiconductor, Inc. Snoop request arbitration in a data processing system
US8433850B2 (en) * 2008-12-02 2013-04-30 Intel Corporation Method and apparatus for pipeline inclusion and instruction restarts in a micro-op cache of a processor
WO2013048460A1 (en) * 2011-09-30 2013-04-04 Intel Corporation Instruction and logic to control transfer in a partial binary translation system
WO2013101213A1 (en) * 2011-12-30 2013-07-04 Intel Corporation Method and apparatus for cutting senior store latency using store prefetching
US9535700B2 (en) 2013-06-14 2017-01-03 Arm Limited Data processing systems
US9864698B2 (en) 2013-11-04 2018-01-09 International Business Machines Corporation Resolving cache lookup of large pages with variable granularity
GB2571536B (en) * 2018-02-28 2020-03-11 Imagination Tech Ltd Coherency manager
GB2571538B (en) * 2018-02-28 2020-08-19 Imagination Tech Ltd Memory interface

Citations (20)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US4484739A (en) * 1983-03-15 1984-11-27 Wavetek International, Inc. Plastic slide for sleds
US4712264A (en) * 1986-09-29 1987-12-15 Voith Thomas P Modular step ramp
US5066600A (en) * 1989-05-19 1991-11-19 Cummins Engine Company, Inc. Multiple waste isolation system
US5133058A (en) * 1989-09-18 1992-07-21 Sun Microsystems, Inc. Page-tagging translation look-aside buffer for a computer memory system
US5137497A (en) * 1991-04-01 1992-08-11 Dubeta David J Slide apparatus
US5214817A (en) * 1991-06-24 1993-06-01 Allen James E Modular ramp and landing walkway assembly
US5277436A (en) * 1992-06-16 1994-01-11 Magline, Inc. Combination hand truck and stair ramp
US5440773A (en) * 1993-09-09 1995-08-15 Daws Manufacturing Co., Inc. Foldable ramp
US5509244A (en) * 1991-05-13 1996-04-23 Bentzon; Frank Flooring system having joinable tile elements, particularly plastic tiles
US5524310A (en) * 1995-05-04 1996-06-11 Farnen; Mark Modular halfpipe skateboard ramp and method of constructing
US5574875A (en) * 1992-03-13 1996-11-12 Inmos Limited Cache memory system including a RAM for storing data and CAM cell arrays for storing virtual and physical addresses
US5740575A (en) * 1995-09-29 1998-04-21 Gordon; Julian D. Ramp systems
US5749615A (en) * 1995-12-01 1998-05-12 Gt Bicycles, Inc. Cycling and skating ramp trailer
US5835949A (en) * 1994-12-27 1998-11-10 National Semiconductor Corporation Method of identifying and self-modifying code
US5860867A (en) * 1998-02-20 1999-01-19 The Shane Group, Inc. Interlocking playground slide sections
US6018786A (en) * 1997-10-23 2000-01-25 Intel Corporation Trace based instruction caching
US6026476A (en) * 1996-03-19 2000-02-15 Intel Corporation Fast fully associative translation lookaside buffer
US6042480A (en) * 1999-02-05 2000-03-28 Labelson; Ross Amusement ramp and method for constructing same
US6463613B1 (en) * 2002-01-15 2002-10-15 Laura M. Thompson Portable ramp
US6594734B1 (en) * 1999-12-20 2003-07-15 Intel Corporation Method and apparatus for self modifying code detection using a translation lookaside buffer

Patent Citations (20)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US4484739A (en) * 1983-03-15 1984-11-27 Wavetek International, Inc. Plastic slide for sleds
US4712264A (en) * 1986-09-29 1987-12-15 Voith Thomas P Modular step ramp
US5066600A (en) * 1989-05-19 1991-11-19 Cummins Engine Company, Inc. Multiple waste isolation system
US5133058A (en) * 1989-09-18 1992-07-21 Sun Microsystems, Inc. Page-tagging translation look-aside buffer for a computer memory system
US5137497A (en) * 1991-04-01 1992-08-11 Dubeta David J Slide apparatus
US5509244A (en) * 1991-05-13 1996-04-23 Bentzon; Frank Flooring system having joinable tile elements, particularly plastic tiles
US5214817A (en) * 1991-06-24 1993-06-01 Allen James E Modular ramp and landing walkway assembly
US5574875A (en) * 1992-03-13 1996-11-12 Inmos Limited Cache memory system including a RAM for storing data and CAM cell arrays for storing virtual and physical addresses
US5277436A (en) * 1992-06-16 1994-01-11 Magline, Inc. Combination hand truck and stair ramp
US5440773A (en) * 1993-09-09 1995-08-15 Daws Manufacturing Co., Inc. Foldable ramp
US5835949A (en) * 1994-12-27 1998-11-10 National Semiconductor Corporation Method of identifying and self-modifying code
US5524310A (en) * 1995-05-04 1996-06-11 Farnen; Mark Modular halfpipe skateboard ramp and method of constructing
US5740575A (en) * 1995-09-29 1998-04-21 Gordon; Julian D. Ramp systems
US5749615A (en) * 1995-12-01 1998-05-12 Gt Bicycles, Inc. Cycling and skating ramp trailer
US6026476A (en) * 1996-03-19 2000-02-15 Intel Corporation Fast fully associative translation lookaside buffer
US6018786A (en) * 1997-10-23 2000-01-25 Intel Corporation Trace based instruction caching
US5860867A (en) * 1998-02-20 1999-01-19 The Shane Group, Inc. Interlocking playground slide sections
US6042480A (en) * 1999-02-05 2000-03-28 Labelson; Ross Amusement ramp and method for constructing same
US6594734B1 (en) * 1999-12-20 2003-07-15 Intel Corporation Method and apparatus for self modifying code detection using a translation lookaside buffer
US6463613B1 (en) * 2002-01-15 2002-10-15 Laura M. Thompson Portable ramp

Cited By (22)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7263585B2 (en) * 2002-09-19 2007-08-28 Ip-First, Llc Store-induced instruction coherency mechanism
US20040068618A1 (en) * 2002-09-19 2004-04-08 Ip-First, Llc Store-induced instruction coherency mechanism
US7268785B1 (en) * 2002-12-19 2007-09-11 Nvidia Corporation System and method for interfacing graphics program modules
US20090013131A1 (en) * 2004-02-26 2009-01-08 Marvell International Ltd. Low power semi-trace instruction cache
US7822925B2 (en) 2004-02-26 2010-10-26 Marvell International Ltd. Low power semi-trace instruction/trace hybrid cache with logic for indexing the trace cache under certain conditions
US20050193175A1 (en) * 2004-02-26 2005-09-01 Morrow Michael W. Low power semi-trace instruction cache
US7437512B2 (en) * 2004-02-26 2008-10-14 Marvell International Ltd. Low power semi-trace instruction/trace hybrid cache with logic for indexing the trace cache under certain conditions
US7386670B2 (en) 2004-10-19 2008-06-10 Platform Solutions, Inc. Processing of self-modifying code in multi-address-space and multi-processor systems
US20080301369A1 (en) * 2004-10-19 2008-12-04 Platform Solutions, Inc. Processing of self-modifying code in multi-address-space and multi-processor systems
US20060085599A1 (en) * 2004-10-19 2006-04-20 Woffinden Gary A Processing of self-modifying code in multi-address-space and multi-processor systems
US7822924B2 (en) * 2004-10-19 2010-10-26 International Business Machines Corporation Processing of self-modifying code in multi-address-space and multi-processor systems
WO2006045029A1 (en) * 2004-10-19 2006-04-27 Platform Solutions, Inc. Processing of self-modifying code in multi-address-space and multi-processor systems
US7346758B1 (en) * 2005-05-10 2008-03-18 Advanced Micro Devices, Inc. System and method for trace messaging
US20100287355A1 (en) * 2009-05-05 2010-11-11 International Business Machines Corporation Dynamic Translation in the Presence of Intermixed Code and Data
US8103850B2 (en) 2009-05-05 2012-01-24 International Business Machines Corporation Dynamic translation in the presence of intermixed code and data
WO2013032437A1 (en) * 2011-08-29 2013-03-07 Intel Corporation Programmably partitioning caches
US20140189659A1 (en) * 2012-12-27 2014-07-03 Nirajan L. Cooray Handling of binary translated self modifying code and cross modifying code
CN104813278A (en) * 2012-12-27 2015-07-29 英特尔公司 Handling of binary translated self modifying code and cross modifying code
US9116729B2 (en) * 2012-12-27 2015-08-25 Intel Corporation Handling of binary translated self modifying code and cross modifying code
KR101744081B1 (en) * 2012-12-27 2017-06-07 인텔 코포레이션 Handling of binary translated self modifying code and cross modifying code
CN104813278B (en) * 2012-12-27 2019-01-01 英特尔公司 The processing of self modifying code and intersection modification code to Binary Conversion
US10635465B2 (en) 2015-03-28 2020-04-28 Intel Corporation Apparatuses and methods to prevent execution of a modified instruction

Also Published As

Publication number Publication date
US6594734B1 (en) 2003-07-15

Similar Documents

Publication Publication Date Title
US6594734B1 (en) Method and apparatus for self modifying code detection using a translation lookaside buffer
US6604187B1 (en) Providing global translations with address space numbers
US5524233A (en) Method and apparatus for controlling an external cache memory wherein the cache controller is responsive to an interagent communication for performing cache control operations
EP0118828B1 (en) Instruction fetch apparatus and method of operating same
US7290081B2 (en) Apparatus and method for implementing a ROM patch using a lockable cache
US5793941A (en) On-chip primary cache testing circuit and test method
US6412043B1 (en) Microprocessor having improved memory management unit and cache memory
US5699551A (en) Software invalidation in a multiple level, multiple cache system
US9710385B2 (en) Method and apparatus for accessing physical memory from a CPU or processing element in a high performance manner
US5768574A (en) Microprocessor using an instruction field to expand the condition flags and a computer system employing the microprocessor
US5214770A (en) System for flushing instruction-cache only when instruction-cache address and data-cache address are matched and the execution of a return-from-exception-or-interrupt command
US7496730B2 (en) System and method for reducing the number of translation buffer invalidates an operating system needs to issue
US5440707A (en) Instruction and data cache with a shared TLB for split accesses and snooping in the same clock cycle
US5708792A (en) Method and apparatus for a coherent copy-back buffer in a multipressor computer system
US6711653B1 (en) Flexible mechanism for enforcing coherency among caching structures
US7269707B2 (en) Multiple patches to on-chip ROM in a processor with a multilevel memory system without affecting performance
KR20010025123A (en) Using ecc/parity bits to store predecode information
US6467027B1 (en) Method and system for an INUSE field resource management scheme
US7133975B1 (en) Cache memory system including a cache memory employing a tag including associated touch bits
JP5669734B2 (en) Effective load cue snooping
US6510506B2 (en) Error detection in cache tag array using valid vector
US5926841A (en) Segment descriptor cache for a processor
US6553460B1 (en) Microprocessor having improved memory management unit and cache memory
US6965962B2 (en) Method and system to overlap pointer load cache misses
US6338128B1 (en) System and method for invalidating an entry in a translation unit

Legal Events

Date Code Title Description
STCB Information on status: application discontinuation

Free format text: ABANDONED -- FAILURE TO RESPOND TO AN OFFICE ACTION