Patent Publication Number: US-5291604-A

Title: Transparent system interrupts with automated halt state restart

Description:
BACKGROUND OF THE INVENTION 
     1. Field of the Invention 
     The present invention relates to the field of microprocessor architecture. In particular, the present invention is a method and apparatus for providing transparent system interrupts with automated halt state restart. 
     2. Background 
     In the co-pending U.S. patent application Ser. No. 07/594,278, filed on Oct. 9, 1990, assigned to the assignee of the present application, Intel Corporation, entitled Transparent System Interrupt, a method and apparatus for providing transparent system interrupts is disclosed, which has particular application to microprocessor architecture. The method and apparatus disclosed in the co-pending U.S. patent application solves the problem inherent in prior art microprocessors, particularly those that have a protected mode as well as a real mode of operation, of the inability of a system integrator or original equipment manufacturer (OEM) to provide transparent system interrupts. 
     Transparent system interrupts are system-level interrupts that may not be relocated or overwritten by any operating system or application, thereby allowing a system integrator using the microprocessor to provide system-level interrupts that will operate reliably in any operating environment. Under the preferred embodiment disclosed in the co-pending U.S. patent application, a transparent system interrupt is invoked by the assertion of an electrical signal at an external pin of the central processing unit (CPU) chip of a microprocessor-based chip set. 
     Upon assertion of the electrical signal at the external pin of the CPU chip, the CPU maps a normally unmapped dedicated random access memory (RAM) area where the transparent system interrupt service routine is stored as a pre-determined area of the main memory space, saves the current CPU state into the dedicated RAM space, and begins execution of the transparent system interrupt service routine. The transparent system interrupt routine typically comprises instructions that are unique to a particular application of the transparent system interrupts to the system in which the CPU chip is installed. Recovery from the transparent system interrupt is accomplished upon recognition of an external event that invokes a &#34;Resume&#34; instruction causing the CPU to be restored to exactly the same state that existed prior to the transparent system interrupt. 
     An important application of the transparent system interrupts is to power management functions, whereby the processor and/or other system devices may be effectively shut down during periods of non-use and then re-started without the need to go through a power-up routine. This function is particularly useful in connection with battery-operated computers where power conservation is a primary concern. Thus, for example, if a computer operator is interrupted while working with an application program, the system may be powered down to conserve battery life. When the operator returns to use the system, it is restored to the same point in the application program as if the system had been running throughout the intervening period of time. The operator need not take any action to save application program results prior to the interruption, nor reload the application program when returning to use the computer. 
     Under the co-pending U.S. patent application, the transparent system interrupt does not provide any specific support for interrupting the CPU during the halt state. Therefore, the transparent system service routine with application specific instructions has the responsibility for checking to determine if the CPU was interrupted during a halt state. If the CPU was interrupted during a halt state, the transparent system service routine has the further responsibility for fixing up the appropriate registers of the CPU state saved in the dedicated memory space, so that when the Resume instruction is executed to restore the CPU state, the CPU will either re-enter the halt state or continue execution with the next instruction as desired by the transparent system interrupt. 
     The manner in which a transparent system interrupt service routine can determine whether the CPU was interrupted during a halt state is microprocessor dependent. For the exemplary &#34;i386™SX&#34; CPU based microprocessor system discussed in the co-pending U.S. patent application, the transparent system interrupt service routine determines whether the CPU was interrupted during a halt state by polling an input-output (I/O) register. The approach of having the transparent system interrupt service routine be responsible for restarting the CPU from an interrupted halt state has at least two disadvantages: 
     1) the burden of re-starting the CPU at a halt state or continued execution at the next instruction is placed on the transparent system interrupt service routine, and 
     2) the manner in which the CPU is restarted after it was interrupted from a halt state is microprocessor dependent. 
     SUMMARY OF THE INVENTION 
     It is therefore an object of the present invention to provide an improved transparent system interrupt with automated halt state restart. 
     Under the present invention, a transparent system interrupt is invoked by the assertion of an electrical signal at an external pin of the central processing unit (CPU) chip of a microprocessor-based chip set. Upon assertion of the electrical signal at the external pin of the CPU chip, the CPU maps a normally unmapped dedicated random access memory (RAM) area where the transparent system interrupt service routine is stored as a pre-determined area of the main memory space, saves the current CPU state into the dedicated RAM space including an instruction pointer and a prior instruction pointer, sets a halt indicator in the dedicated RAM space if the CPU is being interrupted from a halt state, and begins execution of the transparent system interrupt service routine. 
     The transparent system interrupt service routine typically comprises instructions that are unique to a particular application of the transparent system interrupts to the system in which the CPU chip is installed. Optionally, the transparent system interrupt service routine may further comprise instructions for checking the halt indicator and resetting the halt indicator if the CPU is to be restored to continued execution with the next instruction instead of the halt state. 
     Recovery from the transparent system interrupt is accomplished upon recognition of an external event that invokes a &#34;Resume&#34; instruction causing the CPU to be restored to exactly the same state that existed prior to the transparent system interrupt or automatically restarted from the halt state. During restoration of the CPU state, the &#34;Resume&#34; instruction checks the halt indicator, and conditionally decrement the restored instruction pointer to the restored prior instruction pointer if the halt indicator is set, thereby causing the prior instruction, that is the &#34;Halt&#34; instruction, to be re-executed and the CPU to be restored at the halt state, instead of continued execution at the next instruction. 
    
    
     BRIEF DESCRIPTION OF THE DRAWINGS 
     The objects, features and advantages of the present invention will be apparent from the following detailed description of the preferred embodiment of the invention with references to the drawings in which: 
     FIG. 1 is a functional block diagram of an exemplary microprocessor system embodying the present invention. 
     FIG. 2 is a functional flow diagram of the microcode for the transparent system interrupt with automated halt restart of the present invention. 
    
    
     DETAILED DESCRIPTION 
     System Overview 
     Referring now to FIG. 1, a block diagram illustrating an exemplary microprocessor system embodying the present invention is shown. The exemplary microprocessor system is briefly described below; however, it is to be understood that the present invention is not limited to this particular microprocessor design, and may be incorporated in virtually any processor design. 
     The exemplary microprocessor system 10 comprises three main components, designated as GENCPU, GENIO and GENVGA. GENCPU is an expanded central processing unit; GENIO is a single chip input/output unit; and GENVGA is a single chip graphics interface. The three components communicate with each other and with other system components (such as expansion slots, keyboard controller, disk controllers) via ISA bus 42. 
     GENCPU includes a CPU 12, a memory controller 14, a cache controller 16, ISA bus control logic 18 and line buffers 20. CPU 12 has at least two modes of operations, a real mode and a protected mode. CPU 12 is essentially a &#34;i386™SX&#34; CPU manufactured by Intel Corporation, the corporate assignee of this invention. Throughout this description, certain terminology relating to the &#34;i386™SX&#34; CPU, such as register names, signal nomenclature, is employed to described the present invention. Such terminology is understood by practitioners in the field of microprocessor design and will therefore not be explained at length herein. 
     In particular, CPU 12 comprises an instruction pointer register (not shown) and a prior instruction pointer register (not shown) containing an instruction pointer and a prior instruction pointer respectively. The instruction pointer controls instruction fetching. CPU 12 automatically increments the instruction and prior instruction pointers pointing to the next instruction to be executed and the instruction just executed after executing an instruction. 
     CPU 12 also comprises logics (not shown) for executing a plurality of instructions. The instructions comprise a &#34;Halt&#34; instruction for stopping program execution and preventing the CPU 12 from using the local bus until the CPU 12 is restarted. The instructions operate on either zero, one, two or three operands. An operand either resides in the instruction, in a register or in a memory location. CPU 12 has two modes of operations, a real mode and a protected mode. The primary differences between the real mode and the protected mode is how a logical address is translated into a linear address, the size of the address space, and paging capability. 
     Additionally, CPU 12 comprises logics (not shown) for executing a plurality of hardware interrupts. Hardware interrupts occur as the result of an external event and are classified into two types: maskable and non-maskable. Interrupts are serviced after execution of the current instruction. After the interrupt service routine is finished with servicing the interrupt, execution proceeds with the instruction immediately after the interrupted instruction. Maskable interrupts are typically used to respond to asynchronous external hardware events. Unmaskable interrupts are typically used to service very high priority events. 
     For further description relating to the registers and internal structure of CPU 12, see i386™SX Microprocessor, published by Intel Corporation as publication number 240187, and related publications. 
     GENIO includes parallel ports (PIO) 22, dual serial ports (SIO) 24a, 24b, real time clock unit (RTC) 26, dual programmable interrupt controllers (PIC) 28a, 28b, dual programmable timers (PIT) 30a, 30b, and dual direct memory access controllers (DMA) 32a, 32b. GENVGA includes VGA graphics controller 36, video memory controller 38 and interface 40 for a flat panel display unit. 
     Additionally, external to the three main components are system memory 44, cache memory 46, video memory 48, and an interface (PAL/DAC) 50 for a conventional VGA monitor. The system memory 44, the cache memory 46 and video memory 48 are accessed by the memory controller 14, cache memory controller 16 and video memory controller 38 respectively. The video memory 48 may also be accessed through the ISA bus 42, and the two interfaces 40, 50. 
     For further description relating to the &#34;i386™ SX&#34; Microprocessor, see i386™ SX Microprocessor Hardware Reference Manual, published by Intel Corporation as publication number 240332, and related publications. 
     Transparent System Interrupt with Automated Halt State Restart 
     The present invention is implemented by means of three enhancements to a conventional prior art microprocessor architecture, for example, the assignee&#39;s &#34;i386™&#34; architecture, as follows: 
     1. A new interrupt called the System Supervisor interrupt (SSI) for superseding the entire microprocessor system&#39;s protection mechanism with specific support for superseding the protection mechanism while the CPU is at the halt state. The SSI interrupt is non-maskable and has a higher priority than all other interrupts, including other non-maskable interrupt. The SSI interrupt is serviced by a SSI interrupt service routine. 
     2. A special system transparent memory area referred to as System Management RAM or SMRAM for storing the SSI interrupt service routine, the state of the CPU at the time it was interrupted, and a halt state indicator. The halt state indicator indicating whether the CPU was interrupted from a halt state. 
     3. A new instruction, called RESUME, for returning the microprocessor system to the state just before it was interrupted by an SSI interrupt and resuming execution at the next instruction, or optionally returning to the halt state if the CPU was interrupted from a halt state. 
     Referring now to FIG. 2, a flow chart illustrating the microcode of the SSI interrupt of the present invention is shown. A SSI interrupt is invoked by the assertion of an electrical signal at an external pin of the CPU chip. Upon detection of the electrical signal at the external pin of the CPU chip (SSI event), the CPU maps the SMRAM as a pre-determined area of main memory space, block 102. The SMRAM is normally not mapped as part of the main memory space, thereby making it inaccessible to the operating system and the application. Additionally, the CPU saves the CPU state into the SMRAM space, block 104, switches the CPU into real mode, block 105, sets the halt indicator in the SMRAM space, block 107, if the CPU is being interrupted from a halt state resulted from having executed the Halt instruction, branch 106a, re-initializes the CPU&#39;s program control registers, block 108, and starts execution of the SSI interrupt service routine, block 110. 
     The CPU state saved comprises an instruction pointer and a prior instruction pointer. These two pointers point to two instructions of the operating system and/or the applications. The instruction pointer points to an instruction to be executed next by the CPU, and the prior instruction pointer points to an instruction executed by the CPU before the interrupt, that is, the &#34;Halt&#34; instruction if the CPU was interrupted from the halt state. 
     The SSI interrupt service routine typically comprises instructions that are unique to a particular application of the SSI interrupt to the system in which the CPU chip is installed. Additionally, the SSI interrupt service routine may contain instructions for checking whether the halt indicator in the SMRAM space is set, to determine whether the CPU was interrupted at the halt state. If the halt indicator is set, the SSI interrupt service routine may further contain instructions for resetting the halt indicator to cause the CPU to be restored to continued execution at the next instruction upon execution of the &#34;RESUME&#34; instruction. 
     Recovery from the SSI interrupt is accomplished upon recognition of an external event that invokes the &#34;Resume&#34; instruction (RSM event). Upon detection of the external event, the CPU restores the CPU state stored in the SMRAM area including the instruction pointer and the prior instruction pointer, block 112, checks to determine if the halt indicator is set, block 113. If the halt indicator is set, branch 113a, the CPU decrements the restored instruction pointer to the restored prior instruction pointer, block 114. If the halt indicator is not set, branch 113b, or upon decrementing the instruction pointer register, block 114, the CPU switches out the SMRAM area and unmaps it as part of the main memory space, block 116, and continues execution of the interrupted operating system or application program, block 117. Therefore, if the halt indicator remains set upon returning from the system interrupt service routine, the &#34;Halt&#34; instruction gets re-executed, thereby causing the CPU to remain in the halt state. However, if the halt indicator is not set upon returning from the system interrupt service routine, the next instruction gets executed. 
     Except saving the instruction and prior instruction pointers, setting the halt indicator, checking the halt indicator and decrementing the instruction pointer described above, these enhancements, including a specific application of the SSI interrupt, the power management interrupt (PMI), are described in detail in the co-pending U.S. patent application, which is hereby fully incorporated by reference. 
     While the method of the present invention has been described in terms of its presently preferred form, those skilled in the art will recognize that the method of the present invention is not limited to the presently preferred form described. The method of the present invention may be practiced with modification and alteration within the spirit and scope of the appended claims. The specifications and drawings are, accordingly, to be regarded in an illustrative rather than a restrictive sense.