# Patent

## Title
Systems and methods for invasive debug of a processor without processor execution of instructions

## Abstract

Methods for invasive debug of a processor without processor execution of instructions are disclosed. As a part of a method, a memory mapped I/O of the processor is accessed using a debug bus and an operation is initiated that causes a debug port to gain access to registers of the processor using the memory mapped I/O. The invasive debug of the processor is executed from the debug port via registers of the processor.

## Background
A debugger or debugging tool is a computer program that is used to test and debug other programs (e.g., the target program). A “crash” happens when the program cannot normally continue because it has encountered a programming bug. When the program crashes or reaches a preset condition, the debugger typically identifies the location in the original code that caused the crash if it is a source-level debugger or symbolic debugger. If it is a low-level debugger or a machine-language debugger it identifies the line in the disassembly (unless it also has online access to the original source code and can display the appropriate section of code from the assembly or compilation).
Modern day processors have to be debugged in a system in a lab setting. Debug architecture requires that for an invasive debug operation, debugger software be executed by the processor under debug (PUD). If the functionality of processor under debug is compromised such that the processor is unable to run even the debugger software itself, then debug of such processor is impossible. Consequently, conventional approaches that rely on a potentially compromised PUD to execute debug instructions are inadequate.
SUMMARY
A shortcoming of some conventional debugging tools is that they rely on potentially compromised processors to execute their own debug instructions. A method for invasive debug of a processor without processor execution of instructions is disclosed that addresses these shortcomings. As a part of a method, a memory mapped I/O of the processor is accessed via a debug bus and an operation is initiated that causes a debug port to gain access to registers of the processor using the memory mapped I/O. The invasive debug of the processor is executed from the debug port via registers of the processor. Accordingly, the debug port is able to execute an invasive debug of the processor that could otherwise only be performed through execution of instructions by the processor itself.



BRIEF DESCRIPTION OF THE DRAWINGS
The invention, together with further advantages thereof, may best be understood by reference to the following description taken in conjunction with the accompanying drawings in which:
FIG. 1A shows an exemplary operating environment of a system for invasive debug of a processor without processor execution of instructions according to one embodiment.
FIGS. 1B illustrate operations performed by system for invasive debug of a processor without processor execution of instructions.
FIG. 2 shows components of a system for invasive debug of a processor without processor execution of instructions according to one embodiment.
FIG. 3 shows a flowchart of the steps performed in a method for invasive debug of a processor without processor execution of instructions according to one embodiment.



It should be noted that like reference numbers refer to like elements in the figures.
DETAILED DESCRIPTION
Although the present invention has been described in connection with one embodiment, the invention is not intended to be limited to the specific forms set forth herein. On the contrary, it is intended to cover such alternatives, modifications, and equivalents as can be reasonably included within the scope of the invention as defined by the appended claims.
In the following detailed description, numerous specific details such as specific method orders, structures, elements, and connections have been set forth. It is to be understood however that these and other specific details need not be utilized to practice embodiments of the present invention. In other circumstances, well-known structures, elements, or connections have been omitted, or have not been described in particular detail in order to avoid unnecessarily obscuring this description.
References within the specification to “one embodiment” or “an embodiment” are intended to indicate that a particular feature, structure, or characteristic described in connection with the embodiment is included in at least one embodiment of the present invention. The appearance of the phrase “in one embodiment” in various places within the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments. Moreover, various features are described which may be exhibited by some embodiments and not by others. Similarly, various requirements are described which may be requirements for some embodiments but not other embodiments.
Some portions of the detailed descriptions, which follow, are presented in terms of procedures, steps, logic blocks, processing, and other 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. A procedure, computer executed step, logic block, process, etc., is here, and generally, conceived to be a self-consistent sequence of steps or instructions leading to a desired result. The steps are those requiring physical manipulations of physical quantities. Usually, though not necessarily, these quantities take the form of electrical or magnetic signals of a computer readable storage medium and are capable of being stored, transferred, combined, compared, and otherwise manipulated in a computer system. 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 similar terms are to be associated with the appropriate physical quantities and are merely convenient labels applied to these quantities. Unless specifically stated otherwise as apparent from the following discussions, it is appreciated that throughout the present invention, discussions utilizing terms such as “accessing” or “initiating” or “executing” or the like, refer to the action and processes of a computer system, or similar electronic computing device that manipulates and transforms data represented as physical (electronic) quantities within the computer system's registers and memories and other computer readable media into other data similarly represented as physical quantities within the computer system memories or registers or other such information storage, transmission or display devices.
Exemplary Operating Environment of Systems and Methods for Invasive Debug of a Processor Without Processor Execution of Instructions According to One Embodiment
FIG. 1A shows an exemplary operating environment 100 of a system 101 for invasive debug of a processor without processor execution of instructions according to one embodiment. System 101 prompts an invasive debug of a processor that is to be debugged, from debug port 109 that could otherwise only be performed through execution of instructions by the processor itself. FIG. 1A shows system 101, PUD 103, processor registers 103a-103n, MMIO (memory-mapped I/O) 105, debug bus 107, debug port 109 and debugger 111.
Referring to FIG. 1A, PUD 103 is a processor that is undergoing debugging operations. In one embodiment, PUD 103 can be subjected to invasive debugging operations by debug port 109. The access of debug port 109 to the internal components of PUD 103 is facilitated by MMIO 105 which is located inside of PUD 103.
MMIO 105 is configured to initiate a process that makes debug port 109 the master component in debug operations. At this point, debug port 109 gains access to all of the registers of PUD 103. In one embodiment, when debug port 109 becomes master, it can initiate debug functions and features which are invasive in nature and that otherwise can only be performed by the execution of instructions by PUD 103.
Processor registers 103a-103n are system registers of PUD 103 into which data can be loaded and used for arithmetic, manipulated, or tested, by machine instruction. In one embodiment, system registers can include but are not limited to registers that are associated with PUD 103 memory management unit (MMU), front end components, cache components, etc. In one embodiment, when debug port 109 becomes the master component of the processor debug process, it gains access to all of the processor's system registers.
Referring to FIG. 1A, as a part of its operations, system 101, which in one embodiment can reside in debug port 109, causes the accessing of MMIO 105 of PUD 103, initiates an operation that causes debug port 109 to gain access to registers of PUD 103 (using MMIO 105), and with access to registers of PUD 103, causes an execution of an invasive debug of processor PUD 103. For example, access to system registers of PUD 103 can be used to implement diagnostic operations such as causing a value in a TLB to be accessed or causing a flushing of a cache line to main memory, etc.
Debugger 111 is a computer program that is used to test and debug PUD 103. In one embodiment, debugger 111 accesses MMIO 105 via debug bus 107 in order to trigger a mode of operation that is referred to herein as debug port control mode. In one embodiment, debugger 111 can indicate specific diagnostic operations that debug port 109 is to perform.
Operation
FIGS. 1B illustrate operations performed by system 101 for invasive debug of a processor without processor execution of instructions. These operations, which relate to invasive debug of a processor without processor execution of instructions, are only exemplary. It should be appreciated that other operations not illustrated by FIG. 1B can be performed in accordance with one embodiment.
Referring to FIG. 1B, at A, via debug bus 107, MMIO 105 of PUD 103 is accessed by debugger 111 to trigger debug port control mode. In one embodiment, debugger 111 can indicate specific diagnostic operations that debug port 109 is to perform.
At B, using MMIO 105, an operation that causes debug port 109 to gain access to system registers of PUD 103 is performed.
At C, an invasive debug of PUD 103 is caused to be executed from debug port 109, based on the aforementioned access to system registers 103a-103n of PUD 103.
Components of System for Invasive Debug of a Processor Without Processor Execution of Instructions According to One Embodiment
FIG. 2 shows components of a system 101 for invasive debug of a processor without processor execution of instructions according to one embodiment. In one embodiment, components of system 101 implement an algorithm for invasive debug of a processor without processor execution of instructions. In the FIG. 2 embodiment, components of system 101 include MMIO accessing component 201, register access initiating component 203 and invasive debug executing component 205.
MMIO accessing component 201 causes a memory mapped I/O (MMIO) of a PUD (e.g., 103 in FIG. 1A) to be accessed from a debug port (e.g., 109 in FIG. 1A). In one embodiment, access to internal components of the PUD (e.g., 103 in FIG. 1A), as is described herein, is made through the MMIO which is located inside of the PUD.
Register access initiating component 203 initiates an operation that causes the debug port to gain access to system registers of the PUD using the memory mapped I/O. In one embodiment, system registers of the PUD (e.g., processor registers 103a-103n in FIG. 1A) are storage components that are available as part of the PUD into which data can be loaded and used for arithmetic, manipulated, or tested, by machine instruction. In one embodiment, when the debug port (e.g., 109 in FIG. 1A) becomes the master component of the debug process it gains access to all of the PUDs system registers.
Invasive debug executing component 205 causes the execution of an invasive debug of the PUD from the debug port based on the aforementioned access to the system registers of the PUD. In one embodiment, when the debug interface becomes master, invasive debug executing component 205 can initiate debug functions and features which are invasive in nature and that otherwise can only be performed by the execution of instructions by the PUD.
It should be appreciated that the aforementioned components of system 101 can be implemented in hardware or software or in a combination of both. In one embodiment, components and operations of system 101 can be encompassed by components and operations of one or more computer components or programs (such as debug port 109 of FIG. 1A). In another embodiment, components and operations of system 101 can be separate from the aforementioned one or more computer components or programs but can operate cooperatively with components and operations thereof.
Method for Invasive Debug of a Processor Without Processor Execution of Instructions According to One Embodiment
FIG. 3 shows a flowchart 300 of the steps performed in a method for invasive debug of a processor without processor execution of instructions according to one embodiment. The flowchart includes processes that, in one embodiment can be carried out by processors and electrical components under the control of computer-readable and computer-executable instructions. Although specific steps are disclosed in the flowcharts, such steps are exemplary. That is the present embodiment is well suited to performing various other steps or variations of the steps recited in the flowchart.
Referring to FIG. 3, at 301, via a debug bus, a memory mapped I/O of a PUD is accessed (such as by debugger 111 as is described herein with reference to FIG. 1A).
At 303, using the memory mapped I/O, an operation is initiated that causes the debug port to gain access to registers of the PUD.
At 305, from the debug port, and based on access to registers of the PUD, an invasive debug of the PUD is executed at the behest of a system for invasive debug of a processor (e.g., system 101 in FIG. 1A) that in one embodiment can reside in the debug port (e.g., debug port 109 in FIG. 1A). In other embodiments, the system for invasive debug of a processor can be separate from the debug port but can operate cooperatively therewith.
With regard to exemplary embodiments thereof, systems and methods for invasive debug of a processor without processor execution of instructions are disclosed. As a part of the method, a memory mapped I/O of the processor is accessed using a debug interface and an operation is initiated that causes the debug interface to gain access to registers of the processor using the memory mapped I/O. The invasive debug of the processor is executed from the debug interface via registers of the processor.
Although many of the components and processes are described above in the singular for convenience, it will be appreciated by one of skill in the art that multiple components and repeated processes can also be used to practice the techniques of the present invention. Further, while the invention has been particularly shown and described with reference to specific embodiments thereof, it will be understood by those skilled in the art that changes in the form and details of the disclosed embodiments may be made without departing from the spirit or scope of the invention. For example, embodiments of the present invention may be employed with a variety of components and should not be restricted to the ones mentioned above. It is therefore intended that the invention be interpreted to include all variations and equivalents that fall within the true spirit and scope of the present invention.

## Claims

1. A method for invasive debug of a processor without processor execution of instructions, said method comprising:
using a debug port of said processor, accessing a memory mapped I/O of said processor;
using said memory mapped I/O, initiating an operation that causes said debug port to gain access to registers of said processor; and
from said debug port, and based on said access to said registers of said processor, executing said invasive debug of said processor, wherein said executing is performed external to said processor, wherein said debug port can initiate a plurality of invasive operations.

2. The method of claim 1 wherein said memory mapped I/O causes said debug port to become master in said invasive debug of said processor.

3. The method of claim 1 wherein said plurality of invasive operations is performed by running software external to said processor.

4. The method of claim 1 wherein said access to said registers provides control of functionalities of said processor.

5. The method of claim 1 wherein functionality of said processor is compromised.

6. The method of claim 1 wherein said processor is unable to run debugger software.

7. The processor of claim 1, wherein said executing is performed on said debug port.

8. A system for invasive debug of a processor without processor execution of instructions, said system comprising:
an accessing component for accessing a memory mapped I/O of said processor;
an initiating component for initiating an operation that causes a debug port of said processor to gain access to registers of said processor using said memory mapped I/O; and
an executing component operable to execute said invasive debug of said processor based on said access to said registers of said processor, wherein said debug port can initiate a plurality of invasive operations.

9. The system of claim 8 wherein said memory mapped I/O causes said debug port to become master in said invasive debug of said processor.

10. The system of claim 8 wherein said plurality of invasive operations is performed by running software external to said processor.

11. The system of claim 8 wherein said access to said registers provides control of functionalities of said processor.

12. The system of claim 8 wherein functionality of said processor is compromised.

13. The system of claim 8 wherein said processor is unable to run debugger software.

14. A processor comprising:
a debug port, wherein said debug port, comprises:
an accessing component for accessing a memory mapped I/O of said processor;
an initiating component for initiating an operation that causes said debug interface to gain access to registers of said processor using said memory mapped I/O; and
an executing component for executing said invasive debug of said processor based on said access to said registers of said processor, wherein said debug interface can initiate a plurality of invasive operations.

15. The processor of claim 14 wherein said memory mapped I/O causes said debug interface to become master in said invasive debug of said processor.

16. The processor of claim 14 wherein said plurality of invasive operations is performed without running software on said processor.

17. The processor of claim 14 wherein said access to said registers provides control of functionalities of said processor.

18. The processor of claim 14 wherein functionality of said processor is compromised.

19. The processor of claim 14, wherein a debugger is configured to communicate diagnostic operations that said debug port is to perform.