Method and apparatus for managing access to out-of-frame...

Electrical computers and digital processing systems: processing – Processing control – Context preserving (e.g. – context swapping – checkpointing,...

Reexamination Certificate

Rate now

  [ 0.00 ] – not rated yet Voters 0   Comments 0

Details

C711S132000, C712S202000, C712S225000

Reexamination Certificate

active

06665793

ABSTRACT:

FIELD OF THE INVENTION
The present invention relates generally to reading from and writing to registers of a processor. Specifically, the present invention is directed to methods and apparatus for managing access to registers that are outside the current stack frame of an application executing on a processor.
DESCRIPTION OF THE RELATED ART
A register stack may comprise a number of general registers of a microprocessor, which have been designated for the storage of data required by, and pertaining to, procedures of a stored program being executed by the microprocessor. Specifically, upon execution of a particular procedure, a stack frame associated with the procedure is created within the register stack to store saved registers (containing variables local to a relevant procedure). When a procedure (referred to as the “calling” procedure) calls a further procedure (referred to as the “called” procedure), the called procedure in turn creates a further stack frame on top of the stack frame for the calling procedure. Accordingly, for a program in which a number of nested procedures are being executed, the register stack may include a corresponding number of stack frames. The stack frame corresponding to the procedure that is currently executing on the processor is referred to as the “current stack frame.” A register stack accordingly allows multiple procedures to effectively share a large register file by stacking associated stack frames in both on-chip registers and off-chip memory.
Typical programs exhibit high call/return frequencies with small amplitudes. In other words, typical programs include many procedure calls to procedures that execute for a relatively short amount of time. The overhead associated with the context switches necessitated by procedure calls is relatively high for such programs. A register stack significantly reduces the number of stores (i.e. register saves) at procedures calls and loads (i.e. register restores) at procedure returns that are required for context switching, and thus provides a “cache” of information pertinent to nested procedures. As processor operating frequencies continue to increase faster than access times to memory resources (e.g. RAM) decrease, reducing the number of memory accesses performed by a program, as a result of procedure calls and returns, provides a performance advantage. This advantage is becoming increasingly significant in view of the popularity of modular and object-oriented programming, and the use of dynamically linked libraries, which typically result in programs having high call/return frequencies.
As a register stack has a limited size, it will be appreciated that in a deeply nested procedure call sequence, the capacity of the register stack to store additional registers may be exceeded and require what is termed a “spill.” A spill involves storing the values of some of the registers of previous stack frames in a backing store in order to create capacity within the register stack to store registers in a new stack frame. Similarly, as the register stack empties on procedure returns, it is desirable to restore (“fill”) registers of previous stack frames that have been stored in the backing store to the register stack. Spilling and filling of registers may be handled by a register stack engine. An example of a register stack engine is disclosed in the commonly owned U.S. patent application Ser. No. 09/199,003, entitled “Method and Apparatus for Transferring Data Between a Register Stack and a Memory Resource,” referenced above.
Because the register stack engine may perform spilling and filling operations concurrently with programs executing on the processor, it is necessary to ensure that program operations involving access to registers do not interfere with the spilling and filling operations performed by the register stack engine. In particular, it is necessary to ensure that registers used by programs executing on the processor are not overwritten by the register stack engine and vice versa.
SUMMARY
Methods and apparatus are provided for managing access to registers that are outside a current stack frame. In particular, methods and apparatus are provided for preventing a program executing on a processor from writing to registers that are outside the current stack frame. If a program attempts to write to a register that is not in the current stack frame, a fault (such as an illegal operation fault) is generated. Attempts by the program to read from a register that is not in the current stack frame are allowed, although the data returned by such a read attempt has an undefined value.
In one aspect, a method is provided in a processor including a register stack, the register stack including a plurality of register stack frames, each of the register stack frames including zero or more registers, one of the plurality of register stack frames comprising a current register stack frame. The method includes steps of: (A) receiving an instruction whose execution requires writing to a register referenced by the instruction; (B) determining whether the register referenced by the instruction is in the current register stack frame; and (C) executing the instruction only if the register is determined to be in the current register stack frame. The step (B) may include steps of: (B)(1) comparing a register identifier of the register with a size of the current register stack frame; and (B)(2) determining whether the register is in the current register stack frame based on the comparison. The register identifier may be a numerical identifier, and the step (B)(2) may include a step of determining that the register is not in the current register stack frame if the register identifier is greater than or equal to the size of the current register stack frame. The step (C) may include steps of: (C)(1) executing the instruction if the register is determined to be in the current register stack frame; and (C)(2) generating a fault if the register is determined not to be in the current register stack frame. The step (C)(2) may include a step of generating an illegal operation fault if the register is determined not to be in the current register stack frame. The instruction may be one of a plurality of instructions comprising a computer program executing on the processor, and the step (C) may include steps of: (C)(1) executing the instruction if the register is determined to be in the current register stack frame; and (C)(2) halting execution of the program if the register is determined not to be in the current register stack frame.
In another aspect, a method is provided in a processor including a register stack, the register stack including a plurality of register stack frames, each of the register stack frames including zero or more registers, one of the plurality of register stack frames comprising a current register stack frame. The method comprises steps of: (A) receiving an instruction whose execution requires reading from a register identified by a logical register identifier, the logical register identifier identifying a register that is not within the current register stack frame; (B) determining a physical register identifier of a register in the register stack based on the logical register identifier; and (C) executing the instruction using the physical register identifier. The step (C) may include a step of executing the instruction using the physical register identifier without generating a fault. The logical register identifier may indicate a logical register number of the register, and the step (B) may include steps of: (B)(1) determining a difference between the logical register number and a logical register number of a register at a bottom of the current register stack frame; (B)(2) adding the difference to a physical register number of the register at the bottom of the current register stack frame to determine a sum; and (B)(3) generating the physical register number based on the sum. The step (B)(3) may include steps of: (B)(3)(
a
) performing modulus division of a size of the register stack by the sum to determine a remaind

LandOfFree

Say what you really think

Search LandOfFree.com for the USA inventors and patents. Rate them and share your experience with other people.

Rating

Method and apparatus for managing access to out-of-frame... does not yet have a rating. At this time, there are no reviews or comments for this patent.

If you have personal experience with Method and apparatus for managing access to out-of-frame..., we encourage you to share that experience with our LandOfFree.com community. Your opinion is very important and Method and apparatus for managing access to out-of-frame... will most certainly appreciate the feedback.

Rate now

     

Profile ID: LFUS-PAI-O-3095290

  Search
All data on this website is collected from public sources. Our data reflects the most accurate information available at the time of publication.