CA2262928C - Method and apparatus for aliasing memory data in an advanced microprocessor - Google Patents

Method and apparatus for aliasing memory data in an advanced microprocessor Download PDF

Info

Publication number
CA2262928C
CA2262928C CA002262928A CA2262928A CA2262928C CA 2262928 C CA2262928 C CA 2262928C CA 002262928 A CA002262928 A CA 002262928A CA 2262928 A CA2262928 A CA 2262928A CA 2262928 C CA2262928 C CA 2262928C
Authority
CA
Canada
Prior art keywords
register
memory
data
memory address
target
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.)
Expired - Fee Related
Application number
CA002262928A
Other languages
French (fr)
Inventor
Malcolm J. Wing
Edmund J. Kelly
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.)
Intellectual Ventures Holding 81 LLC
Original Assignee
Transmeta Inc
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 Transmeta Inc filed Critical Transmeta Inc
Application granted granted Critical
Publication of CA2262928C publication Critical patent/CA2262928C/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Classifications

    • 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
    • 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/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45554Instruction set architectures of guest OS and hypervisor or native processor differ, e.g. Bochs or VirtualPC on PowerPC MacOS
    • 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/3824Operand accessing
    • G06F9/3834Maintaining memory consistency
    • 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/3861Recovery, e.g. branch miss-prediction, exception handling
    • G06F9/3863Recovery, e.g. branch miss-prediction, exception handling using multiple copies of the architectural state, e.g. shadow registers
    • 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/3885Concurrent instruction execution, e.g. pipeline, look ahead using a plurality of independent parallel functional units
    • 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/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45504Abstract machines for programme code execution, e.g. Java virtual machine [JVM], interpreters, emulators
    • 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/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • 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/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • G06F2009/45583Memory management, e.g. access or allocation

Abstract

Apparatus and a method for storing data already stored at an often utilized memory address in registers (111) in an execution unit (110) and maintain the data in the registers and memory consistent so that the execution unit may respond more rapidly when a memory address is to be accessed.

Description

W O 98/13740 PCT~US97/16gll METHOD AND APPARATUS FOR ALIASING MEMORY DATA IN AN
ADVANCED MICROPROCESSOR

BACKGROUND OF THE INVENTION

5 Field Of The Invention This invention relates to computer systems and, more particularly, to an improved microprocessor which utilizes methods and apparatus for storing frequently utilized memory data in registers for more rapid access.

History Of The Prior Art o There are thousands of application programs which run on computers designed around particular families of microprocessors. The largest number of programs in existence are designed to run on computers (generally referred to as "IBM Compatible Personal Computers"J using the "X86n family of microprocessors (including the Intel~ 8088, Intel 8086, Intel 80186, Intel IS 80286, i386, i486, and progressing through the various Pentium~
microprocessors) designed and manufactured by Intel Corporation of Santa Clara, California. There are many other examples of programs designed to run on computers using other families of processors. Because there are so many application programs which run on these computers, there is a large 20 market for microprocessors capable of use in such computers, especially computers designed to process X86 programs. The microprocessor market is not only large but also quite lucrative.

Although the market for microprocessors which are able to run large numbers of application programs is large and lucrative, it is quite difficult to2s design a new competitive microprocessor. For example, even though the X86 family of processors has been in existence for a number of years and these processors are included in the majority of computers sold and used, W O 98/13740 PCTrUS97tlCgll there are few successful competitive microprocessors which are able to run X86 programs. The reasons for this are many.

In order to be successful, a microprocessor must be able to run all of the programs (including operating systems and legacy programs) designed for 5 that family of processors as fast as existing processors without costing more than existing processors. In addition, to be economically successful, a new microprocessor must do at least one of these things better than existing processors to give buyers a reason to choose the new processor over existing proven processors.

o It is difficult and expensive to make a microprocessor run as fast as state of the art microprocessors. Processors carry out instructions through primitive operations such as loading, shifting, adding, storing, and simil~r low level operations and respond only to such primitive instructions in executing any instruction furnished by an application program. For 5 example, a processor designed to run the instructions of a complicated ' ' instruction set computer (CISC) such as a X86 in which instructions may designate the process to be carried out at a relatively high level have historically included read only memory (ROM) which stores so-called micro-instructions. Each micro-instruction includes a sequence of primitive 20 instructions which when run in succession bring about the result comm~nded by the high level CISC instruction. Typically, an "add A to B"
CISC instruction is decoded to cause a look up of an address in ROM at which a micro-instruction for carrying out the functions of the "add A to B"
instruction is stored. The micro-instruction is loaded, and its primitive 25 instructions are run in sequence to cause the "add A to B" instruction to be carried out. With such a CISC computer, the primitive operations within a micro-instruction can never be changed during program execution. Each CISC instruction can only be run by decoding the instruction, addressing W O 98/13740 PCT~US97/16911 and fetching the micro-instruction, and running the sequence of primitive operations in the order provided in the micro-instruction. Each time the micro-instruction is run, the same sequence must be followed.

State of the art processors for running X86 applications utilize a number of s techniques to provide the fastest processing possible at a price which is still economically reasonable. Any new processor which implements known hardware techniques for accelerating the speed at which a processor may run must increase the sophistication of the processing hardware. This requires increasing the cost of the hardware.

o For example, a superscalar microprocessor which uses a plurality of processing channels in order to execute two or more operations at once has a number of additional requirements. At the most basic level, a simple superscalar microprocessor might decode each application instruction into the micro-instructions which carry out the function of the application s instruction. Then, the simple superscalar microprocessor schedules two micro-instructions to run together if the two micro-instructions do not require the same hardware resources and the execution of a micro-instruction does not depend on the results of other micro-instructions being processed.

20 A more advanced superscalar microprocessor typically decodes each application instruction into a series of primitive instructions so that those primitive instructions may be reordered and scheduled into the most efficient execution order. This requires that each individual primitive operation be addressed and fetched. To accomplish reordering, the 2s processor must be able to ensure that a primitive instruction which requires data resulting from another primitive instruction is run after that other primitive instruction produces the needed data. Such a superscalar W O 98/13740 PCTrUS97/16911 microprocessor must assure that two primitive instructions being run together do not both require the same hardware resources. Such a processor must also resolve conditional branches before the effects of branch operations can be completed.

s Thus, superscalar microprocessors require extensive hardware to compare the relationships of the primitive instructions to one another and to reorder and schedule the sequence of the primitive instructions to carry out any instruction. As the number of processing channels increases, the amount and cost of the hardware to accomplish these superscalar acceleration o techniques increases approximately quadratically. All of these hardware requirements increase the complexity and cost of the circuitry involved. As in dealing with micro-instructions, each time an application instruction is executed, a superscalar microprocessor must use its relatively complicated addressing and fetching hardware to fetch each of these primitive s instructions, must reorder and reschedule these primitive instructions based on the other primitive instructions and hardware usage, and then must execute all of the rescheduled primitive instructions. The need to run each application instruction through the entire hardware sequence each time it is executed limits the speed at which a superscalar processor is 20 capable of executing its instructions.

Moreover, even though these various hardware techniques increase the speed of processing, the complexity involved in providing such hardware significantly increases the cost of such a microprocessor. For example, the Intel i486 DX4 processor uses approximately 1.5 million transistors. Adding 25 the hardware required to accomplish the checking of dependencies and scheduling necessary to process instructions through two channels in a basic superscalar microprocessor such as the Intel Pentium~ rec~uires the use of more than three million transistors. Adding the hardware to allow WO 98/13740 PCT~US97/16911 reordering among primitive instructions derived from different target instructions, provide speculative execution, allow register renaming, and provide branch prediction increases the number of transistors to over six million in the Intel Pentium ProTM microprocessor. Thus, it can be seen that s each hardware addition to increase operation speed has drastically increased the number of transistors in the latest state of the art mlcroprocessors .

Even using these known techniques may not produce a microprocessor faster than existing microprocessors becaùse manufacturers use most of the n economically feasible techniques known to accelerate the operation of existing microprocessors. Consequently, designing a faster processor is a very difficult and expensive task.

Reducing the cost of a processor is also very difficult. As illustrated above, hardware acceleration techniques which produce a sufficiently capable 5 processor are very expensive. One designing a new processor must obtain the facilities to produce the hardware. Such facilities are very difficult to obtain because chip manufacturers do not typically spend assets on small runs of devices. The capital investment required to produce a chip manufacturing facility is so great that it is beyond the reach of most 20 companies.

Even though one is able to design a new processor which runs all of the application programs designed for a family of processors at least as fast as competitive processors, the price of competitive processors includes sufficient profit that substantial price reductions are sure to be faced by any 2s competitor.

Although designing a competitive processor by increasing the complexity of the hardware is very difficult, another way to run application programs W O 98/13740 PCTrUS97/16911 (target application programs) designed for a particular family of microprocessors (target microprocessors) has been to emulate the target microprocessor in software on another faster microprocessor (host microprocessor). This is an incrementally inexpensive method of running 5 these programs because it requires only the addition of some form of emulation software which enables the application program to run on a faster microprocessor. The emulator software changes the target instructions of an application program written for the target processor family into host instructions capable of execution by the host microprocessor. These o changed instructions are then run under control of the operating system on the faster host microprocessor.

There have been a number of different designs by which target applications may be run on host computers with faster processors than the processors of target computers. In general, the host computers executing target programs using emulation software utilize reduced instruction set (RISC) microprocessors because RISC processors are theoretically simpler and consequently can run faster than other types of processors.

However, even though RISC computer systems running emulator software are often capable of running X86 (or other) programs, they usually do so at a 20 rate which is substantially slower than the rate at which state of the art X86 computer systems run the same programs. Moreover, often these emulator programs are not able to run all or a large number of the target programs available.

The reasons why emulator programs are not able to run target programs as 25 rapidly as the target microprocessors is quite complicated and requires some understanding of the different emulation operations. Figure 1 includes a W O 98/13740 PCTrUS97/16911 series of diagrams representing the different ways in which a plurality of different types of microprocessors execute target application programs.

- In Figure 1(a), a typical CISC microprocessor such as an Intel X86 microprocessor is shown running a target application program which is 5 designed to be run on that target processor. As may be seen, the application is run on the CISC processor using a CISC operating system (such as MS DOS, Windows 3.1, Windows NT, and OS/2 which are used with X86 computers) designed to provide interfaces by which access to the hardware of the computer may be gained. Typically, the instructions of the o application program are selected to utilize the devices of the computer only through the access provided by the operating system. Thus, the operating system handles the manipulations which allow applications access to memory and to the various input/output devices of the computer. The target computer includes memory and hardware which the operating system 5 recognizes, and a call to the operating system from a target application causes an operating system device driver to cause an expected operation to occur with a defined device of the target computer. The instructions of the application execute on the processor where they are changed into operations (embodied in microcode or the more primitive operations from which 20 microcode is assembled) which the processor is capable of executing. As has been described above, each time a complicated target instruction is executed, the instruction calls the same subroutine stored as microcode (or as the same set of primitive operations). The same subroutine is always executed. If the processor is a superscalar, these primitive operations for 25 carrying out a target instruction can often be reordered by the processor, rescheduled, and executed using the various processing channels in the manner described above; however, the subroutine is still fetched and executed.

W O98113740 rCTAUS97/16911 In Figure l(b), a typical RISC microprocessor such as a PowerPC
microprocessor used in an Apple Macintosh computer is represented running the same target application program which is designed to be run on the CISC processor of Figure l(a). As may be seen, the target application is 5 run on the host processor using at least a partial target operating system to respond to a portion of the calls which the target application generates.
Typically these are calls to the application-like portions of the target operating system used to provide graphical interfaces on the display and short utility programs which are generally~ application-like. The target 0 application and these portions of the target operating system are changed by a software emulator such as Soft PC~ which breaks the instructions furnished by the target application program and the application-like target operating system programs into instructions which the host processor and its host operating system are capable of executing. The host operating 15 system provides the interfaces through which access to the memory and inputtoutput hardware of the RISC computer may be gained.

However, the host RISC processor and the hardware devices associated with it in a host RISC computer are usually quite different than are the devices associated with the processor for which the target application was designed;
20 and the various instructions provided by the target application program are designed to cooperate with the device drivers of the target operating system in accessing the various portions of the target computer. Consequently, the emulation program, which changes the instructions of the target application program to primitive host instructions which the host operating system is 25 capable of utilizing, must somehow link the operations designed to operate hardware devices in the target computer to operations which hardware devices of the host system are capable of implementing. Often this requires the emulator software to create virtual devices which respond to the W O 98/13740 PCT~US97/16911 instructions of the target application to carry out operations which the host system is incapable of carrying out because the target devices are not those of the host computer. Sometimes the emulator is required to create links from these virtual devices through the host operating system to host 5 hardware devices which are present but are addressed in a different manner by the host operating system.

Target programs when executed in this manner run relatively slowly for a number of reasons. First, each target instruction from a target application program and from the target operating system must be changed by the 10 emulator into the host primitive functions used by the host processor. If thetarget application is designed for a CISC machine such as an X86, the target instructions are of varying lengths and quite complicated so that changing them to host primitive instructions is quite involved. The original target instructions are first decoded, and the sequence of primitive host instructions which make up the target instructions are determined. Then the address (or addresses) of each sequence of primitive host instructions is determined, each sequence of the primitive host instructions is fetched, and these primitive host instructions are executed in or out of order. The large number of extra steps required by an emulator to change the target 20 application and operating system instructions into host instructions understood by the host processor must be conducted each time an instruction is executed and slows the process of emulation.

Second, many target instructions include references to operations conducted by particular hardware devices which function in a particular 25 manner in the target computer, hardware which is not available in the host - computer. To carry out the operation, the emulation software must either make software connections to the hardware devices of the host computer through the existing host operating system or the emulator software must furnish a virtual hardware device. Emulating the hardware of another computer in software is very difficult. The emulation software must generate virtual devices for each of the target application calls to the host operating system; and each of these virtual devices must provide calls to the 5 actual host devices. Emulating a hardware device requires that when a target instruction is to use the device, the code representing the virtual device required by that instruction be fetched from memory and run to implement the device. Either of these methods of solving the problem adds another series of operations to the execution of the sequence of instructions.

10 Complicating the problem of emulation is the requirement that the target application take various exceptions which are carried out by hardware of the target computer and the target operating system in order for the computer system to operate. When a target exception is taken during the operation of a target computer, state of the computer at the time of the exception must 15 be saved typically by calling a microcode sequence to accomplish the operation, the correct exception handler must be retrieved, the exception must be handled, then the correct point in the program must be found for continuing with the program. Sometimes this requires that the program revert to the state of the target computer at the point the exception was 20 taken, and at other times a branch provided by the exception handler is taken. In any case, the hardware and software of the target computer required to accomplish these operations must somehow be provided in the process of emulation. Because the correct target state must be available at the time of any such exception for proper execution, the emulator is forced 25 to keep accurate track of this state at all times so that it is able to correctly respond to these exceptions. In the prior art, this has required executing each instruction in the order provided by the target application because only in this way could correct target state be maintained.

Moreover, prior art emulators have always been required to maintain the order of execution of the target application for other reasons. Target instructions can be of two types, ones which affect memory or ones which affect a memory mapped input/output (I/O) device. There is no way to - 5 know without attempting to execute an instruction whether an operation is to affect memory or a memory-mapped I/O device. When instructions operate on memory, optimi~i"g and reordering is possible and greatly aids in speeding the operation of a system. However, operations affecting I/O
devices often must be practiced in the precise order in which those o operations are programmed without the elimination of any steps or they may have some adverse effect on the operation of the I/O device. For example, a particular I/O operation may have the effect of clearing an I/O register. If the operations take place out of order so that a register is cleared of a value which is still necessary, then the result of the operation may be different than the operation commanded by the target instruction. Without a means to distinguish memory from memory mapped I/O, it is necessary to treat all instructions as though they affect memory mapped I/O. This severely restricts the nature of optimizations that are achievable. Because prior art emulators lack both means to detect the nature of the memory being 20 addressed and means to recover from such failures, they are required to proceed sequentially through the target instructions as though each operation affects memory mapped I/O. This greatly limits the possibility of optimizing the host instructions.

Another problem which limits the ability of prior art emulators to optimize 25 the host code is caused by self-modifying code. If a target instruction has been changed to a sequence of host instructions which in turn write back to change the original target instruction, then the host instructions are no longer valid. Consequently, the emulator must constantly check to WO 98/13740 PCT~US97/16911 determine whether a store is to the target code area. All of these problems make this type of emulation much slower than running a target application on a target processor.

Another example of the type of emulation software shown in figure 1 (b) is s described in an article entitled, "Talisman: Fast and Accurate Multicomputer Simulation," R. C. Bedichek, Laboratory for Computer Sciences, Massachusetts Institute of Technology. This is a more complete example of translation in that it can emulate a complete research system and run the research target operating system. Talisman uses a host UNIX operating ] o system.

In Figure l(c), another example of emulation is shown. In this case, a PowerPC microprocessor used in an Apple Macintosh computer is represented running a target application program which was designed to be run on the Motorola 68000 family CISC processors used in the original s Macintosh computers; this type of arrangement has been required in order to allow Apple legacy programs to run on the Macintosh computers with RISC processors. As may be seen, the target application is run on the host processor using at least a partial target operating system to respond to the application-like portions of the target operating system. A software emulator 20 breaks the instructions furnished by the target application program and the application-like target operating system programs into instructions which the host processor and its host operating system are capable of executing.
The host operating system provides the interfaces through which access to the memory and input/output hardware of the host computer may be 2s gained.

Again, the host RISC processor and the devices associated with it in the host RISC computer are quite different than are the devices associated with the W O 98/13740 13 PCTrUS97/16911 Motorola CISC processor; and the various target instructions are designed to cooperate with the target CISC operating system in accessing the various portions of the target computer. Consequently, the emulation program must link the operations designed to operate hardware devices in the target 5 computer to operations which hardware devices of the host system are capable of implementing. This requires the emulator to create software virtual devices which respond to the instructions of the target application and to create links from these virtual devices through the host operating system to host hardware devices which are present but are addressed in a o different manner by the host operating system.

The target software run in this manner runs relatively slowly for the same reasons that the emulation of Figure l(b) runs slowly. First, each target instruction from the target application and from the target operating system must be changed by fetching the instruction; and all of the host primitive functions derived from that instruction must be run in sequence each time the instruction is executed. Second, the emulation software must generate virtual devices for each of the target application calls to the host operatin~3 system; and each of these virtual devices must provide calls to the actual host devices. Third, the emulator must treat all instructions as 20 conservatively as it treats instructions which are directed to memory mapped I/O devices or risk generating exceptions from which it cannot recover. Finally, the emulator must maintain the correct target state at all times and store operations must always check ahead to determine whether a store is to the target code area. All of these requirements eliminate the 25 ability of the emulator to practice significant optimization of the code run on the host processor and make this type of emulation much slower than running the target application on a target processor. Emulation rates less than one-quarter as fast as state of the art processors are considered very W O 98/13740 14 PCTrUS97/16911 good. In general, this has relegated this type of emulation software to uses where the capability of running applications designed for another processor is useful but not primary.

In Figure l(d), a particular method of emulating a target application s program on a host processor which provides relatively good performance for a very limited series of target applications is illustrated. The target application furnishes instructions to an emulator which changes those instructions into instructions for the host processor and the host operating system. The host processor is a Digital Equipment Corporation Alpha RISC
o processor, and the host operating system is Microsoft NT. The only target applications which may be run by this system are 32 bit applications designed to be executed by a target X86 processor with a Windows WIN32s compliant operating system. Since the host and target operating systems are almost identical, being designed to handle these same instructions, the S emulator software may change the instructions very easily. Moreover, the host operating system is already designed to respond to the same calls that the target application generates so that the generation of virtual devices is considerably reduced.

Although this is technically an emulation system running a target 20 application on a host processor, it is a very special case. Here the emulation software is running on a host operating system already designed to run simil~r applications. This allows the calls from the target applications to be more simply directed to the correct facilities of the host and the host operating system. More importantly, this system will run only 32 bit 2s Windows applications which probably amount to less than one percent of all X86 applications. Moreover, this system will run applications on only one operating system, Windows NT; while X86 processors run applications designed for a large number of operating systems. Such a system, therefore, WO 9gtl3740 PCT/US97116911 could be considered not to be compatible within the terms expressed earlier in this specification. Thus, a processor running such an emulator cannot be considered to be a competitive X86 processor.

Another method of emulation by which software may be used to run 5 portions of applications written for a first instruction set on a computer which recognizes a different instruction set is illustrated in Figure 1 (e). This form of emulation software is typically utilized by a programmer who may be porting an application from one computer system to another. Typically, the target application is being designed for some target computer other than the o host machine on which the emulator is being run. The emulator software analyzes the target instructions, translates those instructions into instructions which may be run on the host machine, and caches those host instructions so that they may be reused. This dynamic translation and caching allows portions of applications to be run very rapidly. This form of emulator is normally used with software tracing tools to provide detailed information about the behavior of a target program being run. The output of a tracing tool may, in turn, be used to drive an analyzer program which analyzes the trace information.

In order to determine how the code actually functions, an emulator of this 20 type, among other things, runs with the host operating system on the host machine, furnishes the virtual hardware which the host operating system does not provide, and otherwise maps the operations of the computer for which the application was designed to the hardware resources of the host machine in order to carry out the operations of the program being run. This 25 software virt~ ing of hardware and mapping to the host computer can be very slow and incomplete.

CA 02262928 l999-02-03 W O 98/13740 16 PCT~US97/16911 Moreover, because it often requires a plurality of host instructions to carry out one of the target instructions, exceptions including faults and traps which require a target operating system exception handler may be generated and cause the host to cease processing the host instructions at a point 5 unrelated to target instruction boundaries. When this happens, it may be impossible to handle the exception correctly because the state of the host processor and memory is incorrect. If this is the case, the emulator must be stopped and rerun to trace the operations which generated the exception.
Thus, even though such an emulator may run sequences of target code very o rapidly, it has no method for recovering from these exceptions so cannot run any significant portion of an application rapidly.

This is not a particular problem with this form of emulator because the functions being performed by the emulators, tracers, and the associated analyzers are directed to generating new programs or porting old programs s to another machine so that the speed at which the emulator software runs is rarely at issue. That is, a programmer is usually not interested in how fast the code produced by a emulator runs on the host machine but in whether the emulator produces code which is executable on the machine for which it is designed and which will run rapidly on that machine. Consequently, this 20 type of emulation software does not provide a method for running application programs written in a first instruction set to run on a different type of microprocessor for other than programming purposes. An example of this type of emulation software is described in an article entitled, "Shade:
A Fast Instruction-Set Simulator for Execution Profiling," Cmelik and 25 Keppel.

It is desirable to provide competitive microprocessors which are faster and less expensive than state of the art microprocessors yet are entirely compatible with target application programs designed for state of the art W O 98/13740 l7 PCTrUS97/16911 microprocessors running any operating systems available for those microprocessors .

- More particularly, it is desirable to provide a host processor having circuitry for enhancing the speed at which the processor functions.

s Summ~r-,r Of The Invention It is, therefore, an object of the present invention to enhance the operation of a microprocessor with apparatus for accelerating the execution of programs.

This and other objects of the present invention are realized by apparatus o and a method for storing data already stored at an often utilized memory address in registers local to a host processor so that the processor may respond more rapidly when a memory address is to be accessed.

These and other objects and features of the invention will be better understood by reference to the detailed description which follows taken together with the drawings in which like elements are referred to by like designations throughout the several views.

Brief Description Of The Drawin~s Figures l(a)-(e) are diagrams illustrating the manner of operation of microprocessors designed in accordance with the prior art.

20 Figure 2 is a block diagram of a microprocessor designed in accordance with the present invention running an application designed for a different mlcroprocessor .

Figure 3 is a diagram illustrating a portion of the microprocessor shown in Figure 2.

.

W O 98/13740 PCT~US97/16911 Figure 4 is a block diagram illustrating a register file used in a microprocessor designed in accordance with the present invention.

Figure 5 is a block diagram illustrating a gated store buffer designed in accordance with the present invention.

5 Figure 6(a)-(c) illustrate instructions used in various microprocessors of theprior art and in a microprocessor designed in accordance with the present invention.

Figure 7 illustrates a method practiced by a software portion of a microprocessor designed in accordance with the present invention.

o Figure 8 illustrates another method practiced by a software portion of a microprocessor designed in accordance with the present invention.

Figure 9 is a block diagram illustrating an improved computer system including the present invention.

Figure lO is a block diagram illustrating a portion of the microprocessor 5 shown in Figure 3.

Figure 11 is a block diagram illustrating in more detail a translation look aside buffer shown in the microprocessor of Figure 3.

Figure 12 is a block diagram illustrating in detail memory ~ ing circuitry in accordance with the present invention.

20 Notation And Nomenclature Some portions of the detailed descriptions which follow are presented in terms of symbolic representations of operations on data bits within a computer memory. These descriptions and representations are the means used by those skilled in the data processing arts to most effectively convey the substance of their work to others skilled in the art. The operations are those requiring physical manipulations of physical quantities. Usually, though not necessarily, these quantities take the form of electrical or magnetic signals capable of being stored, transferred, combined, compared, s and otherwise manipulated. It has proven convenient at times, principally for reasons of common usage, to refer to these signals as bits, values, elements, symbols, characters, terms, numbers, or the like. It should be borne in mind, however, that all of these and ~imi~r terms are to be associated with the appropriate physical q~uantities and are merely o convenient labels applied to these quantities.

Further, the manipulations performed are often referred to in terms, such as adding or comparing, which are commonly associated with mental operations performed by a human operator. No such capability of a human operator is necessary or desirable in most cases in any of the operations described herein which form part of the present invention; the operations are machine operations. Useful machines for performing the operations of the present invention include general purpose digital computers or other ~imil~r devices. In all cases the distinction between the method operations in operating a computer and the method of computation itself should be 20 borne in mind. The present invention relates to a method and apparatus for operating a computer in processing electrical or other (e.g. mechanical, chemical) physical signals to generate other desired physical signals.

During the following description, in some cases the target program is referred to as a program which is designed to be executed on an X86 25 microprocessor in order to provide exemplary details of operation because the majority of emulators run X86 applications. However, the target program may ~e one designed to run on any family of target computers.

. . .

WO 98/13740 PCTAUS97116gll This includes target virtual computers, such as Pcode machines, Postscript machines, or Java virtual machines.

Detailed Description The present invention helps overcome the problems of the prior art and 5 provide a microprocessor which is faster than microprocessors of the prior art, is capable of running all of the software for all of the operating systems which may be run by a large number of families of prior art microprocessors, yet is less expensive than prior art microprocessors.

Rather than using a microprocessor with more complicated hardware to o accelerate its operation, the present invention is a part of a combination including an enhanced hardware processing portion (referred to as a ~morph host~ in this specification3 which is much simpler than state of the art microprocessors and an emulating software portion (referred to as "code morphing software" in this specification) in a manner that the two portions s function together as a microprocessor with more capabilities than any known competitive microprocessor. More particularly, a morph host is a processor which includes hardware enhancements to assist in having state of a target computer immediately at hand when an exception or error occurs, while code morphing software is software which translates the 20 instructions of a target program to morph host instructions for the morph host and responds to exceptions and errors by replacing working state with correct target state when necessary so that correct retranslations occur.
Code morphing software may also include various processes for enhancing the speed of processing. Rather than providing hardware to enhance the 25 speed of processing as do all of the very fast prior art microprocessors, the improved microprocessor allows a large number of acceleration enhancement techniques to be carried out in selectable stages by the code W O 98/13740 PCT~US97/16911 morphing software. Providing the speed enhancement techniques in the code morphing software allows the morph host to be implemented using much less complicated hardware which is faster and substantially less expensive than the hardware of prior art microprocessors. As a comparison, s one embodiment including the present invention designed to run all available X86 applications is implemented by a morph host including approximately one-quarter of the number of gates of the Pentium Pro microprocessor yet runs X86 applications substantially faster than does the Pentium Pro microprocessor or any other known microprocessor capable of o processing these applications.

The code morphing software utilizes certain techniques which have previously been used only by programmers designing new software or emulating new hardware. The morph host includes hardware enhancements especially adapted to allow the acceleration techniques S provided by the code morphing software to be utilized efficiently. These hardware enhancements allow the code morphing software to implement acceleration techniques over a broader range of instructions. These hardware enhancements also permit additional acceleration techniques to be practiced by the code morphing software which are unavailable in 20 hardware processors and could not be implemented in those processors except at exorbitant cost. These techniques significantly increase the speed of the microprocessor which includes the present invention compared to the speeds of prior art microprocessors practicing the e~ecution of native instruction sets.

2s For example, the code morphing software combined with the enhanced morph host allows the use of techniques which allow the reordering and rescheduling of primitive instructions generated by a sequence of target instructions without requiring the addition of significant circuitry. By allowing the reordering and rescheduling of a number of target instructions together, other optimization techniques can be used to reduce the number of processor steps which are necessary to carry out a group of target instructions to fewer than those required by any other microprocessors s which will run the target applications.

The code morphing software combined with the enhanced morph host translates target instructions into instructions for the morph host on the fly and caches those host instructions in a memo~r data structure (referred to in this specification as a "translation buffer"). The use of a translation o buffer to hold translated instructions allows instructions to be recalled without rerunning the lengthy process of determining which primitive instructions are required to implement each target instruction, addressing each primitive instruction, fetching each primitive instruction, optimi~ing the sequence of primitive instructions, allocating assets to each primitive instruction, reordering the primitive instructions, and executing each step of each sequence of primitive instructions involved each time each target instruction is executed. Once a target instruction has been translated, it may be recalled from the translation buffer and executed without the need for any of these myriad of steps.

A primary problem of prior art emulation techniques has been the inability of these techniques to handle with good performance exceptions generated during the execution of a target program. This is especially true of exceptions generated in running the target application which are directed to the target operating system where the correct target state must be available at the time of any such exception for proper execution of the exception and the instructions which follow. Consequently, the emulator is forced to keep accurate track of the target state at all times and must constantly check to determine whether a store is to the target code area. Other exceptions W O 98tl3740 PCTAUS97/169 create ~imil~r problems. For example, exceptions can be generated by the emulator to detect particular target operations which have been replaced by some particular host function. In particular, various hardware operations of a target processor may be replaced by software operations provided by the 5 emulator software. Additionally, the host processor executing the host instructions derived from the target instructions can also generate exceptions. All of these exceptions can occur either during the attempt to change target instructions into host instructions by the emulator, or when the host translations are executed on the host processor. An efficient o emulation must provide some manner of recovering from these exceptions efficiently and in a manner that the exception may be correctly handled.
None of the prior art does this for all software which might be emulated.

In order to overcome these limitations of the prior art, a number of hardware improvements are included in the enhanced morph host. These 5 improvements include a gated store buffer and a large plurality of additional processor registers. Some of the additional registers allow the use of register ren~ming to lessen the problem of instructions needing the same hardware resources. The additional registers also allow the maintenance of a set of host or working registers for processing the host instructions and a set of 20 target registers to hold the official state of the target processor for which the target application was created. The target (or shadow) registers are connected to their working register equivalents through a dedicated interface that allows an operation called "commit" to quickly transfer the content of all working registers to official target registers and allows an operation called 25 "rollback" to quickly transfer the content of all official target registers back to their working register equivalents. The gated store buffer stores working memory state changes on an "uncommitted" side of a hardware "gate" and official memory state changes on a "committed" side of the hardware gate W O 98/13740 PCTrUS97/16911 where these committed stores "drain" to main memory. A commit operation transfers stores from the uncommitted side of the gate to the committed side of the gate. The additional official registers and the gated store buffer allow the state of memory and the state of the target registers to be updated s together once one or a group of target instructions have been translated and run without error.

These updates are chosen by the code morphing software to occur on integral target instruction boundaries. Thus, if the primitive host instructions making up a translation of a series of target instructions are o run by the host processor without generating exceptions, then the working memory stores and working register state generated by those instructions are transferred to official memory and to the official target registers. In thismanner, if an exception occurs when processing the host instructions at a point which is not on the boundary of one or a set of target instructions being translated, the original state in the target registers at the last update (or commit) may be recalled to the working registers and uncommitted memory stores in the gated store buffer may be dumped. Then, for the case where the exception generated is a target exception, the target instructions causing the target exception may be retranslated one at a time and executed 20 in serial sequence as they would be executed by a target microprocessor. As each target instruction is correctly executed without error, the state of the target registers may be updated; and the data in the store buffer gated to memory. Then, when the exception occurs again in running the host instructions, the correct state of the target computer is held by the target 2s registers of the morph host and memory; and the operation may be correctly handled without delay. Each new translation generated by this corrective translating may be cached for future use as it is translated or alternatively dumped for a one time or rare occurrence such as a page fault. This allows W O 98/13740 25 PCT~US97/16911 the microprocessor created by the combination of the code morphing software and the morph host to execute the instructions more rapidly than processors for which the software was originally written.

It should be noted that in executing target programs using the 5 microprocessor including the present invention, many different types of exceptions can occur which are handled in different manners. For example, some exceptions are caused by the target software generating an exception which utilizes a target operating system exception handler. The use of such an exception handler requires that the code morphing software include 0 routines for emulating the entire exception handling process including any hardware provided by the target computer for handling the process. This requires that the code morphing software provide for saving the state of the target processor so that it may proceed correctly after the exception has been handled. Some exceptions like a page fault, which requires fetching data in a new page of memory before the process being translated may be implemented, require a return to the beginning of the process being translated after the exception has been handled. Other exceptions implement a particular operation in software where that operation is not provided by the hardware. These require that the exception handler return 20 the operation to the next step in the translation after the exception has been handled. Each of these different types of exceptions may be efficiently handled by microprocessor including the present invention.

Additionally, some exceptions are generated by host hardware and detect a variety of host and target conditions. Some exceptions behave like 25 exceptions on a conventional microprocessor, but others are used by the code morphing software to detect failure of various speculations. In these cases, the code morphing software, using the state saving and restoring mechanisms described above, causes the target state to be restored to its W O 98/13740 PCTrUS97/16911 most recent official version and generates and saves a new translation (or re-uses a previously generated safe translation) which avoids the failed speculation. This translation is then executed.

The morph host includes additional hardware exception detection 5 mechanisms that in conjunction with the rollback and retranslate method described above allow further optimization. Examples are a means to distinguish memory from memory mapped I/O and a means to eliminate memory references by protecting addresses or address ranges thus allowing target variables to be kept in registers.

o For the case where exceptions are used to detect failure of other speculations, such as whether an operation affects memory or memory mapped I/O, recovery is accomplished by the generation of new translations with different memory operations and different optimizations.

Figure 2 is a diagram of morph host hardware represented running the 1S same application program which is being run on the CISC processor of Figure l(a). As may be seen, the microprocessor includes the code morphing software portion and the enhanced hardware morph host portion described above. The target application furnishes the target instructions to the code morphing software for translation into host instructions which the morph host is capable of executing. In the meantime, the target operating system receives calls from the target application program and transfers these to the code morphing software. In a preferred embodiment of the microprocessor, the morph host is a very long instruction word (VLIW) processor which is designed with a plurality of processing channels. The overall operation of such a processor is further illustrated in F~igure 6(c).

In Figure 6(a)-(c) are illustrated instructions adapted for use with each of a CISC processor, a RISC processor, and a VLIW processor. As may be seen, the CISC instructions are of varied lengths and may include a plurality of more primitive operations te.g., load and add). The RISC instructions, on 5 the other hand, are of equal length and are essentially primitive operations.
The single very long instruction for the VLIW processor illustrated includes each of the more primitive operations (i.e., load, store, integer add, compare, floating point multiply, and branch) of the CISC and RISC instructions. As may be seen in Figure 6(c), each of the primitive instructions which together o make up a single very long instruction word is furnished in parallel with the other primitive instructions either to one of a plurality of separate processing channels of the VLIW processor or to memory to be dealt with in parallel by the processing channels and memory. The results of all of these parallel operations are transferred into a multiported register file.

A VLIW processor which may be the basis of the morph host is a much simpler processor than the other processors described above . It does not include circuitry to detect issue dependencies or to reorder, optimize, and reschedule primitive instructions. This, in turn, allows faster processing at higher clock rates than is possible with either the processors for which the 20 target application programs were originally designed or other processors using emulation programs to run target application programs. However, the processor is not limited to VLIW processors and may function as well with any type of processor such as a RISC processor.

The code morphing software of the microprocessor shown in Figure 2 25 includes a translator portion which decodes the instructions of the target application, converts those target instructions to the primitive host instructions capable of execution by the morph host, optimizes the operations required by the target instructions, reorders and schedules the . .

WO 98/13740 28 PCTrUS97/16911 primitive instructions into VLIW instructions (a translation) for the morph host, and executes the host VLIW instructions. The operations of the translator are illustrated in Figure 7 which illustrates the operation of the main loop of the code morphing software.

s In order to accelerate the operation of the microprocessor which includes the code morphing software and the enhanced morph host hardware, the code morphing software includes a translation buffer as is illustrated in Figure 2.
The translation buffer of one embodiment is a software data structure which may be stored in memory; a hardware cache might also be utilized in a o particular embodiment. The translation buffer is used to store the host instructions which embody each completed translation of the target instructions. As may be seen, once the individual target instructions have been translated and the resulting host instructions have been optimized, reordered, and rescheduled, the resulting host translation is stored in the translation buffer. The host instructions which make up the translation are then executed by the morph host. If the host instructions are executed without generating an exception, the translation may thereafter be recalled whenever the operations required by the target instruction or instructions are required.

Thus, as shown in Figure 7, a typical operation of the code morphing software of the microprocessor when furnished the address of a target instruction by the application program is to first determine whether the target instruction at the target address has been translated. If the target instruction has not been translated, it and subsequent target instructions are fetched, decoded, translated, and then (possibly) optimized, reordered, and rescheduled into a new host translation, and stored in the translation buffer by the translator. As will be seen later, there are various degrees of optimization which are possible. The term "optimization" is often used W O 98/13740 PCTrus97/16911 ~9 generically in this specification to refer to those techniques by which processing is accelerated. For example, reordering is one form of optimization which allows faster processing and which is included within the term. Many of the optimizations which are possible have been described s within the prior art of compiler optimizations, and some optimizations which were difficult to perform within the prior art like ~super-blocks" come from VLIW research. Control is then transferred to the translation to cause execution by the enhanced morph host hardware to resume.

When the particular target instruction sequence is next encountered in ~o running the application, the host translation will then be found in the translation buffer and irnmediately executed without the necessity of translating, optimi~ing, reordering, or rescheduling. Using the advanced techniques described below, it has been estimated that the translation for a target instruction (once completely translated) will be found in the translation buffer all but once for each one million or so executions of the translation. Consequently, after a first translation, all of the steps required for translation such as decoding, fetching primitive instructions, optimi~ing the primitive instructions, rescheduling into a host translation, and storing in the translation buffer may be eliminated from the processing required.
20 Since the processor for which the target instructions were written must decode, fetch, reorder, and reschedule each instruction each time the instruction is executed, this drastically reduces the work required for executing the target instructions and increases the speed of the improved microprocessor .

25 In eliminating all of these steps required in execution of a target application by prior art processors, the microprocessor including the present invention overcomes problems of the prior art which made such operations impossible at any reasonable speed. For example, some of the techniques of the .. ..

W O 98tl3740 PCTrUS97/16911 improved microprocessor were used in the emulators described above used for porting applications to other systems. However, some of these emulators had no way of running more than short portions of applications because in processing translated instructions, exceptions which generate calls to s various system exception handlers were generated at points in the operation at which the state of the host processor had no relation to the state of a target processor processing the same instructions. Because of this, the state of the target processor at the point at which such an exception was generated was not known. Thus, correct state of the target machine could 0 not be determined; and the operation would have to be stopped, restarted, and the correct state ascertained before the exception could be serviced and execution continued. This made running an application program at host speed impossible.

The morph host hardware includes a number of enhancements which overcome this problem. These enhancements are each illustrated in Figures 3, 4, and 5. In order to determine the correct state of the registers at the time an error occurs, a set of official target registers is provided by the enhanced hardware to hold the state of the registers of the target processor for which the original application was designed. These target registers may 20 be included in each of the floating point units, any integer units, and any other execution units. These official registers have been added to the morph host along with an increased number of normal working registers so that a number of optimizations including register renaming may be practiced. One embodiment of the enhanced hardware includes sixty-four working registers 25 in the integer unit and thirty-two working registers in the floating point unit.
The embodiment also includes an enhanced set of target registers which include all of the frequently changed registers of the target processor necessary to provide the state of that processor; these include condition W O 98/13740 PCT~US97/16911 control registers and other registers necessary for control of the simulated system.

It should be noted that depending on the type of enhanced processing hardware utilized by the morph host, a translated instruction sequence may s include primitive operations which constitute a plurality of target instructions from the original application. For example, a VLIW
microprocessor may be capable of rl7nning a plurality of either CISC or RISC
instructions at once as is illustrated in Figure 6(a)-~c). Whatever the morph host type, the state of the target registers of the morph host hardware is not 0 changed except at an integral target instruction boundary; and then all target registers are updated. Thus, if the microprocessor is executing a target instruction or instructions which have been translated into a series of primitive instructions which may have been reordered and rescheduled into a host translation, when the processor begins executing the translated instruction sequence, the official target registers hold the values which would be held by the registers of the target processor for which the application was designed when the first target instruction was addressed.
After the morph host has begun executing the translated instructions, however, the working registers hold values determined by the primitive 20 operations of the translated instructions executed to that point. Thus, whilesome of these working registers may hold values which are identical to those in the official target registers, others of the working registers hold values which are meaningless to the target processor. This is especially true in an embodiment which provides many more registers than does a particular 2s target machine in order to allow advanced acceleration techniques. Once the translated host instructions begin, the values in the working registers are whatever those translated host instructions determine the condition of those registers to be. If a set of translated host instructions is executed W O 98/13740 32 PCTrUS97/16911 without generating an exception, then the new working register values determined at the end of the set of instructions are transferred together to the official target registers (possibly including a target instruction pointer register). In the present embodiment of the processor, this transfer occurs 5 outside of the execution of the host instructions in an additional pipeline stage so it does not slow operation of the morph host.

In a ~imil~r manner, a gated store buffer such as that illustrated in Figure 5 is utilized in the hardware of the improved microprocessor to control the transfer of data to memory. The gated store buffer includes a number of 0 elements each of which may hold the address and data for a memory store operation. These elements may be implemented by any of a number of different hardware arrangements (e.g., first-in first-out buffers); the embodiment illustrated is implemented utilizing random access memory and three dedicated working registers. The three registers store, respectively, a pointer to the head of the queue of memory stores, a pointer to the gate, and a pointer to the tail of the queue of the memory stores. Memory stores positioned between the head of the queue and the gate are already committed to memory, while those positioned between the gate of the queue and the tail are not yet committed to memory. Memory stores generated 20 during execution of host translations are placed in the store buffer by the integer unit in the order generated during the execution of the host instructions by the morph host but are not allowed to be written to memory until a commit operation is encountered in a host instruction. Thus, as translations execute, the store operations are placed in the queue.
25 Assuming these are the first stores so that no other stores are in the gated store buffer, both the head and gate pointers will point to the same position.
As each store is executed, it is placed in the next position in the queue and the tail point is incremented to the next position (upward in the figure). This WO 98/13740 PCTrUS97/16911 continues until a commit comm~nd is executed. This will normally happen when the translation of a set of target instructions has been completed without generating an exception or a error exit condition. When a translation has been executed by the morph host without error, then the 5 memory stores in the store buffer generated during execution are moved together past the gate of the store buffer (committed) and subsequently written to memory. In the embodiment illustrated, this is accomplished by copying the value in the register holding the tail pointer to the register holding the gate pointer.

Thus, it may be seen that both the transfer of register state from working registers to official target registers and the transfer of working memory stores to official memory occur together and only on boundaries between integral target instructions in response to explicit commit operations.

This allows the microprocessor to recover from target exceptions which 15 occur during execution by the enhanced morph host without any significant delay. If a target exception is generated during the running of any translated instruction or instructions, that exception is detected by the morph host hardware or software. In response to the detection of the target exception, the code morphing software may cause the values retained in the 20 official registers to be placed back into the working registers and any non-committed memory stores in the gated store buffer to be dumped (an operation referred to as "rollback"). The memory stores in the gated store buffer of Figure 5 may be dumped by copying the value in the register holding the gate pointer to the register holding the tail pointer.

25 Placing the values from the target registers into the working registers may place the address of the first of the target instructions which were running when the exception occurred in the working instruction pointer register.

W O 98/13740 rCTAUS97/16911 Beginning with this official state of the target processor in the working registers, the target instructions which were running when the exception occurred are retranslated in serial order without any reordering or other optimi7in~. After each target instruction is newly decoded and translated into a new host translation, the translated host instruction representing the target instructions is executed by the morph host and causes or does not cause an exception to occur. (If the morph host is other than a VLIW
processor, then each of the primitive operations of the host translation is executed in sequence. If no exception occurs as the host translation is run, o the next primitive function is run.) This continues until an exception re-occurs or the single target instruction has been translated and executed. In one embodiment, if a translation of a target instruction is executed without an exception being generated, then the state of working registers is transferred to the target registers and any data in the gated store buffer is committed so that it may be transferred to memory. However, if an exception re-occurs during the running of a translation, then the state of the target registers and memoly has not changed but is identical to the state produced in a target computer when the exception occurs. Consequently, when the target exception is generated, the exception will be correctly 20 handled by the target operating system.

Similarly, once a first target instruction of the series of instructions the translation of which generated an exception has been executed without generating an exception, the target instruction pointer points to the next of the target instructions. This second target instruction is decoded and 25 retranslated without optimizing or reordering in the same manner as the first. As each of the host translations of a single target instruction is processed by the morph host, any exception generated will occur when the state of the target registers and memory is identical to the state which would W O 98/13740 PCTrUS97/16911 occur in the target computer. Consequently, the exception may be immediately and correctly handled. These new translations may be stored in the translation buffer as the correct translations for that sequence of instructions in the target application and recalled whenever the instructions s are rerun.

Other embodiments for accomplishing the same result as the gated store buffer of Figure 5 might include arrangements for transferring stores directly to memory while recording data sufficient to recover state of the target computer in case the execution of a translation results in an exception or an error necessitating rollback. In such a case, the effect of any memory stores which occurred during translation and execution would have to be reversed and the memory state existing at the beginning of the translation restored;
while working registers would have to receive data held in the official target registers in the manner discussed above. One embodiment for s accomplishing this maintains a separate target memory to hold the original memory state which is then utilized to replace overwritten memory if a rollback occurs. Another embodiment for accomplishing memory rollback logs each store and the memory data replaced as they occur, and then reverses the store process if rollback is required.

20 The code morphing software provides an additional operation which greatly enhances the speed of processing programs which are being translated. In addition to simply translating the instructions, optimizing, reordering, rescheduling, caching, and executing each translation so that it may be rerun whenever that set of instructions needs to be executed, the translator 2s also links the different translations to eliminate in almost all cases a return to the main loop of the translation process. Figure 8 illustrates the steps carried out by the translator portion of the code morphing software in accomplishing this linking process. It will be understood by those skilled in CA 02262928 l999-02-03 W O 98/13740 PCTrUS97/16911 the art that this linking operation essentially elimin~tes the return to the main loop for most translations of instructions, which eliminates this overhead.

Presume for exemplary purposes that the target program being run consists 5 of X86 instructions. When a translation of a sequence of target instructions occurs and the primitive host instructions are reordered and rescheduled, two primitive instructions may occur at the end of each host translation.
The first is a primitive instruction which updates the value of the instruction pointer for the target processor (or its equivalent); this instruction is used to ]o place the correct address of the next target instruction in the target instruction pointer register. Following this primitive instruction is a branch instruction which contains the address of each of two possible targets for the branch. The manner in which the primitive instruction which precedes the branch instruction may update the value of the instruction pointer for 15 the target processor is to test the condition code for the branch in the condition code registers and then determine whether one of the two branch addresses indicated by the condition controlling the branch is stored in the translation buffer. The first time the sequence of target instructions is translated, the two branch targets of the host instruction both hold the 20 same host processor address for the main loop of the translator software.

When the host translation is completed, stored in the translation buffer, and executed for the first time, the instruction pointer is updated in the target instruction pointer register (as are the rest of the target registers); and the operation branches back to the main loop. At the main loop, the translator 25 software looks up the instruction pointer to the next target instruction in the target instruction pointer register. Then the next target instruction sequence is addressed. Presuming that this sequence of target instructions has not yet been translated and therefore a translation does not reside in W O98/13740 PCTrUS97/16911 the translation buffer, the next set of target instructions is fetched from memory, decoded, translated, optimized, reordered, rescheduled, cached in the translation buffer, and executed. Since the second set of target instructions follows the first set of target instructions, the primitive branch s instruction at the end of the host translation of the first set of target instructions is automatically updated to substitute the address of the host translation of the second set of target instructions as the branch address for the particular condition controlling the branch.

If then, the second translated host instruction were to loop back to the first o translated host instruction, the branch operation at the end of the second translation would include the main loop address and the X86 address of the first translation as the two possible targets for the branch. The update-instruction-pointer primitive operation preceding the branch tests the condition and determines that the loop back to the first translation is to be s taken and updates the target instruction pointer to the X86 address of the first translation. This causes the translator to look in the translation buffer to see if the X86 address being sought appears there. The address of the first translation is found, and its value in host memory space is substituted for the X86 address in the branch at the end of the second host translated 20 instruction. Then, the second host translated instruction is cached and executed. This causes the loop to be run until the condition causing the branch from the first translation to the second translation fails, and the branch takes the path back to the main loop. When this happens, the first translated host instruction branches back to the main loop where the next 25 set of target instructions designated by the target instruction pointer is searched for in the translation buffer, the host translation is fetched from the cache; or the search in the translation buffer fails, and the target instructions are fetched from memoIy and translated. When this translated W O 98/13740 PCT~US97/16911 host instruction is cached in the translation buffer, its address replaces the main loop address in the branch instruction which ended the loop.

In this manner, the various translated host instructions are chained to one another so that the need to follow the long path through the translator main 5 loop only occurs where a link does not exist. Eventually, the main loop references in the branch instructions of host instructions are almost completely eliminated. When this condition is reached, the time required to fetch target instructions, decode target instructions, fetch the primitive instructions which make up the target instructions, optimize those primitive o operations, reorder the primitive operations, and reschedule those primitive operations before running any host instruction is elimin~ted. Thus, in contrast to all prior art microprocessors which must take each of these steps each time any application instruction sequence is run, the work required to run any set of target instructions using the improved microprocessor after s the first translation has taken place is drastically reduced. This work is further reduced as each set of translated host instructions is linked to the other sets of translated host instructions. In fact, it is estimated that translation will be needed in less than one translation execution out oi one million during the running of an application.

20 Those skilled in the art will recognize that the implementation of the microprocessor requires a large translation buffer since each set of instructions which is translated is cached in order that it need not be translated again. Translators designed to function with applications programmed for different systems will vary in their need for supporting 25 buffer memory. However, one embodiment of the microprocessor designed to run X86 programs utilizes a translation buffer of two megabytes of random access memory.

W O 98113740 PCTrUS97/16911 Two additional hardware enhancements help to increase the speed at which applications can be processed by the microprocessor which includes the present invention. The first of these is an abnormal/normal (A/N) protection bit stored with each address translation in a translation look-5 aside buffer (TLB) (see Figure 3) where lookup of the physical address oftarget instructions is first accomplished. Target memory operations within translations can be of two types, ones which operate on memory (normal) or ones which operate on a memory mapped I/O device (abnormal).

A normal access which affects memory completes normally. When o instructions operate on memory, the optimizing and reordering of those instructions is appropriate and greatly aids in speeding the operation of any system using the microprocessor which includes the present invention. On the other hand, the operations of an abnormal access which affects an l/O
device often must be practiced in the precise order in which those operations are programmed without the elimination of any steps or they may have some adverse affect at the I/O device. For example, a particular I/O
operation may have the effect of clearing an I/O register; if the primitive operations take place out of order, then the result of the operations may be different than the operation commanded by the target instruction. Without 20 a means to distinguish memory from memoly mapped I/O, it is necessary to treat all memoIy with the conservative assumptions used to translate instruction which affect memory mapped I/O. This severely restricts the nature of optimizations that are achievable Because prior art emulators lacked means to both detect a failure of speculation on the nature of the 25 memory being addressed, and means to recover from such failures, their performance was restricted.

In one embodiment of the microprocessor illustrated in Figure 11, the A/N
bit is a bit which may be set in the translation look-aside buffer to indicate W O 98113740 PCT~US97/16911 either a memory page or memory-mapped I/O. The translation look-aside buffer stores page table entries for memory accesses. Each such entry includes a virtual address being accessed and the physical address at which the data sought may be accessed as well as other information regarding the s entry. In the present invention, the A/N bit is part of that other information and indicates whether the physical address is a memory address or a memory-mapped I/O address. A translation of an operation which affects memory as though it were a memory operation is actually a speculation that the operation is one affecting memory. In one embodiment, when the code o morphing software first attempts to execute a translation which requires an access of either memory or a memory-mapped I/O device, it is actually presuming that the access is a memory access. In a different embodiment, the software might presume the target comm~3nd requires an I/O access.
Presuming an access of that address has not previously been accomplished, 5 there will be no entry in the translation look-aside buffer; and the access will fail in the translation look-aside buffer. This failure causes the software to do a page table lookup and fill a storage location of the translation look-aside buffer with the page table entry to provide the correct physical address translation for the virtual address. In accomplishing this, the software 20 causes the A/N bit for the physical address to be entered in the translation look-aside buffer. Then another attempt to execute the access takes place once more assuming that the access is of a memory address. As the access is attempted, the target memory reference is checked by comparing the access type presumed (normal or abnormal) against the A/N protection bit 25 now in the TLB page table entry. When the access type does not match the A/N protection, an exception occurs. If the operation in fact affects memory, then the optimi~ing, reordering, and rescheduling techniques described above were correctly applied during translation. If the comparison with the A/N bit in the TLB shows that the operation, however, affects an I/O device, W O 98/13740 PCTrUS97/16911 then execution causes an exception to be taken; and the translator produces a new translation one target instruction at a time without optimi7.ing, reordering, or rescheduling of any sort. Similarly, if a translation incorrectlyassumes an I/O operation for an operation which actually affects memory, s execution causes an exception to be taken; and the target instructions are retranslated using the optimizing, reordering, and rescheduling techniques.
In this manner, the processor can enhance performance beyond what has been traditionally possible.

It will be recognized by those skilled in the art that the technique which o uses the A/N bit to determine whether a failure of speculation has occurred as to whether an access is to memory or a memory-mapped l/O device may also be used for speculations regarding other properties of memory-mapped addresses. For example, different types of memory might be distinguished using such a normal/abnormal bit. Other similar uses is distinguishing memory properties will be found by those skilled in the art.

One of the most frec~uent speculations practiced by the improved microprocessor is that target exceptions will not occur within a translation.
This allows significant optimization over the prior art. First, target state does not have to be updated on each target instruction boundary, but only 20 on target instruction boundaries which occur on translation boundaries.
This elimin~tes instructions necessary to save target state on each target instruction boundary. Optimizations that would previously have been impossible in scheduling and removing redundant operations are also made possible.

25 The improved microprocessor is admirably adapted to select the appropriate process of translation. In accordance with the method of translating described above, a set of instructions may first be translated as though it W O 98/13740 PCT~US97/16911 were to affect memory. When the optimized, reordered, and rescheduled host instructions are then executed, the address may be found to refer to an I/O device by the condition of the A/N bit provided in the translation look-aside buffer. The comparison of the A/N bit and the translated instruction s address which shows that an operation is an I/O operation generates an error exception which causes a software initiated rollback procedure to occur, causing any uncommitted memory stores to be dumped and the values in the target registers to be placed back into the working registers.
Then the translation starts over, one target instruction at a time without o optimization, reordering, or rescheduling. This re-translation is the appropriate host translation for an I/O device.

In a simil~r manner, it is possible for a memory operation to be incorrectly translated as an I/O operation. The error generated may be used to cause its correct re-translation where it may be optimized, reordered, and rescheduled to provide faster operation.

Prior art emulators have also struggled with what is generally referred to as self modifying code. Should a target program write to the memory that contains target instructions, this will cause translations that exist for these target instructions to become "stale" and no longer valid. It is necessary to detect these stores as they occur dynamically. In the prior art, such detection has to be accomplished with extra instructions for each store.
This problem is larger in scope than programs modifying themselves. Any agent which can write to memory, such as a second processor or a DMA
device, can also cause this problem.

The present invention deals with this problem by another enhancement to the morph host. A translation bit (T bit) which may also be stored in the translation look-aside buffer is used to indicate target memory pages for W O98/13740 PCTrUS97/16911 which translations exist. The T bit thus possibly indicates that particular pages of target memory contain target instructions for which host translations exist which would become stale if those target instructions were to be over~,vritten. If an attempt is made to write to the protected pages in s memory, the presence of the translation bit will cause an exception which when handled by the code morphing software can cause the appropriate translation(s) to be invalidated or removed from the translation buffer. The T bit can also be used to mark other target pages that translation may rely upon not being written.

o This may be understood by referring to Figure 3 which illustrates in block diagram form the general functional elements of the microprocessor which includes the invention. When the morph host executes a target program, it actually runs the translator portion of the code morphing software which includes the only original untranslated host instructions which effectively s run on the morph host. To the right in the figure is illustrated memory divided into a host portion including essentially the translator and the translation buffer and a target portion including the target instructions and data, including the target operating system. The morph host hardware begins executing the translator by fetching host instructions from memory 20 and placing those instructions in an instruction cache. The translator instructions generate a fetch of the first target instructions stored in the target portion of memory. Carrying out a target fetch causes the integer unit to look to the official target instruction pointer register for a first address of a target instruction. The first address is then accessed in the translation 2s look-aside buffer of the memory management unit. The memory m~n~3gement unit includes hardware for paging and provides memory mapping facilities for the TLB. Presuming that the TLB is correctly mapped so that it holds lookup data for the correct page of target memory, the target W O 98/13740 PCTrUS97/16911 instruction pointer value is translated to the physical address of the target instruction. At this point, the condition of the bit (T bit) indicating whether a translation has been accomplished for the target instruction is detected;
but the access is a read operation, and no T bit exception will occur. The 5 condition of the A/N bit indicating whether the access is to memory or memory mapped I/O is also detected. Presuming the last mentioned bit indicates a memory location, the target instruction is accessed in target memory since no translation exists. The target instruction and subsequent target instructions are transferred as data to the morph host computing 0 units and translated under control of the translator instructions stored in the instruction cache. The translator instructions utilize reordering, optimi7ing, and rescheduling techniques as though the target instruction affected memory. The resulting translation containing a sequence of host instructions is then stored in the translation buffer in host memory. The translation IS transferred directly to the translation buffer in host memory via the gated store buffer. Once the translation has been stored in host memory, the translator branches to the translation which then executes.
The execution (and subsequent executions) will determine if the translation has made correct assumptions concerning exceptions and memory. Prior to 20 executing the translation, the T bit for the target page(s) containing the target instructions that have been translated is set. This indication warns that the instruction has been translated; and, if an attempt to write to the target address occurs, the attempt generates an exception which causes the translation to possibly be invalidated or removed.

25 If a write is attempted to target pages marked by a T bit, an exception occurs and the write is aborted. The write will be allowed to continue after the response to the exception assures that translations associated with the target memory address to be written are either marked as invalid or W O 98/13740 PCT~US97/16911 otherwise protected against use until they have been appropriately updated.
Some write operations will actually require nothing to be done since no valid translations will be affected. Other write operations will require that one or more translations associated with the addressed target memory be appropriately marked or removed. Figure 11 illustrates one embodiment of a translation look-aside buffer including storage positions with each entry for holding a T bit indication.

An additional hardware enhancement to the morph host is a circuit utilized to allow data which is normally stored in memory but is used quite often in o the execution of an operation to be replicated (or "aliased") in an execution unit register in order to elimin~te the time required to fetch the data from or store the data to memory. For example, if data in memory is reused frequently during the execution of a code sequence, the data must typically be retrieved from memory and loaded to a register in an execution unit each 5 time the data is used. To reduce the time required by such frequent memory accesses, the data may according to the present invention instead be loaded once from memory to an execution unit register at the beginning of the code sequence and the register designated to function in place of the memory space during the period in which the code sequence continues.
20 Once this has been accomplished, each of the load operations which would normally involve loading data to a register from the designated memory address becomes instead a simple register-to-register copy operation which proceeds at a much faster pace; and even those copy operations may frequently be eliminated by further optimization.

2s Similarly, execution of a code sequence often requires that data be written to a memory address frequently during the execution of a code sequence. To reduce the time required by such frequent memory stores to the same address, each time the data is to be written to the memory address, according to the present invention, it may be transferred to an execution unit register which is designated to function in place of the memory space during the period in which the code sequence is continuing. Once an execution unit register has been designated, each change to the data 5 requires only a simple register-to-register transfer operation which proceeds much faster than storing to a memory address.

The present invention provides a unique arrangement to accomplish these ~liasirlg operations. In one embodiment illustrated in Figure 10, the morph host is designed to respond to a "load and protect" command with respect to o a designated memory address which is to be used frequently in a code sequence. The morph host allocates a working register 111 in an execution unit 110 to hold the memory data and stores the memory address in a special register 112 of the memory control unit. The working register 111 may be one of a number of registers (e.g., eight of the working registers illustrated in Figure 4) in an execution unit which may be allocated for such a purpose.

When the invention is used to eliminate loads from a memory address to the execution unit, the data at the memory address is first loaded to the register 111 and the memory address placed in the register 112. Thereafter, the 20 code sequence is executed at an accelerated rate using the data in the register 111. During this period, each operation which would normally require a load from the memory address held in the register 112 is accomplished instead by copying the data from the register l l l. This continues until the code sequence is complete (or terminates in some other 25 manner) and the protection of the memory space is removed.

Similarly, in order to accelerate a code sequence which constantly stores data from an execution unit 110 to the same memory address, a .simil:~r WO 98/13740 PCT~US97/16911 47 aliasing process may be practiced. A "load and protect" command causes the memory address to be placed in the register 112 and the data which would normally be stored at that memory address to be transferred instead to the working register 111. For example, in a computation in which a loop 5 execution would normally be storing a series of values to the same memory address, by allocating a register 111 to hold the data and holding the memory address in a register 112, the process of storing becomes a register-to-register transfer within the execution unit. This operation also continues until the code sequence is complete (or terminates in some other manner), o the memory space is updated, and the protection of the memory space is removed.

Although each of these aliasing techniques greatly enhances the speed of execution of some code sequences, these operations by which memory accesses are elimin~ted give rise to a significant number of problems. This especially true where a substantial portion of the host processor operations relate to translation of instructions between a target instruction set and the host instruction set. All of these problems are related to the necessity to assure that data which is to be used in the execution of an instruction is valid at the time it is to be used.

20 There are a number of instances in which data stored at a memory address and data stored in an execution unit register may differ so that one or the other is invalid at any particular instant. For example, if a working register 111 is being used to hold data which would normally be loaded frequently from the memory space to registers during a code sequence, an instruction 25 may write to the memory address before the code sequence using the data in the execution unit register completes. In such a case, the data in the execution unit register being utilized by the code sequence will be stale and must be updated.

CA 02262928 l999-02-03 W O 98/13740 PCTrUS97/16911 As another example, if a working register is being used to hold data which would normally be stored frequently to a memory address during a code sequence, an instruction may attempt to write to the memory address before the code sequence using the execution unit register in place of memory s completes. If the host processor is functioning in a mode in which data at the memory address is normally updated only at the end of the code sequence (a write-back mode), the data in the execution unit register will be stale and must be updated from data written to the memory address. Of course, if the host processor is functioning in a mode in which data at the o memory address is normally updated each time it is written to the execution unit register (a write through mode), then the register and memory will be consistent.

As yet another example, if a working register is being used to hold data which would normally be stored frequently during a code sequence to a 5 memory address, an instruction may attempt to read data from the memory address before the code sequence transferring data to the register l l l completes. If the host processor is functioning in a mode in which data at the memory address is normally updated only at the end of the code sequence (a write-back mode), the data in memory will be stale and must be 20 updated by data from the execution unit register before the read is allowed.
As with the example above, if the host processor is functioning in a mode in which data at the memory address is normally updated each time it is written to the execution unit register (a write through mode), then the register and memory will be consistent.

2s Another possibility by which data held in memory and in aliasing registers may become inconsistent exists because the microprocessor formed by the combination of the morph host and the code morphing software is adapted to reorder and reschedule host instructions to accelerate execution. As will W O 98/13740 PCTrUS97/16911 be seen in the various examples of code sequences provided below, once memory data has been aliased in an execution unit register to be used in the execution of a code sequence, the data in the execution unit register may be copied to other registers and a process of reordering and rescheduling s instructions may then occur. If reordering and rescheduling has occurred, it is possible for an instruction in the code sequence to write to the memory address which is being aliased so that the data in the execution unit register must be updated before further use. However, if the now-stale data in the execution unit register 111 has already beçn copied to additional registers o and the code sequence of instructions using those registers has been altered, then stale data in registers to which the data has been copied may be utilized in carrying out the code sequence. Thus, a second order inconsistency may occur.

To make sure that loads from and stores to the memory address which is 1S being protected do not take place without verifying that the data at the memory address and in the register 111 are consistent after the load or store operation, a comparator 113 in the memo~ control unit is associated with the address register 112. The comparator 113 receives the addresses of loads from memory and stores to the gated store buffer directed to memory 20 during translations. If a memory address for either a load or a store compares with an address in the register 112 (or additional registers depending on the implementation), an exception may be generated depending on the mode. The code morphing software responds to the exception by assuring that the memory address and the execution unit 2s register 111 hold the same correct data. This allows the inconsistencies described above to be corrected.

The manner in which the code morphing software responds depends on the particular exception. If the data are not the same, in one embodiment, the , W O 98/13740 PCT~US97/16911 translation is rolled back and reexecuted without any "aliased~ data in an execution unit register. Such a solution allows the correction of inconsistencies which occur both between memory and the execution unit register and between memory and other registers which have copied the s data from the execution unit register 111 before the code sequence was reordered or rescheduled. Other possible methods of correcting the problem are to update the execution unit register with the latest memory data or memory with the latest load data.

During the period in which a memory address is aliased to eliminate loads o from that memory address, the comparator looks for attempts to write the memory address since the data in the execution unit register 111 may become stale when the new data is written to the memory address. In such a case, the comparator 113 detects the attempt to write to the protected memory address; and generates an exception if such an attempt occurs.
The exception either causes the data in memory to be written to the register 111 to update the register before the register data may be used further, or causes a rollback and execution of code that does not use an execution unit register to accomplish alias optimization. This may involve re-translation of the target code.

20 During the period in which a memory address is aliased to allow sequential store operations using a register 111 to represent the memory address, the generation of an exception for a store to the memory address may be disabled by a command which places the circuitry in a mode (write through mode) in which stores to the memory address from the register 111 may 25 occur without an alias check thereby allowing the repetitive storage to memory at the protected address from the register.

Alternatively, during a period in which a memory address is aliased to allow store operations using a register 111 to represent the memory address, the circuitry may be placed in a mode (write back mode~ in which the data at the memory location is not updated until the code sequence has been completed or otherwise terminated. In such a mode, a write by an instruction to the memory address may require that the data held in the execution unit register be updated to be consistent with the new data. On the other hand, in such a mode, an attempt to read the memo~y address will require that an exception be generated so that the data held in the memory space can be o updated to be consistent with the new data in the execution unit register before it is read.

Figure 12 illustrates alias circuitry including one embodiment of a comparator 120 for detecting and controlling load and store operations to protected memory space in accordance with the present invention. The lS comparator 120 includes a plurality of storage locations 122 (only one of which is illustrated~ such as content addressable memory for entries of memory addresses which are to be protected. For example, there may be eight locations for entries. Each entry includes a sufficient number of bit positions (e.g., 32) to store a physical address for the memory location, a byte mask, and various attribute bits. Among the attribute bits are those indicating the size of the protected memory and whether the memory address is normal or abnormal. It should be noted that the locations for entries in the comparator 120 are each equivalent to a register 112 shown in Figure 10 so that the comparator 120 accomplishes the purpose of both register 112 and comparator 1 13 of Figure 10.

The alias circuitryalso includes an alias enable register 124, aregister 125 for shadowing the alias enable register, an alias fault register 126, a register W O 98113740 52 PCT~US97/16911 127 storing an indication (e.g., a single bit) that the alias circuitry is enabled, and a register 128 storing a mode bit.

In operation, a physical address to be protected is stored in one of the locations for entries together with a byte mask the bits of which indicate 5 which bytes of the location are protected. Such a physical address may address 64 bits of data so that each bit of the byte mask indicates one byte of the data at the address. The particular entry which is protected is indicated by setting a particular bit of the hardware enable register 124.
The register 125 shadows the values in thè register 124 at commit points 0 during translation to allow rollbacks to occur during translation. In the embodiment shown, the enable register 24 and the shadow enable register are physically distributed as attribute bits of the storage locations 122.

When ~ ing is enabled as indicated by the register 127, depending on the condition in which the mode is set as indicated by the register 128, the comparator holds a physical memory address and byte mask and uses those to test addresses of stores to memory or both loads and stores. If the mode is set to a write through condition, then memory is continually updated from the execution unit register holding data for the protected memory address so that loads from that memory address to other addresses are always up to 20 date and need not be checked. However, stores to the memory address may invalidate the data in the execution unit register 112 so these stores must be tested. If a store is to a protected address and its byte mask shows that data is being stored to a protected byte at the memory address held in the comparator 120, then the comparator generates an alias exception in order 25 to test stores in the write through mode.

On the other hand, if the mode is set to a write back condition, then the memory address is only updated when the alias hardware is released or when exceptions occur. Consequently, the data at the memory address may be stale so both load and stores must be tested when the alias hardware is enabled. To accomplish this, if either a load or a store is to a protected address and its byte mask shows that data is being accessed at a protected 5 byte at the memory address held in the comparator 120, then the comparator generates an alias exception.

An exception caused in either mode sets an appropriate bit in the alias fault register 126 to designate the address causing the exception. Depending on the particular exception handler of the code morphing software, the lO particular exception generated may repair or rollback to correct the problem.A repair of the problem causes the most up-to-date data to be placed in the particular bytes affected of the execution unit data register and the memory address. A rollback causes the state of the registers to be replaced by the state held in the target registers; this includes the state of the enable register 124 which is rolled back to the state held in the register 125.

The use of alias detection hardware to allow optimizations that elimin~te loads and stores and also to allow the re-ordering or re-scheduling of operations dependent upon the elimin~ted loads and stores has been described. The re-ordering enables better scheduling of operations in a 20 machine with parallel execution resources, such as a superscaler or VLIW
machine.

The method can also be used to allow the safe re-ordering of operations dependent upon loads or stores, without elimin~ting the load or store operations. This improves scheduling performance and is useful for code 25 where there is no repetition of load or store operations.

It will be recognized by those skilled in the art that the microprocessor may be connected in circuit with typical computer elements to form a computer such as that illustrated in Figure 9. As may be seen, when used in a modern X86 computer the microprocessor is joined by a processor bus to memory and bus control circuitry. The memory and bus control circuitry is arranged to provide access to main memory as well as to cache memory 5 which may be utilized with the microprocessor. The memory and bus control circuitry also provides access to a bus such as a PCI or other local bus through which I/O devices may be accessed. The particular computer system will depend upon the circuitry utilized with a typical microprocessor which the present microprocessor replaces.

0 In order to illustrate the operation of the processor and the manner in which acceleration of execution occurs, the translation of a small sample of X86 target code to host primitive instructions is presented at this point. The sample illustrates the translation of X86 target instructions to morph host instructions including various exemplary steps of optimi~ing, reordering, 5 and rescheduling by the microprocessor which includes the invention. By following the process illustrated, the substantial difference between the operations required to execute the original instructions using the target processor and the operations required to execute the translation on the host processor will become apparent to those skilled in the art.

20 The original instruction illustrated in C language source code describes a very brief loop operation. Essentially, while some variable "n" which is being decremented after each loop remains greater than "0", a value "c" is stored at an address indicated by a pointer "*s" which is being incremented after each loop.
2s Original C code while( (n--)>0) {
*s++=c ====================================================================

W O 98/13740 PCT~US97/16911 Win32 x86 instructions produced by a compiler compiling this C code.
mov ~ecx,[~ebp+Oxc] // load c from memory address into the ~ecx S mov ~eax,[~ebp+Ox8] // load s from memory address into the ~eax mov [~eax],~ecx // store c into memory address s held in ~eax add ~eax,#4 // increment s by 4.
mov [%ebp+Ox8],~eax // store (s + 4) back into memory mov ~eax,[~ebp+OxlO] // load n from memory address into the ~eax lea ~ecx,[~eax-l] // decrement n and store the result in ~ecx mov [~ebp+OxlO],~ecx // store (n-l) into memory and ~eax,~eax // test n to set the condition codes jg .-Oxlb // branch to the top of this section if "n>O"
15 Notation: [] indicates an address expression for a memory operand. In the example above, the address for a memory operand is formed from the contents of a register added to a hexadecimal constan~ indicated by the Ox prefix.
Target registers are indicated with the ~ prefix, e.g. ~ecx is the ecx register. The destination of an operation is to the left.
Target instruction key:
jg = jump if greater mov = move lea = load effective address and = AND
In this first portion of the sample, each of the individual X86 assembly language instructions for carrying out the execution of the operation defined by the C language statement is listed by the assembly language mnemonic for the operation followed by the parameters involved in the particular primitive operation. An explanation of the operation is also provided in a comment for each instruction. Even though the order of execution may be varied by the target processor from that shown, each of these assembly language instructions must be executed each time the loop is executed in carrying out the target C language instructions. Thus, if the loop is executed one hundred times, each instruction shown above must be carried out one hundred times.
Shows each X86 Instruction shown above followed by the host instructions necess7~r to i~ rie~ne~il the X86 Instruction.
mov %ecx, [%ebp+Oxc] // load c from memory address into ecx add RO,Rebp,Oxc ; form the memory address and put it in RO
ld Recx,[RO~ ; load c from memory address in RO into Recx WO 9811374n PCT~US97/16911 mov %eax,[%ebp+Ox8] // load s from memory address into 96eax add R2,Rebp,Ox8 ; form the memory address and put it in R2 ld Reax,[R2] ; load s from memory address in R2 into Recx s mov [%eax~, %ecx // store c into memory address s held in ~eax st [Reax],Recx ; store c into memory address s held in Reax lo add %eax,#4 // increment s by 4 add Reax,Reax,4 i increment S by 4 mov [%ebp+Ox8], %eax // store (s + 4) back into memory add R5,Rebp,Ox8 ; form the memory address and put it in R5 st [R5],Reax ; store (s + 4) back into memory mov %eax,[%ebp~Ox101 // load n from memory address into %eax add R7,Rebp,OxlO ; form the memory address and put it in R7 ld Reax,[R7] ; load n from memory address into the Reax lea %ecx,[%eax-11 // decrement n and store the result in 96ecx sub Recx,Reax,l ; decrement n and store the result in Recx mov [%ebp+Ox101, %ecx // store ~n - l) into memory add R9,Rebp,OxlO ; form the memory address and put it in R9 st [R9],Recx ; store (n - l) into memory and %eax, %eax // test n to set the condition codes andcc Rll,Reax,Reax ; test n to set the condition codes jg .-Ox1b // branch to the top of this section if ~n~O~
jg mainloop,mainloop ; jump to the main loop Host Instruction key:
ld = load add = ADD st =store sub = subtract jg = jump if condition codes indicate greater andcc = and set the condition codes The next sample illustrates the same target primitive instructions which carry out the C language instructions. However, following each primitive target instruction are listed primitive host instructions required to 50 accomplish the same operation in one particular embodiment of the microprocessor in which the morph host is a VLIW processor designed in the manner described herein. It should be noted that the host registers which are shadowed by official target registers are designated by an "R" followed by the X86 register designation so that, for example, Reax is the working 5 register associated with the EAX official tar~et register.
Adds host instructions necess~ry to perform X86 address con~r~u~tion and upper and lower s~y...~nt limit checks.
mov %ecx,[%ebplOxc] // load c add RO,Rebp,Oxc ; form logical address into RO
chkl RO,Rss limit ; Check the logical address against segment lower limit chku RO,R~ ; Check the logical address against segment upper IS limit add Rl,RO,Rss_base ; add the segment base to form the linear address ld Recx,[Rl] ; load c from memory address in R1 into Recx mov %eax,1%ebp~0x81 // load s add R2,Rebp,Ox8 ; form logical address into R0 chkl R2,Rss limit ; Check the logical address against segment lower limit chku R2,R~ F i Check the logical address against segment upper limit add R3,R2,Rss_base ; add the segment base to form the linear address ld Reax,[R3] ; load s from memory address in R3 into Ra mov [%eax], %ecx // store c into [s]
chku Reax,Rds_limit i Check the logical address against segment upper limit add R4,Reax,Rds_base ; add the segment base to form the linear address st rR4],Recx ; store c into memory address s add %eax,#4 // increment s by 4 addcc Reax,Reax,4 ; increment s by 4 WO 98/13740 PCTrUS97tl6911 mov [%ebp~Ox8], %eax /~ store (s + 4) to memory add R5,Rebp,Ox8 ; form logical address into R5 chkl R5,Rss_limit ; Check the logical address against segment lower limit chku R5,R~ ; Check the logical address against segment upper limit add R6,R5,Rss_base ; add the segment base to form the linear address st [R6~,Reax ; store ts + 4) to memory address in R6 mov %eax,[%ebp+Ox10] // load n add R7,Rebp,OxlO ; form logical address into R7 chkl R7,Rss limit ; Check the logical address against segment lower limit chku R7,R_~ ; Check the logical address against segment upper limit add R8,R7,Rss_base ; add the segment base to form the linear address ld Reax,[R8] ; load n from memory address in R8 into Reax lea %ecx,[%eax-1] // decrement n sub Recx,Reax,l ; decrement n mov [%ebp+Ox10], %ecx // store (n - l) add R9,Rebp,OxlO ; form logical address into R9 chkl R9,Rss_limit ; Check the logical address against segment lower limit chku R9,R_~ ; Check the logical address against segment upper limit add RlO,R9,Rss_base ; add the segment base to form the linear address st [RlO],Recx ; store n-l in Recx into memory using address in RlO
and %eax, %eax // test n to set the condition codes andcc Rll,Reax,Reax ; test n to set the condition codes jg .-Ox1b // branch to the top of this section if "n>0"
jg mainloop,mainloop ; jump to the main loop Host Instruction key:
chkl + check lower limit chku = check upper limit The next sample illustrates for each of the primitive target instructions the addition of host primitive instructions by which addresses needed for the W O 98/13740 PCTrUS97/16911 target operation may be generated by the code morphing software. It should be noted that host address generation instructions are only required in an embodiment of a microprocessor in which code morphing software is used for address generation rather than address generation hardware. In a target s processor such as an X86 microprocessor these addresses are generated using address generation hardware. Whenever address generation occurs in such an embodiment, the calculation is accomplished; and host primitive instructions are also added to check the address values to determine that the calculated addresses are within the appropriate X86 segment limits.
10 Adds instructions to maintain the target X86 instruction pointer "eip" and the commit instructions that use the special morph host hardware to update X86 state.
mov %ecx, 1%ebp+0xc] // load c add RO,Rebp,Oxc chkl RO,Rss_limit chku RO,R_~
add Rl,RO,Rss_base ld Recx,[R1]
add Reip,Reip,3 ; add X86 instruction length to eip in Reip commit ; commits working state to official state mov %eax,[%ebplOx8] // load s add R2,Rebp,Ox8 chkl R2,Rss_limit chku R2,R_~
add R3,R2,Rss_base ld Reax,[R3]
add Reip,Reip,3 ; add X86 instruction length to eip in Reip commit ; commits working state to official state mov 1%eaxl, %ecx // store c into [s]
chku Reax,Rds_limit add R4,Reax,Rds_base st [R4],Recx add Reip,Reip,2 ; add X86 instruction length to eip in Reip commit ; commits working state to official state W O 98/13740 PCT~US97/16g11 add %eax,#4 // increment s by 4 addcc Reax,Reax,4 add Reip,Reip,5 ; add X86 instruction length to eip in Reip commit ; commits working state to official state mov [%ebp+Ox8], %eax // store (s + 4) add R5,Rebp,Ox8 chkl R5,Rss_limit chku R5,R~
add R6,R5,Rss_base st [R6],Reax add Reip,Reip,3 ; add X86 instruction length to eip in Reip commit ; commits working state to official state mov %eax,[%ebp+Ox10] // load n add R7,Rebp,OxlO
chkl R7,Rss_limit chku R7,R_~
add R8,R7,Rss_base ld Reax,[RB]
add Reip,Reip,3 ; add X86 instruction length to eip in Reip commit ; commits working state to official state lea %ecx,[%eax-1] // decrement n sub Recx,Reax,1 add Reip,Reip,3 ; add X86 instruction length to eip in Reip commit ; commits working state to official state mov ~%ebp+Ox10], %eGx // store (n - 1) add R9,Rebp,OxlO
chkl R9,Rss_limit chku R9,R_~
add RlO,R9,Rss_base st [RlO],Recx add Reip,Reip,3 add X86 instruction length to eip in Reip commit ; commits working state to official state WO 98113740 PCT~US97/16911 and %eax, %eax // test n andcc Rll,Reax,Reax add Reip,Reip,3 commit ; commits working state to official state jg .-Ox1b // branch ~n~O~
add Rseq,Reip,Length(jg) ldc Rtarg,EIP(target) selcc Reip,Rseq,Rtarg commit ; commits working state to official state jg mainloop,mainloop Host Instruction key:
commit = copy the contents of the working registers to the official target registers and send working stores to memory This sample illustrates the addition of two steps to each set of primitive host instructions to update the official target registers after the execution of the host instructions necessary to carry out each primitive target instruction and to commit the uncommitted values in the gated store buffer to memory.
2s As may be seen, in each case, the length of the target instruction is added to the value in the working instruction pointer register (Reip). Then a commit instruction is executed. In one embodiment, the commit instruction copies the current value of each working register which is shadowed into its associated official target register and moves a pointer value designating the 30 position of the gate of the gated store buffer from immediately in front of the uncommitted stores to immediately behind those stores so that they will be placed in memory.

It will be appreciated that the list of instructions illustrated last above are all of the instructions necessary to form a host translation of the original target 3s assembly language instructions. If the translation were to stop at this point, the number of primitive host instructions would be much larger than the number of target instructions (probably six times as many instructions), and W O 98/13740 PCTrUS97/169 62 the execution could take longer than execution on a target processor.
However, at this point, no reordering, optimizing, or rescheduling has yet taken place.

If an instruction is to be run but once, it may be that the time required to s accomplish further reordering and other optimization is greater than the time to execute the translation as it exists at this point. If so, one embodiment of the microprocessor ceases the translation at this point, stores the translation, then executes it to determine whether exception or errors occur. In this embodiment, steps of reordering and other o optimization only occur if it is determined that the particular translation will be run a number times or otherwise should be optimized. This may be accomplished, for example by placing host instructions in each translation which count the number of times a translation is executed and generate an exception (or branch) when a certain value is reached. The exception (or s branch) transfers the operation to the code morphing software which then implements some or all of the following optimizations and any additional optimizations determined useful for that translation. A second method of determining translations being run a number of times and requiring optimization is to interrupt the execution of translations at some frequency 20 or on some statistical basis and optimize any translation running at that time. This would ultimately provide that the instructions most often run would be optimized. Another solution would be to optimize each of certain particular types of host instructions such as those which create loops or are otherwise likely to be run most often.
2s W O 98113740 PCT~US97/16911 O~ti~ '~n ====================================================================
Assumes 32 bit flat address space which allows the e~ alion of segment base additions and some ~imit checks.
Win32 uses Flat 32b segmentation Record Assumptions:
- 10 Rss_base==O
Rss limit==O
Rds base==O
Rds limit==FFFFFFFF
SS and DS protection check mov %ecx,[%ebp+Oxc] // load c add RO,Rebp,Oxc 20 chku RO,R~
ld Recx,[RO]
add Reip,Reip,3 commit mov %eax,[%ebp+Ox8] // load s add R2,Rebp,Ox8 chku R2,R_~
ld Reax,[R2]
add Reip,Relp,3 commit mov [%eax],%ecx // store c into [s]
chku Reax,R_~
st [Reax],Recx add Reip,Reip,2 commit add %eax,#4 /i increment s by 4 addcc Reax,Reax,4 add Reip,Reip,5 commit mov ~%ebp+Ox8~,%eax // store (s + 4) add R5,Rebp,Ox8 chku R5,R_~
st [R5],Reax add Reip,Reip,3 commit W O 98/13740 PCTrUS97/169 mov %eax,[%ebp+Ox10] // load n add R7,Rebp,OxlO
chku R7,R~
S ld Reax,[R7]
add Reip,Reip,3 commit lea %ecx,~%eax-1] // decrement n sub Recx,Reax,l add Reip,Reip,3 commit mov [%ebp+Ox10],%ecx // store (n - l) add R9,Rebp,OxlO
chku R9,R~
st [R9],Recx add Reip,Reip,3 commit and %eax,%eax // test n andcc Rll,Reax,Reax add Reip,Reip,3 commit jg .-Ox1b // branch "n>0"
add Rseq,Reip,Length(jg) ldc Rtarg,EIP(target) selcc Reip,Rseq,Rtarg commit jg mainloop,mainloop This sample illustrates a first stage of optimization which may be practiced utilizing the improved microprocessor. This stage of optimization, like many of the other operations of the code morphing software, assumes an 40 optimistic result. The particular optimization assumes that a target application program which has begun as a 32 bit program written for a flat memory model provided by the X86 family of processors will continue as such a program. It will be noted that such an assumption is particular to the X86 family and would not necessarily be assumed with other families of 4s processors being emulated.

If this assumption is made, then in X86 applications all segments are mapped to the same address space. This allows those primitive host instructions required by the X86 segmentation process to be eliminated. As may be seen, the segment values are first set to zero. Then, the base for data is set to zero, and the limit set to the maximum available memoly.
Then, in each set of primitive host instructions for executing a target primitive instruction, the check for a segment base value and the computation of the segment base address required by segmentation are both eliminated. This reduces the loop to be executed by two host primitive o instructions for each target primitive instruction requiring an addressing function. At this point, the host instruction check for the upper memory limit still exists.

It should be noted that this optimization requires the speculation noted that the application utilizes a 32 bit flat memory model. If this is not true, then the error will be discovered as the main loop resolves the destination of control transfers and detects that the source assumptions do not match the destination assumptions. A new translation will then be necessary. This technique is very general and can be applied to a variety of segmentation and other "moded" cases where the "mode" changes infrequently, like debug, 20 system m~n~gement mode, or "real" mode.
Assume data addressed includes no bytes outside of computer memory limits which can only occur on unal _ ,ed page crossi,lg memory refercnces at the upper memory limit, and can be handled by special case software or hardware.

mov %ecx, [%ebp+Oxc] // load c add RO,Rebp,Oxc ld Recx,[R0]
add Reip,Reip,3 commit W O 98/13740 PCT~US97/16911 mov %eax,[%ebp+Ox8] // load s add R2,Rebp,Ox8 ld Reax,[R2]
add Reip,Reip,3 , commit mov 1%eax], %ecx // store c into ~s]
st [Reax],Recx add Reip,Reip,2 commit add %eax,#4 // increment s by 4 addcc Reax,Reax,4 add Reip,Reip,5 commit mov [%ebp+Ox8], %eax // store (s + 4) add R5,Rebp,OxB
st [R5],Reax add Reip,Reip,3 commit mov %eax,[%ebp+Ox10] // load n add R7,Rebp,OxlO
ld Reax,~R7]
add Reip,Reip,3 commit lea %ecx,l%eax-1] // decrement n sub Recx,Reax,l add Reip,Reip,3 commit mov [%ebp+Ox10], %ecx // store (n - l) add R9,Rebp,OxlO
st [R9],Recx add Reip,Reip,3 commit and %eax, %eax // test n andcc Rll,Reax,Reax add Reip,Reip,3 commit W O 98/13740 PCTrUS97/16911 jg .-Ox1b // branch "n>0"
add Rseq,Reip,Length(jg) ldc Rtarg,EIP(target) selcc Reip,Rseq,Rtarg commit jg mainloop,mainloop Host Instruction key:
selcc = Select one of the source registers and copy its contents to the destination reglster based on the condition codes.

The above sample illustrates a next stage of optimization in which a speculative translation eliminates the upper memoIy boundary check which S is only necessary for unaligned page crossing memory references at the top of the memory address space. Failure of this assumption is detected by either hardware or software alignment fix up. This reduces the translation by another host primitive instruction for each target primitive instruction requiring addressing. This optimization requires both the assumption noted 20 before that the application utilizes a 32 bit flat memory model and the speculation that the instruction is aligned. If these are not both true, then the translation will fail when it is executed; and a new translation will be necessary.
Detect and eliminate redundant address calculations. The example shows the code after 2s 6'~ ~dLing the redundant operdliGns.
mov %ecx, 1~/Oebp+Oxc] // load c add RO,Rebp,Oxc ld Recx,[R0]
add Reip,Reip,3 commit mov %eax, [%ebp+Ox8] // load s add R2,Rebp,Ox8 ld Reax,[R2]
add Reip,Reip,3 commit W O 98/13740 PCTrUS97116911 mov l%eax], %ecx ~/ store c into [s]
st [Reax],Recx add Relp,Reip,2 commit add %eax,#4 // increment s by 4 addcc Reax,Reax,4 add Reip,Reip,S
commit mov 1%ebplOx8], %eax // store (s + 4) st [R2],Reax add Reip,Reip,3 commit mov %eax,l%ebplOx10] // load n add R7,Rebp,OxlO
ld Reax,[R7]
add Reip,Reip,3 commit lea %ecx,[%eax-1] // decrement n sub Recx,Reax,l add Reip,Reip,3 commit mov 1%ebp~Ox10], %ecx // store (n - l) st [R7],Recx add Reip,Reip,3 commit and %eax,%eax // test n andcc Rll,Reax,Reax add Reip,Reip,3 commit jg .-Ox1b // branch "n>0"
add Rseq,Reip,Length(jg) ldc Rtarg,EIP(target~
selcc Reip,Rseq,Rtarg commit jg mainloop,mainloop W O 98/13740 PCTrUS97/16911 This sample illustrates a next optimization in which common host expressions are eliminated. More particularly, in translating the second target primitive instruction, a value in working register Rebp (the working register representing the stack base point register of an X86 processor) is 5 added to an offset value Ox8 and placed in a host working register R2. It willbe noted that the same operation took place in translating target primitive instruction five in the previous sample except that the result of the addition was placed in working register R5. Consequently the value to be placed in working register R5 already exists in working register R2 when host o primitive instruction five is about to occur. Thus, the host addition instruction may be eliminated from the translation of target primitive instruction five; and the value in working register R2 copied to working register ~5. Similarly, a host instruction adding a value in working register Rebp to an offset value OxlO may be eliminated in the translation of target primitive instruction eight because the step has already been accomplished in the translation of target primitive instruction six and the result resides inregister R7. It should be noted that this optimization does not depend on speculation and consequently is not subject to failure and retranslation.
Assume that target exceptions will not occur within the translation so delay updating eip and 20 target state.
mov %ecx,[%ebp+Oxcj // load c add RO,Rebp,Oxc 25 ld Recx,[R0]
mov %eax,[%ebp+Ox8] // load s add R2,Rebp,Ox8 ld Reax,[R2]
mov [%eax],%ecx // store c into [s]
st [Reax],Recx W O 98/13740 PCTrUS97tl6911 add ~/~Y~4 // increment s }:)y 4 add Reax,Reax,4 mov [%ebp~Ox8],%eax // store (s + 4) st [R2],Reax mov %eax,[%ebp+Ox10] // load n add R7,Rebp,OxlO
ld Reax,[R7]
lS lea %ecx,[%eax-1] // decrement n sub Recx,Reax,l mov [%ebp~Ox10],%ecx // store (n - l) st [R7],Recx and %eax,%eax // test n andcc Rll,Reax,Reax jg .-Ox1b // branch "n>0"
add Rseq,Reip,Length(block) ldc Rtarg,EIP(target) selcc Reip,Rseq,Rtarg commit jg mainloop,mainloop The above sample illustrates an optimization which speculates that the translation of the primitive target instructions making up the entire translation may be accomplished without generating an exception. If this is true, then there is no need to update the official target registers or to committhe uncommitted stores in the store buffer at the end of each sequence of host primitive instructions which carries out an individual target primitive 40 instruction. If the speculation holds true, the official target registers need only be updated and the stores need only be committed once, at the end of the sequence of target primitive instructions. This allows the elimination of two primitive host instructions for carrying out each primitive target W O 98/13740 71 PCTrUS97/16911 instruction. These are replaced by a single host primitive instruction which updates the official target registers and commits the uncommitted stores to memory.

As will be understood, this is another speculative operation which is also s highly likely to involve a correct speculation. This step offers a very great advantage over all prior art emulation techniques if the speculation holds true. It allows all of the primitive host instructions which carry out the entire sequence of target primitive instructions to be grouped in a sequence in which all of the individual host primitives may be optimized together.
0 This has the advantage of allowing a great number of operations to be run in parallel on a morph host which takes advantage of the very long instruction word techniques. It also allows a greater number of other optimizations to be made because more choices for such optimizations exist. Once again, however, if the speculation proves untrue and an exception is taken when 1S the loop is executed, the official target registers and memory hold the official target state which existed at the beginning of the sequence of target primitive instructions since a commit does not occur until the sequence of host instructions is actually executed. All that is necessary to recover from an exception is to dump the uncommitted stores, rollback the official 20 registers into the working registers, and restart translation of the target primitive instructions at the beginning of the sequence. This re-translation produces a translation of one target instruction at a time, and the official state is updated after the host sequence representing each target primitive instruction has been translated. This translation is then executed. When 2s the exception occurs on this re-translation, correct target state is immediately available in the official target registers and memory for carrying out the exception.

,. . .

Insum ma~:
add RO,Rebp,0xc ld Recx,[R0]
add R2,Rebp,Ox8 ld Reax,tR2]
st [Reax],Recx add Reax,Reax,4 st [R2],Reax add R7,Rebp,OxlO
ld Reax,[R7] // Live out sub Recx,Reax,1 // Live out st [R7],Recx andcc Rll,Reax,Reax IS add Rseq,Reip,Length(block) ldc Rtarg,EIP(target) selcc Reip,Rseq,Rtarg commit jg mainloop,mainloop The comment "Live Out" refers to the need to actually maintain Reax and Recx correctly prior to the commit. Otherwise further optimization might be possible.
====================================================================

The sl]mmAry above illustrates the sequence of host primitive instructions which remain at this point in the optimization process. While this example shows the maintenance of the target instruction pointer (EIP) inline, it is 30 possible to maintain the pointer EIP for branches out of line at translation time, which would remove the pointer EIP updating sequence from this and subsequent steps of the example.

W O 98/13740 PCTrUS97/16911 Renaming to reduce register resource dependencies. This will allow subsequent scheduling to be more effective. From this point on, the original target X86 code is omitted as the relationship b~tw~n individual target X86 instructions and host instructions l~cG,.,es increasingly blurred.
add RO,Rebp,Oxc ld Rl,[~0]
add R2,Rebp,Ox8 ld R3,[R2]
st [R3],Rl add R4,R3,4 st [R2~,R4 add R7,Rebp,OxlO
ld Reax,[R7] // Live out sub Recx,Reax,l // Live out st [R7],Recx andcc Rll,Reax,Reax add Rseq,Reip,Length~block) ldc Rtarg,EIP(target) selcc Reip,Rseq,Rtarg commlt jg mainloop,mainloop This sample illustrates a next step of optimization, normally called register r~n~ming, in which operations requiring working registers used for more than one operation in the sequence of host primitive instructions are changed to utilize a different unused working register to elimin~te the possibility that two host instructions will require the same hardware. Thus, for example, the second host primitive instruction in two samples above 30 uses working register Recx which represents an official target register ECX.
The tenth host primitive instruction also uses the working register Recx. By ch~n~ing the operation in the second host primitive instruction so that the value pointed to by the address in RO is stored in the working register Rl rather than the register Recx, the two host instructions do not both use the 35 same register. Similarly, the fourth, fifth, and sixth host primitive instructions all utilize the working register Reax in the earlier sample; by changing the fourth host primitive instruction to utilize the previously unused working register R3 instead the working register Reax and the sixth host primitive instruction to utilize the previously unused working register W O 98113740 rCTrUS97/16911 R4 instead of the register Reax, these hardware dependencies are elimin~ted.
After the scheduling process which organizes the primitive host operations as multiple op~r~ lons that can execute in the parallel on the host VLIW l,--.lv,~re. Each line shows the 5 parallel operJtions that the VLIW machine executes, and the "&" j"r~;c~lPs the parallelism.
add R2,Rebp,Ox8 & add RO,Rebp,Oxc nop & add R7,Rebp,OxlO
ld R3,[R2] & add Rseq,Reip,Length(block) ld Rl,[R0] & add R4,R3,4 st [R3],Rl & ldc Rtarg,EIP(target) ld Reax,[R7] & nop st [R2],R4 & sub Recx,Reax,l st [R7],Recx & andcc Rll,Reax,Reax selcc Reip,Rseq,Rtarg & jg mainloop,mainloop & commit Host Instruction key:
nop = no operation The above sample illustrates the scheduling of host primitive instructions for execution on the morph host. In this example, the morph host is presumed to be a VLIW processor which in addition to the hardware enhancements provided for cooperating with the code morphing software also includes, among other processing units, two arithmetic and logic (ALU) units. The first line illustrates two individual add instructions which have been scheduled to run together on the morph host. As may be seen, these are the third and the eight primitive host instructions in the sample just before the sllmmary above. The second line includes a NOP instruction (no 30 operation but go to next instruction) and another add instruction. The NOP
instruction illustrates that there are not always two instructions which can be run together even after some scheduling optimizing has taken place. In any case, this sample illustrates that only nine sets of primitive host instructions are left at this point to execute the original ten target 3s instructions.

Re~olve host branch targets and chain stored translations add R2,Rebp,Ox8 & add RO,Rebp,Oxc nop & add R7,Rebp,OxlO
ld R3,[R2] & add Rseq,Reip,Length(block) ld Rl,[RO~ & add R4,R3,4 st [R3],Rl & ldc Rtarg,EIP(target) ld Reax,LR7] & nop st [R2],R4 & sub Recx,Reax,l st [R7],Recx & andcc Rll,Reax,Reax selcc Reip,Rseq,Rtarg & jg Sequential,Target & commit This sample illustrates essentially the same set of host primitive instructions except that the instructions have by now been stored in the translation buffer and executed one or more times because the last jump (jg) instruction now points to a jump address furnished by chaining to another sequence of translated instructions. The chaining process takes the sequence of instructions out of the translator main loop so that translation of the sequence has been completed.
20 Adv.~nced O,~ti,.,i~lions, Backward Code Motion:
This and subsequent examples start with the code prior to scheduling. This optimization first depends on detecting that the code is a loop. Then invariant operations can be moved out of the loop body and executed once before entering the loop body.
entry:
add RO,Rebp,Oxc add R2,Rebp,Ox8 add R7,Rebp,OxlO
add Rseq,Reip,Length(block) ldc Rtarg,EIP(target) Loop:
ld Rl,[R0]
ld R3,[R2]
st [R3],Rl add R4,R3,4 st [R2],R4 ld Reax,[R7]
sub Recx,Reax,l st [R7],Recx andcc Rll,Reax,Reax selcc Reip,Rseq,Rtarg commit ]g mainloop,Loop WO 98/13740 76 PCTrUS97/16911 The above sample illustrates an advanced optimization step which is usually only utilized with sequences which are to be repeated a large number of times. The process first detects translations that form loops, and reviews the individual primitives host instructions to determine which instructions s produce constant results within the loop body. These instructions are removed from the loop and executed only once to place a value in a register;
from that point on, the value stored in the register is used rather than rerunning the instruction.
Schedule the loop body a~er bach~/~r~ code motion. For example purposes, only the code in the loop body is shown scheduled Entry:
add RO,Re~,Oxc add R2,Rebp,Ox8 add R7,Rebp,OxlO
add Rseq,Reip,Length~block) ldc Rtarg,EIP(target) Loop:
ld R3,[R2] & nop ld Rl,[R0] & add R4,R3,4 st [R3],Rl & nop ld Reax,[R7] & nop st [R2],R4 & sub Recx,Reax,l st [R7],Recx & andcc Rll,Reax,Reax selcc Reip,Rseq,Rtarg & jg Sequential~Loop & commit Host Instruction key:
ldc = load a 32-bit constant When these non-repetitive instructions are removed from the loop and the sequence is scheduled for execution, the scheduled instructions appear as in the last sample above. It can be seen that the initial instructions are performed but once during the first iteration of the loop and thereafter only 3s the host primitive instructions remaining in the seven clock intervals shown are executed during the loop. Thus, the execution time has been reduced to seven instruction intervals from the ten instructions necessary to execute the primitive target instructions.

As may be seen, the steps which have been removed from the loop are address generation steps. Thus, address generation only need be done once per loop invocation in the improved microprocessor; that is, the address generation need only be done one time. On the other hand, the address generation hardware of the X86 target processor must generate these addresses each time the loop is executed. If a loop is executed one hundred times, the improved microprocessor generates the addresses only once while a target processor would generate each address one hundred times.
After Bacl~a~(l Code Motion:
Target:
add RO,Rebp,Oxc add R2,Rebp,Ox8 add R7,Rebp,OxlO
add Rseq,Reip,Length(block) ldc Rtarg,EIP(target) Loop:
ld Rl,[R0]
ld R3,[R2]
st [R3],Rl add R4,R3,4 st [R2],R4 ld Reax,[R7] //Live out sub Recx,Reax,l //Llve out st [R7],Recx andcc Rll,Reax,Reax selcc Reip,Rseq,Rtarg commit ]g mainloop,Loop ====================================================================
Register ~"oc~tion This shows the use of register alias detection hardware of the morph host 35 that allows variables to be safely moved from memory into registers. The starting point is the code after "backward code motion". This shows the optimization that can eliminate loads.
First the loads are performed. The address is protected by the alias hardware, such that should a store to the address occur, an "alias"
exception is raised. The loads in the loop body are then replaced with copies. After the main body of the loop, the alias hardware is freed.

.

W O 98113740 PCTrUS97/16911 Entry:
add RO,Rebp,Oxc add R2,Rebp,Ox8 add R7,Rebp,OxlO
add Rseq,Reip,Length(block) ldc Rtarg,EIP(target) ld Rc,[R0] jFirst do the load of the variable from memory ]0 prot [RO],Aliasl ;Then protect the memory location from stores ld Rs,[R2]
prot [R2],Alias2 ld Rn,[R7]
prot [R7],Alias3 Loop:
copy Rl,Rc copy R3,Rs st [R3],Rl add R4,Rs,4 copy Rs,R4 st [R2],Rs,NoAliasCheck copy Reax,Rn //Live out sub Recx,Reax,l //Live out copy Rn,Recx st [R7],Rn,noAliasCheck andcc Rll,Reax,Reax selcc Reip,Rseq,Rtarg commit jg Epilog,Loop Epilog:
FA Aliasl Free the alias detection hardware FA Alias2 Free the alias detection hardware FA Alias3 Free the alias detection hardware j Sequential Host Instruction key:
protect = protect address from loads FA = free alias copy = copy j = jump This sample illustrates an even more advanced optimization which may be practiced by the microprocessor including the present invention. Referring back to the second sample before this sample, it will be noticed that the first three add instructions involved computing addresses on the stack. These addresses do not change during the execution of the sequence of host operations. Consequently, the values stored at these addresses may be W O 98/13740 PCTrUS97/16911 retrieved from memory and loaded in registers where they are immediately available for execution. As may be seen, this is done in host primitive instructions six, eight, and ten. In instructions seven, nine and eleven, each of the memory addresses is marked as protected by special host alias 5 hardware and the registers are indicated as aliases for those memory addresses so that any attempt to vary the data will cause an exception. At this point, each of the load operations involving moving data from these stack memory addresses becomes a simple register-to-register copy operation which proceeds much faster than loading from a memory address.
o It should be noted that once the loop has been executed until n=O, the protection must be removed from each of the memory addresses so that the alias registers may be othen~ise utilized.
Copy Prop~
]5 After using the alias hardware to turn loads within the loop body into copies, copy propagation allows the elimination o~ some copies.
Entry:
add RO,Rebp,Oxc add R2,Rebp,Ox8 add R7,Rebp,OxlO
add Rseq,Reip,Length(block) ldc Rtarg,EIP(target) ld Rc,[RO]
prot [RO],Aliasl ld Rs,[R2]
prot [R2],Alias2 ld Recx,[R7]
prot [R7],Alias3 Loop:
st [Rs],Rc add Rs,Rs,4 st [R2],Rs,NoAliasCheck copy Reax,Recx //Live out sub Recx,Reax,l //Live out st [R7],Recx,NoAliasCheck andcc Rll,Reax,Reax selcc Reip,Rseq,Rtarg commit jg Epilog,Loop W O 98/13740 PCTrUS97116911 Epilog:
FA Aliasl FA Alias2 FA Alias3 j Sequential This sample illustrates the next stage of optimization in which it is recognized that most of the copy instructions which replaced the load instructions in the optimization illustrated in the last sample are o unnecessary and may be eliminated. That is, if a register-to-register copy operation takes place, then the data existed before the operation in the register from which the data was copied. If so, the data can be accessed in the first register rather than the register to which it is being copied and the copy operation eliminated. As may be seen, this eliminates the ~lrst, second, s fifth, and ninth primitive host instructions shown in the loop of the last sample. In addition, the registers used in others of the host primitive instructions are also changed to reflect the correct registers for the data.
Thus, for example, when the first and second copy instructions are elimin~ted, the third store instruction must copy the data from the working register Rc where it exists (rather than register R1) and place the data at the address indicated in working register Rs where the address exists (rather than register R3).
Example illustrating scheduling of the loop body only.
25 Entry:
add RO,Rebp,Oxc add R2,Rebp,Ox8 add R7,Rebp,OxlO
add Rseq,Reip,Length(b~ock) ldc Rtarg,EIPltarget) ld Rc,[R0]
prot [RO],Aliasl ld Rs,[R2]
prot [R2],Alias2 ld Recx,[R7]
prot [R7],Alias3 CA 02262928 l999-02-03 W O 98/13-40 PCT~Us97/16911 Loop:
st [Rs],Rc, & add Rs,Rs,4 & copy Reax,Recx st [R2],Rs,NAC & sub Recx,Reax,1 st [R7],Recx,NAC & andcc Rll,Reax,Reax selcc Reip,Rseq,Rtarg & jg Epilog,Loop & commit Epilog:
FA Aliasl FA Alias2 FA Allas3 j Sequential Host Instruction key:
NAC= No Alias Check IS The scheduled host instructions are illustrated in the sample above. It will be noted that the sequence is such that fewer clocks are required to execute the loop than to execute the primitive target instruction originally decoded from the source code. Thus, apart from all of the other acceleration accomplished, the total number of combined operations to be run is simply 20 less than the operations necessaIy to execute the original target code.
Store Eli...i .aliGn by use of the alias hardware.
Entry:
add RO,Rebp,Oxc add R2,Rebp,Ox8 add R7,Rebp,OxlO
add Rseq,Reip,Length(block) ldc Rtarg,EIP(target) ld Rc,[R0]
prot [RO],Aliasl ;protect the address from loads and stores ld Rs,[R2]
prot [R2],Alias2 ;protect the address from loads and stores ld Recx,[R7]
prot [R7],Alias3 iprotect the address from loads and 40 stores Loop:
st [Rs],Rc, & add Rs,Rs,4 & copy Reax,Recx sub Recx,Reax,l & andcc Rll,Reax,Reax 4S selcc Reip,Rseq,Rtarg & jg Epilog,Loop & commlt Epilog:
FA Allasl FA Allas2 FA Alias3 st [R2],Rs ;write~ack the final value of Rs st [R7],Recx ;writeback the final value of Recx j Sequent1al The final optimization shown in this sample is the use of the alias hardware o to elimin~te stores. This eliminates the stores from within the loop body, and performs them only in the loop epilog. This reduces the number of host instructions within the loop body to three compared to the original ten target instructions.

Although the present invention has been described in terms of a preferred s embodiment, it will be appreciated that various modifications and alterations might be made by those skilled in the art without departing from the spirit and scope of the invention. For example, although the invention has been described with relation to the emulation of X86 processors, it should be understood that the invention applies just as well to programs 20 designed for other processor architectures, and programs that execute on virtual machines, such as P code, Postscript, or Java programs. The invention should therefore be measured in terms of the claims which follow.

What Is Claimed Is:

Claims (32)

  1. Claim 1. A memory controller for use with a microprocessor including an execution unit having a plurality of registers, the memory controller comprising:

    means for storing memory data to be frequently accessed during a code sequence by the execution unit in a first register of the execution unit, means for holding the memory address of the data in the first register of the execution unit in a second register of the execution unit during the execution of the code sequence by the execution unit, means for detecting an access attempted to the memory address during the execution of the code sequence, and means for maintaining the data in the first register and in memory consistent and valid during execution of the code sequence.
  2. Claim 2. A memory controller as claimed in Claim 1 in which the means for detecting an access attempted to the memory address during the execution of the code sequence comprises a comparator for comparing the access address with the memory address in the second register and generating an exception in response to a comparison.
  3. Claim 3. A memory controller as claimed in Claim 2 in which the means for maintaining the data in the first register and in memory consistent and valid during execution of the code sequence comprises software implemented means responsive to an exception for replacing stale data with valid data being written.
  4. Claim 4. A memory controller as claimed in Claim 2 in which the means for maintaining the data in the first register and in memory consistent and valid during execution of the code sequence comprises software implemented means responsive to an exception for retranslating into a new code sequence without storing memory data in the first register which is frequently utilized by the execution unit during a code sequence and executing the new code sequence.
  5. Claim 5. A memory controller as claimed in Claim 2 in which the comparator comprises means for generating an exception to an attempt to write the memory address when the data in the first register is being utilized instead of data at the memory address during execution of the code sequence;
    and in which the means for maintaining the data in the first register and in memory consistent and valid during execution of the code sequence comprises means for updating the data in the first register with data written to the memory address.
  6. Claim 6. A memory controller as claimed in Claim 2 in which the comparator comprises means for generating an exception to an attempt to read the memory address when data is being loaded to the first register in place of the memory address during execution of the code sequence; and in which the means for maintaining the data in the first register and in memory consistent and valid during execution of the code sequence comprises means for updating the data at the memory address with data in the first register.
  7. Claim 7. A computer system comprising:

    a host processor designed to execute instructions of a host instruction set, thehost processor including an execution unit having a plurality of registers;

    software for translating instructions from a target instruction set to instructions of the host instruction set;

    memory for storing target instructions from a program being translated, and a memory controller for storing memory data which is frequently utilized by the host processor during a code sequence in a first register of the execution unit, a second register for holding a memory address of memory data stored in the first register, and means for selecting data frequently utilized by the host processor during a code sequence to be stored in the second register.
  8. Claim 8. A computer system as claimed in Claim 7 which further comprises means for assuring that data stored in the first register and at the memory address remain consistent.
  9. Claim 9. A computer system as claimed in Claim 8 in which the means forassuring that data stored in the first register and at the memory address remain consistent comprises a comparator for comparing addresses of memory accesses with a memory address in the second register and generating an exception when addresses compare.
  10. Claim 10. A computer as claimed in Claim 9 in which the means for assuring that data stored in the first register and at the memory address remain consistent further comprises software implemented means responsive to an exception generated by the comparator for replacing stale data with valid data being written.
  11. Claim 11. A computer as claimed in Claim 9 in which the means for assuring that data stored in the first register and at the memory address remain consistent comprises software implemented means responsive to an exception generated by the comparator for retranslating into a new code sequence without storing memory data in the first register which is frequently utilized by the host processor during a code sequence and executing the new code sequence.
  12. Claim 12. A computer system as claimed in Claim 9 further comprising means responding to an exception taken during a write access of a memory address for updating data stored in the first register with data being written to the memory address.
  13. Claim 13. A computer system as claimed in Claim 9 further comprising means responding to an exception taken during a read access of a memory address for updating data stored at the memory address with data stored in the first register.
  14. Claim 14. A method for enhancing the speed of a processor comprising the steps of:

    placing memory data to be frequently accessed during a code sequence of the execution unit in a first register of the execution unit, storing a memory address of the data in the first register of the execution unitin a second register of the execution unit, detecting an access attempted to the memory address during the execution of the code sequence, and maintaining the data in the first register and at the memory address consistent and valid during execution of the code sequence.
  15. Claim 15. A method as claimed in Claim 14 in which the step of detecting an access attempted to the memory address during the execution of the code sequence comprises comparing an access address with the memory address in the second register, and generating an exception in response to a comparison.
  16. Claim 16. A method as claimed in Claim 15 in which the step of maintaining the data in the first register and at the memory address consistent and valid during execution of the code sequence further comprises responding to an exception generated by a comparison by replacing stale data with valid data being written.
  17. Claim 17. A method as claimed in Claim 15 in which the step of maintaining the data in the first register and at the memory address consistent and valid during execution of the code sequence further comprises responding to an exception generated by a comparison by retranslating into a new code sequence without storing memory data in the first register which is frequently utilized by the execution unit during a code sequence and executing the new code sequence.
  18. Claim 18. A method as claimed in Claim 15 in which the step of generating an exception in response to a comparison comprises generating an exception to an attempt to write the memory address when the data in the first register is being copied to another register during execution of the code sequence; and in which the step of maintaining the data in the first register and in memory consistent and valid during execution of the code sequence comprises updating the data in the first register with data to be written to the memory address.
  19. Claim 19. A method as claimed in Claim 15 in which the step of generating an exception in response to a comparison comprises generating an exception to an attempt to read the memory address when data is being copied to the first register during execution of the code sequence; and in which the step of maintaining the data in the first register and in memory consistent and valid during execution of the code sequence comprises updating the data at the memory address with data in the first register.
  20. Claim 20. A microprocessor comprising:

    a host processor capable of executing a first instruction set, code morphing software for translating programs written for a target processor having a second different instruction set into instructions of the first instruction set for execution by the host processor, and a memory controller comprising:

    a first register for storing memory data which is frequently utilized by a processing unit in executing a code sequence, a second register for holding a memory address of memory data stored in the first register, and optimizing means for selecting data frequently utilized by a processing unit to be stored in the first register while executing the code sequence.
  21. Claim 21. A microprocessor as claimed in Claim 20 which further comprises means for assuring that data stored in the first register and at the memory address remain consistent.
  22. Claim 22. A microprocessor as claimed in Claim 21 in which the means for assuring that data stored in the first register and at the memory address remain consistent comprises a comparator for comparing addresses of memory accesses with a memory address held in the second register and generating an exception when addresses compare.
  23. Claim 23. A microprocessor as claimed in Claim 22 in which the means for assuring that data stored in the first register and at the memory address remain consistent further comprises software implemented means responsive to an exception generated by the comparator for replacing stale data with valid data being written.
  24. Claim 24. A microprocessor as claimed in Claim 22 in which the means for assuring that data stored in the first register and at the memory address remain consistent comprises software implemented means responsive to an exception generated by the comparator for retranslating into a new code sequence without storing memory data in the first register which is frequently utilized by the host processor during a code sequence and executing the new code sequence.
  25. Claim 25. A microprocessor as claimed in Claim 22 further comprising means responding to an exception taken during a write access of a memory address for updating data stored in the first register with data being written to the memory address.
  26. Claim 26. A microprocessor as claimed in Claim 22 further comprising means responding to an exception taken during a read access of a memory address for updating data stored at the memory address with data stored in the first register.
  27. Claim 27. A memory controller comprising:

    a first register for storing memory data which is frequently utilized by a processing unit during execution of a code sequence, a second register for storing a memory address of memory data stored in the first register, means for selecting data frequently utilized by a processing unit during execution of a code sequence to be stored in the second register, and means for assuring that data stored in the first register and at the memory address remain consistent.
  28. Claim 28. A memory controller as claimed in Claim 27 in which the meansfor assuring that data stored in the first register and at the memory address remain consistent comprises:

    a comparator for comparing addresses of memory accesses with a memory address in the second register and generating an exception when addresses compare.
  29. Claim 29. A memory controller as claimed in Claim 28 in which the meansfor assuring that data stored in the first register and at the memory address remain consistent further comprises means responsive to an exception generated by the comparator for replacing stale data with valid data being written.
  30. Claim 30. A memory controller as claimed in Claim 28 in which the meansfor assuring that data stored in the first register and at the memory address remain consistent comprises means responsive to an exception generated by the comparator for retranslating into a new code sequence without storing memory data in the first register which is frequently utilized by the processingunit during a code sequence and executing the new code sequence.
  31. Claim 31. A memory controller as claimed in Claim 28 further comprisingmeans responding to an exception taken during a write access of a memory address for updating data stored in the first register with data stored being written to the memory address.
  32. Claim 32. A memory controller as claimed in Claim 28 further comprisingmeans responding to an exception taken during a read access of a memory address for updating data stored at the memory address with data stored in the first register.
CA002262928A 1996-09-26 1997-09-22 Method and apparatus for aliasing memory data in an advanced microprocessor Expired - Fee Related CA2262928C (en)

Applications Claiming Priority (3)

Application Number Priority Date Filing Date Title
US08/721,698 US5926832A (en) 1996-09-26 1996-09-26 Method and apparatus for aliasing memory data in an advanced microprocessor
US08/721,698 1996-09-26
PCT/US1997/016911 WO1998013740A2 (en) 1996-09-26 1997-09-22 Method and apparatus for aliasing memory data in an advanced microprocessor

Publications (1)

Publication Number Publication Date
CA2262928C true CA2262928C (en) 2001-01-30

Family

ID=24898953

Family Applications (1)

Application Number Title Priority Date Filing Date
CA002262928A Expired - Fee Related CA2262928C (en) 1996-09-26 1997-09-22 Method and apparatus for aliasing memory data in an advanced microprocessor

Country Status (9)

Country Link
US (1) US5926832A (en)
EP (1) EP1008050B1 (en)
JP (1) JP3753743B2 (en)
KR (1) KR100385426B1 (en)
CN (1) CN1141647C (en)
AT (1) ATE355558T1 (en)
CA (1) CA2262928C (en)
DE (1) DE69737423T2 (en)
WO (1) WO1998013740A2 (en)

Families Citing this family (96)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6199152B1 (en) * 1996-08-22 2001-03-06 Transmeta Corporation Translated memory protection apparatus for an advanced microprocessor
JP3320358B2 (en) * 1998-06-18 2002-09-03 インターナショナル・ビジネス・マシーンズ・コーポレーション Compiling method, exception handling method, and computer
US6205537B1 (en) 1998-07-16 2001-03-20 University Of Rochester Mechanism for dynamically adapting the complexity of a microprocessor
US6289445B2 (en) * 1998-07-21 2001-09-11 Lsi Logic Corporation Circuit and method for initiating exception routines using implicit exception checking
US6298477B1 (en) * 1998-10-30 2001-10-02 Sun Microsystems, Inc. Method and apparatus for selecting ways to compile at runtime
US6332215B1 (en) 1998-12-08 2001-12-18 Nazomi Communications, Inc. Java virtual machine hardware for RISC and CISC processors
US7225436B1 (en) 1998-12-08 2007-05-29 Nazomi Communications Inc. Java hardware accelerator using microcode engine
US20050149694A1 (en) * 1998-12-08 2005-07-07 Mukesh Patel Java hardware accelerator using microcode engine
US7779236B1 (en) * 1998-12-31 2010-08-17 Stmicroelectronics, Inc. Symbolic store-load bypass
US7111290B1 (en) 1999-01-28 2006-09-19 Ati International Srl Profiling program execution to identify frequently-executed portions and to assist binary translation
US6954923B1 (en) 1999-01-28 2005-10-11 Ati International Srl Recording classification of instructions executed by a computer
US20020046305A1 (en) * 1999-02-17 2002-04-18 Babaian Boris A. Method for effective binary translation between different instruction sets using emulated supervisor flag and multiple page tables
US6549959B1 (en) 1999-08-30 2003-04-15 Ati International Srl Detecting modification to computer memory by a DMA device
US6470493B1 (en) * 1999-09-30 2002-10-22 Compaq Information Technologies Group, L.P. Computer method and apparatus for safe instrumentation of reverse executable program modules
US6415379B1 (en) * 1999-10-13 2002-07-02 Transmeta Corporation Method and apparatus for maintaining context while executing translated instructions
EP1188294B1 (en) 1999-10-14 2008-03-26 Bluearc UK Limited Apparatus and method for hardware implementation or acceleration of operating system functions
US6748589B1 (en) 1999-10-20 2004-06-08 Transmeta Corporation Method for increasing the speed of speculative execution
US6751583B1 (en) 1999-10-29 2004-06-15 Vast Systems Technology Corporation Hardware and software co-simulation including simulating a target processor using binary translation
US7085914B1 (en) * 2000-01-27 2006-08-01 International Business Machines Corporation Methods for renaming stack references to processor registers
US6671664B1 (en) * 2000-02-22 2003-12-30 Hewlett-Packard Development Copany, L.P. Management of uncommitted register values during random program generation
US7389208B1 (en) * 2000-06-30 2008-06-17 Accord Solutions, Inc. System and method for dynamic knowledge construction
GB2367654B (en) 2000-10-05 2004-10-27 Advanced Risc Mach Ltd Storing stack operands in registers
US20020069402A1 (en) * 2000-10-05 2002-06-06 Nevill Edward Colles Scheduling control within a system having mixed hardware and software based instruction execution
GB2367653B (en) 2000-10-05 2004-10-20 Advanced Risc Mach Ltd Restarting translated instructions
KR20020028814A (en) * 2000-10-10 2002-04-17 나조미 커뮤니케이션즈, 인코포레이티드 Java hardware accelerator using microcode engine
GB2369464B (en) 2000-11-27 2005-01-05 Advanced Risc Mach Ltd A data processing apparatus and method for saving return state
US7076771B2 (en) 2000-12-01 2006-07-11 Arm Limited Instruction interpretation within a data processing system
US6779087B2 (en) * 2001-04-06 2004-08-17 Sun Microsystems, Inc. Method and apparatus for checkpointing to facilitate reliable execution
US6820194B1 (en) * 2001-04-10 2004-11-16 Mindspeed Technologies, Inc. Method for reducing power when fetching instructions in a processor and related apparatus
US6772315B1 (en) 2001-05-24 2004-08-03 Rambus Inc Translation lookaside buffer extended to provide physical and main-memory addresses
GB2376100B (en) * 2001-05-31 2005-03-09 Advanced Risc Mach Ltd Data processing using multiple instruction sets
GB2376098B (en) * 2001-05-31 2004-11-24 Advanced Risc Mach Ltd Unhandled operation handling in multiple instruction set systems
GB2376097B (en) 2001-05-31 2005-04-06 Advanced Risc Mach Ltd Configuration control within data processing systems
GB2376099B (en) * 2001-05-31 2005-11-16 Advanced Risc Mach Ltd Program instruction interpretation
JP3804823B2 (en) * 2001-07-03 2006-08-02 日本電気株式会社 Cache system with failure recovery function and cache control method thereof
US8769508B2 (en) 2001-08-24 2014-07-01 Nazomi Communications Inc. Virtual machine hardware for RISC and CISC processors
US7266811B2 (en) * 2001-09-05 2007-09-04 Conexant Systems, Inc. Methods, systems, and computer program products for translating machine code associated with a first processor for execution on a second processor
US20030093775A1 (en) * 2001-11-14 2003-05-15 Ronald Hilton Processing of self-modifying code under emulation
US7131118B2 (en) * 2002-07-25 2006-10-31 Arm Limited Write-through caching a JAVA® local variable within a register of a register bank
US8041735B1 (en) 2002-11-01 2011-10-18 Bluearc Uk Limited Distributed file system and method
US7457822B1 (en) 2002-11-01 2008-11-25 Bluearc Uk Limited Apparatus and method for hardware-based file system
GB2399897B (en) * 2003-03-26 2006-02-01 Advanced Risc Mach Ltd Memory recycling in computer systems
JP2005032018A (en) * 2003-07-04 2005-02-03 Semiconductor Energy Lab Co Ltd Microprocessor using genetic algorithm
US8539063B1 (en) 2003-08-29 2013-09-17 Mcafee, Inc. Method and system for containment of networked application client software by explicit human input
US20050091459A1 (en) * 2003-10-23 2005-04-28 Nhon Quach Flexible mechanism for enforcing coherency among caching structures
US7840968B1 (en) 2003-12-17 2010-11-23 Mcafee, Inc. Method and system for containment of usage of language interfaces
GB2412192B (en) * 2004-03-18 2007-08-29 Advanced Risc Mach Ltd Function calling mechanism
US7930526B2 (en) 2004-03-24 2011-04-19 Arm Limited Compare and branch mechanism
US7802080B2 (en) 2004-03-24 2010-09-21 Arm Limited Null exception handling
US7856661B1 (en) 2005-07-14 2010-12-21 Mcafee, Inc. Classification of software on networked systems
US7546421B2 (en) * 2005-08-08 2009-06-09 Intel Corporation Interconnect transaction translation technique
US7721075B2 (en) * 2006-01-23 2010-05-18 Mips Technologies, Inc. Conditional branch execution in a processor having a write-tie instruction and a data mover engine that associates register addresses with memory addresses
US7721073B2 (en) * 2006-01-23 2010-05-18 Mips Technologies, Inc. Conditional branch execution in a processor having a data mover engine that associates register addresses with memory addresses
US7721074B2 (en) * 2006-01-23 2010-05-18 Mips Technologies, Inc. Conditional branch execution in a processor having a read-tie instruction and a data mover engine that associates register addresses with memory addresses
US7757269B1 (en) 2006-02-02 2010-07-13 Mcafee, Inc. Enforcing alignment of approved changes and deployed changes in the software change life-cycle
US7895573B1 (en) 2006-03-27 2011-02-22 Mcafee, Inc. Execution environment file inventory
US8555404B1 (en) 2006-05-18 2013-10-08 Mcafee, Inc. Connectivity-based authorization
US8332929B1 (en) 2007-01-10 2012-12-11 Mcafee, Inc. Method and apparatus for process enforced configuration management
US9424154B2 (en) 2007-01-10 2016-08-23 Mcafee, Inc. Method of and system for computer system state checks
US8515075B1 (en) * 2008-01-31 2013-08-20 Mcafee, Inc. Method of and system for malicious software detection using critical address space protection
US8615502B2 (en) 2008-04-18 2013-12-24 Mcafee, Inc. Method of and system for reverse mapping vnode pointers
US10621092B2 (en) 2008-11-24 2020-04-14 Intel Corporation Merging level cache and data cache units having indicator bits related to speculative execution
US9672019B2 (en) 2008-11-24 2017-06-06 Intel Corporation Systems, apparatuses, and methods for a hardware and software system to automatically decompose a program to multiple parallel threads
US9069918B2 (en) * 2009-06-12 2015-06-30 Cadence Design Systems, Inc. System and method implementing full-rate writes for simulation acceleration
US8381284B2 (en) 2009-08-21 2013-02-19 Mcafee, Inc. System and method for enforcing security policies in a virtual environment
US8364461B2 (en) * 2009-11-09 2013-01-29 International Business Machines Corporation Reusing invalidated traces in a system emulator
US9552497B2 (en) 2009-11-10 2017-01-24 Mcafee, Inc. System and method for preventing data loss using virtual machine wrapped applications
US8775153B2 (en) * 2009-12-23 2014-07-08 Intel Corporation Transitioning from source instruction set architecture (ISA) code to translated code in a partial emulation environment
US8925101B2 (en) 2010-07-28 2014-12-30 Mcafee, Inc. System and method for local protection against malicious software
US8938800B2 (en) 2010-07-28 2015-01-20 Mcafee, Inc. System and method for network level protection against malicious software
US8549003B1 (en) 2010-09-12 2013-10-01 Mcafee, Inc. System and method for clustering host inventories
US9075993B2 (en) 2011-01-24 2015-07-07 Mcafee, Inc. System and method for selectively grouping and managing program files
US9112830B2 (en) 2011-02-23 2015-08-18 Mcafee, Inc. System and method for interlocking a host and a gateway
US9594881B2 (en) 2011-09-09 2017-03-14 Mcafee, Inc. System and method for passive threat detection using virtual memory inspection
US9417855B2 (en) 2011-09-30 2016-08-16 Intel Corporation Instruction and logic to perform dynamic binary translation
US8694738B2 (en) 2011-10-11 2014-04-08 Mcafee, Inc. System and method for critical address space protection in a hypervisor environment
US9069586B2 (en) 2011-10-13 2015-06-30 Mcafee, Inc. System and method for kernel rootkit protection in a hypervisor environment
US8973144B2 (en) 2011-10-13 2015-03-03 Mcafee, Inc. System and method for kernel rootkit protection in a hypervisor environment
US8713668B2 (en) 2011-10-17 2014-04-29 Mcafee, Inc. System and method for redirected firewall discovery in a network environment
US8800024B2 (en) 2011-10-17 2014-08-05 Mcafee, Inc. System and method for host-initiated firewall discovery in a network environment
US20130132061A1 (en) * 2011-11-18 2013-05-23 Michael J. Rieschl Just-in-time static translation system for emulated computing environments
US8739272B1 (en) 2012-04-02 2014-05-27 Mcafee, Inc. System and method for interlocking a host and a gateway
US8977916B2 (en) * 2012-12-04 2015-03-10 Texas Instruments Incorporated Using data watchpoints to detect unitialized memory reads
US8973146B2 (en) 2012-12-27 2015-03-03 Mcafee, Inc. Herd based scan avoidance system in a network environment
US9171159B2 (en) 2013-02-28 2015-10-27 Intel Corporation Performing security operations using binary translation
US9405551B2 (en) 2013-03-12 2016-08-02 Intel Corporation Creating an isolated execution environment in a co-designed processor
US9891936B2 (en) 2013-09-27 2018-02-13 Intel Corporation Method and apparatus for page-level monitoring
EP3061030A4 (en) 2013-10-24 2017-04-19 McAfee, Inc. Agent assisted malicious application blocking in a network environment
US10185561B2 (en) 2015-07-09 2019-01-22 Centipede Semi Ltd. Processor with efficient memory access
CN107710153B (en) * 2015-07-09 2022-03-01 森蒂彼得塞米有限公司 Processor with efficient memory access
US9575897B2 (en) 2015-07-09 2017-02-21 Centipede Semi Ltd. Processor with efficient processing of recurring load instructions from nearby memory addresses
US10423354B2 (en) * 2015-09-23 2019-09-24 Advanced Micro Devices, Inc. Selective data copying between memory modules
US9721048B1 (en) * 2015-09-24 2017-08-01 Cadence Design Systems, Inc. Multiprocessing subsystem with FIFO/buffer modes for flexible input/output processing in an emulation system
US10216496B2 (en) * 2016-09-27 2019-02-26 International Business Machines Corporation Dynamic alias checking with transactional memory
WO2020213059A1 (en) * 2019-04-16 2020-10-22 三菱電機株式会社 Program creation assistance device, program creation assistance method, and program
CN112199669B (en) * 2020-09-25 2022-05-17 杭州安恒信息技术股份有限公司 Method and device for detecting ROP attack

Family Cites Families (15)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS5582356A (en) * 1978-12-15 1980-06-21 Toshiba Corp Pre-fetch control system
JPS6054048A (en) * 1983-09-02 1985-03-28 Nec Corp Information processing device
US5097409A (en) * 1988-06-30 1992-03-17 Wang Laboratories, Inc. Multi-processor system with cache memories
US4928225A (en) * 1988-08-25 1990-05-22 Edgcore Technology, Inc. Coherent cache structures and methods
US5197144A (en) * 1990-02-26 1993-03-23 Motorola, Inc. Data processor for reloading deferred pushes in a copy-back data cache
JPH03255535A (en) * 1990-03-05 1991-11-14 Nec Corp Central processing unit
US5247648A (en) * 1990-04-12 1993-09-21 Sun Microsystems, Inc. Maintaining data coherency between a central cache, an I/O cache and a memory
EP0468831B1 (en) * 1990-06-29 1997-10-15 Digital Equipment Corporation Bus protocol for write-back cache processor
JPH04246728A (en) * 1991-02-01 1992-09-02 Toshiba Corp Information processor
US5507030A (en) * 1991-03-07 1996-04-09 Digitial Equipment Corporation Successive translation, execution and interpretation of computer program having code at unknown locations due to execution transfer instructions having computed destination addresses
US5428786A (en) * 1991-03-07 1995-06-27 Digital Equipment Corporation Branch resolution via backward symbolic execution
US5438668A (en) * 1992-03-31 1995-08-01 Seiko Epson Corporation System and method for extraction, alignment and decoding of CISC instructions into a nano-instruction bucket for execution by a RISC computer
DE69311330T2 (en) * 1992-03-31 1997-09-25 Seiko Epson Corp COMMAND SEQUENCE PLANNING FROM A RISC SUPER SCALAR PROCESSOR
US5623628A (en) * 1994-03-02 1997-04-22 Intel Corporation Computer system and method for maintaining memory consistency in a pipelined, non-blocking caching bus request queue
JP2685713B2 (en) * 1994-04-11 1997-12-03 株式会社日立製作所 Data processing device

Also Published As

Publication number Publication date
WO1998013740A2 (en) 1998-04-02
EP1008050A2 (en) 2000-06-14
EP1008050A4 (en) 2001-08-16
EP1008050B1 (en) 2007-02-28
KR100385426B1 (en) 2003-05-27
CN1241272A (en) 2000-01-12
CN1141647C (en) 2004-03-10
KR20000048630A (en) 2000-07-25
ATE355558T1 (en) 2006-03-15
DE69737423T2 (en) 2007-11-08
DE69737423D1 (en) 2007-04-12
WO1998013740A3 (en) 1998-07-02
US5926832A (en) 1999-07-20
JP2001504957A (en) 2001-04-10
JP3753743B2 (en) 2006-03-08

Similar Documents

Publication Publication Date Title
CA2262928C (en) Method and apparatus for aliasing memory data in an advanced microprocessor
US8495337B2 (en) Translated memory protection
US5832205A (en) Memory controller for a microprocessor for detecting a failure of speculation on the physical nature of a component being addressed
US5958061A (en) Host microprocessor with apparatus for temporarily holding target processor state
US6011908A (en) Gated store buffer for an advanced microprocessor
US6031992A (en) Combining hardware and software to provide an improved microprocessor
CA2283776C (en) Combining hardware and software to provide an improved microprocessor
CA2283560C (en) Translated memory protection apparatus for an advanced microprocessor
CA2283772C (en) Host microprocessor with apparatus for temporarily holding target processor state

Legal Events

Date Code Title Description
EEER Examination request
MKLA Lapsed